vendor: add github.com/Azure/azure-sdk-for-go and dependencies

This commit is contained in:
Nick Craig-Wood
2017-08-04 22:54:27 +01:00
parent 132f71d504
commit 91cfcc21ff
958 changed files with 320589 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
// Package servicefabric implements the Azure ARM Servicefabric service API
// version 2016-09-01.
//
//
package servicefabric
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
)
const (
// DefaultBaseURI is the default URI used for the service Servicefabric
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Servicefabric.
type ManagementClient struct {
autorest.Client
BaseURI string
SubscriptionID string
}
// New creates an instance of the ManagementClient client.
func New(subscriptionID string) ManagementClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewWithBaseURI creates an instance of the ManagementClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
SubscriptionID: subscriptionID,
}
}
+572
View File
@@ -0,0 +1,572 @@
package servicefabric
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// ClustersClient is the client for the Clusters methods of the Servicefabric
// service.
type ClustersClient struct {
ManagementClient
}
// NewClustersClient creates an instance of the ClustersClient client.
func NewClustersClient(subscriptionID string) ClustersClient {
return NewClustersClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewClustersClientWithBaseURI creates an instance of the ClustersClient
// client.
func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient {
return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Create create cluster resource This method may poll for completion. Polling
// can be canceled by passing the cancel channel argument. The channel will be
// used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group to which the resource
// belongs or get created clusterName is the name of the cluster resource
// parameters is put Request
func (client ClustersClient) Create(resourceGroupName string, clusterName string, parameters Cluster, cancel <-chan struct{}) (<-chan Cluster, <-chan error) {
resultChan := make(chan Cluster, 1)
errChan := make(chan error, 1)
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.ClusterProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.Certificate", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.Certificate.Thumbprint", Name: validation.Null, Rule: true, Chain: nil}}},
{Target: "parameters.ClusterProperties.ReverseProxyCertificate", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.ReverseProxyCertificate.Thumbprint", Name: validation.Null, Rule: true, Chain: nil}}},
{Target: "parameters.ClusterProperties.ManagementEndpoint", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.ClusterProperties.NodeTypes", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.StorageAccountName", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.ProtectedAccountKeyName", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.BlobEndpoint", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.QueueEndpoint", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.TableEndpoint", Name: validation.Null, Rule: true, Chain: nil},
}},
{Target: "parameters.ClusterProperties.UpgradeDescription", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.UpgradeReplicaSetCheckTimeout", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.ClusterProperties.UpgradeDescription.HealthCheckWaitDuration", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.ClusterProperties.UpgradeDescription.HealthCheckStableDuration", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.ClusterProperties.UpgradeDescription.HealthCheckRetryTimeout", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.ClusterProperties.UpgradeDescription.UpgradeTimeout", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.ClusterProperties.UpgradeDescription.UpgradeDomainTimeout", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyNodes", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyNodes", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil},
{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyNodes", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil},
}},
{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil},
{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil},
}},
}},
{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyNodes", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyNodes", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil},
{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyNodes", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil},
}},
{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil},
{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil},
}},
{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyApplications", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyApplications", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil},
{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyApplications", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil},
}},
}},
}},
}}}}}); err != nil {
errChan <- validation.NewErrorWithValidationError(err, "servicefabric.ClustersClient", "Create")
close(errChan)
close(resultChan)
return resultChan, errChan
}
go func() {
var err error
var result Cluster
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.CreatePreparer(resourceGroupName, clusterName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Create", nil, "Failure preparing request")
return
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Create", resp, "Failure sending request")
return
}
result, err = client.CreateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Create", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// CreatePreparer prepares the Create request.
func (client ClustersClient) CreatePreparer(resourceGroupName string, clusterName string, parameters Cluster, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// CreateSender sends the Create request. The method will close the
// http.Response Body if it receives an error.
func (client ClustersClient) CreateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateResponder handles the response to the Create request. The method always
// closes the http.Response Body.
func (client ClustersClient) CreateResponder(resp *http.Response) (result Cluster, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete delete cluster resource
//
// resourceGroupName is the name of the resource group to which the resource
// belongs or get created clusterName is the name of the cluster resource
func (client ClustersClient) Delete(resourceGroupName string, clusterName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, clusterName)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client ClustersClient) DeletePreparer(resourceGroupName string, clusterName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client ClustersClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Get get cluster resource
//
// resourceGroupName is the name of the resource group to which the resource
// belongs or get created clusterName is the name of the cluster resource
func (client ClustersClient) Get(resourceGroupName string, clusterName string) (result Cluster, err error) {
req, err := client.GetPreparer(resourceGroupName, clusterName)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client ClustersClient) GetPreparer(resourceGroupName string, clusterName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ClustersClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client ClustersClient) GetResponder(resp *http.Response) (result Cluster, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// List list cluster resource
func (client ClustersClient) List() (result ClusterListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client ClustersClient) ListPreparer() (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ClustersClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client ClustersClient) ListResponder(resp *http.Response) (result ClusterListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client ClustersClient) ListNextResults(lastResults ClusterListResult) (result ClusterListResult, err error) {
req, err := lastResults.ClusterListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure responding to next results request")
}
return
}
// ListByResourceGroup list cluster resource by resource group
//
// resourceGroupName is the name of the resource group to which the resource
// belongs or get created
func (client ClustersClient) ListByResourceGroup(resourceGroupName string) (result ClusterListResult, err error) {
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request")
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure sending request")
return
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request")
}
return
}
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
func (client ClustersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func (client ClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
// closes the http.Response Body.
func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByResourceGroupNextResults retrieves the next set of results, if any.
func (client ClustersClient) ListByResourceGroupNextResults(lastResults ClusterListResult) (result ClusterListResult, err error) {
req, err := lastResults.ClusterListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure sending next results request")
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure responding to next results request")
}
return
}
// Update update cluster configuration This method may poll for completion.
// Polling can be canceled by passing the cancel channel argument. The channel
// will be used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group to which the resource
// belongs or get created clusterName is the name of the cluster resource
// parameters is the parameters which contains the property value and property
// name which used to update the cluster configuration
func (client ClustersClient) Update(resourceGroupName string, clusterName string, parameters ClusterUpdateParameters, cancel <-chan struct{}) (<-chan Cluster, <-chan error) {
resultChan := make(chan Cluster, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result Cluster
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.UpdatePreparer(resourceGroupName, clusterName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Update", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// UpdatePreparer prepares the Update request.
func (client ClustersClient) UpdatePreparer(resourceGroupName string, clusterName string, parameters ClusterUpdateParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPatch(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error.
func (client ClustersClient) UpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// UpdateResponder handles the response to the Update request. The method always
// closes the http.Response Body.
func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluster, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+134
View File
@@ -0,0 +1,134 @@
package servicefabric
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// ClusterVersionsClient is the client for the ClusterVersions methods of the
// Servicefabric service.
type ClusterVersionsClient struct {
ManagementClient
}
// NewClusterVersionsClient creates an instance of the ClusterVersionsClient
// client.
func NewClusterVersionsClient(subscriptionID string) ClusterVersionsClient {
return NewClusterVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewClusterVersionsClientWithBaseURI creates an instance of the
// ClusterVersionsClient client.
func NewClusterVersionsClientWithBaseURI(baseURI string, subscriptionID string) ClusterVersionsClient {
return ClusterVersionsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List list cluster code versions by location
//
// location is the location for the cluster code versions, this is different
// from cluster location environment is cluster operating system, the default
// means all
func (client ClusterVersionsClient) List(location string, environment string) (result ClusterCodeVersionsListResult, err error) {
req, err := client.ListPreparer(location, environment)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client ClusterVersionsClient) ListPreparer(location string, environment string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"environment": autorest.Encode("path", environment),
"location": autorest.Encode("path", location),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ClusterVersionsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client ClusterVersionsClient) ListResponder(resp *http.Response) (result ClusterCodeVersionsListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client ClusterVersionsClient) ListNextResults(lastResults ClusterCodeVersionsListResult) (result ClusterCodeVersionsListResult, err error) {
req, err := lastResults.ClusterCodeVersionsListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure responding to next results request")
}
return
}
+439
View File
@@ -0,0 +1,439 @@
package servicefabric
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/to"
"net/http"
)
// ClusterState enumerates the values for cluster state.
type ClusterState string
const (
// AutoScale specifies the auto scale state for cluster state.
AutoScale ClusterState = "AutoScale"
// BaselineUpgrade specifies the baseline upgrade state for cluster state.
BaselineUpgrade ClusterState = "BaselineUpgrade"
// Deploying specifies the deploying state for cluster state.
Deploying ClusterState = "Deploying"
// EnforcingClusterVersion specifies the enforcing cluster version state
// for cluster state.
EnforcingClusterVersion ClusterState = "EnforcingClusterVersion"
// Ready specifies the ready state for cluster state.
Ready ClusterState = "Ready"
// UpdatingInfrastructure specifies the updating infrastructure state for
// cluster state.
UpdatingInfrastructure ClusterState = "UpdatingInfrastructure"
// UpdatingUserCertificate specifies the updating user certificate state
// for cluster state.
UpdatingUserCertificate ClusterState = "UpdatingUserCertificate"
// UpdatingUserConfiguration specifies the updating user configuration
// state for cluster state.
UpdatingUserConfiguration ClusterState = "UpdatingUserConfiguration"
// UpgradeServiceUnreachable specifies the upgrade service unreachable
// state for cluster state.
UpgradeServiceUnreachable ClusterState = "UpgradeServiceUnreachable"
// WaitingForNodes specifies the waiting for nodes state for cluster state.
WaitingForNodes ClusterState = "WaitingForNodes"
)
// DurabilityLevel enumerates the values for durability level.
type DurabilityLevel string
const (
// Bronze specifies the bronze state for durability level.
Bronze DurabilityLevel = "Bronze"
// Gold specifies the gold state for durability level.
Gold DurabilityLevel = "Gold"
// Silver specifies the silver state for durability level.
Silver DurabilityLevel = "Silver"
)
// Environment enumerates the values for environment.
type Environment string
const (
// Linux specifies the linux state for environment.
Linux Environment = "Linux"
// Windows specifies the windows state for environment.
Windows Environment = "Windows"
)
// ProvisioningState enumerates the values for provisioning state.
type ProvisioningState string
const (
// Canceled specifies the canceled state for provisioning state.
Canceled ProvisioningState = "Canceled"
// Failed specifies the failed state for provisioning state.
Failed ProvisioningState = "Failed"
// Succeeded specifies the succeeded state for provisioning state.
Succeeded ProvisioningState = "Succeeded"
// Updating specifies the updating state for provisioning state.
Updating ProvisioningState = "Updating"
)
// ReliabilityLevel enumerates the values for reliability level.
type ReliabilityLevel string
const (
// ReliabilityLevelBronze specifies the reliability level bronze state for
// reliability level.
ReliabilityLevelBronze ReliabilityLevel = "Bronze"
// ReliabilityLevelGold specifies the reliability level gold state for
// reliability level.
ReliabilityLevelGold ReliabilityLevel = "Gold"
// ReliabilityLevelSilver specifies the reliability level silver state for
// reliability level.
ReliabilityLevelSilver ReliabilityLevel = "Silver"
)
// ReliabilityLevel1 enumerates the values for reliability level 1.
type ReliabilityLevel1 string
const (
// ReliabilityLevel1Bronze specifies the reliability level 1 bronze state
// for reliability level 1.
ReliabilityLevel1Bronze ReliabilityLevel1 = "Bronze"
// ReliabilityLevel1Gold specifies the reliability level 1 gold state for
// reliability level 1.
ReliabilityLevel1Gold ReliabilityLevel1 = "Gold"
// ReliabilityLevel1Platinum specifies the reliability level 1 platinum
// state for reliability level 1.
ReliabilityLevel1Platinum ReliabilityLevel1 = "Platinum"
// ReliabilityLevel1Silver specifies the reliability level 1 silver state
// for reliability level 1.
ReliabilityLevel1Silver ReliabilityLevel1 = "Silver"
)
// UpgradeMode enumerates the values for upgrade mode.
type UpgradeMode string
const (
// Automatic specifies the automatic state for upgrade mode.
Automatic UpgradeMode = "Automatic"
// Manual specifies the manual state for upgrade mode.
Manual UpgradeMode = "Manual"
)
// UpgradeMode1 enumerates the values for upgrade mode 1.
type UpgradeMode1 string
const (
// UpgradeMode1Automatic specifies the upgrade mode 1 automatic state for
// upgrade mode 1.
UpgradeMode1Automatic UpgradeMode1 = "Automatic"
// UpgradeMode1Manual specifies the upgrade mode 1 manual state for upgrade
// mode 1.
UpgradeMode1Manual UpgradeMode1 = "Manual"
)
// X509StoreName enumerates the values for x509 store name.
type X509StoreName string
const (
// AddressBook specifies the address book state for x509 store name.
AddressBook X509StoreName = "AddressBook"
// AuthRoot specifies the auth root state for x509 store name.
AuthRoot X509StoreName = "AuthRoot"
// CertificateAuthority specifies the certificate authority state for x509
// store name.
CertificateAuthority X509StoreName = "CertificateAuthority"
// Disallowed specifies the disallowed state for x509 store name.
Disallowed X509StoreName = "Disallowed"
// My specifies the my state for x509 store name.
My X509StoreName = "My"
// Root specifies the root state for x509 store name.
Root X509StoreName = "Root"
// TrustedPeople specifies the trusted people state for x509 store name.
TrustedPeople X509StoreName = "TrustedPeople"
// TrustedPublisher specifies the trusted publisher state for x509 store
// name.
TrustedPublisher X509StoreName = "TrustedPublisher"
)
// AvailableOperationDisplay is operation supported by ServiceFabric resource
// provider
type AvailableOperationDisplay struct {
Provider *string `json:"provider,omitempty"`
Resource *string `json:"resource,omitempty"`
Operation *string `json:"operation,omitempty"`
Description *string `json:"description,omitempty"`
}
// AzureActiveDirectory is the settings to enable AAD authentication on the
// cluster
type AzureActiveDirectory struct {
TenantID *string `json:"tenantId,omitempty"`
ClusterApplication *string `json:"clusterApplication,omitempty"`
ClientApplication *string `json:"clientApplication,omitempty"`
}
// CertificateDescription is certificate details
type CertificateDescription struct {
Thumbprint *string `json:"thumbprint,omitempty"`
ThumbprintSecondary *string `json:"thumbprintSecondary,omitempty"`
X509StoreName X509StoreName `json:"x509StoreName,omitempty"`
}
// ClientCertificateCommonName is client certificate details using common name
type ClientCertificateCommonName struct {
IsAdmin *bool `json:"isAdmin,omitempty"`
CertificateCommonName *string `json:"certificateCommonName,omitempty"`
CertificateIssuerThumbprint *string `json:"certificateIssuerThumbprint,omitempty"`
}
// ClientCertificateThumbprint is client certificate details using thumbprint
type ClientCertificateThumbprint struct {
IsAdmin *bool `json:"isAdmin,omitempty"`
CertificateThumbprint *string `json:"certificateThumbprint,omitempty"`
}
// Cluster is the cluster resource
type Cluster struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*ClusterProperties `json:"properties,omitempty"`
}
// ClusterCodeVersionsListResult is the list results of the ServiceFabric
// runtime versions
type ClusterCodeVersionsListResult struct {
autorest.Response `json:"-"`
Value *[]ClusterCodeVersionsResult `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ClusterCodeVersionsListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ClusterCodeVersionsListResult) ClusterCodeVersionsListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// ClusterCodeVersionsResult is the result of the ServiceFabric runtime
// versions
type ClusterCodeVersionsResult struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
*ClusterVersionDetails `json:"properties,omitempty"`
}
// ClusterHealthPolicy is defines a health policy used to evaluate the health
// of the cluster or of a cluster node.
type ClusterHealthPolicy struct {
MaxPercentUnhealthyNodes *int32 `json:"maxPercentUnhealthyNodes,omitempty"`
MaxPercentUnhealthyApplications *int32 `json:"maxPercentUnhealthyApplications,omitempty"`
}
// ClusterListResult is cluster list results
type ClusterListResult struct {
autorest.Response `json:"-"`
Value *[]Cluster `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ClusterListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ClusterListResult) ClusterListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// ClusterProperties is the cluster resource properties
type ClusterProperties struct {
AvailableClusterVersions *[]ClusterVersionDetails `json:"availableClusterVersions,omitempty"`
ClusterID *string `json:"clusterId,omitempty"`
ClusterState ClusterState `json:"clusterState,omitempty"`
ClusterEndpoint *string `json:"clusterEndpoint,omitempty"`
ClusterCodeVersion *string `json:"clusterCodeVersion,omitempty"`
Certificate *CertificateDescription `json:"certificate,omitempty"`
ReliabilityLevel ReliabilityLevel `json:"reliabilityLevel,omitempty"`
UpgradeMode UpgradeMode `json:"upgradeMode,omitempty"`
ClientCertificateThumbprints *[]ClientCertificateThumbprint `json:"clientCertificateThumbprints,omitempty"`
ClientCertificateCommonNames *[]ClientCertificateCommonName `json:"clientCertificateCommonNames,omitempty"`
FabricSettings *[]SettingsSectionDescription `json:"fabricSettings,omitempty"`
ReverseProxyCertificate *CertificateDescription `json:"reverseProxyCertificate,omitempty"`
ManagementEndpoint *string `json:"managementEndpoint,omitempty"`
NodeTypes *[]NodeTypeDescription `json:"nodeTypes,omitempty"`
AzureActiveDirectory *AzureActiveDirectory `json:"azureActiveDirectory,omitempty"`
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
VMImage *string `json:"vmImage,omitempty"`
DiagnosticsStorageAccountConfig *DiagnosticsStorageAccountConfig `json:"diagnosticsStorageAccountConfig,omitempty"`
UpgradeDescription *ClusterUpgradePolicy `json:"upgradeDescription,omitempty"`
}
// ClusterPropertiesUpdateParameters is the cluster resource properties can be
// updated
type ClusterPropertiesUpdateParameters struct {
ReliabilityLevel ReliabilityLevel `json:"reliabilityLevel,omitempty"`
UpgradeMode UpgradeMode `json:"upgradeMode,omitempty"`
ClusterCodeVersion *string `json:"clusterCodeVersion,omitempty"`
Certificate *CertificateDescription `json:"certificate,omitempty"`
ClientCertificateThumbprints *[]ClientCertificateThumbprint `json:"clientCertificateThumbprints,omitempty"`
ClientCertificateCommonNames *[]ClientCertificateCommonName `json:"clientCertificateCommonNames,omitempty"`
FabricSettings *[]SettingsSectionDescription `json:"fabricSettings,omitempty"`
ReverseProxyCertificate *CertificateDescription `json:"reverseProxyCertificate,omitempty"`
NodeTypes *[]NodeTypeDescription `json:"nodeTypes,omitempty"`
UpgradeDescription *ClusterUpgradePolicy `json:"upgradeDescription,omitempty"`
}
// ClusterUpdateParameters is cluster update request
type ClusterUpdateParameters struct {
*ClusterPropertiesUpdateParameters `json:"properties,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
}
// ClusterUpgradeDeltaHealthPolicy is delta health policy for the cluster
type ClusterUpgradeDeltaHealthPolicy struct {
MaxPercentDeltaUnhealthyNodes *int32 `json:"maxPercentDeltaUnhealthyNodes,omitempty"`
MaxPercentUpgradeDomainDeltaUnhealthyNodes *int32 `json:"maxPercentUpgradeDomainDeltaUnhealthyNodes,omitempty"`
MaxPercentDeltaUnhealthyApplications *int32 `json:"maxPercentDeltaUnhealthyApplications,omitempty"`
}
// ClusterUpgradePolicy is cluster upgrade policy
type ClusterUpgradePolicy struct {
OverrideUserUpgradePolicy *bool `json:"overrideUserUpgradePolicy,omitempty"`
ForceRestart *bool `json:"forceRestart,omitempty"`
UpgradeReplicaSetCheckTimeout *string `json:"upgradeReplicaSetCheckTimeout,omitempty"`
HealthCheckWaitDuration *string `json:"healthCheckWaitDuration,omitempty"`
HealthCheckStableDuration *string `json:"healthCheckStableDuration,omitempty"`
HealthCheckRetryTimeout *string `json:"healthCheckRetryTimeout,omitempty"`
UpgradeTimeout *string `json:"upgradeTimeout,omitempty"`
UpgradeDomainTimeout *string `json:"upgradeDomainTimeout,omitempty"`
HealthPolicy *ClusterHealthPolicy `json:"healthPolicy,omitempty"`
DeltaHealthPolicy *ClusterUpgradeDeltaHealthPolicy `json:"deltaHealthPolicy,omitempty"`
}
// ClusterVersionDetails is the detail of the ServiceFabric runtime version
// result
type ClusterVersionDetails struct {
CodeVersion *string `json:"codeVersion,omitempty"`
SupportExpiryUtc *string `json:"supportExpiryUtc,omitempty"`
Environment Environment `json:"environment,omitempty"`
}
// DiagnosticsStorageAccountConfig is diagnostics storage account config
type DiagnosticsStorageAccountConfig struct {
StorageAccountName *string `json:"storageAccountName,omitempty"`
ProtectedAccountKeyName *string `json:"protectedAccountKeyName,omitempty"`
BlobEndpoint *string `json:"blobEndpoint,omitempty"`
QueueEndpoint *string `json:"queueEndpoint,omitempty"`
TableEndpoint *string `json:"tableEndpoint,omitempty"`
}
// EndpointRangeDescription is port range details
type EndpointRangeDescription struct {
StartPort *int32 `json:"startPort,omitempty"`
EndPort *int32 `json:"endPort,omitempty"`
}
// ErrorModel is the structure of the error
type ErrorModel struct {
Error *ErrorModelError `json:"error,omitempty"`
}
// ErrorModelError is the error detail
type ErrorModelError struct {
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
}
// NodeTypeDescription is describes a node type in the cluster, each node type
// represents sub set of nodes in the cluster
type NodeTypeDescription struct {
Name *string `json:"name,omitempty"`
PlacementProperties *map[string]*string `json:"placementProperties,omitempty"`
Capacities *map[string]*string `json:"capacities,omitempty"`
ClientConnectionEndpointPort *int32 `json:"clientConnectionEndpointPort,omitempty"`
HTTPGatewayEndpointPort *int32 `json:"httpGatewayEndpointPort,omitempty"`
DurabilityLevel DurabilityLevel `json:"durabilityLevel,omitempty"`
ApplicationPorts *EndpointRangeDescription `json:"applicationPorts,omitempty"`
EphemeralPorts *EndpointRangeDescription `json:"ephemeralPorts,omitempty"`
IsPrimary *bool `json:"isPrimary,omitempty"`
VMInstanceCount *int32 `json:"vmInstanceCount,omitempty"`
ReverseProxyEndpointPort *int32 `json:"reverseProxyEndpointPort,omitempty"`
}
// OperationListResult is result of the request to list ServiceFabric
// operations. It contains a list of operations and a URL link to get the next
// set of results.
type OperationListResult struct {
autorest.Response `json:"-"`
Value *[]OperationResult `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// OperationResult is available operation list result
type OperationResult struct {
Name *string `json:"name,omitempty"`
Display *AvailableOperationDisplay `json:"display,omitempty"`
Origin *string `json:"origin,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// Resource is the resource model definition.
type Resource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
}
// SettingsParameterDescription is serviceFabric settings under sections
type SettingsParameterDescription struct {
Name *string `json:"name,omitempty"`
Value *string `json:"value,omitempty"`
}
// SettingsSectionDescription is serviceFabric section settings
type SettingsSectionDescription struct {
Name *string `json:"name,omitempty"`
Parameters *[]SettingsParameterDescription `json:"parameters,omitempty"`
}
+123
View File
@@ -0,0 +1,123 @@
package servicefabric
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// OperationsClient is the client for the Operations methods of the
// Servicefabric service.
type OperationsClient struct {
ManagementClient
}
// NewOperationsClient creates an instance of the OperationsClient client.
func NewOperationsClient(subscriptionID string) OperationsClient {
return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewOperationsClientWithBaseURI creates an instance of the OperationsClient
// client.
func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient {
return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List lists all of the available ServiceFabric REST API operations.
func (client OperationsClient) List() (result OperationListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client OperationsClient) ListPreparer() (*http.Request, error) {
const APIVersion = "2016-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/providers/Microsoft.ServiceFabric/operations"),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) {
req, err := lastResults.OperationListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure responding to next results request")
}
return
}
+29
View File
@@ -0,0 +1,29 @@
package servicefabric
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return "Azure-SDK-For-Go/v10.1.0-beta arm-servicefabric/2016-09-01"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return "v10.1.0-beta"
}