From fca0fb745d6b2ef7aaa396eb69203714a0a33ee2 Mon Sep 17 00:00:00 2001 From: arcturusZhang Date: Wed, 22 Jul 2020 14:24:10 +0800 Subject: [PATCH 1/4] Generated from hdinsight (tag package-2018-06-preview) --- .../hdinsight/mgmt/hdinsight/models.go | 3 + .../2018-06-01-preview/hdinsight/clusters.go | 78 +++++++++++++++++++ .../hdinsight/hdinsightapi/interfaces.go | 1 + .../2018-06-01-preview/hdinsight/models.go | 39 ++++++++++ 4 files changed, 121 insertions(+) diff --git a/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go b/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go index cb1eded8a233..06ab96508ca2 100644 --- a/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go +++ b/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go @@ -129,6 +129,7 @@ type ApplicationsCreateFuture = original.ApplicationsCreateFuture type ApplicationsDeleteFuture = original.ApplicationsDeleteFuture type Autoscale = original.Autoscale type AutoscaleCapacity = original.AutoscaleCapacity +type AutoscaleConfigurationUpdateParameter = original.AutoscaleConfigurationUpdateParameter type AutoscaleRecurrence = original.AutoscaleRecurrence type AutoscaleSchedule = original.AutoscaleSchedule type AutoscaleTimeAndCapacity = original.AutoscaleTimeAndCapacity @@ -162,6 +163,7 @@ type ClustersDeleteFuture = original.ClustersDeleteFuture type ClustersExecuteScriptActionsFuture = original.ClustersExecuteScriptActionsFuture type ClustersResizeFuture = original.ClustersResizeFuture type ClustersRotateDiskEncryptionKeyFuture = original.ClustersRotateDiskEncryptionKeyFuture +type ClustersUpdateAutoScaleConfigurationFuture = original.ClustersUpdateAutoScaleConfigurationFuture type ClustersUpdateGatewaySettingsFuture = original.ClustersUpdateGatewaySettingsFuture type ComputeProfile = original.ComputeProfile type ConfigurationsClient = original.ConfigurationsClient @@ -170,6 +172,7 @@ type ConnectivityEndpoint = original.ConnectivityEndpoint type DataDisksGroups = original.DataDisksGroups type DiskBillingMeters = original.DiskBillingMeters type DiskEncryptionProperties = original.DiskEncryptionProperties +type EncryptionInTransitProperties = original.EncryptionInTransitProperties type ErrorResponse = original.ErrorResponse type Errors = original.Errors type ExecuteScriptActionParameters = original.ExecuteScriptActionParameters diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go index 3adc29e9b90f..80dc92f206ea 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go @@ -879,6 +879,84 @@ func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluste return } +// UpdateAutoScaleConfiguration updates the Autoscale Configuration for HDInsight cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// parameters - the parameters for the update autoscale configuration operation. +func (client ClustersClient) UpdateAutoScaleConfiguration(ctx context.Context, resourceGroupName string, clusterName string, parameters AutoscaleConfigurationUpdateParameter) (result ClustersUpdateAutoScaleConfigurationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.UpdateAutoScaleConfiguration") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateAutoScaleConfigurationPreparer(ctx, resourceGroupName, clusterName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "UpdateAutoScaleConfiguration", nil, "Failure preparing request") + return + } + + result, err = client.UpdateAutoScaleConfigurationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "UpdateAutoScaleConfiguration", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateAutoScaleConfigurationPreparer prepares the UpdateAutoScaleConfiguration request. +func (client ClustersClient) UpdateAutoScaleConfigurationPreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters AutoscaleConfigurationUpdateParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleName": autorest.Encode("path", "workernode"), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/autoscale", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateAutoScaleConfigurationSender sends the UpdateAutoScaleConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) UpdateAutoScaleConfigurationSender(req *http.Request) (future ClustersUpdateAutoScaleConfigurationFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateAutoScaleConfigurationResponder handles the response to the UpdateAutoScaleConfiguration request. The method always +// closes the http.Response Body. +func (client ClustersClient) UpdateAutoScaleConfigurationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + // UpdateGatewaySettings configures the gateway settings on the specified cluster. // Parameters: // resourceGroupName - the name of the resource group. diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi/interfaces.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi/interfaces.go index ecf84696ff3f..0dcd2254d52e 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi/interfaces.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi/interfaces.go @@ -37,6 +37,7 @@ type ClustersClientAPI interface { Resize(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.ClusterResizeParameters) (result hdinsight.ClustersResizeFuture, err error) RotateDiskEncryptionKey(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.ClusterDiskEncryptionParameters) (result hdinsight.ClustersRotateDiskEncryptionKeyFuture, err error) Update(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.ClusterPatchParameters) (result hdinsight.Cluster, err error) + UpdateAutoScaleConfiguration(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.AutoscaleConfigurationUpdateParameter) (result hdinsight.ClustersUpdateAutoScaleConfigurationFuture, err error) UpdateGatewaySettings(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.UpdateGatewaySettingsParameters) (result hdinsight.ClustersUpdateGatewaySettingsFuture, err error) } diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go index 5f486f56966f..a46c522fdc44 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go @@ -516,6 +516,12 @@ type AutoscaleCapacity struct { MaxInstanceCount *int32 `json:"maxInstanceCount,omitempty"` } +// AutoscaleConfigurationUpdateParameter the autoscale configuration update parameter. +type AutoscaleConfigurationUpdateParameter struct { + // Autoscale - The autoscale configuration. + Autoscale *Autoscale `json:"autoscale,omitempty"` +} + // AutoscaleRecurrence schedule-based autoscale request parameters type AutoscaleRecurrence struct { // TimeZone - The time zone for the autoscale schedule times @@ -732,6 +738,8 @@ type ClusterCreateProperties struct { StorageProfile *StorageProfile `json:"storageProfile,omitempty"` // DiskEncryptionProperties - The disk encryption properties. DiskEncryptionProperties *DiskEncryptionProperties `json:"diskEncryptionProperties,omitempty"` + // EncryptionInTransitProperties - The encryption-in-transit properties. + EncryptionInTransitProperties *EncryptionInTransitProperties `json:"encryptionInTransitProperties,omitempty"` // MinSupportedTLSVersion - The minimal supported tls version. MinSupportedTLSVersion *string `json:"minSupportedTlsVersion,omitempty"` // NetworkSettings - The network settings. @@ -808,6 +816,8 @@ type ClusterGetProperties struct { ConnectivityEndpoints *[]ConnectivityEndpoint `json:"connectivityEndpoints,omitempty"` // DiskEncryptionProperties - The disk encryption properties. DiskEncryptionProperties *DiskEncryptionProperties `json:"diskEncryptionProperties,omitempty"` + // EncryptionInTransitProperties - The encryption-in-transit properties. + EncryptionInTransitProperties *EncryptionInTransitProperties `json:"encryptionInTransitProperties,omitempty"` // MinSupportedTLSVersion - The minimal supported tls version. MinSupportedTLSVersion *string `json:"minSupportedTlsVersion,omitempty"` // NetworkSettings - The network settings. @@ -1167,6 +1177,29 @@ func (future *ClustersRotateDiskEncryptionKeyFuture) Result(client ClustersClien return } +// ClustersUpdateAutoScaleConfigurationFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClustersUpdateAutoScaleConfigurationFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersUpdateAutoScaleConfigurationFuture) Result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersUpdateAutoScaleConfigurationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ClustersUpdateAutoScaleConfigurationFuture") + return + } + ar.Response = future.Response() + return +} + // ClustersUpdateGatewaySettingsFuture an abstraction for monitoring and retrieving the results of a // long-running operation. type ClustersUpdateGatewaySettingsFuture struct { @@ -1265,6 +1298,12 @@ type DiskEncryptionProperties struct { MsiResourceID *string `json:"msiResourceId,omitempty"` } +// EncryptionInTransitProperties the encryption-in-transit properties. +type EncryptionInTransitProperties struct { + // IsEncryptionInTransitEnabled - Indicates whether or not inter cluster node communication is encrypted in transit. + IsEncryptionInTransitEnabled *bool `json:"isEncryptionInTransitEnabled,omitempty"` +} + // ErrorResponse describes the format of Error response. type ErrorResponse struct { // Code - Error code From f747b243b9807ac60ea64e33e7a650b8480e8654 Mon Sep 17 00:00:00 2001 From: arcturusZhang Date: Wed, 22 Jul 2020 14:30:56 +0800 Subject: [PATCH 2/4] Generated from azurestackhci (tag package-2020-03-01-preview) --- .../azurestackhci/azurestackhciapi/models.go | 25 + .../mgmt/azurestackhci/models.go | 109 +++ .../azurestackhciapi/interfaces.go | 45 ++ .../azurestackhci/client.go | 52 ++ .../azurestackhci/clusters.go | 628 ++++++++++++++++++ .../azurestackhci/models.go | 507 ++++++++++++++ .../azurestackhci/operations.go | 108 +++ .../azurestackhci/version.go | 30 + 8 files changed, 1504 insertions(+) create mode 100644 profiles/preview/preview/azurestackhci/mgmt/azurestackhci/azurestackhciapi/models.go create mode 100644 profiles/preview/preview/azurestackhci/mgmt/azurestackhci/models.go create mode 100644 services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/azurestackhciapi/interfaces.go create mode 100644 services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/client.go create mode 100644 services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/clusters.go create mode 100644 services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/models.go create mode 100644 services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/operations.go create mode 100644 services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/version.go diff --git a/profiles/preview/preview/azurestackhci/mgmt/azurestackhci/azurestackhciapi/models.go b/profiles/preview/preview/azurestackhci/mgmt/azurestackhci/azurestackhciapi/models.go new file mode 100644 index 000000000000..774cc1b99030 --- /dev/null +++ b/profiles/preview/preview/azurestackhci/mgmt/azurestackhci/azurestackhciapi/models.go @@ -0,0 +1,25 @@ +// +build go1.9 + +// Copyright 2020 Microsoft Corporation +// +// 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. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package azurestackhciapi + +import original "github.com/Azure/azure-sdk-for-go/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/azurestackhciapi" + +type ClustersClientAPI = original.ClustersClientAPI +type OperationsClientAPI = original.OperationsClientAPI diff --git a/profiles/preview/preview/azurestackhci/mgmt/azurestackhci/models.go b/profiles/preview/preview/azurestackhci/mgmt/azurestackhci/models.go new file mode 100644 index 000000000000..95789126258b --- /dev/null +++ b/profiles/preview/preview/azurestackhci/mgmt/azurestackhci/models.go @@ -0,0 +1,109 @@ +// +build go1.9 + +// Copyright 2020 Microsoft Corporation +// +// 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. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package azurestackhci + +import ( + "context" + + original "github.com/Azure/azure-sdk-for-go/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci" +) + +const ( + DefaultBaseURI = original.DefaultBaseURI +) + +type ProvisioningState = original.ProvisioningState + +const ( + Accepted ProvisioningState = original.Accepted + Canceled ProvisioningState = original.Canceled + Failed ProvisioningState = original.Failed + Provisioning ProvisioningState = original.Provisioning + Succeeded ProvisioningState = original.Succeeded +) + +type Status = original.Status + +const ( + ConnectedRecently Status = original.ConnectedRecently + Error Status = original.Error + Expired Status = original.Expired + NeverConnected Status = original.NeverConnected + NotConnectedRecently Status = original.NotConnectedRecently +) + +type AzureEntityResource = original.AzureEntityResource +type BaseClient = original.BaseClient +type Cluster = original.Cluster +type ClusterList = original.ClusterList +type ClusterListIterator = original.ClusterListIterator +type ClusterListPage = original.ClusterListPage +type ClusterNode = original.ClusterNode +type ClusterProperties = original.ClusterProperties +type ClusterReportedProperties = original.ClusterReportedProperties +type ClusterUpdate = original.ClusterUpdate +type ClustersClient = original.ClustersClient +type ErrorAdditionalInfo = original.ErrorAdditionalInfo +type ErrorResponse = original.ErrorResponse +type ErrorResponseError = original.ErrorResponseError +type Operation = original.Operation +type OperationDisplay = original.OperationDisplay +type OperationList = original.OperationList +type OperationsClient = original.OperationsClient +type ProxyResource = original.ProxyResource +type Resource = original.Resource +type TrackedResource = original.TrackedResource + +func New(subscriptionID string) BaseClient { + return original.New(subscriptionID) +} +func NewClusterListIterator(page ClusterListPage) ClusterListIterator { + return original.NewClusterListIterator(page) +} +func NewClusterListPage(getNextPage func(context.Context, ClusterList) (ClusterList, error)) ClusterListPage { + return original.NewClusterListPage(getNextPage) +} +func NewClustersClient(subscriptionID string) ClustersClient { + return original.NewClustersClient(subscriptionID) +} +func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { + return original.NewClustersClientWithBaseURI(baseURI, subscriptionID) +} +func NewOperationsClient(subscriptionID string) OperationsClient { + return original.NewOperationsClient(subscriptionID) +} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID) +} +func PossibleProvisioningStateValues() []ProvisioningState { + return original.PossibleProvisioningStateValues() +} +func PossibleStatusValues() []Status { + return original.PossibleStatusValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/azurestackhciapi/interfaces.go b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/azurestackhciapi/interfaces.go new file mode 100644 index 000000000000..76b1cafcdee7 --- /dev/null +++ b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/azurestackhciapi/interfaces.go @@ -0,0 +1,45 @@ +package azurestackhciapi + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci" + "github.com/Azure/go-autorest/autorest" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result azurestackhci.OperationList, err error) +} + +var _ OperationsClientAPI = (*azurestackhci.OperationsClient)(nil) + +// ClustersClientAPI contains the set of methods on the ClustersClient type. +type ClustersClientAPI interface { + Create(ctx context.Context, resourceGroupName string, clusterName string, cluster azurestackhci.Cluster) (result azurestackhci.Cluster, err error) + Delete(ctx context.Context, resourceGroupName string, clusterName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, clusterName string) (result azurestackhci.Cluster, err error) + List(ctx context.Context) (result azurestackhci.ClusterListPage, err error) + ListComplete(ctx context.Context) (result azurestackhci.ClusterListIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result azurestackhci.ClusterListPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result azurestackhci.ClusterListIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterName string, cluster azurestackhci.ClusterUpdate) (result azurestackhci.Cluster, err error) +} + +var _ ClustersClientAPI = (*azurestackhci.ClustersClient)(nil) diff --git a/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/client.go b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/client.go new file mode 100644 index 000000000000..26396d5a2c90 --- /dev/null +++ b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/client.go @@ -0,0 +1,52 @@ +// Package azurestackhci implements the Azure ARM Azurestackhci service API version 2020-03-01-preview. +// +// Azure Stack HCI management service +package azurestackhci + +// 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. +// 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 Azurestackhci + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Azurestackhci. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/clusters.go b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/clusters.go new file mode 100644 index 000000000000..c2e9d1bfacec --- /dev/null +++ b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/clusters.go @@ -0,0 +1,628 @@ +package azurestackhci + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ClustersClient is the azure Stack HCI management service +type ClustersClient struct { + BaseClient +} + +// 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 using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { + return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create an HCI cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// cluster - details of the HCI cluster. +func (client ClustersClient) Create(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster) (result Cluster, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: cluster, + Constraints: []validation.Constraint{{Target: "cluster.ClusterProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cluster.ClusterProperties.AadClientID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cluster.ClusterProperties.AadTenantID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("azurestackhci.ClustersClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterName, cluster) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.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, "azurestackhci.ClustersClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ClustersClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster) (*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 = "2020-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", pathParameters), + autorest.WithJSON(cluster), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// 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 client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// 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, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an HCI cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +func (client ClustersClient) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ClustersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ClustersClient) DeletePreparer(ctx context.Context, 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 = "2020-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// 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 client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// 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, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get HCI cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +func (client ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string) (result Cluster, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ClustersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.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, "azurestackhci.ClustersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClustersClient) GetPreparer(ctx context.Context, 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 = "2020-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// 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 client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// 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, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all HCI clusters in a subscription. +func (client ClustersClient) List(ctx context.Context) (result ClusterListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.List") + defer func() { + sc := -1 + if result.cl.Response.Response != nil { + sc = result.cl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ClustersClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.cl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "List", resp, "Failure sending request") + return + } + + result.cl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// 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 client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListResponder(resp *http.Response) (result ClusterList, err error) { + err = autorest.Respond( + resp, + 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(ctx context.Context, lastResults ClusterList) (result ClusterList, err error) { + req, err := lastResults.clusterListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listNextResults", 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, "azurestackhci.ClustersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClustersClient) ListComplete(ctx context.Context) (result ClusterListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup list all HCI clusters in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client ClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ClusterListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.cl.Response.Response != nil { + sc = result.cl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ClustersClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.cl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.cl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ClustersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// 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 client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterList, err error) { + err = autorest.Respond( + resp, + 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(ctx context.Context, lastResults ClusterList) (result ClusterList, err error) { + req, err := lastResults.clusterListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listByResourceGroupNextResults", 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, "azurestackhci.ClustersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClustersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ClusterListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Update update an HCI cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// cluster - details of the HCI cluster. +func (client ClustersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, cluster ClusterUpdate) (result Cluster, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ClustersClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, cluster) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.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, "azurestackhci.ClustersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, cluster ClusterUpdate) (*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 = "2020-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", pathParameters), + autorest.WithJSON(cluster), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// 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 client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// 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, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/models.go b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/models.go new file mode 100644 index 000000000000..32580d030601 --- /dev/null +++ b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/models.go @@ -0,0 +1,507 @@ +package azurestackhci + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci" + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Accepted ... + Accepted ProvisioningState = "Accepted" + // Canceled ... + Canceled ProvisioningState = "Canceled" + // Failed ... + Failed ProvisioningState = "Failed" + // Provisioning ... + Provisioning ProvisioningState = "Provisioning" + // Succeeded ... + Succeeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{Accepted, Canceled, Failed, Provisioning, Succeeded} +} + +// Status enumerates the values for status. +type Status string + +const ( + // ConnectedRecently ... + ConnectedRecently Status = "ConnectedRecently" + // Error ... + Error Status = "Error" + // Expired ... + Expired Status = "Expired" + // NeverConnected ... + NeverConnected Status = "NeverConnected" + // NotConnectedRecently ... + NotConnectedRecently Status = "NotConnectedRecently" +) + +// PossibleStatusValues returns an array of possible values for the Status const type. +func PossibleStatusValues() []Status { + return []Status{ConnectedRecently, Error, Expired, NeverConnected, NotConnectedRecently} +} + +// AzureEntityResource the resource model definition for a Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// Cluster cluster details. +type Cluster struct { + autorest.Response `json:"-"` + // ClusterProperties - Cluster properties. + *ClusterProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Cluster. +func (c Cluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.ClusterProperties != nil { + objectMap["properties"] = c.ClusterProperties + } + if c.Tags != nil { + objectMap["tags"] = c.Tags + } + if c.Location != nil { + objectMap["location"] = c.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Cluster struct. +func (c *Cluster) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var clusterProperties ClusterProperties + err = json.Unmarshal(*v, &clusterProperties) + if err != nil { + return err + } + c.ClusterProperties = &clusterProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + c.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + c.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + c.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + c.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + c.Type = &typeVar + } + } + } + + return nil +} + +// ClusterList list of clusters. +type ClusterList struct { + autorest.Response `json:"-"` + // Value - List of clusters. + Value *[]Cluster `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ClusterListIterator provides access to a complete listing of Cluster values. +type ClusterListIterator struct { + i int + page ClusterListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ClusterListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ClusterListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ClusterListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ClusterListIterator) Response() ClusterList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ClusterListIterator) Value() Cluster { + if !iter.page.NotDone() { + return Cluster{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ClusterListIterator type. +func NewClusterListIterator(page ClusterListPage) ClusterListIterator { + return ClusterListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cl ClusterList) IsEmpty() bool { + return cl.Value == nil || len(*cl.Value) == 0 +} + +// clusterListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cl ClusterList) clusterListPreparer(ctx context.Context) (*http.Request, error) { + if cl.NextLink == nil || len(to.String(cl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cl.NextLink))) +} + +// ClusterListPage contains a page of Cluster values. +type ClusterListPage struct { + fn func(context.Context, ClusterList) (ClusterList, error) + cl ClusterList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ClusterListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.cl) + if err != nil { + return err + } + page.cl = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ClusterListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ClusterListPage) NotDone() bool { + return !page.cl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ClusterListPage) Response() ClusterList { + return page.cl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ClusterListPage) Values() []Cluster { + if page.cl.IsEmpty() { + return nil + } + return *page.cl.Value +} + +// Creates a new instance of the ClusterListPage type. +func NewClusterListPage(getNextPage func(context.Context, ClusterList) (ClusterList, error)) ClusterListPage { + return ClusterListPage{fn: getNextPage} +} + +// ClusterNode cluster node details. +type ClusterNode struct { + // Name - READ-ONLY; Name of the cluster node. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; Id of the node in the cluster. + ID *float64 `json:"id,omitempty"` + // Manufacturer - READ-ONLY; Manufacturer of the cluster node hardware. + Manufacturer *string `json:"manufacturer,omitempty"` + // Model - READ-ONLY; Model name of the cluster node hardware. + Model *string `json:"model,omitempty"` + // OsName - READ-ONLY; Operating system running on the cluster node. + OsName *string `json:"osName,omitempty"` + // OsVersion - READ-ONLY; Version of the operating system running on the cluster node. + OsVersion *string `json:"osVersion,omitempty"` + // SerialNumber - READ-ONLY; Immutable id of the cluster node. + SerialNumber *string `json:"serialNumber,omitempty"` + // CoreCount - READ-ONLY; Number of physical cores on the cluster node. + CoreCount *float64 `json:"coreCount,omitempty"` + // MemoryInGiB - READ-ONLY; Total available memory on the cluster node (in GiB). + MemoryInGiB *float64 `json:"memoryInGiB,omitempty"` +} + +// ClusterProperties cluster properties. +type ClusterProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state. Possible values include: 'Succeeded', 'Failed', 'Canceled', 'Accepted', 'Provisioning' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Status - READ-ONLY; Status of the cluster agent. Possible values include: 'NeverConnected', 'ConnectedRecently', 'NotConnectedRecently', 'Expired', 'Error' + Status Status `json:"status,omitempty"` + // CloudID - READ-ONLY; Unique, immutable resource id. + CloudID *string `json:"cloudId,omitempty"` + // AadClientID - App id of cluster AAD identity. + AadClientID *string `json:"aadClientId,omitempty"` + // AadTenantID - Tenant id of cluster AAD identity. + AadTenantID *string `json:"aadTenantId,omitempty"` + // ReportedProperties - Properties reported by cluster agent. + ReportedProperties *ClusterReportedProperties `json:"reportedProperties,omitempty"` + // TrialDaysRemaining - READ-ONLY; Number of days remaining in the trial period. + TrialDaysRemaining *float64 `json:"trialDaysRemaining,omitempty"` + // BillingModel - READ-ONLY; Type of billing applied to the resource. + BillingModel *string `json:"billingModel,omitempty"` +} + +// ClusterReportedProperties properties reported by cluster agent. +type ClusterReportedProperties struct { + // ClusterName - READ-ONLY; Name of the on-prem cluster connected to this resource. + ClusterName *string `json:"clusterName,omitempty"` + // ClusterID - READ-ONLY; Unique id generated by the on-prem cluster. + ClusterID *string `json:"clusterId,omitempty"` + // ClusterVersion - READ-ONLY; Version of the cluster software. + ClusterVersion *string `json:"clusterVersion,omitempty"` + // Nodes - READ-ONLY; List of nodes reported by the cluster. + Nodes *[]ClusterNode `json:"nodes,omitempty"` + // LastUpdated - READ-ONLY; Last time the cluster reported the data. + LastUpdated *date.Time `json:"lastUpdated,omitempty"` +} + +// ClusterUpdate cluster details to update. +type ClusterUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ClusterUpdate. +func (cu ClusterUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cu.Tags != nil { + objectMap["tags"] = cu.Tags + } + return json.Marshal(objectMap) +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// ErrorResponse the resource management error response. +type ErrorResponse struct { + // Error - The error object. + Error *ErrorResponseError `json:"error,omitempty"` +} + +// ErrorResponseError the error object. +type ErrorResponseError struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorResponse `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// Operation operation details. +type Operation struct { + // Name - READ-ONLY; Name of the operation. + Name *string `json:"name,omitempty"` + // Display - Operation properties. + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay operation properties. +type OperationDisplay struct { + // Provider - Resource provider name. + Provider *string `json:"provider,omitempty"` + // Resource - Resource type name. + Resource *string `json:"resource,omitempty"` + // Operation - Operation name. + Operation *string `json:"operation,omitempty"` + // Description - Operation description. + Description *string `json:"description,omitempty"` +} + +// OperationList list of available operations. +type OperationList struct { + autorest.Response `json:"-"` + // Value - List of operations. + Value *[]Operation `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than +// required location and tags +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// Resource ... +type Resource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// TrackedResource the resource model definition for a ARM tracked top level resource +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} diff --git a/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/operations.go b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/operations.go new file mode 100644 index 000000000000..211dbced57e8 --- /dev/null +++ b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/operations.go @@ -0,0 +1,108 @@ +package azurestackhci + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the azure Stack HCI management service +type OperationsClient struct { + BaseClient +} + +// 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 using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all available Microsoft.AzureStackHCI provider operations +func (client OperationsClient) List(ctx context.Context) (result OperationList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.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, "azurestackhci.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2020-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.AzureStackHCI/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// 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 client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/version.go b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/version.go new file mode 100644 index 000000000000..146beca65677 --- /dev/null +++ b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/version.go @@ -0,0 +1,30 @@ +package azurestackhci + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. +// 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/" + Version() + " azurestackhci/2020-03-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} From 973b172b3cbb1c96d59b1d0fecb9c4c5b65e1b0b Mon Sep 17 00:00:00 2001 From: arcturusZhang Date: Wed, 22 Jul 2020 14:32:18 +0800 Subject: [PATCH 3/4] Generated from synapse (tag package-vnet-2019-06-01-preview) --- .../managedvirtualnetworkapi/models.go | 24 ++ .../synapse/managedvirtualnetwork/models.go | 61 +++ .../managedvirtualnetwork/client.go | 49 +++ .../managedprivateendpoints.go | 392 ++++++++++++++++++ .../managedvirtualnetworkapi/interfaces.go | 35 ++ .../managedvirtualnetwork/models.go | 213 ++++++++++ .../managedvirtualnetwork/version.go | 30 ++ 7 files changed, 804 insertions(+) create mode 100644 profiles/preview/preview/synapse/managedvirtualnetwork/managedvirtualnetworkapi/models.go create mode 100644 profiles/preview/preview/synapse/managedvirtualnetwork/models.go create mode 100644 services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/client.go create mode 100644 services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/managedprivateendpoints.go create mode 100644 services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/managedvirtualnetworkapi/interfaces.go create mode 100644 services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/models.go create mode 100644 services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/version.go diff --git a/profiles/preview/preview/synapse/managedvirtualnetwork/managedvirtualnetworkapi/models.go b/profiles/preview/preview/synapse/managedvirtualnetwork/managedvirtualnetworkapi/models.go new file mode 100644 index 000000000000..7a14237f6c1a --- /dev/null +++ b/profiles/preview/preview/synapse/managedvirtualnetwork/managedvirtualnetworkapi/models.go @@ -0,0 +1,24 @@ +// +build go1.9 + +// Copyright 2020 Microsoft Corporation +// +// 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. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package managedvirtualnetworkapi + +import original "github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/managedvirtualnetworkapi" + +type ManagedPrivateEndpointsClientAPI = original.ManagedPrivateEndpointsClientAPI diff --git a/profiles/preview/preview/synapse/managedvirtualnetwork/models.go b/profiles/preview/preview/synapse/managedvirtualnetwork/models.go new file mode 100644 index 000000000000..8d9094830fbb --- /dev/null +++ b/profiles/preview/preview/synapse/managedvirtualnetwork/models.go @@ -0,0 +1,61 @@ +// +build go1.9 + +// Copyright 2020 Microsoft Corporation +// +// 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. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package managedvirtualnetwork + +import ( + "context" + + original "github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork" +) + +const ( + DefaultSynapseDNSSuffix = original.DefaultSynapseDNSSuffix +) + +type BaseClient = original.BaseClient +type ManagedPrivateEndpoint = original.ManagedPrivateEndpoint +type ManagedPrivateEndpointConnectionState = original.ManagedPrivateEndpointConnectionState +type ManagedPrivateEndpointListResponse = original.ManagedPrivateEndpointListResponse +type ManagedPrivateEndpointListResponseIterator = original.ManagedPrivateEndpointListResponseIterator +type ManagedPrivateEndpointListResponsePage = original.ManagedPrivateEndpointListResponsePage +type ManagedPrivateEndpointProperties = original.ManagedPrivateEndpointProperties +type ManagedPrivateEndpointsClient = original.ManagedPrivateEndpointsClient + +func New() BaseClient { + return original.New() +} +func NewManagedPrivateEndpointListResponseIterator(page ManagedPrivateEndpointListResponsePage) ManagedPrivateEndpointListResponseIterator { + return original.NewManagedPrivateEndpointListResponseIterator(page) +} +func NewManagedPrivateEndpointListResponsePage(getNextPage func(context.Context, ManagedPrivateEndpointListResponse) (ManagedPrivateEndpointListResponse, error)) ManagedPrivateEndpointListResponsePage { + return original.NewManagedPrivateEndpointListResponsePage(getNextPage) +} +func NewManagedPrivateEndpointsClient() ManagedPrivateEndpointsClient { + return original.NewManagedPrivateEndpointsClient() +} +func NewWithoutDefaults(synapseDNSSuffix string) BaseClient { + return original.NewWithoutDefaults(synapseDNSSuffix) +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/client.go b/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/client.go new file mode 100644 index 000000000000..7b3b855d7185 --- /dev/null +++ b/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/client.go @@ -0,0 +1,49 @@ +// Package managedvirtualnetwork implements the Azure ARM Managedvirtualnetwork service API version 2019-06-01-preview. +// +// +package managedvirtualnetwork + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultSynapseDNSSuffix is the default value for synapse dns suffix + DefaultSynapseDNSSuffix = "dev.azuresynapse.net" +) + +// BaseClient is the base client for Managedvirtualnetwork. +type BaseClient struct { + autorest.Client + SynapseDNSSuffix string +} + +// New creates an instance of the BaseClient client. +func New() BaseClient { + return NewWithoutDefaults(DefaultSynapseDNSSuffix) +} + +// NewWithoutDefaults creates an instance of the BaseClient client. +func NewWithoutDefaults(synapseDNSSuffix string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + SynapseDNSSuffix: synapseDNSSuffix, + } +} diff --git a/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/managedprivateendpoints.go b/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/managedprivateendpoints.go new file mode 100644 index 000000000000..9ad829596dec --- /dev/null +++ b/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/managedprivateendpoints.go @@ -0,0 +1,392 @@ +package managedvirtualnetwork + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ManagedPrivateEndpointsClient is the client for the ManagedPrivateEndpoints methods of the Managedvirtualnetwork +// service. +type ManagedPrivateEndpointsClient struct { + BaseClient +} + +// NewManagedPrivateEndpointsClient creates an instance of the ManagedPrivateEndpointsClient client. +func NewManagedPrivateEndpointsClient() ManagedPrivateEndpointsClient { + return ManagedPrivateEndpointsClient{New()} +} + +// Create create Managed Private Endpoints +// Parameters: +// workspaceName - the name of the workspace to execute operations on. +// managedVirtualNetworkName - managed virtual network name +// managedPrivateEndpointName - managed private endpoint name +func (client ManagedPrivateEndpointsClient) Create(ctx context.Context, workspaceName string, managedVirtualNetworkName string, managedPrivateEndpointName string) (result ManagedPrivateEndpoint, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedPrivateEndpointsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreatePreparer(ctx, workspaceName, managedVirtualNetworkName, managedPrivateEndpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "managedvirtualnetwork.ManagedPrivateEndpointsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedvirtualnetwork.ManagedPrivateEndpointsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedvirtualnetwork.ManagedPrivateEndpointsClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ManagedPrivateEndpointsClient) CreatePreparer(ctx context.Context, workspaceName string, managedVirtualNetworkName string, managedPrivateEndpointName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "SynapseDnsSuffix": client.SynapseDNSSuffix, + "workspaceName": workspaceName, + } + + pathParameters := map[string]interface{}{ + "managedPrivateEndpointName": autorest.Encode("path", managedPrivateEndpointName), + "managedVirtualNetworkName": autorest.Encode("path", managedVirtualNetworkName), + } + + const APIVersion = "2019-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{workspaceName}.{SynapseDnsSuffix}", urlParameters), + autorest.WithPathParameters("/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints/{managedPrivateEndpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedPrivateEndpointsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ManagedPrivateEndpointsClient) CreateResponder(resp *http.Response) (result ManagedPrivateEndpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete Managed Private Endpoints +// Parameters: +// workspaceName - the name of the workspace to execute operations on. +// managedVirtualNetworkName - managed virtual network name +// managedPrivateEndpointName - managed private endpoint name +func (client ManagedPrivateEndpointsClient) Delete(ctx context.Context, workspaceName string, managedVirtualNetworkName string, managedPrivateEndpointName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedPrivateEndpointsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, workspaceName, managedVirtualNetworkName, managedPrivateEndpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "managedvirtualnetwork.ManagedPrivateEndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "managedvirtualnetwork.ManagedPrivateEndpointsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedvirtualnetwork.ManagedPrivateEndpointsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ManagedPrivateEndpointsClient) DeletePreparer(ctx context.Context, workspaceName string, managedVirtualNetworkName string, managedPrivateEndpointName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "SynapseDnsSuffix": client.SynapseDNSSuffix, + "workspaceName": workspaceName, + } + + pathParameters := map[string]interface{}{ + "managedPrivateEndpointName": autorest.Encode("path", managedPrivateEndpointName), + "managedVirtualNetworkName": autorest.Encode("path", managedVirtualNetworkName), + } + + const APIVersion = "2019-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("https://{workspaceName}.{SynapseDnsSuffix}", urlParameters), + autorest.WithPathParameters("/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints/{managedPrivateEndpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedPrivateEndpointsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ManagedPrivateEndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get Managed Private Endpoints +// Parameters: +// workspaceName - the name of the workspace to execute operations on. +// managedVirtualNetworkName - managed virtual network name +// managedPrivateEndpointName - managed private endpoint name +func (client ManagedPrivateEndpointsClient) Get(ctx context.Context, workspaceName string, managedVirtualNetworkName string, managedPrivateEndpointName string) (result ManagedPrivateEndpoint, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedPrivateEndpointsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, workspaceName, managedVirtualNetworkName, managedPrivateEndpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "managedvirtualnetwork.ManagedPrivateEndpointsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedvirtualnetwork.ManagedPrivateEndpointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedvirtualnetwork.ManagedPrivateEndpointsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ManagedPrivateEndpointsClient) GetPreparer(ctx context.Context, workspaceName string, managedVirtualNetworkName string, managedPrivateEndpointName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "SynapseDnsSuffix": client.SynapseDNSSuffix, + "workspaceName": workspaceName, + } + + pathParameters := map[string]interface{}{ + "managedPrivateEndpointName": autorest.Encode("path", managedPrivateEndpointName), + "managedVirtualNetworkName": autorest.Encode("path", managedVirtualNetworkName), + } + + const APIVersion = "2019-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{workspaceName}.{SynapseDnsSuffix}", urlParameters), + autorest.WithPathParameters("/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints/{managedPrivateEndpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedPrivateEndpointsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ManagedPrivateEndpointsClient) GetResponder(resp *http.Response) (result ManagedPrivateEndpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list Managed Private Endpoints +// Parameters: +// workspaceName - the name of the workspace to execute operations on. +// managedVirtualNetworkName - managed virtual network name +func (client ManagedPrivateEndpointsClient) List(ctx context.Context, workspaceName string, managedVirtualNetworkName string) (result ManagedPrivateEndpointListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedPrivateEndpointsClient.List") + defer func() { + sc := -1 + if result.mpelr.Response.Response != nil { + sc = result.mpelr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, workspaceName, managedVirtualNetworkName) + if err != nil { + err = autorest.NewErrorWithError(err, "managedvirtualnetwork.ManagedPrivateEndpointsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mpelr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "managedvirtualnetwork.ManagedPrivateEndpointsClient", "List", resp, "Failure sending request") + return + } + + result.mpelr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedvirtualnetwork.ManagedPrivateEndpointsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ManagedPrivateEndpointsClient) ListPreparer(ctx context.Context, workspaceName string, managedVirtualNetworkName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "SynapseDnsSuffix": client.SynapseDNSSuffix, + "workspaceName": workspaceName, + } + + pathParameters := map[string]interface{}{ + "managedVirtualNetworkName": autorest.Encode("path", managedVirtualNetworkName), + } + + const APIVersion = "2019-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{workspaceName}.{SynapseDnsSuffix}", urlParameters), + autorest.WithPathParameters("/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedPrivateEndpointsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ManagedPrivateEndpointsClient) ListResponder(resp *http.Response) (result ManagedPrivateEndpointListResponse, err error) { + err = autorest.Respond( + resp, + 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 ManagedPrivateEndpointsClient) listNextResults(ctx context.Context, lastResults ManagedPrivateEndpointListResponse) (result ManagedPrivateEndpointListResponse, err error) { + req, err := lastResults.managedPrivateEndpointListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "managedvirtualnetwork.ManagedPrivateEndpointsClient", "listNextResults", 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, "managedvirtualnetwork.ManagedPrivateEndpointsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "managedvirtualnetwork.ManagedPrivateEndpointsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedPrivateEndpointsClient) ListComplete(ctx context.Context, workspaceName string, managedVirtualNetworkName string) (result ManagedPrivateEndpointListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedPrivateEndpointsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, workspaceName, managedVirtualNetworkName) + return +} diff --git a/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/managedvirtualnetworkapi/interfaces.go b/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/managedvirtualnetworkapi/interfaces.go new file mode 100644 index 000000000000..d467c3d4fd24 --- /dev/null +++ b/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/managedvirtualnetworkapi/interfaces.go @@ -0,0 +1,35 @@ +package managedvirtualnetworkapi + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork" + "github.com/Azure/go-autorest/autorest" +) + +// ManagedPrivateEndpointsClientAPI contains the set of methods on the ManagedPrivateEndpointsClient type. +type ManagedPrivateEndpointsClientAPI interface { + Create(ctx context.Context, workspaceName string, managedVirtualNetworkName string, managedPrivateEndpointName string) (result managedvirtualnetwork.ManagedPrivateEndpoint, err error) + Delete(ctx context.Context, workspaceName string, managedVirtualNetworkName string, managedPrivateEndpointName string) (result autorest.Response, err error) + Get(ctx context.Context, workspaceName string, managedVirtualNetworkName string, managedPrivateEndpointName string) (result managedvirtualnetwork.ManagedPrivateEndpoint, err error) + List(ctx context.Context, workspaceName string, managedVirtualNetworkName string) (result managedvirtualnetwork.ManagedPrivateEndpointListResponsePage, err error) + ListComplete(ctx context.Context, workspaceName string, managedVirtualNetworkName string) (result managedvirtualnetwork.ManagedPrivateEndpointListResponseIterator, err error) +} + +var _ ManagedPrivateEndpointsClientAPI = (*managedvirtualnetwork.ManagedPrivateEndpointsClient)(nil) diff --git a/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/models.go b/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/models.go new file mode 100644 index 000000000000..e778c28de6d3 --- /dev/null +++ b/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/models.go @@ -0,0 +1,213 @@ +package managedvirtualnetwork + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork" + +// ManagedPrivateEndpoint managed private endpoint +type ManagedPrivateEndpoint struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` + // Properties - Managed private endpoint properties + Properties *ManagedPrivateEndpointProperties `json:"properties,omitempty"` +} + +// ManagedPrivateEndpointConnectionState the connection state of a managed private endpoint +type ManagedPrivateEndpointConnectionState struct { + // Status - READ-ONLY; The approval status + Status *string `json:"status,omitempty"` + // Description - The managed private endpoint description + Description *string `json:"description,omitempty"` + // ActionsRequired - The actions required on the managed private endpoint + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// ManagedPrivateEndpointListResponse a list of managed private endpoints +type ManagedPrivateEndpointListResponse struct { + autorest.Response `json:"-"` + // Value - List of managed private endpoints + Value *[]ManagedPrivateEndpoint `json:"value,omitempty"` + // NextLink - READ-ONLY; The link to the next page of results, if any remaining results exist. + NextLink *string `json:"nextLink,omitempty"` +} + +// ManagedPrivateEndpointListResponseIterator provides access to a complete listing of +// ManagedPrivateEndpoint values. +type ManagedPrivateEndpointListResponseIterator struct { + i int + page ManagedPrivateEndpointListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedPrivateEndpointListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedPrivateEndpointListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedPrivateEndpointListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedPrivateEndpointListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedPrivateEndpointListResponseIterator) Response() ManagedPrivateEndpointListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedPrivateEndpointListResponseIterator) Value() ManagedPrivateEndpoint { + if !iter.page.NotDone() { + return ManagedPrivateEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedPrivateEndpointListResponseIterator type. +func NewManagedPrivateEndpointListResponseIterator(page ManagedPrivateEndpointListResponsePage) ManagedPrivateEndpointListResponseIterator { + return ManagedPrivateEndpointListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mpelr ManagedPrivateEndpointListResponse) IsEmpty() bool { + return mpelr.Value == nil || len(*mpelr.Value) == 0 +} + +// managedPrivateEndpointListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mpelr ManagedPrivateEndpointListResponse) managedPrivateEndpointListResponsePreparer(ctx context.Context) (*http.Request, error) { + if mpelr.NextLink == nil || len(to.String(mpelr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mpelr.NextLink))) +} + +// ManagedPrivateEndpointListResponsePage contains a page of ManagedPrivateEndpoint values. +type ManagedPrivateEndpointListResponsePage struct { + fn func(context.Context, ManagedPrivateEndpointListResponse) (ManagedPrivateEndpointListResponse, error) + mpelr ManagedPrivateEndpointListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedPrivateEndpointListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedPrivateEndpointListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.mpelr) + if err != nil { + return err + } + page.mpelr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedPrivateEndpointListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedPrivateEndpointListResponsePage) NotDone() bool { + return !page.mpelr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedPrivateEndpointListResponsePage) Response() ManagedPrivateEndpointListResponse { + return page.mpelr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedPrivateEndpointListResponsePage) Values() []ManagedPrivateEndpoint { + if page.mpelr.IsEmpty() { + return nil + } + return *page.mpelr.Value +} + +// Creates a new instance of the ManagedPrivateEndpointListResponsePage type. +func NewManagedPrivateEndpointListResponsePage(getNextPage func(context.Context, ManagedPrivateEndpointListResponse) (ManagedPrivateEndpointListResponse, error)) ManagedPrivateEndpointListResponsePage { + return ManagedPrivateEndpointListResponsePage{fn: getNextPage} +} + +// ManagedPrivateEndpointProperties properties of a managed private endpoint +type ManagedPrivateEndpointProperties struct { + // PrivateLinkResourceID - The ARM resource ID of the resource to which the managed private endpoint is created + PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` + // GroupID - The groupId to which the managed private endpoint is created + GroupID *string `json:"groupId,omitempty"` + // ProvisioningState - READ-ONLY; The managed private endpoint provisioning state + ProvisioningState *string `json:"provisioningState,omitempty"` + // ConnectionState - The managed private endpoint connection state + ConnectionState *ManagedPrivateEndpointConnectionState `json:"connectionState,omitempty"` + // IsReserved - READ-ONLY; Denotes whether the managed private endpoint is reserved + IsReserved *bool `json:"isReserved,omitempty"` +} diff --git a/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/version.go b/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/version.go new file mode 100644 index 000000000000..ab6cf371ad24 --- /dev/null +++ b/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork/version.go @@ -0,0 +1,30 @@ +package managedvirtualnetwork + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. +// 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/" + Version() + " managedvirtualnetwork/2019-06-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} From 6b08af854b0c02672930666103ea443a4eb409db Mon Sep 17 00:00:00 2001 From: arcturusZhang Date: Wed, 22 Jul 2020 15:16:24 +0800 Subject: [PATCH 4/4] v44.2.0 --- CHANGELOG.md | 16 ++++++++++++++++ version/version.go | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fb4a99b25ab..4696fd736f6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # CHANGELOG +## `v44.2.0` + +### New Packages + +| Package Name | API Version | +| -----------: | :---------: | +| azurestackhci | 2020-03-01-preview | +| managedvirtualnetwork | 2019-06-01-preview | +| monitoring | 2019-11-01-preview | + +### Updated Packages + +| Package Name | API Version | +| -----------: | :---------: | +| hdinsight | 2018-06-01-preview | + ## `v44.1.0` ### New Packages diff --git a/version/version.go b/version/version.go index f7ee5efc9784..24cee19e8f24 100644 --- a/version/version.go +++ b/version/version.go @@ -18,4 +18,4 @@ package version // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Number contains the semantic version of this SDK. -const Number = "v44.1.0" +const Number = "v44.2.0"