diff --git a/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go b/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go index 57e39fc3d6fe..541895a71026 100644 --- a/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go +++ b/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go @@ -19,7 +19,7 @@ package hdinsight -import original "github.com/Azure/azure-sdk-for-go/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight" +import original "github.com/Azure/azure-sdk-for-go/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight" type ApplicationsClient = original.ApplicationsClient @@ -30,8 +30,8 @@ const ( type BaseClient = original.BaseClient type ClustersClient = original.ClustersClient type ConfigurationsClient = original.ConfigurationsClient -type ExtensionClient = original.ExtensionClient -type LocationClient = original.LocationClient +type ExtensionsClient = original.ExtensionsClient +type LocationsClient = original.LocationsClient type AsyncOperationState = original.AsyncOperationState const ( @@ -56,13 +56,6 @@ const ( ActiveDirectory DirectoryType = original.ActiveDirectory ) -type EnabledCredential = original.EnabledCredential - -const ( - False EnabledCredential = original.False - True EnabledCredential = original.True -) - type OSType = original.OSType const ( @@ -80,12 +73,12 @@ const ( type Application = original.Application type ApplicationGetEndpoint = original.ApplicationGetEndpoint type ApplicationGetHTTPSEndpoint = original.ApplicationGetHTTPSEndpoint -type ApplicationGetProperties = original.ApplicationGetProperties type ApplicationListResult = original.ApplicationListResult type ApplicationListResultIterator = original.ApplicationListResultIterator type ApplicationListResultPage = original.ApplicationListResultPage +type ApplicationProperties = original.ApplicationProperties +type ApplicationsCreateFuture = original.ApplicationsCreateFuture type ApplicationsDeleteFuture = original.ApplicationsDeleteFuture -type CapabilitiesResult = original.CapabilitiesResult type Cluster = original.Cluster type ClusterCreateParametersExtended = original.ClusterCreateParametersExtended type ClusterCreateProperties = original.ClusterCreateProperties @@ -108,14 +101,17 @@ type ComputeProfile = original.ComputeProfile type ConfigurationsUpdateHTTPSettingsFuture = original.ConfigurationsUpdateHTTPSettingsFuture type ConnectivityEndpoint = original.ConnectivityEndpoint type DataDisksGroups = original.DataDisksGroups +type ErrorResponse = original.ErrorResponse type Errors = original.Errors type ExecuteScriptActionParameters = original.ExecuteScriptActionParameters type Extension = original.Extension -type ExtensionDisableMonitoringFuture = original.ExtensionDisableMonitoringFuture -type ExtensionEnableMonitoringFuture = original.ExtensionEnableMonitoringFuture +type ExtensionsCreateFuture = original.ExtensionsCreateFuture +type ExtensionsDeleteFuture = original.ExtensionsDeleteFuture +type ExtensionsDisableMonitoringFuture = original.ExtensionsDisableMonitoringFuture +type ExtensionsEnableMonitoringFuture = original.ExtensionsEnableMonitoringFuture type HardwareProfile = original.HardwareProfile -type HTTPConnectivitySettings = original.HTTPConnectivitySettings type LinuxOperatingSystemProfile = original.LinuxOperatingSystemProfile +type LocalizedName = original.LocalizedName type Operation = original.Operation type OperationDisplay = original.OperationDisplay type OperationListResult = original.OperationListResult @@ -124,10 +120,7 @@ type OperationListResultPage = original.OperationListResultPage type OperationResource = original.OperationResource type OsProfile = original.OsProfile type ProxyResource = original.ProxyResource -type QuotaCapability = original.QuotaCapability type QuotaInfo = original.QuotaInfo -type RegionalQuotaCapability = original.RegionalQuotaCapability -type RegionsCapability = original.RegionsCapability type Resource = original.Resource type Role = original.Role type RuntimeScriptAction = original.RuntimeScriptAction @@ -148,11 +141,9 @@ type SSHPublicKey = original.SSHPublicKey type StorageAccount = original.StorageAccount type StorageProfile = original.StorageProfile type TrackedResource = original.TrackedResource -type VersionsCapability = original.VersionsCapability -type VersionSpec = original.VersionSpec +type Usage = original.Usage +type UsagesListResult = original.UsagesListResult type VirtualNetworkProfile = original.VirtualNetworkProfile -type VMSizeCompatibilityFilter = original.VMSizeCompatibilityFilter -type VMSizesCapability = original.VMSizesCapability type OperationsClient = original.OperationsClient type ScriptActionsClient = original.ScriptActionsClient type ScriptExecutionHistoryClient = original.ScriptExecutionHistoryClient @@ -181,17 +172,17 @@ func NewConfigurationsClient(subscriptionID string) ConfigurationsClient { func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationsClient { return original.NewConfigurationsClientWithBaseURI(baseURI, subscriptionID) } -func NewExtensionClient(subscriptionID string) ExtensionClient { - return original.NewExtensionClient(subscriptionID) +func NewExtensionsClient(subscriptionID string) ExtensionsClient { + return original.NewExtensionsClient(subscriptionID) } -func NewExtensionClientWithBaseURI(baseURI string, subscriptionID string) ExtensionClient { - return original.NewExtensionClientWithBaseURI(baseURI, subscriptionID) +func NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { + return original.NewExtensionsClientWithBaseURI(baseURI, subscriptionID) } -func NewLocationClient(subscriptionID string) LocationClient { - return original.NewLocationClient(subscriptionID) +func NewLocationsClient(subscriptionID string) LocationsClient { + return original.NewLocationsClient(subscriptionID) } -func NewLocationClientWithBaseURI(baseURI string, subscriptionID string) LocationClient { - return original.NewLocationClientWithBaseURI(baseURI, subscriptionID) +func NewLocationsClientWithBaseURI(baseURI string, subscriptionID string) LocationsClient { + return original.NewLocationsClientWithBaseURI(baseURI, subscriptionID) } func PossibleAsyncOperationStateValues() []AsyncOperationState { return original.PossibleAsyncOperationStateValues() @@ -202,9 +193,6 @@ func PossibleClusterProvisioningStateValues() []ClusterProvisioningState { func PossibleDirectoryTypeValues() []DirectoryType { return original.PossibleDirectoryTypeValues() } -func PossibleEnabledCredentialValues() []EnabledCredential { - return original.PossibleEnabledCredentialValues() -} func PossibleOSTypeValues() []OSType { return original.PossibleOSTypeValues() } diff --git a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/applications.go b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/applications.go index f70f108419fd..b3d70f419d73 100644 --- a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/applications.go +++ b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/applications.go @@ -43,33 +43,28 @@ func NewApplicationsClientWithBaseURI(baseURI string, subscriptionID string) App // Parameters: // resourceGroupName - the name of the resource group. // clusterName - the name of the cluster. +// applicationName - the constant value for the application name. // parameters - the application create request. -func (client ApplicationsClient) Create(ctx context.Context, resourceGroupName string, clusterName string, parameters ApplicationGetProperties) (result Application, err error) { - req, err := client.CreatePreparer(ctx, resourceGroupName, clusterName, parameters) +func (client ApplicationsClient) Create(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters ApplicationProperties) (result ApplicationsCreateFuture, err error) { + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterName, applicationName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Create", nil, "Failure preparing request") return } - resp, err := client.CreateSender(req) + result, err = client.CreateSender(req) if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Create", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Create", result.Response(), "Failure sending request") return } - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Create", resp, "Failure responding to request") - } - return } // CreatePreparer prepares the Create request. -func (client ApplicationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ApplicationGetProperties) (*http.Request, error) { +func (client ApplicationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters ApplicationProperties) (*http.Request, error) { pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", "hue"), + "applicationName": autorest.Encode("path", applicationName), "clusterName": autorest.Encode("path", clusterName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), @@ -92,9 +87,19 @@ func (client ApplicationsClient) CreatePreparer(ctx context.Context, resourceGro // CreateSender sends the Create request. The method will close the // http.Response Body if it receives an error. -func (client ApplicationsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, +func (client ApplicationsClient) CreateSender(req *http.Request) (future ApplicationsCreateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return } // CreateResponder handles the response to the Create request. The method always @@ -114,8 +119,9 @@ func (client ApplicationsClient) CreateResponder(resp *http.Response) (result Ap // Parameters: // resourceGroupName - the name of the resource group. // clusterName - the name of the cluster. -func (client ApplicationsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result ApplicationsDeleteFuture, err error) { - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName) +// applicationName - the constant value for the application name. +func (client ApplicationsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (result ApplicationsDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, applicationName) if err != nil { err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Delete", nil, "Failure preparing request") return @@ -131,9 +137,9 @@ func (client ApplicationsClient) Delete(ctx context.Context, resourceGroupName s } // DeletePreparer prepares the Delete request. -func (client ApplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { +func (client ApplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", "hue"), + "applicationName": autorest.Encode("path", applicationName), "clusterName": autorest.Encode("path", clusterName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), @@ -161,7 +167,7 @@ func (client ApplicationsClient) DeleteSender(req *http.Request) (future Applica if err != nil { return } - err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) if err != nil { return } @@ -175,7 +181,7 @@ func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result au err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp return @@ -250,7 +256,7 @@ func (client ApplicationsClient) GetResponder(resp *http.Response) (result Appli return } -// List lists all of the applications HDInsight cluster. +// List lists all of the applications for the HDInsight cluster. // Parameters: // resourceGroupName - the name of the resource group. // clusterName - the name of the cluster. diff --git a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/configurations.go b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/configurations.go index 3bebc5fed7dd..0c6118bab131 100644 --- a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/configurations.go +++ b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/configurations.go @@ -21,6 +21,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "net/http" ) @@ -43,7 +44,7 @@ func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) C // Parameters: // resourceGroupName - the name of the resource group. // clusterName - the name of the cluster. -// configurationName - the constant for configuration type of gateway. +// configurationName - the name of the cluster configuration. func (client ConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, configurationName string) (result SetString, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, configurationName) if err != nil { @@ -112,9 +113,16 @@ func (client ConfigurationsClient) GetResponder(resp *http.Response) (result Set // Parameters: // resourceGroupName - the name of the resource group. // clusterName - the name of the cluster. -// parameters - the name of the resource group. -func (client ConfigurationsClient) UpdateHTTPSettings(ctx context.Context, resourceGroupName string, clusterName string, parameters HTTPConnectivitySettings) (result ConfigurationsUpdateHTTPSettingsFuture, err error) { - req, err := client.UpdateHTTPSettingsPreparer(ctx, resourceGroupName, clusterName, parameters) +// configurationName - the name of the cluster configuration. +// parameters - the cluster configurations. +func (client ConfigurationsClient) UpdateHTTPSettings(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters map[string]*string) (result ConfigurationsUpdateHTTPSettingsFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("hdinsight.ConfigurationsClient", "UpdateHTTPSettings", err.Error()) + } + + req, err := client.UpdateHTTPSettingsPreparer(ctx, resourceGroupName, clusterName, configurationName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "UpdateHTTPSettings", nil, "Failure preparing request") return @@ -130,10 +138,10 @@ func (client ConfigurationsClient) UpdateHTTPSettings(ctx context.Context, resou } // UpdateHTTPSettingsPreparer prepares the UpdateHTTPSettings request. -func (client ConfigurationsClient) UpdateHTTPSettingsPreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters HTTPConnectivitySettings) (*http.Request, error) { +func (client ConfigurationsClient) UpdateHTTPSettingsPreparer(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters map[string]*string) (*http.Request, error) { pathParameters := map[string]interface{}{ "clusterName": autorest.Encode("path", clusterName), - "configurationName": autorest.Encode("path", "gateway"), + "configurationName": autorest.Encode("path", configurationName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } diff --git a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/extension.go b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/extension.go index d69f4f48d8db..c9cbdd33090d 100644 --- a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/extension.go +++ b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/extension.go @@ -43,9 +43,10 @@ func NewExtensionClientWithBaseURI(baseURI string, subscriptionID string) Extens // Parameters: // resourceGroupName - the name of the resource group. // clusterName - the name of the cluster. +// extensionName - the name of the cluster extension. // parameters - the cluster extensions create request. -func (client ExtensionClient) Create(ctx context.Context, resourceGroupName string, clusterName string, parameters Extension) (result autorest.Response, err error) { - req, err := client.CreatePreparer(ctx, resourceGroupName, clusterName, parameters) +func (client ExtensionClient) Create(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, parameters Extension) (result autorest.Response, err error) { + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterName, extensionName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Create", nil, "Failure preparing request") return @@ -67,10 +68,10 @@ func (client ExtensionClient) Create(ctx context.Context, resourceGroupName stri } // CreatePreparer prepares the Create request. -func (client ExtensionClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters Extension) (*http.Request, error) { +func (client ExtensionClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, parameters Extension) (*http.Request, error) { pathParameters := map[string]interface{}{ "clusterName": autorest.Encode("path", clusterName), - "extensionName": autorest.Encode("path", "clustermonitoring"), + "extensionName": autorest.Encode("path", extensionName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -113,8 +114,9 @@ func (client ExtensionClient) CreateResponder(resp *http.Response) (result autor // Parameters: // resourceGroupName - the name of the resource group. // clusterName - the name of the cluster. -func (client ExtensionClient) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName) +// extensionName - the name of the cluster extension. +func (client ExtensionClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, extensionName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, extensionName) if err != nil { err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Delete", nil, "Failure preparing request") return @@ -136,10 +138,10 @@ func (client ExtensionClient) Delete(ctx context.Context, resourceGroupName stri } // DeletePreparer prepares the Delete request. -func (client ExtensionClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { +func (client ExtensionClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, extensionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "clusterName": autorest.Encode("path", clusterName), - "extensionName": autorest.Encode("path", "clustermonitoring"), + "extensionName": autorest.Encode("path", extensionName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -323,8 +325,9 @@ func (client ExtensionClient) EnableMonitoringResponder(resp *http.Response) (re // Parameters: // resourceGroupName - the name of the resource group. // clusterName - the name of the cluster. -func (client ExtensionClient) Get(ctx context.Context, resourceGroupName string, clusterName string) (result Extension, err error) { - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName) +// extensionName - the name of the cluster extension. +func (client ExtensionClient) Get(ctx context.Context, resourceGroupName string, clusterName string, extensionName string) (result Extension, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, extensionName) if err != nil { err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Get", nil, "Failure preparing request") return @@ -346,10 +349,10 @@ func (client ExtensionClient) Get(ctx context.Context, resourceGroupName string, } // GetPreparer prepares the Get request. -func (client ExtensionClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { +func (client ExtensionClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, extensionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "clusterName": autorest.Encode("path", clusterName), - "extensionName": autorest.Encode("path", "clustermonitoring"), + "extensionName": autorest.Encode("path", extensionName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } diff --git a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/locations.go b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/locations.go new file mode 100644 index 000000000000..6d4d04e3249e --- /dev/null +++ b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/locations.go @@ -0,0 +1,170 @@ +package hdinsight + +// 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" + "net/http" +) + +// LocationsClient is the hDInsight Management Client +type LocationsClient struct { + BaseClient +} + +// NewLocationsClient creates an instance of the LocationsClient client. +func NewLocationsClient(subscriptionID string) LocationsClient { + return NewLocationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocationsClientWithBaseURI creates an instance of the LocationsClient client. +func NewLocationsClientWithBaseURI(baseURI string, subscriptionID string) LocationsClient { + return LocationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetCapabilities gets the capabilities for the specified location. +// Parameters: +// location - the location. +func (client LocationsClient) GetCapabilities(ctx context.Context, location string) (result CapabilitiesResult, err error) { + req, err := client.GetCapabilitiesPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.LocationsClient", "GetCapabilities", nil, "Failure preparing request") + return + } + + resp, err := client.GetCapabilitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.LocationsClient", "GetCapabilities", resp, "Failure sending request") + return + } + + result, err = client.GetCapabilitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.LocationsClient", "GetCapabilities", resp, "Failure responding to request") + } + + return +} + +// GetCapabilitiesPreparer prepares the GetCapabilities request. +func (client LocationsClient) GetCapabilitiesPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-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.HDInsight/locations/{location}/capabilities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCapabilitiesSender sends the GetCapabilities request. The method will close the +// http.Response Body if it receives an error. +func (client LocationsClient) GetCapabilitiesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetCapabilitiesResponder handles the response to the GetCapabilities request. The method always +// closes the http.Response Body. +func (client LocationsClient) GetCapabilitiesResponder(resp *http.Response) (result CapabilitiesResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsages lists the usages for the specified location. +// Parameters: +// location - the location. +func (client LocationsClient) ListUsages(ctx context.Context, location string) (result UsagesListResult, err error) { + req, err := client.ListUsagesPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.LocationsClient", "ListUsages", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.LocationsClient", "ListUsages", resp, "Failure sending request") + return + } + + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.LocationsClient", "ListUsages", resp, "Failure responding to request") + } + + return +} + +// ListUsagesPreparer prepares the ListUsages request. +func (client LocationsClient) ListUsagesPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-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.HDInsight/locations/{location}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListUsagesSender sends the ListUsages request. The method will close the +// http.Response Body if it receives an error. +func (client LocationsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListUsagesResponder handles the response to the ListUsages request. The method always +// closes the http.Response Body. +func (client LocationsClient) ListUsagesResponder(resp *http.Response) (result UsagesListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/models.go b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/models.go index f1f531dce628..4171a66fd512 100644 --- a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/models.go +++ b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/models.go @@ -76,21 +76,6 @@ func PossibleDirectoryTypeValues() []DirectoryType { return []DirectoryType{ActiveDirectory} } -// EnabledCredential enumerates the values for enabled credential. -type EnabledCredential string - -const ( - // False ... - False EnabledCredential = "false" - // True ... - True EnabledCredential = "true" -) - -// PossibleEnabledCredentialValues returns an array of possible values for the EnabledCredential const type. -func PossibleEnabledCredentialValues() []EnabledCredential { - return []EnabledCredential{False, True} -} - // OSType enumerates the values for os type. type OSType string @@ -129,7 +114,7 @@ type Application struct { // Tags - The tags for the application. Tags map[string]*string `json:"tags"` // Properties - The properties of the application. - Properties *ApplicationGetProperties `json:"properties,omitempty"` + Properties *ApplicationProperties `json:"properties,omitempty"` // ID - Fully qualified resource Id for the resource. ID *string `json:"id,omitempty"` // Name - The name of the resource @@ -207,34 +192,6 @@ func (aghe ApplicationGetHTTPSEndpoint) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// ApplicationGetProperties the HDInsight cluster application GET response. -type ApplicationGetProperties struct { - // ComputeProfile - The list of roles in the cluster. - ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"` - // InstallScriptActions - The list of install script actions. - InstallScriptActions *[]RuntimeScriptAction `json:"installScriptActions,omitempty"` - // UninstallScriptActions - The list of uninstall script actions. - UninstallScriptActions *[]RuntimeScriptAction `json:"uninstallScriptActions,omitempty"` - // HTTPSEndpoints - The list of application HTTPS endpoints. - HTTPSEndpoints *[]ApplicationGetHTTPSEndpoint `json:"httpsEndpoints,omitempty"` - // SSHEndpoints - The list of application SSH endpoints. - SSHEndpoints *[]ApplicationGetEndpoint `json:"sshEndpoints,omitempty"` - // ProvisioningState - The provisioning state of the application. - ProvisioningState *string `json:"provisioningState,omitempty"` - // ApplicationType - The application type. - ApplicationType *string `json:"applicationType,omitempty"` - // ApplicationState - The application state. - ApplicationState *string `json:"applicationState,omitempty"` - // Errors - The list of errors. - Errors *[]Errors `json:"errors,omitempty"` - // CreatedDate - The application create date time. - CreatedDate *string `json:"createdDate,omitempty"` - // MarketplaceIdentifier - The marketplace identifier. - MarketplaceIdentifier *string `json:"marketplaceIdentifier,omitempty"` - // AdditionalProperties - The additional properties for application. - AdditionalProperties *string `json:"additionalProperties,omitempty"` -} - // ApplicationListResult result of the request to list cluster Applications. It contains a list of operations and a // URL link to get the next set of results. type ApplicationListResult struct { @@ -338,6 +295,62 @@ func (page ApplicationListResultPage) Values() []Application { return *page.alr.Value } +// ApplicationProperties the HDInsight cluster application GET response. +type ApplicationProperties struct { + // ComputeProfile - The list of roles in the cluster. + ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"` + // InstallScriptActions - The list of install script actions. + InstallScriptActions *[]RuntimeScriptAction `json:"installScriptActions,omitempty"` + // UninstallScriptActions - The list of uninstall script actions. + UninstallScriptActions *[]RuntimeScriptAction `json:"uninstallScriptActions,omitempty"` + // HTTPSEndpoints - The list of application HTTPS endpoints. + HTTPSEndpoints *[]ApplicationGetHTTPSEndpoint `json:"httpsEndpoints,omitempty"` + // SSHEndpoints - The list of application SSH endpoints. + SSHEndpoints *[]ApplicationGetEndpoint `json:"sshEndpoints,omitempty"` + // ProvisioningState - The provisioning state of the application. + ProvisioningState *string `json:"provisioningState,omitempty"` + // ApplicationType - The application type. + ApplicationType *string `json:"applicationType,omitempty"` + // ApplicationState - The application state. + ApplicationState *string `json:"applicationState,omitempty"` + // Errors - The list of errors. + Errors *[]Errors `json:"errors,omitempty"` + // CreatedDate - The application create date time. + CreatedDate *string `json:"createdDate,omitempty"` + // MarketplaceIdentifier - The marketplace identifier. + MarketplaceIdentifier *string `json:"marketplaceIdentifier,omitempty"` + // AdditionalProperties - The additional properties for application. + AdditionalProperties *string `json:"additionalProperties,omitempty"` +} + +// ApplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ApplicationsCreateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ApplicationsCreateFuture) Result(client ApplicationsClient) (a Application, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ApplicationsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { + a, err = client.CreateResponder(a.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsCreateFuture", "Result", a.Response.Response, "Failure responding to request") + } + } + return +} + // ApplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ApplicationsDeleteFuture struct { azure.Future @@ -676,9 +689,9 @@ type ClusterMonitoringRequest struct { type ClusterMonitoringResponse struct { autorest.Response `json:"-"` // ClusterMonitoringEnabled - The status of the Operations Management Suite (OMS) on the HDInsight cluster. - ClusterMonitoringEnabled *bool `json:"ClusterMonitoringEnabled,omitempty"` + ClusterMonitoringEnabled *bool `json:"clusterMonitoringEnabled,omitempty"` // WorkspaceID - The workspace ID of the Operations Management Suite (OMS) on the HDInsight cluster. - WorkspaceID *string `json:"WorkspaceId,omitempty"` + WorkspaceID *string `json:"workspaceId,omitempty"` } // ClusterPatchParameters the PatchCluster request parameters @@ -848,6 +861,14 @@ type DataDisksGroups struct { DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` } +// ErrorResponse describes the format of Error response. +type ErrorResponse struct { + // Code - Error code + Code *string `json:"code,omitempty"` + // Message - Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + // Errors the error message associated with the cluster creation. type Errors struct { // Code - The error code. @@ -925,16 +946,6 @@ type HardwareProfile struct { VMSize *string `json:"vmSize,omitempty"` } -// HTTPConnectivitySettings the payload for a Configure HTTP settings request. -type HTTPConnectivitySettings struct { - // EnabledCredential - Whether or not the HTTP based authorization is enabled. Possible values include: 'True', 'False' - EnabledCredential EnabledCredential `json:"restAuthCredential.isEnabled,omitempty"` - // Username - The HTTP username. - Username *string `json:"restAuthCredential.username,omitempty"` - // Password - The HTTP user password. - Password *string `json:"restAuthCredential.password,omitempty"` -} - // LinuxOperatingSystemProfile the ssh username, password, and ssh public key. type LinuxOperatingSystemProfile struct { // Username - The username. @@ -945,6 +956,14 @@ type LinuxOperatingSystemProfile struct { SSHProfile *SSHProfile `json:"sshProfile,omitempty"` } +// LocalizedName the details about the localizable name of a type of usage. +type LocalizedName struct { + // Value - The name of the used resource. + Value *string `json:"value,omitempty"` + // LocalizedValue - The localized name of the used resource. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + // Operation the HDInsight REST API operation. type Operation struct { // Name - The operation name: {provider}/{resource}/{operation} @@ -957,7 +976,7 @@ type Operation struct { type OperationDisplay struct { // Provider - The service provider: Microsoft.HDInsight Provider *string `json:"provider,omitempty"` - // Resource - The resource on which the operation is performed: Cluster, Capabilities, etc. + // Resource - The resource on which the operation is performed: Cluster, Applications, etc. Resource *string `json:"resource,omitempty"` // Operation - The operation type: read, write, delete, etc. Operation *string `json:"operation,omitempty"` @@ -1527,6 +1546,25 @@ func (tr TrackedResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// Usage the details about the usage of a particular limited resource. +type Usage struct { + // Unit - The type of measurement for usage. + Unit *string `json:"unit,omitempty"` + // CurrentValue - The current usage. + CurrentValue *int32 `json:"currentValue,omitempty"` + // Limit - The maximum allowed usage. + Limit *int32 `json:"limit,omitempty"` + // Name - The details about the localizable name of the used resource. + Name *LocalizedName `json:"name,omitempty"` +} + +// UsagesListResult the response for the operation to get regional usages for a subscription. +type UsagesListResult struct { + autorest.Response `json:"-"` + // Value - The list of usages. + Value *[]Usage `json:"value,omitempty"` +} + // VersionsCapability the version capability. type VersionsCapability struct { // Available - The list of version capabilities. diff --git a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/scriptexecutionhistory.go b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/scriptexecutionhistory.go index 8412531befbe..28735f3fca13 100644 --- a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/scriptexecutionhistory.go +++ b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/scriptexecutionhistory.go @@ -138,8 +138,8 @@ func (client ScriptExecutionHistoryClient) ListComplete(ctx context.Context, res // Parameters: // resourceGroupName - the name of the resource group. // clusterName - the name of the cluster. -// scriptExecutionID - the script execution ID. -func (client ScriptExecutionHistoryClient) Promote(ctx context.Context, resourceGroupName string, clusterName string, scriptExecutionID int64) (result autorest.Response, err error) { +// scriptExecutionID - the script execution Id +func (client ScriptExecutionHistoryClient) Promote(ctx context.Context, resourceGroupName string, clusterName string, scriptExecutionID string) (result autorest.Response, err error) { req, err := client.PromotePreparer(ctx, resourceGroupName, clusterName, scriptExecutionID) if err != nil { err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Promote", nil, "Failure preparing request") @@ -162,7 +162,7 @@ func (client ScriptExecutionHistoryClient) Promote(ctx context.Context, resource } // PromotePreparer prepares the Promote request. -func (client ScriptExecutionHistoryClient) PromotePreparer(ctx context.Context, resourceGroupName string, clusterName string, scriptExecutionID int64) (*http.Request, error) { +func (client ScriptExecutionHistoryClient) PromotePreparer(ctx context.Context, resourceGroupName string, clusterName string, scriptExecutionID string) (*http.Request, error) { pathParameters := map[string]interface{}{ "clusterName": autorest.Encode("path", clusterName), "resourceGroupName": autorest.Encode("path", resourceGroupName), diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/applications.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/applications.go new file mode 100644 index 000000000000..6f6cabc3d1c6 --- /dev/null +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/applications.go @@ -0,0 +1,352 @@ +package hdinsight + +// 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" + "net/http" +) + +// ApplicationsClient is the hDInsight Management Client +type ApplicationsClient struct { + BaseClient +} + +// NewApplicationsClient creates an instance of the ApplicationsClient client. +func NewApplicationsClient(subscriptionID string) ApplicationsClient { + return NewApplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApplicationsClientWithBaseURI creates an instance of the ApplicationsClient client. +func NewApplicationsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationsClient { + return ApplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates applications for the HDInsight cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// applicationName - the constant value for the application name. +// parameters - the application create request. +func (client ApplicationsClient) Create(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters ApplicationProperties) (result ApplicationsCreateFuture, err error) { + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterName, applicationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ApplicationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters ApplicationProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationName": autorest.Encode("path", applicationName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}", pathParameters), + autorest.WithJSON(parameters), + 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 ApplicationsClient) CreateSender(req *http.Request) (future ApplicationsCreateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) CreateResponder(resp *http.Response) (result Application, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified application on the HDInsight cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// applicationName - the constant value for the application name. +func (client ApplicationsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (result ApplicationsDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, applicationName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ApplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationName": autorest.Encode("path", applicationName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-06-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.HDInsight/clusters/{clusterName}/applications/{applicationName}", 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 ApplicationsClient) DeleteSender(req *http.Request) (future ApplicationsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets properties of the specified application. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// applicationName - the constant value for the application name. +func (client ApplicationsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (result Application, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, applicationName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApplicationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationName": autorest.Encode("path", applicationName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-06-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.HDInsight/clusters/{clusterName}/applications/{applicationName}", 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 ApplicationsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) GetResponder(resp *http.Response) (result Application, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByCluster lists all of the applications for the HDInsight cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +func (client ApplicationsClient) ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result ApplicationListResultPage, err error) { + result.fn = client.listByClusterNextResults + req, err := client.ListByClusterPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "ListByCluster", nil, "Failure preparing request") + return + } + + resp, err := client.ListByClusterSender(req) + if err != nil { + result.alr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "ListByCluster", resp, "Failure sending request") + return + } + + result.alr, err = client.ListByClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "ListByCluster", resp, "Failure responding to request") + } + + return +} + +// ListByClusterPreparer prepares the ListByCluster request. +func (client ApplicationsClient) ListByClusterPreparer(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 = "2018-06-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.HDInsight/clusters/{clusterName}/applications", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByClusterSender sends the ListByCluster request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationsClient) ListByClusterSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByClusterResponder handles the response to the ListByCluster request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) ListByClusterResponder(resp *http.Response) (result ApplicationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByClusterNextResults retrieves the next set of results, if any. +func (client ApplicationsClient) listByClusterNextResults(lastResults ApplicationListResult) (result ApplicationListResult, err error) { + req, err := lastResults.applicationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "listByClusterNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByClusterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "listByClusterNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "listByClusterNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByClusterComplete enumerates all values, automatically crossing page boundaries as required. +func (client ApplicationsClient) ListByClusterComplete(ctx context.Context, resourceGroupName string, clusterName string) (result ApplicationListResultIterator, err error) { + result.page, err = client.ListByCluster(ctx, resourceGroupName, clusterName) + return +} diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/client.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/client.go new file mode 100644 index 000000000000..19b78b2d7d9a --- /dev/null +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/client.go @@ -0,0 +1,51 @@ +// Package hdinsight implements the Azure ARM Hdinsight service API version 2018-06-01-preview. +// +// HDInsight Management Client +package hdinsight + +// 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 Hdinsight + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Hdinsight. +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. +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} 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 new file mode 100644 index 000000000000..4f0acbaeea93 --- /dev/null +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go @@ -0,0 +1,658 @@ +package hdinsight + +// 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" + "net/http" +) + +// ClustersClient is the hDInsight Management Client +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. +func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { + return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new HDInsight cluster with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// parameters - the cluster create request. +func (client ClustersClient) Create(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterCreateParametersExtended) (result ClustersCreateFuture, err error) { + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ClustersClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterCreateParametersExtended) (*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 = "2018-06-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.HDInsight/clusters/{clusterName}", pathParameters), + autorest.WithJSON(parameters), + 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) (future ClustersCreateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ClustersClient) CreateResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified HDInsight cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +func (client ClustersClient) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result ClustersDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Delete", result.Response(), "Failure sending request") + return + } + + 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 = "2018-06-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.HDInsight/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) (future ClustersDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ExecuteScriptActions executes script actions on the specified HDInsight cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// parameters - the parameters for executing script actions. +func (client ClustersClient) ExecuteScriptActions(ctx context.Context, resourceGroupName string, clusterName string, parameters ExecuteScriptActionParameters) (result ClustersExecuteScriptActionsFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.PersistOnSuccess", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("hdinsight.ClustersClient", "ExecuteScriptActions", err.Error()) + } + + req, err := client.ExecuteScriptActionsPreparer(ctx, resourceGroupName, clusterName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ExecuteScriptActions", nil, "Failure preparing request") + return + } + + result, err = client.ExecuteScriptActionsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ExecuteScriptActions", result.Response(), "Failure sending request") + return + } + + return +} + +// ExecuteScriptActionsPreparer prepares the ExecuteScriptActions request. +func (client ClustersClient) ExecuteScriptActionsPreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ExecuteScriptActionParameters) (*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 = "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}/executeScriptActions", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExecuteScriptActionsSender sends the ExecuteScriptActions request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ExecuteScriptActionsSender(req *http.Request) (future ClustersExecuteScriptActionsFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ExecuteScriptActionsResponder handles the response to the ExecuteScriptActions request. The method always +// closes the http.Response Body. +func (client ClustersClient) ExecuteScriptActionsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +func (client ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string) (result Cluster, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.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, "hdinsight.ClustersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.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 = "2018-06-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.HDInsight/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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the HDInsight clusters under the subscription. +func (client ClustersClient) List(ctx context.Context) (result ClusterListResultPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.clr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", resp, "Failure sending request") + return + } + + result.clr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.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 = "2018-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/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 autorest.SendWithSender(client, 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 ClusterListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ClustersClient) listNextResults(lastResults ClusterListResult) (result ClusterListResult, err error) { + req, err := lastResults.clusterListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "hdinsight.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, "hdinsight.ClustersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.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 ClusterListResultIterator, err error) { + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists the HDInsight clusters in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ClusterListResultPage, err error) { + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.clr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.clr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.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 = "2018-06-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.HDInsight/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 autorest.SendWithSender(client, 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 ClusterListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ClustersClient) listByResourceGroupNextResults(lastResults ClusterListResult) (result ClusterListResult, err error) { + req, err := lastResults.clusterListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "hdinsight.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, "hdinsight.ClustersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.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 ClusterListResultIterator, err error) { + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Resize resizes the specified HDInsight cluster to the specified size. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// parameters - the parameters for the resize operation. +func (client ClustersClient) Resize(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterResizeParameters) (result ClustersResizeFuture, err error) { + req, err := client.ResizePreparer(ctx, resourceGroupName, clusterName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Resize", nil, "Failure preparing request") + return + } + + result, err = client.ResizeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Resize", result.Response(), "Failure sending request") + return + } + + return +} + +// ResizePreparer prepares the Resize request. +func (client ClustersClient) ResizePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterResizeParameters) (*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}/resize", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResizeSender sends the Resize request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ResizeSender(req *http.Request) (future ClustersResizeFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ResizeResponder handles the response to the Resize request. The method always +// closes the http.Response Body. +func (client ClustersClient) ResizeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update patch HDInsight cluster with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// parameters - the cluster patch request. +func (client ClustersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterPatchParameters) (result Cluster, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.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, "hdinsight.ClustersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterPatchParameters) (*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 = "2018-06-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.HDInsight/clusters/{clusterName}", pathParameters), + autorest.WithJSON(parameters), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/configurations.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/configurations.go new file mode 100644 index 000000000000..6abb70cb09c1 --- /dev/null +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/configurations.go @@ -0,0 +1,191 @@ +package hdinsight + +// 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" + "net/http" +) + +// ConfigurationsClient is the hDInsight Management Client +type ConfigurationsClient struct { + BaseClient +} + +// NewConfigurationsClient creates an instance of the ConfigurationsClient client. +func NewConfigurationsClient(subscriptionID string) ConfigurationsClient { + return NewConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConfigurationsClientWithBaseURI creates an instance of the ConfigurationsClient client. +func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationsClient { + return ConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get the configuration object for the specified cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// configurationName - the name of the cluster configuration. +func (client ConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, configurationName string) (result SetString, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, configurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, configurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "configurationName": autorest.Encode("path", configurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-06-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.HDInsight/clusters/{clusterName}/configurations/{configurationName}", 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 ConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ConfigurationsClient) GetResponder(resp *http.Response) (result SetString, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateHTTPSettings configures the HTTP settings on the specified cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// configurationName - the name of the cluster configuration. +// parameters - the cluster configurations. +func (client ConfigurationsClient) UpdateHTTPSettings(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters map[string]*string) (result ConfigurationsUpdateHTTPSettingsFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("hdinsight.ConfigurationsClient", "UpdateHTTPSettings", err.Error()) + } + + req, err := client.UpdateHTTPSettingsPreparer(ctx, resourceGroupName, clusterName, configurationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "UpdateHTTPSettings", nil, "Failure preparing request") + return + } + + result, err = client.UpdateHTTPSettingsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "UpdateHTTPSettings", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateHTTPSettingsPreparer prepares the UpdateHTTPSettings request. +func (client ConfigurationsClient) UpdateHTTPSettingsPreparer(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters map[string]*string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "configurationName": autorest.Encode("path", configurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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}/configurations/{configurationName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateHTTPSettingsSender sends the UpdateHTTPSettings request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationsClient) UpdateHTTPSettingsSender(req *http.Request) (future ConfigurationsUpdateHTTPSettingsFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateHTTPSettingsResponder handles the response to the UpdateHTTPSettings request. The method always +// closes the http.Response Body. +func (client ConfigurationsClient) UpdateHTTPSettingsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/extensions.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/extensions.go new file mode 100644 index 000000000000..f01005716570 --- /dev/null +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/extensions.go @@ -0,0 +1,466 @@ +package hdinsight + +// 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" + "net/http" +) + +// ExtensionsClient is the hDInsight Management Client +type ExtensionsClient struct { + BaseClient +} + +// NewExtensionsClient creates an instance of the ExtensionsClient client. +func NewExtensionsClient(subscriptionID string) ExtensionsClient { + return NewExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionsClientWithBaseURI creates an instance of the ExtensionsClient client. +func NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { + return ExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates an HDInsight cluster extension. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// extensionName - the name of the cluster extension. +// parameters - the cluster extensions create request. +func (client ExtensionsClient) Create(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, parameters Extension) (result ExtensionsCreateFuture, err error) { + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterName, extensionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ExtensionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, parameters Extension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}", pathParameters), + autorest.WithJSON(parameters), + 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 ExtensionsClient) CreateSender(req *http.Request) (future ExtensionsCreateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the specified extension for HDInsight cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// extensionName - the name of the cluster extension. +func (client ExtensionsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, extensionName string) (result ExtensionsDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, extensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, extensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-06-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.HDInsight/clusters/{clusterName}/extensions/{extensionName}", 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 ExtensionsClient) DeleteSender(req *http.Request) (future ExtensionsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DisableMonitoring disables the Operations Management Suite (OMS) on the HDInsight cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +func (client ExtensionsClient) DisableMonitoring(ctx context.Context, resourceGroupName string, clusterName string) (result ExtensionsDisableMonitoringFuture, err error) { + req, err := client.DisableMonitoringPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "DisableMonitoring", nil, "Failure preparing request") + return + } + + result, err = client.DisableMonitoringSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "DisableMonitoring", result.Response(), "Failure sending request") + return + } + + return +} + +// DisableMonitoringPreparer prepares the DisableMonitoring request. +func (client ExtensionsClient) DisableMonitoringPreparer(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 = "2018-06-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.HDInsight/clusters/{clusterName}/extensions/clustermonitoring", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableMonitoringSender sends the DisableMonitoring request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) DisableMonitoringSender(req *http.Request) (future ExtensionsDisableMonitoringFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DisableMonitoringResponder handles the response to the DisableMonitoring request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) DisableMonitoringResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// EnableMonitoring enables the Operations Management Suite (OMS) on the HDInsight cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// parameters - the Operations Management Suite (OMS) workspace parameters. +func (client ExtensionsClient) EnableMonitoring(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterMonitoringRequest) (result ExtensionsEnableMonitoringFuture, err error) { + req, err := client.EnableMonitoringPreparer(ctx, resourceGroupName, clusterName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "EnableMonitoring", nil, "Failure preparing request") + return + } + + result, err = client.EnableMonitoringSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "EnableMonitoring", result.Response(), "Failure sending request") + return + } + + return +} + +// EnableMonitoringPreparer prepares the EnableMonitoring request. +func (client ExtensionsClient) EnableMonitoringPreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterMonitoringRequest) (*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 = "2018-06-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.HDInsight/clusters/{clusterName}/extensions/clustermonitoring", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableMonitoringSender sends the EnableMonitoring request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) EnableMonitoringSender(req *http.Request) (future ExtensionsEnableMonitoringFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// EnableMonitoringResponder handles the response to the EnableMonitoring request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) EnableMonitoringResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the extension properties for the specified HDInsight cluster extension. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// extensionName - the name of the cluster extension. +func (client ExtensionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, extensionName string) (result Extension, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, extensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, extensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-06-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.HDInsight/clusters/{clusterName}/extensions/{extensionName}", 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 ExtensionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) GetResponder(resp *http.Response) (result Extension, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMonitoringStatus gets the status of Operations Management Suite (OMS) on the HDInsight cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +func (client ExtensionsClient) GetMonitoringStatus(ctx context.Context, resourceGroupName string, clusterName string) (result ClusterMonitoringResponse, err error) { + req, err := client.GetMonitoringStatusPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "GetMonitoringStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetMonitoringStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "GetMonitoringStatus", resp, "Failure sending request") + return + } + + result, err = client.GetMonitoringStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsClient", "GetMonitoringStatus", resp, "Failure responding to request") + } + + return +} + +// GetMonitoringStatusPreparer prepares the GetMonitoringStatus request. +func (client ExtensionsClient) GetMonitoringStatusPreparer(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 = "2018-06-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.HDInsight/clusters/{clusterName}/extensions/clustermonitoring", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetMonitoringStatusSender sends the GetMonitoringStatus request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) GetMonitoringStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetMonitoringStatusResponder handles the response to the GetMonitoringStatus request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) GetMonitoringStatusResponder(resp *http.Response) (result ClusterMonitoringResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/location.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/locations.go similarity index 51% rename from services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/location.go rename to services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/locations.go index 37daa19808a2..05627d7885df 100644 --- a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/location.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/locations.go @@ -24,54 +24,54 @@ import ( "net/http" ) -// LocationClient is the hDInsight Management Client -type LocationClient struct { +// LocationsClient is the hDInsight Management Client +type LocationsClient struct { BaseClient } -// NewLocationClient creates an instance of the LocationClient client. -func NewLocationClient(subscriptionID string) LocationClient { - return NewLocationClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewLocationsClient creates an instance of the LocationsClient client. +func NewLocationsClient(subscriptionID string) LocationsClient { + return NewLocationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewLocationClientWithBaseURI creates an instance of the LocationClient client. -func NewLocationClientWithBaseURI(baseURI string, subscriptionID string) LocationClient { - return LocationClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewLocationsClientWithBaseURI creates an instance of the LocationsClient client. +func NewLocationsClientWithBaseURI(baseURI string, subscriptionID string) LocationsClient { + return LocationsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// GetCapabilities gets the capabilities for the specified location. +// ListUsages lists the usages for the specified location. // Parameters: // location - the location to get capabilities for. -func (client LocationClient) GetCapabilities(ctx context.Context, location string) (result CapabilitiesResult, err error) { - req, err := client.GetCapabilitiesPreparer(ctx, location) +func (client LocationsClient) ListUsages(ctx context.Context, location string) (result UsagesListResult, err error) { + req, err := client.ListUsagesPreparer(ctx, location) if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.LocationClient", "GetCapabilities", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "hdinsight.LocationsClient", "ListUsages", nil, "Failure preparing request") return } - resp, err := client.GetCapabilitiesSender(req) + resp, err := client.ListUsagesSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.LocationClient", "GetCapabilities", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "hdinsight.LocationsClient", "ListUsages", resp, "Failure sending request") return } - result, err = client.GetCapabilitiesResponder(resp) + result, err = client.ListUsagesResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.LocationClient", "GetCapabilities", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "hdinsight.LocationsClient", "ListUsages", resp, "Failure responding to request") } return } -// GetCapabilitiesPreparer prepares the GetCapabilities request. -func (client LocationClient) GetCapabilitiesPreparer(ctx context.Context, location string) (*http.Request, error) { +// ListUsagesPreparer prepares the ListUsages request. +func (client LocationsClient) ListUsagesPreparer(ctx context.Context, location string) (*http.Request, error) { pathParameters := map[string]interface{}{ "location": autorest.Encode("path", location), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2015-03-01-preview" + const APIVersion = "2018-06-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -79,21 +79,21 @@ func (client LocationClient) GetCapabilitiesPreparer(ctx context.Context, locati preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/usages", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// GetCapabilitiesSender sends the GetCapabilities request. The method will close the +// ListUsagesSender sends the ListUsages request. The method will close the // http.Response Body if it receives an error. -func (client LocationClient) GetCapabilitiesSender(req *http.Request) (*http.Response, error) { +func (client LocationsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } -// GetCapabilitiesResponder handles the response to the GetCapabilities request. The method always +// ListUsagesResponder handles the response to the ListUsages request. The method always // closes the http.Response Body. -func (client LocationClient) GetCapabilitiesResponder(resp *http.Response) (result CapabilitiesResult, err error) { +func (client LocationsClient) ListUsagesResponder(resp *http.Response) (result UsagesListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), 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 new file mode 100644 index 000000000000..ad5634d95473 --- /dev/null +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go @@ -0,0 +1,1555 @@ +package hdinsight + +// 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 ( + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AsyncOperationState enumerates the values for async operation state. +type AsyncOperationState string + +const ( + // Failed ... + Failed AsyncOperationState = "Failed" + // InProgress ... + InProgress AsyncOperationState = "InProgress" + // Succeeded ... + Succeeded AsyncOperationState = "Succeeded" +) + +// PossibleAsyncOperationStateValues returns an array of possible values for the AsyncOperationState const type. +func PossibleAsyncOperationStateValues() []AsyncOperationState { + return []AsyncOperationState{Failed, InProgress, Succeeded} +} + +// ClusterProvisioningState enumerates the values for cluster provisioning state. +type ClusterProvisioningState string + +const ( + // ClusterProvisioningStateCanceled ... + ClusterProvisioningStateCanceled ClusterProvisioningState = "Canceled" + // ClusterProvisioningStateDeleting ... + ClusterProvisioningStateDeleting ClusterProvisioningState = "Deleting" + // ClusterProvisioningStateFailed ... + ClusterProvisioningStateFailed ClusterProvisioningState = "Failed" + // ClusterProvisioningStateInProgress ... + ClusterProvisioningStateInProgress ClusterProvisioningState = "InProgress" + // ClusterProvisioningStateSucceeded ... + ClusterProvisioningStateSucceeded ClusterProvisioningState = "Succeeded" +) + +// PossibleClusterProvisioningStateValues returns an array of possible values for the ClusterProvisioningState const type. +func PossibleClusterProvisioningStateValues() []ClusterProvisioningState { + return []ClusterProvisioningState{ClusterProvisioningStateCanceled, ClusterProvisioningStateDeleting, ClusterProvisioningStateFailed, ClusterProvisioningStateInProgress, ClusterProvisioningStateSucceeded} +} + +// DirectoryType enumerates the values for directory type. +type DirectoryType string + +const ( + // ActiveDirectory ... + ActiveDirectory DirectoryType = "ActiveDirectory" +) + +// PossibleDirectoryTypeValues returns an array of possible values for the DirectoryType const type. +func PossibleDirectoryTypeValues() []DirectoryType { + return []DirectoryType{ActiveDirectory} +} + +// OSType enumerates the values for os type. +type OSType string + +const ( + // Linux ... + Linux OSType = "Linux" + // Windows ... + Windows OSType = "Windows" +) + +// PossibleOSTypeValues returns an array of possible values for the OSType const type. +func PossibleOSTypeValues() []OSType { + return []OSType{Linux, Windows} +} + +// Tier enumerates the values for tier. +type Tier string + +const ( + // Premium ... + Premium Tier = "Premium" + // Standard ... + Standard Tier = "Standard" +) + +// PossibleTierValues returns an array of possible values for the Tier const type. +func PossibleTierValues() []Tier { + return []Tier{Premium, Standard} +} + +// Application the HDInsight cluster application +type Application struct { + autorest.Response `json:"-"` + // Etag - The ETag for the application + Etag *string `json:"etag,omitempty"` + // Tags - The tags for the application. + Tags map[string]*string `json:"tags"` + // Properties - The properties of the application. + Properties *ApplicationProperties `json:"properties,omitempty"` + // ID - Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Application. +func (a Application) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.Etag != nil { + objectMap["etag"] = a.Etag + } + if a.Tags != nil { + objectMap["tags"] = a.Tags + } + if a.Properties != nil { + objectMap["properties"] = a.Properties + } + if a.ID != nil { + objectMap["id"] = a.ID + } + if a.Name != nil { + objectMap["name"] = a.Name + } + if a.Type != nil { + objectMap["type"] = a.Type + } + return json.Marshal(objectMap) +} + +// ApplicationGetEndpoint gets the application SSH endpoint +type ApplicationGetEndpoint struct { + // Location - The location of the endpoint. + Location *string `json:"location,omitempty"` + // DestinationPort - The destination port to connect to. + DestinationPort *int32 `json:"destinationPort,omitempty"` + // PublicPort - The public port to connect to. + PublicPort *int32 `json:"publicPort,omitempty"` +} + +// ApplicationGetHTTPSEndpoint gets the application HTTP endpoints. +type ApplicationGetHTTPSEndpoint struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]*string `json:""` + // AccessModes - The list of access modes for the application. + AccessModes *[]string `json:"accessModes,omitempty"` + // Location - The location of the endpoint. + Location *string `json:"location,omitempty"` + // DestinationPort - The destination port to connect to. + DestinationPort *int32 `json:"destinationPort,omitempty"` + // PublicPort - The public port to connect to. + PublicPort *int32 `json:"publicPort,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGetHTTPSEndpoint. +func (aghe ApplicationGetHTTPSEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aghe.AccessModes != nil { + objectMap["accessModes"] = aghe.AccessModes + } + if aghe.Location != nil { + objectMap["location"] = aghe.Location + } + if aghe.DestinationPort != nil { + objectMap["destinationPort"] = aghe.DestinationPort + } + if aghe.PublicPort != nil { + objectMap["publicPort"] = aghe.PublicPort + } + for k, v := range aghe.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// ApplicationListResult result of the request to list cluster Applications. It contains a list of operations and a +// URL link to get the next set of results. +type ApplicationListResult struct { + autorest.Response `json:"-"` + // Value - The list of HDInsight applications installed on HDInsight cluster. + Value *[]Application `json:"value,omitempty"` + // NextLink - The URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplicationListResultIterator provides access to a complete listing of Application values. +type ApplicationListResultIterator struct { + i int + page ApplicationListResultPage +} + +// Next 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 *ApplicationListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationListResultIterator) 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 ApplicationListResultIterator) Response() ApplicationListResult { + 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 ApplicationListResultIterator) Value() Application { + if !iter.page.NotDone() { + return Application{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (alr ApplicationListResult) IsEmpty() bool { + return alr.Value == nil || len(*alr.Value) == 0 +} + +// applicationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (alr ApplicationListResult) applicationListResultPreparer() (*http.Request, error) { + if alr.NextLink == nil || len(to.String(alr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(alr.NextLink))) +} + +// ApplicationListResultPage contains a page of Application values. +type ApplicationListResultPage struct { + fn func(ApplicationListResult) (ApplicationListResult, error) + alr ApplicationListResult +} + +// 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. +func (page *ApplicationListResultPage) Next() error { + next, err := page.fn(page.alr) + if err != nil { + return err + } + page.alr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationListResultPage) NotDone() bool { + return !page.alr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationListResultPage) Response() ApplicationListResult { + return page.alr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationListResultPage) Values() []Application { + if page.alr.IsEmpty() { + return nil + } + return *page.alr.Value +} + +// ApplicationProperties the HDInsight cluster application GET response. +type ApplicationProperties struct { + // ComputeProfile - The list of roles in the cluster. + ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"` + // InstallScriptActions - The list of install script actions. + InstallScriptActions *[]RuntimeScriptAction `json:"installScriptActions,omitempty"` + // UninstallScriptActions - The list of uninstall script actions. + UninstallScriptActions *[]RuntimeScriptAction `json:"uninstallScriptActions,omitempty"` + // HTTPSEndpoints - The list of application HTTPS endpoints. + HTTPSEndpoints *[]ApplicationGetHTTPSEndpoint `json:"httpsEndpoints,omitempty"` + // SSHEndpoints - The list of application SSH endpoints. + SSHEndpoints *[]ApplicationGetEndpoint `json:"sshEndpoints,omitempty"` + // ProvisioningState - The provisioning state of the application. + ProvisioningState *string `json:"provisioningState,omitempty"` + // ApplicationType - The application type. + ApplicationType *string `json:"applicationType,omitempty"` + // ApplicationState - The application state. + ApplicationState *string `json:"applicationState,omitempty"` + // Errors - The list of errors. + Errors *[]Errors `json:"errors,omitempty"` + // CreatedDate - The application create date time. + CreatedDate *string `json:"createdDate,omitempty"` + // MarketplaceIdentifier - The marketplace identifier. + MarketplaceIdentifier *string `json:"marketplaceIdentifier,omitempty"` + // AdditionalProperties - The additional properties for application. + AdditionalProperties *string `json:"additionalProperties,omitempty"` +} + +// ApplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ApplicationsCreateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ApplicationsCreateFuture) Result(client ApplicationsClient) (a Application, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ApplicationsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { + a, err = client.CreateResponder(a.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsCreateFuture", "Result", a.Response.Response, "Failure responding to request") + } + } + return +} + +// ApplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ApplicationsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ApplicationsDeleteFuture) Result(client ApplicationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ApplicationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// Cluster the HDInsight cluster. +type Cluster struct { + autorest.Response `json:"-"` + // Etag - The ETag for the resource + Etag *string `json:"etag,omitempty"` + // Properties - The properties of the cluster. + Properties *ClusterGetProperties `json:"properties,omitempty"` + // Location - The Azure Region where the resource lives + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + 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.Etag != nil { + objectMap["etag"] = c.Etag + } + if c.Properties != nil { + objectMap["properties"] = c.Properties + } + if c.Location != nil { + objectMap["location"] = c.Location + } + if c.Tags != nil { + objectMap["tags"] = c.Tags + } + if c.ID != nil { + objectMap["id"] = c.ID + } + if c.Name != nil { + objectMap["name"] = c.Name + } + if c.Type != nil { + objectMap["type"] = c.Type + } + return json.Marshal(objectMap) +} + +// ClusterCreateParametersExtended the CreateCluster request parameters. +type ClusterCreateParametersExtended struct { + // Location - The location of the cluster. + Location *string `json:"location,omitempty"` + // Tags - The resource tags. + Tags map[string]*string `json:"tags"` + // Properties - The cluster create parameters. + Properties *ClusterCreateProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterCreateParametersExtended. +func (ccpe ClusterCreateParametersExtended) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ccpe.Location != nil { + objectMap["location"] = ccpe.Location + } + if ccpe.Tags != nil { + objectMap["tags"] = ccpe.Tags + } + if ccpe.Properties != nil { + objectMap["properties"] = ccpe.Properties + } + return json.Marshal(objectMap) +} + +// ClusterCreateProperties the cluster create parameters. +type ClusterCreateProperties struct { + // ClusterVersion - The version of the cluster. + ClusterVersion *string `json:"clusterVersion,omitempty"` + // OsType - The type of operating system. Possible values include: 'Windows', 'Linux' + OsType OSType `json:"osType,omitempty"` + // Tier - The cluster tier. Possible values include: 'Standard', 'Premium' + Tier Tier `json:"tier,omitempty"` + // ClusterDefinition - The cluster definition. + ClusterDefinition *ClusterDefinition `json:"clusterDefinition,omitempty"` + // SecurityProfile - The security profile. + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + // ComputeProfile - The compute profile. + ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"` + // StorageProfile - The storage profile. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` +} + +// ClusterDefinition the cluster definition. +type ClusterDefinition struct { + // Blueprint - The link to the blueprint. + Blueprint *string `json:"blueprint,omitempty"` + // Kind - The type of cluster. + Kind *string `json:"kind,omitempty"` + // ComponentVersion - The versions of different services in the cluster. + ComponentVersion map[string]*string `json:"componentVersion"` + // Configurations - The cluster configurations. + Configurations interface{} `json:"configurations,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterDefinition. +func (cd ClusterDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cd.Blueprint != nil { + objectMap["blueprint"] = cd.Blueprint + } + if cd.Kind != nil { + objectMap["kind"] = cd.Kind + } + if cd.ComponentVersion != nil { + objectMap["componentVersion"] = cd.ComponentVersion + } + objectMap["configurations"] = cd.Configurations + return json.Marshal(objectMap) +} + +// ClusterGetProperties the properties of cluster. +type ClusterGetProperties struct { + // ClusterVersion - The version of the cluster. + ClusterVersion *string `json:"clusterVersion,omitempty"` + // OsType - The type of operating system. Possible values include: 'Windows', 'Linux' + OsType OSType `json:"osType,omitempty"` + // Tier - The cluster tier. Possible values include: 'Standard', 'Premium' + Tier Tier `json:"tier,omitempty"` + // ClusterDefinition - The cluster definition. + ClusterDefinition *ClusterDefinition `json:"clusterDefinition,omitempty"` + // SecurityProfile - The security profile. + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + // ComputeProfile - The compute profile. + ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"` + // ProvisioningState - The provisioning state, which only appears in the response. Possible values include: 'ClusterProvisioningStateInProgress', 'ClusterProvisioningStateFailed', 'ClusterProvisioningStateSucceeded', 'ClusterProvisioningStateCanceled', 'ClusterProvisioningStateDeleting' + ProvisioningState ClusterProvisioningState `json:"provisioningState,omitempty"` + // CreatedDate - The date on which the cluster was created. + CreatedDate *string `json:"createdDate,omitempty"` + // ClusterState - The state of the cluster. + ClusterState *string `json:"clusterState,omitempty"` + // QuotaInfo - The quota information. + QuotaInfo *QuotaInfo `json:"quotaInfo,omitempty"` + // Errors - The list of errors. + Errors *[]Errors `json:"errors,omitempty"` + // ConnectivityEndpoints - The list of connectivity endpoints. + ConnectivityEndpoints *[]ConnectivityEndpoint `json:"connectivityEndpoints,omitempty"` +} + +// ClusterListPersistedScriptActionsResult the ListPersistedScriptActions operation response. +type ClusterListPersistedScriptActionsResult struct { + // Value - The list of Persisted Script Actions. + Value *[]RuntimeScriptAction `json:"value,omitempty"` + // NextLink - The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ClusterListResult the List Cluster operation response. +type ClusterListResult struct { + autorest.Response `json:"-"` + // Value - The list of Clusters. + Value *[]Cluster `json:"value,omitempty"` + // NextLink - The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ClusterListResultIterator provides access to a complete listing of Cluster values. +type ClusterListResultIterator struct { + i int + page ClusterListResultPage +} + +// Next 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 *ClusterListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ClusterListResultIterator) 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 ClusterListResultIterator) Response() ClusterListResult { + 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 ClusterListResultIterator) Value() Cluster { + if !iter.page.NotDone() { + return Cluster{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (clr ClusterListResult) IsEmpty() bool { + return clr.Value == nil || len(*clr.Value) == 0 +} + +// clusterListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (clr ClusterListResult) clusterListResultPreparer() (*http.Request, error) { + if clr.NextLink == nil || len(to.String(clr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(clr.NextLink))) +} + +// ClusterListResultPage contains a page of Cluster values. +type ClusterListResultPage struct { + fn func(ClusterListResult) (ClusterListResult, error) + clr ClusterListResult +} + +// 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. +func (page *ClusterListResultPage) Next() error { + next, err := page.fn(page.clr) + if err != nil { + return err + } + page.clr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ClusterListResultPage) NotDone() bool { + return !page.clr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ClusterListResultPage) Response() ClusterListResult { + return page.clr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ClusterListResultPage) Values() []Cluster { + if page.clr.IsEmpty() { + return nil + } + return *page.clr.Value +} + +// ClusterListRuntimeScriptActionDetailResult the list runtime script action detail response. +type ClusterListRuntimeScriptActionDetailResult struct { + // Value - The list of persisted script action details for the cluster. + Value *[]RuntimeScriptActionDetail `json:"value,omitempty"` + // NextLink - The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ClusterMonitoringRequest the Operations Management Suite (OMS) parameters. +type ClusterMonitoringRequest struct { + // WorkspaceID - The Operations Management Suite (OMS) workspace ID. + WorkspaceID *string `json:"workspaceId,omitempty"` + // PrimaryKey - The Operations Management Suite (OMS) workspace key. + PrimaryKey *string `json:"primaryKey,omitempty"` +} + +// ClusterMonitoringResponse the Operations Management Suite (OMS) status response +type ClusterMonitoringResponse struct { + autorest.Response `json:"-"` + // ClusterMonitoringEnabled - The status of the Operations Management Suite (OMS) on the HDInsight cluster. + ClusterMonitoringEnabled *bool `json:"clusterMonitoringEnabled,omitempty"` + // WorkspaceID - The workspace ID of the Operations Management Suite (OMS) on the HDInsight cluster. + WorkspaceID *string `json:"workspaceId,omitempty"` +} + +// ClusterPatchParameters the PatchCluster request parameters +type ClusterPatchParameters struct { + // Tags - The resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ClusterPatchParameters. +func (cpp ClusterPatchParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cpp.Tags != nil { + objectMap["tags"] = cpp.Tags + } + return json.Marshal(objectMap) +} + +// ClusterResizeParameters the Resize Cluster request parameters. +type ClusterResizeParameters struct { + // TargetInstanceCount - The target instance count for the operation. + TargetInstanceCount *int32 `json:"targetInstanceCount,omitempty"` +} + +// ClustersCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ClustersCreateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersCreateFuture) Result(client ClustersClient) (c Cluster, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ClustersCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { + c, err = client.CreateResponder(c.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersCreateFuture", "Result", c.Response.Response, "Failure responding to request") + } + } + return +} + +// ClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ClustersDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersDeleteFuture) Result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ClustersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ClustersExecuteScriptActionsFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ClustersExecuteScriptActionsFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersExecuteScriptActionsFuture) Result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersExecuteScriptActionsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ClustersExecuteScriptActionsFuture") + return + } + ar.Response = future.Response() + return +} + +// ClustersResizeFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ClustersResizeFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersResizeFuture) Result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersResizeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ClustersResizeFuture") + return + } + ar.Response = future.Response() + return +} + +// ComputeProfile describes the compute profile. +type ComputeProfile struct { + // Roles - The list of roles in the cluster. + Roles *[]Role `json:"roles,omitempty"` +} + +// ConfigurationsUpdateHTTPSettingsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConfigurationsUpdateHTTPSettingsFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ConfigurationsUpdateHTTPSettingsFuture) Result(client ConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsUpdateHTTPSettingsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ConfigurationsUpdateHTTPSettingsFuture") + return + } + ar.Response = future.Response() + return +} + +// ConnectivityEndpoint the connectivity properties +type ConnectivityEndpoint struct { + // Name - The name of the endpoint. + Name *string `json:"name,omitempty"` + // Protocol - The protocol of the endpoint. + Protocol *string `json:"protocol,omitempty"` + // Location - The location of the endpoint. + Location *string `json:"location,omitempty"` + // Port - The port to connect to. + Port *int32 `json:"port,omitempty"` +} + +// DataDisksGroups the data disks groups for the role. +type DataDisksGroups struct { + // DisksPerNode - The number of disks per node. + DisksPerNode *int32 `json:"disksPerNode,omitempty"` + // StorageAccountType - ReadOnly. The storage account type. Do not set this value. + StorageAccountType *string `json:"storageAccountType,omitempty"` + // DiskSizeGB - ReadOnly. The DiskSize in GB. Do not set this value. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` +} + +// ErrorResponse describes the format of Error response. +type ErrorResponse struct { + // Code - Error code + Code *string `json:"code,omitempty"` + // Message - Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// Errors the error message associated with the cluster creation. +type Errors struct { + // Code - The error code. + Code *string `json:"code,omitempty"` + // Message - The error message. + Message *string `json:"message,omitempty"` +} + +// ExecuteScriptActionParameters the parameters for the script actions to execute on a running cluster. +type ExecuteScriptActionParameters struct { + // ScriptActions - The list of run time script actions. + ScriptActions *[]RuntimeScriptAction `json:"scriptActions,omitempty"` + // PersistOnSuccess - Gets or sets if the scripts needs to be persisted. + PersistOnSuccess *bool `json:"persistOnSuccess,omitempty"` +} + +// Extension cluster monitoring extensions +type Extension struct { + autorest.Response `json:"-"` + // WorkspaceID - The workspace ID for the cluster monitoring extension. + WorkspaceID *string `json:"workspaceId,omitempty"` + // PrimaryKey - The certificate for the cluster monitoring extensions. + PrimaryKey *string `json:"primaryKey,omitempty"` +} + +// ExtensionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ExtensionsCreateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExtensionsCreateFuture) Result(client ExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ExtensionsCreateFuture") + return + } + ar.Response = future.Response() + return +} + +// ExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ExtensionsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExtensionsDeleteFuture) Result(client ExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ExtensionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExtensionsDisableMonitoringFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsDisableMonitoringFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExtensionsDisableMonitoringFuture) Result(client ExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsDisableMonitoringFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ExtensionsDisableMonitoringFuture") + return + } + ar.Response = future.Response() + return +} + +// ExtensionsEnableMonitoringFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsEnableMonitoringFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ExtensionsEnableMonitoringFuture) Result(client ExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionsEnableMonitoringFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ExtensionsEnableMonitoringFuture") + return + } + ar.Response = future.Response() + return +} + +// HardwareProfile the hardware profile. +type HardwareProfile struct { + // VMSize - The size of the VM + VMSize *string `json:"vmSize,omitempty"` +} + +// LinuxOperatingSystemProfile the ssh username, password, and ssh public key. +type LinuxOperatingSystemProfile struct { + // Username - The username. + Username *string `json:"username,omitempty"` + // Password - The password. + Password *string `json:"password,omitempty"` + // SSHProfile - The SSH profile. + SSHProfile *SSHProfile `json:"sshProfile,omitempty"` +} + +// LocalizedName the details about the localizable name of a type of usage. +type LocalizedName struct { + // Value - The name of the used resource. + Value *string `json:"value,omitempty"` + // LocalizedValue - The localized name of the used resource. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// Operation the HDInsight REST API operation. +type Operation struct { + // Name - The operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - The object that represents the operation. + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay the object that represents the operation. +type OperationDisplay struct { + // Provider - The service provider: Microsoft.HDInsight + Provider *string `json:"provider,omitempty"` + // Resource - The resource on which the operation is performed: Cluster, Applications, etc. + Resource *string `json:"resource,omitempty"` + // Operation - The operation type: read, write, delete, etc. + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult result of the request to list HDInsight operations. It contains a list of operations and a +// URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - The list of HDInsight operations supported by the HDInsight resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - The URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// Next 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 *OperationListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) 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 OperationListResultIterator) Response() OperationListResult { + 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 OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer() (*http.Request, error) { + if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// 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. +func (page *OperationListResultPage) Next() error { + next, err := page.fn(page.olr) + if err != nil { + return err + } + page.olr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// OperationResource the azure async operation response. +type OperationResource struct { + // Status - The async operation state. Possible values include: 'InProgress', 'Succeeded', 'Failed' + Status AsyncOperationState `json:"status,omitempty"` + // Error - The operation error information. + Error *Errors `json:"error,omitempty"` +} + +// OsProfile the Linux operation systems profile. +type OsProfile struct { + // LinuxOperatingSystemProfile - The Linux OS profile. + LinuxOperatingSystemProfile *LinuxOperatingSystemProfile `json:"linuxOperatingSystemProfile,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 - Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` +} + +// QuotaInfo the quota properties for the cluster. +type QuotaInfo struct { + // CoresUsed - The cores used by the cluster. + CoresUsed *int32 `json:"coresUsed,omitempty"` +} + +// Resource the core properties of ARM resources +type Resource struct { + // ID - Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` +} + +// Role describes a role on the cluster. +type Role struct { + // Name - The name of the role. + Name *string `json:"name,omitempty"` + // MinInstanceCount - The minimum instance count of the cluster. + MinInstanceCount *int32 `json:"minInstanceCount,omitempty"` + // TargetInstanceCount - The instance count of the cluster. + TargetInstanceCount *int32 `json:"targetInstanceCount,omitempty"` + // HardwareProfile - The hardware profile. + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + // OsProfile - The operating system profile. + OsProfile *OsProfile `json:"osProfile,omitempty"` + // VirtualNetworkProfile - The virtual network profile. + VirtualNetworkProfile *VirtualNetworkProfile `json:"virtualNetworkProfile,omitempty"` + // DataDisksGroups - The data disks groups for the role. + DataDisksGroups *[]DataDisksGroups `json:"dataDisksGroups,omitempty"` + // ScriptActions - The list of script actions on the role. + ScriptActions *[]ScriptAction `json:"scriptActions,omitempty"` +} + +// RuntimeScriptAction describes a script action on a running cluster. +type RuntimeScriptAction struct { + // Name - The name of the script action. + Name *string `json:"name,omitempty"` + // URI - The URI to the script. + URI *string `json:"uri,omitempty"` + // Parameters - The parameters for the script + Parameters *string `json:"parameters,omitempty"` + // Roles - The list of roles where script will be executed. + Roles *[]string `json:"roles,omitempty"` + // ApplicationName - The application name of the script action, if any. + ApplicationName *string `json:"applicationName,omitempty"` +} + +// RuntimeScriptActionDetail the execution details of a script action. +type RuntimeScriptActionDetail struct { + autorest.Response `json:"-"` + // ScriptExecutionID - The execution id of the script action. + ScriptExecutionID *int64 `json:"scriptExecutionId,omitempty"` + // StartTime - The start time of script action execution. + StartTime *string `json:"startTime,omitempty"` + // EndTime - The end time of script action execution. + EndTime *string `json:"endTime,omitempty"` + // Status - The current execution status of the script action. + Status *string `json:"status,omitempty"` + // Operation - The reason why the script action was executed. + Operation *string `json:"operation,omitempty"` + // ExecutionSummary - The summary of script action execution result. + ExecutionSummary *[]ScriptActionExecutionSummary `json:"executionSummary,omitempty"` + // DebugInformation - The script action execution debug information. + DebugInformation *string `json:"debugInformation,omitempty"` + // Name - The name of the script action. + Name *string `json:"name,omitempty"` + // URI - The URI to the script. + URI *string `json:"uri,omitempty"` + // Parameters - The parameters for the script + Parameters *string `json:"parameters,omitempty"` + // Roles - The list of roles where script will be executed. + Roles *[]string `json:"roles,omitempty"` + // ApplicationName - The application name of the script action, if any. + ApplicationName *string `json:"applicationName,omitempty"` +} + +// ScriptAction describes a script action on role on the cluster. +type ScriptAction struct { + // Name - The name of the script action. + Name *string `json:"name,omitempty"` + // URI - The URI to the script. + URI *string `json:"uri,omitempty"` + // Parameters - The parameters for the script provided. + Parameters *string `json:"parameters,omitempty"` +} + +// ScriptActionExecutionHistoryList the list script execution history response. +type ScriptActionExecutionHistoryList struct { + autorest.Response `json:"-"` + // Value - The list of persisted script action details for the cluster. + Value *[]RuntimeScriptActionDetail `json:"value,omitempty"` + // NextLink - The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ScriptActionExecutionHistoryListIterator provides access to a complete listing of RuntimeScriptActionDetail +// values. +type ScriptActionExecutionHistoryListIterator struct { + i int + page ScriptActionExecutionHistoryListPage +} + +// Next 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 *ScriptActionExecutionHistoryListIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ScriptActionExecutionHistoryListIterator) 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 ScriptActionExecutionHistoryListIterator) Response() ScriptActionExecutionHistoryList { + 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 ScriptActionExecutionHistoryListIterator) Value() RuntimeScriptActionDetail { + if !iter.page.NotDone() { + return RuntimeScriptActionDetail{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (saehl ScriptActionExecutionHistoryList) IsEmpty() bool { + return saehl.Value == nil || len(*saehl.Value) == 0 +} + +// scriptActionExecutionHistoryListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (saehl ScriptActionExecutionHistoryList) scriptActionExecutionHistoryListPreparer() (*http.Request, error) { + if saehl.NextLink == nil || len(to.String(saehl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(saehl.NextLink))) +} + +// ScriptActionExecutionHistoryListPage contains a page of RuntimeScriptActionDetail values. +type ScriptActionExecutionHistoryListPage struct { + fn func(ScriptActionExecutionHistoryList) (ScriptActionExecutionHistoryList, error) + saehl ScriptActionExecutionHistoryList +} + +// 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. +func (page *ScriptActionExecutionHistoryListPage) Next() error { + next, err := page.fn(page.saehl) + if err != nil { + return err + } + page.saehl = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ScriptActionExecutionHistoryListPage) NotDone() bool { + return !page.saehl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ScriptActionExecutionHistoryListPage) Response() ScriptActionExecutionHistoryList { + return page.saehl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ScriptActionExecutionHistoryListPage) Values() []RuntimeScriptActionDetail { + if page.saehl.IsEmpty() { + return nil + } + return *page.saehl.Value +} + +// ScriptActionExecutionSummary the execution summary of a script action. +type ScriptActionExecutionSummary struct { + // Status - The status of script action execution. + Status *string `json:"status,omitempty"` + // InstanceCount - The instance count for a given script action execution status. + InstanceCount *int32 `json:"instanceCount,omitempty"` +} + +// ScriptActionPersistedGetResponseSpec the persisted script action for cluster. +type ScriptActionPersistedGetResponseSpec struct { + // Name - The name of script action. + Name *string `json:"name,omitempty"` + // URI - The URI to the script. + URI *string `json:"uri,omitempty"` + // Parameters - The parameters for the script provided. + Parameters *string `json:"parameters,omitempty"` + // Roles - The list of roles where script will be executed. + Roles *[]string `json:"roles,omitempty"` + // ApplicationName - The application name for the script action. + ApplicationName *string `json:"applicationName,omitempty"` +} + +// ScriptActionsList the persisted script action for the cluster. +type ScriptActionsList struct { + autorest.Response `json:"-"` + // Value - The list of persisted script action details for the cluster. + Value *[]RuntimeScriptActionDetail `json:"value,omitempty"` + // NextLink - The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ScriptActionsListIterator provides access to a complete listing of RuntimeScriptActionDetail values. +type ScriptActionsListIterator struct { + i int + page ScriptActionsListPage +} + +// Next 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 *ScriptActionsListIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ScriptActionsListIterator) 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 ScriptActionsListIterator) Response() ScriptActionsList { + 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 ScriptActionsListIterator) Value() RuntimeScriptActionDetail { + if !iter.page.NotDone() { + return RuntimeScriptActionDetail{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (sal ScriptActionsList) IsEmpty() bool { + return sal.Value == nil || len(*sal.Value) == 0 +} + +// scriptActionsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sal ScriptActionsList) scriptActionsListPreparer() (*http.Request, error) { + if sal.NextLink == nil || len(to.String(sal.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sal.NextLink))) +} + +// ScriptActionsListPage contains a page of RuntimeScriptActionDetail values. +type ScriptActionsListPage struct { + fn func(ScriptActionsList) (ScriptActionsList, error) + sal ScriptActionsList +} + +// 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. +func (page *ScriptActionsListPage) Next() error { + next, err := page.fn(page.sal) + if err != nil { + return err + } + page.sal = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ScriptActionsListPage) NotDone() bool { + return !page.sal.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ScriptActionsListPage) Response() ScriptActionsList { + return page.sal +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ScriptActionsListPage) Values() []RuntimeScriptActionDetail { + if page.sal.IsEmpty() { + return nil + } + return *page.sal.Value +} + +// SecurityProfile the security profile which contains Ssh public key for the HDInsight cluster. +type SecurityProfile struct { + // DirectoryType - The directory type. Possible values include: 'ActiveDirectory' + DirectoryType DirectoryType `json:"directoryType,omitempty"` + // Domain - The organization's active directory domain. + Domain *string `json:"domain,omitempty"` + // OrganizationalUnitDN - The organizational unit within the Active Directory to place the cluster and service accounts. + OrganizationalUnitDN *string `json:"organizationalUnitDN,omitempty"` + // LdapsUrls - The LDAPS protocol URLs to communicate with the Active Directory. + LdapsUrls *[]string `json:"ldapsUrls,omitempty"` + // DomainUsername - The domain user account that will have admin privileges on the cluster. + DomainUsername *string `json:"domainUsername,omitempty"` + // DomainUserPassword - The domain admin password. + DomainUserPassword *string `json:"domainUserPassword,omitempty"` + // ClusterUsersGroupDNS - Optional. The Distinguished Names for cluster user groups + ClusterUsersGroupDNS *[]string `json:"clusterUsersGroupDNs,omitempty"` +} + +// SetString ... +type SetString struct { + autorest.Response `json:"-"` + Value map[string]*string `json:"value"` +} + +// MarshalJSON is the custom marshaler for SetString. +func (ss SetString) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ss.Value != nil { + objectMap["value"] = ss.Value + } + return json.Marshal(objectMap) +} + +// SSHProfile the list of SSH public keys. +type SSHProfile struct { + // PublicKeys - The list of SSH public keys. + PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` +} + +// SSHPublicKey the SSH public key for the cluster nodes. +type SSHPublicKey struct { + // CertificateData - The certificate for SSH. + CertificateData *string `json:"certificateData,omitempty"` +} + +// StorageAccount the storage Account. +type StorageAccount struct { + // Name - The name of the storage account. + Name *string `json:"name,omitempty"` + // IsDefault - Whether or not the storage account is the default storage account. + IsDefault *bool `json:"isDefault,omitempty"` + // Container - The container in the storage account. + Container *string `json:"container,omitempty"` + // Key - The storage account access key. + Key *string `json:"key,omitempty"` +} + +// StorageProfile the storage profile. +type StorageProfile struct { + // Storageaccounts - The list of storage accounts in the cluster. + Storageaccounts *[]StorageAccount `json:"storageaccounts,omitempty"` +} + +// TrackedResource the resource model definition for a ARM tracked top level resource +type TrackedResource struct { + // Location - The Azure Region where the resource lives + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + 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.Location != nil { + objectMap["location"] = tr.Location + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.ID != nil { + objectMap["id"] = tr.ID + } + if tr.Name != nil { + objectMap["name"] = tr.Name + } + if tr.Type != nil { + objectMap["type"] = tr.Type + } + return json.Marshal(objectMap) +} + +// Usage the details about the usage of a particular limited resource. +type Usage struct { + // Unit - The type of measurement for usage. + Unit *string `json:"unit,omitempty"` + // CurrentValue - The current usage. + CurrentValue *int32 `json:"currentValue,omitempty"` + // Limit - The maximum allowed usage. + Limit *int32 `json:"limit,omitempty"` + // Name - The details about the localizable name of the used resource. + Name *LocalizedName `json:"name,omitempty"` +} + +// UsagesListResult the response for the operation to get regional usages for a subscription. +type UsagesListResult struct { + autorest.Response `json:"-"` + // Value - The list of usages. + Value *[]Usage `json:"value,omitempty"` +} + +// VirtualNetworkProfile the virtual network properties. +type VirtualNetworkProfile struct { + // ID - The ID of the virtual network. + ID *string `json:"id,omitempty"` + // Subnet - The name of the subnet. + Subnet *string `json:"subnet,omitempty"` +} diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/operations.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/operations.go new file mode 100644 index 000000000000..4cddc33df93e --- /dev/null +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/operations.go @@ -0,0 +1,126 @@ +package hdinsight + +// 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" + "net/http" +) + +// OperationsClient is the hDInsight Management Client +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. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available HDInsight REST API operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.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 = "2018-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.HDInsight/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 autorest.SendWithSender(client, 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 OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "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, "hdinsight.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptactions.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptactions.go new file mode 100644 index 000000000000..1b49c08928f3 --- /dev/null +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptactions.go @@ -0,0 +1,272 @@ +package hdinsight + +// 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" + "net/http" +) + +// ScriptActionsClient is the hDInsight Management Client +type ScriptActionsClient struct { + BaseClient +} + +// NewScriptActionsClient creates an instance of the ScriptActionsClient client. +func NewScriptActionsClient(subscriptionID string) ScriptActionsClient { + return NewScriptActionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewScriptActionsClientWithBaseURI creates an instance of the ScriptActionsClient client. +func NewScriptActionsClientWithBaseURI(baseURI string, subscriptionID string) ScriptActionsClient { + return ScriptActionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete deletes a specified persisted script action of the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// scriptName - the name of the script. +func (client ScriptActionsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, scriptName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, scriptName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ScriptActionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, scriptName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scriptName": autorest.Encode("path", scriptName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-06-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.HDInsight/clusters/{clusterName}/scriptActions/{scriptName}", 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 ScriptActionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ScriptActionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetExecutionDetail gets the script execution detail for the given script execution ID. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// scriptExecutionID - the script execution Id +func (client ScriptActionsClient) GetExecutionDetail(ctx context.Context, resourceGroupName string, clusterName string, scriptExecutionID string) (result RuntimeScriptActionDetail, err error) { + req, err := client.GetExecutionDetailPreparer(ctx, resourceGroupName, clusterName, scriptExecutionID) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "GetExecutionDetail", nil, "Failure preparing request") + return + } + + resp, err := client.GetExecutionDetailSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "GetExecutionDetail", resp, "Failure sending request") + return + } + + result, err = client.GetExecutionDetailResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "GetExecutionDetail", resp, "Failure responding to request") + } + + return +} + +// GetExecutionDetailPreparer prepares the GetExecutionDetail request. +func (client ScriptActionsClient) GetExecutionDetailPreparer(ctx context.Context, resourceGroupName string, clusterName string, scriptExecutionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scriptExecutionId": autorest.Encode("path", scriptExecutionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-06-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.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetExecutionDetailSender sends the GetExecutionDetail request. The method will close the +// http.Response Body if it receives an error. +func (client ScriptActionsClient) GetExecutionDetailSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetExecutionDetailResponder handles the response to the GetExecutionDetail request. The method always +// closes the http.Response Body. +func (client ScriptActionsClient) GetExecutionDetailResponder(resp *http.Response) (result RuntimeScriptActionDetail, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByCluster lists all the persisted script actions for the specified cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +func (client ScriptActionsClient) ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result ScriptActionsListPage, err error) { + result.fn = client.listByClusterNextResults + req, err := client.ListByClusterPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "ListByCluster", nil, "Failure preparing request") + return + } + + resp, err := client.ListByClusterSender(req) + if err != nil { + result.sal.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "ListByCluster", resp, "Failure sending request") + return + } + + result.sal, err = client.ListByClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "ListByCluster", resp, "Failure responding to request") + } + + return +} + +// ListByClusterPreparer prepares the ListByCluster request. +func (client ScriptActionsClient) ListByClusterPreparer(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 = "2018-06-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.HDInsight/clusters/{clusterName}/scriptActions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByClusterSender sends the ListByCluster request. The method will close the +// http.Response Body if it receives an error. +func (client ScriptActionsClient) ListByClusterSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByClusterResponder handles the response to the ListByCluster request. The method always +// closes the http.Response Body. +func (client ScriptActionsClient) ListByClusterResponder(resp *http.Response) (result ScriptActionsList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByClusterNextResults retrieves the next set of results, if any. +func (client ScriptActionsClient) listByClusterNextResults(lastResults ScriptActionsList) (result ScriptActionsList, err error) { + req, err := lastResults.scriptActionsListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "listByClusterNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByClusterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "listByClusterNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "listByClusterNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByClusterComplete enumerates all values, automatically crossing page boundaries as required. +func (client ScriptActionsClient) ListByClusterComplete(ctx context.Context, resourceGroupName string, clusterName string) (result ScriptActionsListIterator, err error) { + result.page, err = client.ListByCluster(ctx, resourceGroupName, clusterName) + return +} diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptexecutionhistory.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptexecutionhistory.go new file mode 100644 index 000000000000..a7121ef0392d --- /dev/null +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptexecutionhistory.go @@ -0,0 +1,203 @@ +package hdinsight + +// 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" + "net/http" +) + +// ScriptExecutionHistoryClient is the hDInsight Management Client +type ScriptExecutionHistoryClient struct { + BaseClient +} + +// NewScriptExecutionHistoryClient creates an instance of the ScriptExecutionHistoryClient client. +func NewScriptExecutionHistoryClient(subscriptionID string) ScriptExecutionHistoryClient { + return NewScriptExecutionHistoryClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewScriptExecutionHistoryClientWithBaseURI creates an instance of the ScriptExecutionHistoryClient client. +func NewScriptExecutionHistoryClientWithBaseURI(baseURI string, subscriptionID string) ScriptExecutionHistoryClient { + return ScriptExecutionHistoryClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByCluster lists all scripts' execution history for the specified cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +func (client ScriptExecutionHistoryClient) ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result ScriptActionExecutionHistoryListPage, err error) { + result.fn = client.listByClusterNextResults + req, err := client.ListByClusterPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "ListByCluster", nil, "Failure preparing request") + return + } + + resp, err := client.ListByClusterSender(req) + if err != nil { + result.saehl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "ListByCluster", resp, "Failure sending request") + return + } + + result.saehl, err = client.ListByClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "ListByCluster", resp, "Failure responding to request") + } + + return +} + +// ListByClusterPreparer prepares the ListByCluster request. +func (client ScriptExecutionHistoryClient) ListByClusterPreparer(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 = "2018-06-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.HDInsight/clusters/{clusterName}/scriptExecutionHistory", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByClusterSender sends the ListByCluster request. The method will close the +// http.Response Body if it receives an error. +func (client ScriptExecutionHistoryClient) ListByClusterSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByClusterResponder handles the response to the ListByCluster request. The method always +// closes the http.Response Body. +func (client ScriptExecutionHistoryClient) ListByClusterResponder(resp *http.Response) (result ScriptActionExecutionHistoryList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByClusterNextResults retrieves the next set of results, if any. +func (client ScriptExecutionHistoryClient) listByClusterNextResults(lastResults ScriptActionExecutionHistoryList) (result ScriptActionExecutionHistoryList, err error) { + req, err := lastResults.scriptActionExecutionHistoryListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "listByClusterNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByClusterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "listByClusterNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "listByClusterNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByClusterComplete enumerates all values, automatically crossing page boundaries as required. +func (client ScriptExecutionHistoryClient) ListByClusterComplete(ctx context.Context, resourceGroupName string, clusterName string) (result ScriptActionExecutionHistoryListIterator, err error) { + result.page, err = client.ListByCluster(ctx, resourceGroupName, clusterName) + return +} + +// Promote promotes the specified ad-hoc script execution to a persisted script. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// scriptExecutionID - the script execution Id +func (client ScriptExecutionHistoryClient) Promote(ctx context.Context, resourceGroupName string, clusterName string, scriptExecutionID string) (result autorest.Response, err error) { + req, err := client.PromotePreparer(ctx, resourceGroupName, clusterName, scriptExecutionID) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Promote", nil, "Failure preparing request") + return + } + + resp, err := client.PromoteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Promote", resp, "Failure sending request") + return + } + + result, err = client.PromoteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Promote", resp, "Failure responding to request") + } + + return +} + +// PromotePreparer prepares the Promote request. +func (client ScriptExecutionHistoryClient) PromotePreparer(ctx context.Context, resourceGroupName string, clusterName string, scriptExecutionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scriptExecutionId": autorest.Encode("path", scriptExecutionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}/promote", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PromoteSender sends the Promote request. The method will close the +// http.Response Body if it receives an error. +func (client ScriptExecutionHistoryClient) PromoteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// PromoteResponder handles the response to the Promote request. The method always +// closes the http.Response Body. +func (client ScriptExecutionHistoryClient) PromoteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/version.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/version.go new file mode 100644 index 000000000000..ab4bbf64a50e --- /dev/null +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/version.go @@ -0,0 +1,30 @@ +package hdinsight + +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.Number + " hdinsight/2018-06-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}