diff --git a/profiles/preview/hdinsight/mgmt/hdinsight/hdinsightapi/models.go b/profiles/preview/hdinsight/mgmt/hdinsight/hdinsightapi/models.go new file mode 100644 index 000000000000..72550ee517fa --- /dev/null +++ b/profiles/preview/hdinsight/mgmt/hdinsight/hdinsightapi/models.go @@ -0,0 +1,31 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package hdinsightapi + +import original "github.com/Azure/azure-sdk-for-go/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi" + +type ApplicationsClientAPI = original.ApplicationsClientAPI +type ClustersClientAPI = original.ClustersClientAPI +type ConfigurationsClientAPI = original.ConfigurationsClientAPI +type ExtensionsClientAPI = original.ExtensionsClientAPI +type LocationsClientAPI = original.LocationsClientAPI +type OperationsClientAPI = original.OperationsClientAPI +type ScriptActionsClientAPI = original.ScriptActionsClientAPI +type ScriptExecutionHistoryClientAPI = original.ScriptExecutionHistoryClientAPI diff --git a/profiles/preview/hdinsight/mgmt/hdinsight/models.go b/profiles/preview/hdinsight/mgmt/hdinsight/models.go new file mode 100644 index 000000000000..75521f196d9e --- /dev/null +++ b/profiles/preview/hdinsight/mgmt/hdinsight/models.go @@ -0,0 +1,290 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package hdinsight + +import ( + "context" + + original "github.com/Azure/azure-sdk-for-go/services/hdinsight/mgmt/2018-06-01-preview/hdinsight" +) + +const ( + DefaultBaseURI = original.DefaultBaseURI +) + +type AsyncOperationState = original.AsyncOperationState + +const ( + Failed AsyncOperationState = original.Failed + InProgress AsyncOperationState = original.InProgress + Succeeded AsyncOperationState = original.Succeeded +) + +type ClusterProvisioningState = original.ClusterProvisioningState + +const ( + ClusterProvisioningStateCanceled ClusterProvisioningState = original.ClusterProvisioningStateCanceled + ClusterProvisioningStateDeleting ClusterProvisioningState = original.ClusterProvisioningStateDeleting + ClusterProvisioningStateFailed ClusterProvisioningState = original.ClusterProvisioningStateFailed + ClusterProvisioningStateInProgress ClusterProvisioningState = original.ClusterProvisioningStateInProgress + ClusterProvisioningStateSucceeded ClusterProvisioningState = original.ClusterProvisioningStateSucceeded +) + +type DirectoryType = original.DirectoryType + +const ( + ActiveDirectory DirectoryType = original.ActiveDirectory +) + +type JSONWebKeyEncryptionAlgorithm = original.JSONWebKeyEncryptionAlgorithm + +const ( + RSA15 JSONWebKeyEncryptionAlgorithm = original.RSA15 + RSAOAEP JSONWebKeyEncryptionAlgorithm = original.RSAOAEP + RSAOAEP256 JSONWebKeyEncryptionAlgorithm = original.RSAOAEP256 +) + +type OSType = original.OSType + +const ( + Linux OSType = original.Linux + Windows OSType = original.Windows +) + +type ResourceIdentityType = original.ResourceIdentityType + +const ( + None ResourceIdentityType = original.None + SystemAssigned ResourceIdentityType = original.SystemAssigned + SystemAssignedUserAssigned ResourceIdentityType = original.SystemAssignedUserAssigned + UserAssigned ResourceIdentityType = original.UserAssigned +) + +type Tier = original.Tier + +const ( + Premium Tier = original.Premium + Standard Tier = original.Standard +) + +type Application = original.Application +type ApplicationGetEndpoint = original.ApplicationGetEndpoint +type ApplicationGetHTTPSEndpoint = original.ApplicationGetHTTPSEndpoint +type ApplicationListResult = original.ApplicationListResult +type ApplicationListResultIterator = original.ApplicationListResultIterator +type ApplicationListResultPage = original.ApplicationListResultPage +type ApplicationProperties = original.ApplicationProperties +type ApplicationsClient = original.ApplicationsClient +type ApplicationsCreateFuture = original.ApplicationsCreateFuture +type ApplicationsDeleteFuture = original.ApplicationsDeleteFuture +type BaseClient = original.BaseClient +type Cluster = original.Cluster +type ClusterConfigurations = original.ClusterConfigurations +type ClusterCreateParametersExtended = original.ClusterCreateParametersExtended +type ClusterCreateProperties = original.ClusterCreateProperties +type ClusterDefinition = original.ClusterDefinition +type ClusterDiskEncryptionParameters = original.ClusterDiskEncryptionParameters +type ClusterGetProperties = original.ClusterGetProperties +type ClusterIdentity = original.ClusterIdentity +type ClusterIdentityUserAssignedIdentitiesValue = original.ClusterIdentityUserAssignedIdentitiesValue +type ClusterListPersistedScriptActionsResult = original.ClusterListPersistedScriptActionsResult +type ClusterListResult = original.ClusterListResult +type ClusterListResultIterator = original.ClusterListResultIterator +type ClusterListResultPage = original.ClusterListResultPage +type ClusterListRuntimeScriptActionDetailResult = original.ClusterListRuntimeScriptActionDetailResult +type ClusterMonitoringRequest = original.ClusterMonitoringRequest +type ClusterMonitoringResponse = original.ClusterMonitoringResponse +type ClusterPatchParameters = original.ClusterPatchParameters +type ClusterResizeParameters = original.ClusterResizeParameters +type ClustersClient = original.ClustersClient +type ClustersCreateFuture = original.ClustersCreateFuture +type ClustersDeleteFuture = original.ClustersDeleteFuture +type ClustersExecuteScriptActionsFuture = original.ClustersExecuteScriptActionsFuture +type ClustersResizeFuture = original.ClustersResizeFuture +type ClustersRotateDiskEncryptionKeyFuture = original.ClustersRotateDiskEncryptionKeyFuture +type ClustersUpdateGatewaySettingsFuture = original.ClustersUpdateGatewaySettingsFuture +type ComputeProfile = original.ComputeProfile +type ConfigurationsClient = original.ConfigurationsClient +type ConfigurationsUpdateFuture = original.ConfigurationsUpdateFuture +type ConnectivityEndpoint = original.ConnectivityEndpoint +type DataDisksGroups = original.DataDisksGroups +type DiskEncryptionProperties = original.DiskEncryptionProperties +type ErrorResponse = original.ErrorResponse +type Errors = original.Errors +type ExecuteScriptActionParameters = original.ExecuteScriptActionParameters +type Extension = original.Extension +type ExtensionsClient = original.ExtensionsClient +type ExtensionsCreateFuture = original.ExtensionsCreateFuture +type ExtensionsDeleteFuture = original.ExtensionsDeleteFuture +type ExtensionsDisableMonitoringFuture = original.ExtensionsDisableMonitoringFuture +type ExtensionsEnableMonitoringFuture = original.ExtensionsEnableMonitoringFuture +type GatewaySettings = original.GatewaySettings +type HardwareProfile = original.HardwareProfile +type LinuxOperatingSystemProfile = original.LinuxOperatingSystemProfile +type LocalizedName = original.LocalizedName +type LocationsClient = original.LocationsClient +type Operation = original.Operation +type OperationDisplay = original.OperationDisplay +type OperationListResult = original.OperationListResult +type OperationListResultIterator = original.OperationListResultIterator +type OperationListResultPage = original.OperationListResultPage +type OperationResource = original.OperationResource +type OperationsClient = original.OperationsClient +type OsProfile = original.OsProfile +type ProxyResource = original.ProxyResource +type QuotaInfo = original.QuotaInfo +type Resource = original.Resource +type Role = original.Role +type RuntimeScriptAction = original.RuntimeScriptAction +type RuntimeScriptActionDetail = original.RuntimeScriptActionDetail +type SSHProfile = original.SSHProfile +type SSHPublicKey = original.SSHPublicKey +type ScriptAction = original.ScriptAction +type ScriptActionExecutionHistoryList = original.ScriptActionExecutionHistoryList +type ScriptActionExecutionHistoryListIterator = original.ScriptActionExecutionHistoryListIterator +type ScriptActionExecutionHistoryListPage = original.ScriptActionExecutionHistoryListPage +type ScriptActionExecutionSummary = original.ScriptActionExecutionSummary +type ScriptActionPersistedGetResponseSpec = original.ScriptActionPersistedGetResponseSpec +type ScriptActionsClient = original.ScriptActionsClient +type ScriptActionsList = original.ScriptActionsList +type ScriptActionsListIterator = original.ScriptActionsListIterator +type ScriptActionsListPage = original.ScriptActionsListPage +type ScriptExecutionHistoryClient = original.ScriptExecutionHistoryClient +type SecurityProfile = original.SecurityProfile +type SetString = original.SetString +type StorageAccount = original.StorageAccount +type StorageProfile = original.StorageProfile +type TrackedResource = original.TrackedResource +type UpdateGatewaySettingsParameters = original.UpdateGatewaySettingsParameters +type Usage = original.Usage +type UsagesListResult = original.UsagesListResult +type VirtualNetworkProfile = original.VirtualNetworkProfile + +func New(subscriptionID string) BaseClient { + return original.New(subscriptionID) +} +func NewApplicationListResultIterator(page ApplicationListResultPage) ApplicationListResultIterator { + return original.NewApplicationListResultIterator(page) +} +func NewApplicationListResultPage(getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage { + return original.NewApplicationListResultPage(getNextPage) +} +func NewApplicationsClient(subscriptionID string) ApplicationsClient { + return original.NewApplicationsClient(subscriptionID) +} +func NewApplicationsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationsClient { + return original.NewApplicationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewClusterListResultIterator(page ClusterListResultPage) ClusterListResultIterator { + return original.NewClusterListResultIterator(page) +} +func NewClusterListResultPage(getNextPage func(context.Context, ClusterListResult) (ClusterListResult, error)) ClusterListResultPage { + return original.NewClusterListResultPage(getNextPage) +} +func NewClustersClient(subscriptionID string) ClustersClient { + return original.NewClustersClient(subscriptionID) +} +func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { + return original.NewClustersClientWithBaseURI(baseURI, subscriptionID) +} +func NewConfigurationsClient(subscriptionID string) ConfigurationsClient { + return original.NewConfigurationsClient(subscriptionID) +} +func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationsClient { + return original.NewConfigurationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewExtensionsClient(subscriptionID string) ExtensionsClient { + return original.NewExtensionsClient(subscriptionID) +} +func NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { + return original.NewExtensionsClientWithBaseURI(baseURI, subscriptionID) +} +func NewLocationsClient(subscriptionID string) LocationsClient { + return original.NewLocationsClient(subscriptionID) +} +func NewLocationsClientWithBaseURI(baseURI string, subscriptionID string) LocationsClient { + return original.NewLocationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return original.NewOperationListResultIterator(page) +} +func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return original.NewOperationListResultPage(getNextPage) +} +func NewOperationsClient(subscriptionID string) OperationsClient { + return original.NewOperationsClient(subscriptionID) +} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewScriptActionExecutionHistoryListIterator(page ScriptActionExecutionHistoryListPage) ScriptActionExecutionHistoryListIterator { + return original.NewScriptActionExecutionHistoryListIterator(page) +} +func NewScriptActionExecutionHistoryListPage(getNextPage func(context.Context, ScriptActionExecutionHistoryList) (ScriptActionExecutionHistoryList, error)) ScriptActionExecutionHistoryListPage { + return original.NewScriptActionExecutionHistoryListPage(getNextPage) +} +func NewScriptActionsClient(subscriptionID string) ScriptActionsClient { + return original.NewScriptActionsClient(subscriptionID) +} +func NewScriptActionsClientWithBaseURI(baseURI string, subscriptionID string) ScriptActionsClient { + return original.NewScriptActionsClientWithBaseURI(baseURI, subscriptionID) +} +func NewScriptActionsListIterator(page ScriptActionsListPage) ScriptActionsListIterator { + return original.NewScriptActionsListIterator(page) +} +func NewScriptActionsListPage(getNextPage func(context.Context, ScriptActionsList) (ScriptActionsList, error)) ScriptActionsListPage { + return original.NewScriptActionsListPage(getNextPage) +} +func NewScriptExecutionHistoryClient(subscriptionID string) ScriptExecutionHistoryClient { + return original.NewScriptExecutionHistoryClient(subscriptionID) +} +func NewScriptExecutionHistoryClientWithBaseURI(baseURI string, subscriptionID string) ScriptExecutionHistoryClient { + return original.NewScriptExecutionHistoryClientWithBaseURI(baseURI, subscriptionID) +} +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID) +} +func PossibleAsyncOperationStateValues() []AsyncOperationState { + return original.PossibleAsyncOperationStateValues() +} +func PossibleClusterProvisioningStateValues() []ClusterProvisioningState { + return original.PossibleClusterProvisioningStateValues() +} +func PossibleDirectoryTypeValues() []DirectoryType { + return original.PossibleDirectoryTypeValues() +} +func PossibleJSONWebKeyEncryptionAlgorithmValues() []JSONWebKeyEncryptionAlgorithm { + return original.PossibleJSONWebKeyEncryptionAlgorithmValues() +} +func PossibleOSTypeValues() []OSType { + return original.PossibleOSTypeValues() +} +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return original.PossibleResourceIdentityTypeValues() +} +func PossibleTierValues() []Tier { + return original.PossibleTierValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/applications.go b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/applications.go new file mode 100644 index 000000000000..1e220b03c585 --- /dev/null +++ b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/applications.go @@ -0,0 +1,395 @@ +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/tracing" + "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 Application) (result ApplicationsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Create") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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 Application) (*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 + } + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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 + } + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListByCluster") + defer func() { + sc := -1 + if result.alr.Response.Response != nil { + sc = result.alr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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(ctx context.Context, lastResults ApplicationListResult) (result ApplicationListResult, err error) { + req, err := lastResults.applicationListResultPreparer(ctx) + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListByCluster") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByCluster(ctx, resourceGroupName, clusterName) + return +} diff --git a/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/client.go b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/client.go new file mode 100644 index 000000000000..19b78b2d7d9a --- /dev/null +++ b/services/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/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go new file mode 100644 index 000000000000..e6adf44a9c73 --- /dev/null +++ b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go @@ -0,0 +1,978 @@ +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" + "github.com/Azure/go-autorest/tracing" + "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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Create") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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 + } + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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 + } + 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 tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ExecuteScriptActions") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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 + } + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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 +} + +// GetGatewaySettings gets the gateway settings for the specified cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +func (client ClustersClient) GetGatewaySettings(ctx context.Context, resourceGroupName string, clusterName string) (result GatewaySettings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.GetGatewaySettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetGatewaySettingsPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "GetGatewaySettings", nil, "Failure preparing request") + return + } + + resp, err := client.GetGatewaySettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "GetGatewaySettings", resp, "Failure sending request") + return + } + + result, err = client.GetGatewaySettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "GetGatewaySettings", resp, "Failure responding to request") + } + + return +} + +// GetGatewaySettingsPreparer prepares the GetGatewaySettings request. +func (client ClustersClient) GetGatewaySettingsPreparer(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.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/getGatewaySettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetGatewaySettingsSender sends the GetGatewaySettings request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) GetGatewaySettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetGatewaySettingsResponder handles the response to the GetGatewaySettings request. The method always +// closes the http.Response Body. +func (client ClustersClient) GetGatewaySettingsResponder(resp *http.Response) (result GatewaySettings, 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.List") + defer func() { + sc := -1 + if result.clr.Response.Response != nil { + sc = result.clr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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(ctx context.Context, lastResults ClusterListResult) (result ClusterListResult, err error) { + req, err := lastResults.clusterListResultPreparer(ctx) + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.clr.Response.Response != nil { + sc = result.clr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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(ctx context.Context, lastResults ClusterListResult) (result ClusterListResult, err error) { + req, err := lastResults.clusterListResultPreparer(ctx) + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Resize") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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 + } + 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 +} + +// RotateDiskEncryptionKey rotate disk encryption key of the specified HDInsight cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// parameters - the parameters for the disk encryption operation. +func (client ClustersClient) RotateDiskEncryptionKey(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterDiskEncryptionParameters) (result ClustersRotateDiskEncryptionKeyFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.RotateDiskEncryptionKey") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RotateDiskEncryptionKeyPreparer(ctx, resourceGroupName, clusterName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "RotateDiskEncryptionKey", nil, "Failure preparing request") + return + } + + result, err = client.RotateDiskEncryptionKeySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "RotateDiskEncryptionKey", result.Response(), "Failure sending request") + return + } + + return +} + +// RotateDiskEncryptionKeyPreparer prepares the RotateDiskEncryptionKey request. +func (client ClustersClient) RotateDiskEncryptionKeyPreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterDiskEncryptionParameters) (*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}/rotatediskencryptionkey", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RotateDiskEncryptionKeySender sends the RotateDiskEncryptionKey request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) RotateDiskEncryptionKeySender(req *http.Request) (future ClustersRotateDiskEncryptionKeyFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RotateDiskEncryptionKeyResponder handles the response to the RotateDiskEncryptionKey request. The method always +// closes the http.Response Body. +func (client ClustersClient) RotateDiskEncryptionKeyResponder(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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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 +} + +// UpdateGatewaySettings configures the gateway settings on the specified cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// parameters - the cluster configurations. +func (client ClustersClient) UpdateGatewaySettings(ctx context.Context, resourceGroupName string, clusterName string, parameters UpdateGatewaySettingsParameters) (result ClustersUpdateGatewaySettingsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.UpdateGatewaySettings") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateGatewaySettingsPreparer(ctx, resourceGroupName, clusterName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "UpdateGatewaySettings", nil, "Failure preparing request") + return + } + + result, err = client.UpdateGatewaySettingsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "UpdateGatewaySettings", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateGatewaySettingsPreparer prepares the UpdateGatewaySettings request. +func (client ClustersClient) UpdateGatewaySettingsPreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters UpdateGatewaySettingsParameters) (*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}/updateGatewaySettings", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateGatewaySettingsSender sends the UpdateGatewaySettings request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) UpdateGatewaySettingsSender(req *http.Request) (future ClustersUpdateGatewaySettingsFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateGatewaySettingsResponder handles the response to the UpdateGatewaySettings request. The method always +// closes the http.Response Body. +func (client ClustersClient) UpdateGatewaySettingsResponder(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 +} diff --git a/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/configurations.go b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/configurations.go new file mode 100644 index 000000000000..ad0389668067 --- /dev/null +++ b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/configurations.go @@ -0,0 +1,287 @@ +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" + "github.com/Azure/go-autorest/tracing" + "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. This API is not recommended and might be removed in the +// future. Please consider using List configurations API instead. +// 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, 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 +} + +// List gets all configuration information for an HDI cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +func (client ConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result ClusterConfigurations, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ConfigurationsClient) ListPreparer(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.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations", 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 ConfigurationsClient) 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 ConfigurationsClient) ListResponder(resp *http.Response) (result ClusterConfigurations, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update configures the HTTP settings on the specified cluster. This API is deprecated, please use +// UpdateGatewaySettings in cluster endpoint instead. +// 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) Update(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters map[string]*string) (result ConfigurationsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, configurationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ConfigurationsClient) UpdatePreparer(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)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationsClient) UpdateSender(req *http.Request) (future ConfigurationsUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ConfigurationsClient) UpdateResponder(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/hdinsight/mgmt/2018-06-01-preview/hdinsight/extensions.go b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/extensions.go new file mode 100644 index 000000000000..01b7dcd77b30 --- /dev/null +++ b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/extensions.go @@ -0,0 +1,511 @@ +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/tracing" + "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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Create") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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 + } + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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 + } + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.DisableMonitoring") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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 + } + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.EnableMonitoring") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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 + } + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.GetMonitoringStatus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi/interfaces.go b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi/interfaces.go new file mode 100644 index 000000000000..a94d1299fbbd --- /dev/null +++ b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi/interfaces.go @@ -0,0 +1,103 @@ +package hdinsightapi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/hdinsight/mgmt/2018-06-01-preview/hdinsight" + "github.com/Azure/go-autorest/autorest" +) + +// ClustersClientAPI contains the set of methods on the ClustersClient type. +type ClustersClientAPI interface { + Create(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.ClusterCreateParametersExtended) (result hdinsight.ClustersCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterName string) (result hdinsight.ClustersDeleteFuture, err error) + ExecuteScriptActions(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.ExecuteScriptActionParameters) (result hdinsight.ClustersExecuteScriptActionsFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterName string) (result hdinsight.Cluster, err error) + GetGatewaySettings(ctx context.Context, resourceGroupName string, clusterName string) (result hdinsight.GatewaySettings, err error) + List(ctx context.Context) (result hdinsight.ClusterListResultPage, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result hdinsight.ClusterListResultPage, err error) + Resize(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.ClusterResizeParameters) (result hdinsight.ClustersResizeFuture, err error) + RotateDiskEncryptionKey(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.ClusterDiskEncryptionParameters) (result hdinsight.ClustersRotateDiskEncryptionKeyFuture, err error) + Update(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.ClusterPatchParameters) (result hdinsight.Cluster, err error) + UpdateGatewaySettings(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.UpdateGatewaySettingsParameters) (result hdinsight.ClustersUpdateGatewaySettingsFuture, err error) +} + +var _ ClustersClientAPI = (*hdinsight.ClustersClient)(nil) + +// ApplicationsClientAPI contains the set of methods on the ApplicationsClient type. +type ApplicationsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters hdinsight.Application) (result hdinsight.ApplicationsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (result hdinsight.ApplicationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (result hdinsight.Application, err error) + ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result hdinsight.ApplicationListResultPage, err error) +} + +var _ ApplicationsClientAPI = (*hdinsight.ApplicationsClient)(nil) + +// LocationsClientAPI contains the set of methods on the LocationsClient type. +type LocationsClientAPI interface { + ListUsages(ctx context.Context, location string) (result hdinsight.UsagesListResult, err error) +} + +var _ LocationsClientAPI = (*hdinsight.LocationsClient)(nil) + +// ConfigurationsClientAPI contains the set of methods on the ConfigurationsClient type. +type ConfigurationsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterName string, configurationName string) (result hdinsight.SetString, err error) + List(ctx context.Context, resourceGroupName string, clusterName string) (result hdinsight.ClusterConfigurations, err error) + Update(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters map[string]*string) (result hdinsight.ConfigurationsUpdateFuture, err error) +} + +var _ ConfigurationsClientAPI = (*hdinsight.ConfigurationsClient)(nil) + +// ExtensionsClientAPI contains the set of methods on the ExtensionsClient type. +type ExtensionsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, parameters hdinsight.Extension) (result hdinsight.ExtensionsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterName string, extensionName string) (result hdinsight.ExtensionsDeleteFuture, err error) + DisableMonitoring(ctx context.Context, resourceGroupName string, clusterName string) (result hdinsight.ExtensionsDisableMonitoringFuture, err error) + EnableMonitoring(ctx context.Context, resourceGroupName string, clusterName string, parameters hdinsight.ClusterMonitoringRequest) (result hdinsight.ExtensionsEnableMonitoringFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterName string, extensionName string) (result hdinsight.Extension, err error) + GetMonitoringStatus(ctx context.Context, resourceGroupName string, clusterName string) (result hdinsight.ClusterMonitoringResponse, err error) +} + +var _ ExtensionsClientAPI = (*hdinsight.ExtensionsClient)(nil) + +// ScriptActionsClientAPI contains the set of methods on the ScriptActionsClient type. +type ScriptActionsClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, clusterName string, scriptName string) (result autorest.Response, err error) + GetExecutionDetail(ctx context.Context, resourceGroupName string, clusterName string, scriptExecutionID string) (result hdinsight.RuntimeScriptActionDetail, err error) + ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result hdinsight.ScriptActionsListPage, err error) +} + +var _ ScriptActionsClientAPI = (*hdinsight.ScriptActionsClient)(nil) + +// ScriptExecutionHistoryClientAPI contains the set of methods on the ScriptExecutionHistoryClient type. +type ScriptExecutionHistoryClientAPI interface { + ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result hdinsight.ScriptActionExecutionHistoryListPage, err error) + Promote(ctx context.Context, resourceGroupName string, clusterName string, scriptExecutionID string) (result autorest.Response, err error) +} + +var _ ScriptExecutionHistoryClientAPI = (*hdinsight.ScriptExecutionHistoryClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result hdinsight.OperationListResultPage, err error) +} + +var _ OperationsClientAPI = (*hdinsight.OperationsClient)(nil) diff --git a/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/locations.go b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/locations.go new file mode 100644 index 000000000000..79231a569a5b --- /dev/null +++ b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/locations.go @@ -0,0 +1,116 @@ +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/tracing" + "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)} +} + +// ListUsages lists the usages for the specified location. +// Parameters: +// location - the location to get capabilities for. +func (client LocationsClient) ListUsages(ctx context.Context, location string) (result UsagesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationsClient.ListUsages") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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 = "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/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/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go new file mode 100644 index 000000000000..c314beeb9d79 --- /dev/null +++ b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go @@ -0,0 +1,1969 @@ +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" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/hdinsight/mgmt/2018-06-01-preview/hdinsight" + +// 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} +} + +// JSONWebKeyEncryptionAlgorithm enumerates the values for json web key encryption algorithm. +type JSONWebKeyEncryptionAlgorithm string + +const ( + // RSA15 ... + RSA15 JSONWebKeyEncryptionAlgorithm = "RSA1_5" + // RSAOAEP ... + RSAOAEP JSONWebKeyEncryptionAlgorithm = "RSA-OAEP" + // RSAOAEP256 ... + RSAOAEP256 JSONWebKeyEncryptionAlgorithm = "RSA-OAEP-256" +) + +// PossibleJSONWebKeyEncryptionAlgorithmValues returns an array of possible values for the JSONWebKeyEncryptionAlgorithm const type. +func PossibleJSONWebKeyEncryptionAlgorithmValues() []JSONWebKeyEncryptionAlgorithm { + return []JSONWebKeyEncryptionAlgorithm{RSA15, RSAOAEP, RSAOAEP256} +} + +// 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} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // None ... + None ResourceIdentityType = "None" + // SystemAssigned ... + SystemAssigned ResourceIdentityType = "SystemAssigned" + // SystemAssignedUserAssigned ... + SystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + // UserAssigned ... + UserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned} +} + +// 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 { + // 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"` +} + +// 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 +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ApplicationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// 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] +} + +// Creates a new instance of the ApplicationListResultIterator type. +func NewApplicationListResultIterator(page ApplicationListResultPage) ApplicationListResultIterator { + return ApplicationListResultIterator{page: page} +} + +// 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(ctx context.Context) (*http.Request, error) { + if alr.NextLink == nil || len(to.String(alr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(alr.NextLink))) +} + +// ApplicationListResultPage contains a page of Application values. +type ApplicationListResultPage struct { + fn func(context.Context, ApplicationListResult) (ApplicationListResult, error) + alr ApplicationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ApplicationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.alr) + if err != nil { + return err + } + page.alr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// 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 +} + +// Creates a new instance of the ApplicationListResultPage type. +func NewApplicationListResultPage(getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage { + return ApplicationListResultPage{fn: getNextPage} +} + +// 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"` +} + +// 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"` + // Identity - The identity of the cluster, if configured. + Identity *ClusterIdentity `json:"identity,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.Identity != nil { + objectMap["identity"] = c.Identity + } + 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) +} + +// ClusterConfigurations the configuration object for the specified cluster. +type ClusterConfigurations struct { + autorest.Response `json:"-"` + // Configurations - The configuration object for the specified configuration for the specified cluster. + Configurations map[string]map[string]*string `json:"configurations"` +} + +// MarshalJSON is the custom marshaler for ClusterConfigurations. +func (cc ClusterConfigurations) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cc.Configurations != nil { + objectMap["configurations"] = cc.Configurations + } + 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"` + // Identity - The identity of the cluster, if configured. + Identity *ClusterIdentity `json:"identity,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 + } + if ccpe.Identity != nil { + objectMap["identity"] = ccpe.Identity + } + 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"` + // DiskEncryptionProperties - The disk encryption properties. + DiskEncryptionProperties *DiskEncryptionProperties `json:"diskEncryptionProperties,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 + } + if cd.Configurations != nil { + objectMap["configurations"] = cd.Configurations + } + return json.Marshal(objectMap) +} + +// ClusterDiskEncryptionParameters the Disk Encryption Cluster request parameters. +type ClusterDiskEncryptionParameters struct { + // VaultURI - Base key vault URI where the customers key is located eg. https://myvault.vault.azure.net + VaultURI *string `json:"vaultUri,omitempty"` + // KeyName - Key name that is used for enabling disk encryption. + KeyName *string `json:"keyName,omitempty"` + // KeyVersion - Specific key version that is used for enabling disk encryption. + KeyVersion *string `json:"keyVersion,omitempty"` +} + +// 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"` + // DiskEncryptionProperties - The disk encryption properties. + DiskEncryptionProperties *DiskEncryptionProperties `json:"diskEncryptionProperties,omitempty"` +} + +// ClusterIdentity identity for the cluster. +type ClusterIdentity struct { + // PrincipalID - The principal id of cluster identity. This property will only be provided for a system assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - The tenant id associated with the cluster. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty"` + // Type - The type of identity used for the cluster. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. Possible values include: 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned', 'None' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with the cluster. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*ClusterIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ClusterIdentity. +func (ci ClusterIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ci.PrincipalID != nil { + objectMap["principalId"] = ci.PrincipalID + } + if ci.TenantID != nil { + objectMap["tenantId"] = ci.TenantID + } + if ci.Type != "" { + objectMap["type"] = ci.Type + } + if ci.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = ci.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// ClusterIdentityUserAssignedIdentitiesValue ... +type ClusterIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - The client id of user assigned identity. + ClientID *string `json:"clientId,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 +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ClusterListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// 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] +} + +// Creates a new instance of the ClusterListResultIterator type. +func NewClusterListResultIterator(page ClusterListResultPage) ClusterListResultIterator { + return ClusterListResultIterator{page: page} +} + +// 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(ctx context.Context) (*http.Request, error) { + if clr.NextLink == nil || len(to.String(clr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(clr.NextLink))) +} + +// ClusterListResultPage contains a page of Cluster values. +type ClusterListResultPage struct { + fn func(context.Context, ClusterListResult) (ClusterListResult, error) + clr ClusterListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ClusterListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.clr) + if err != nil { + return err + } + page.clr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ClusterListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// 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 +} + +// Creates a new instance of the ClusterListResultPage type. +func NewClusterListResultPage(getNextPage func(context.Context, ClusterListResult) (ClusterListResult, error)) ClusterListResultPage { + return ClusterListResultPage{fn: getNextPage} +} + +// 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 +} + +// ClustersRotateDiskEncryptionKeyFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClustersRotateDiskEncryptionKeyFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersRotateDiskEncryptionKeyFuture) Result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersRotateDiskEncryptionKeyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ClustersRotateDiskEncryptionKeyFuture") + return + } + ar.Response = future.Response() + return +} + +// ClustersUpdateGatewaySettingsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClustersUpdateGatewaySettingsFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersUpdateGatewaySettingsFuture) Result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersUpdateGatewaySettingsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ClustersUpdateGatewaySettingsFuture") + 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"` +} + +// ConfigurationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConfigurationsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ConfigurationsUpdateFuture) Result(client ConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.ConfigurationsUpdateFuture") + 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"` +} + +// DiskEncryptionProperties the disk encryption properties +type DiskEncryptionProperties struct { + // VaultURI - Base key vault URI where the customers key is located eg. https://myvault.vault.azure.net + VaultURI *string `json:"vaultUri,omitempty"` + // KeyName - Key name that is used for enabling disk encryption. + KeyName *string `json:"keyName,omitempty"` + // KeyVersion - Specific key version that is used for enabling disk encryption. + KeyVersion *string `json:"keyVersion,omitempty"` + // EncryptionAlgorithm - Algorithm identifier for encryption, default RSA-OAEP. Possible values include: 'RSAOAEP', 'RSAOAEP256', 'RSA15' + EncryptionAlgorithm JSONWebKeyEncryptionAlgorithm `json:"encryptionAlgorithm,omitempty"` + // MsiResourceID - Resource ID of Managed Identity that is used to access the key vault. + MsiResourceID *string `json:"msiResourceId,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 +} + +// GatewaySettings gateway settings. +type GatewaySettings struct { + autorest.Response `json:"-"` + // IsCredentialEnabled - Indicates whether or not the gateway settings based authorization is enabled. + IsCredentialEnabled *string `json:"restAuthCredential.isEnabled,omitempty"` + // UserName - The gateway settings user name. + UserName *string `json:"restAuthCredential.username,omitempty"` + // Password - The gateway settings user password. + Password *string `json:"restAuthCredential.password,omitempty"` +} + +// 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 +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// 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] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// 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(ctx context.Context) (*http.Request, error) { + if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// 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 +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{fn: getNextPage} +} + +// 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 +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ScriptActionExecutionHistoryListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScriptActionExecutionHistoryListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ScriptActionExecutionHistoryListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// 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] +} + +// Creates a new instance of the ScriptActionExecutionHistoryListIterator type. +func NewScriptActionExecutionHistoryListIterator(page ScriptActionExecutionHistoryListPage) ScriptActionExecutionHistoryListIterator { + return ScriptActionExecutionHistoryListIterator{page: page} +} + +// 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(ctx context.Context) (*http.Request, error) { + if saehl.NextLink == nil || len(to.String(saehl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(saehl.NextLink))) +} + +// ScriptActionExecutionHistoryListPage contains a page of RuntimeScriptActionDetail values. +type ScriptActionExecutionHistoryListPage struct { + fn func(context.Context, ScriptActionExecutionHistoryList) (ScriptActionExecutionHistoryList, error) + saehl ScriptActionExecutionHistoryList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ScriptActionExecutionHistoryListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScriptActionExecutionHistoryListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.saehl) + if err != nil { + return err + } + page.saehl = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ScriptActionExecutionHistoryListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// 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 +} + +// Creates a new instance of the ScriptActionExecutionHistoryListPage type. +func NewScriptActionExecutionHistoryListPage(getNextPage func(context.Context, ScriptActionExecutionHistoryList) (ScriptActionExecutionHistoryList, error)) ScriptActionExecutionHistoryListPage { + return ScriptActionExecutionHistoryListPage{fn: getNextPage} +} + +// 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 +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ScriptActionsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScriptActionsListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ScriptActionsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// 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] +} + +// Creates a new instance of the ScriptActionsListIterator type. +func NewScriptActionsListIterator(page ScriptActionsListPage) ScriptActionsListIterator { + return ScriptActionsListIterator{page: page} +} + +// 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(ctx context.Context) (*http.Request, error) { + if sal.NextLink == nil || len(to.String(sal.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sal.NextLink))) +} + +// ScriptActionsListPage contains a page of RuntimeScriptActionDetail values. +type ScriptActionsListPage struct { + fn func(context.Context, ScriptActionsList) (ScriptActionsList, error) + sal ScriptActionsList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ScriptActionsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScriptActionsListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.sal) + if err != nil { + return err + } + page.sal = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ScriptActionsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// 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 +} + +// Creates a new instance of the ScriptActionsListPage type. +func NewScriptActionsListPage(getNextPage func(context.Context, ScriptActionsList) (ScriptActionsList, error)) ScriptActionsListPage { + return ScriptActionsListPage{fn: getNextPage} +} + +// 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"` + // AaddsResourceID - The resource ID of the user's Azure Active Directory Domain Service. + AaddsResourceID *string `json:"aaddsResourceId,omitempty"` + // MsiResourceID - User assigned identity that has permissions to read and create cluster-related artifacts in the user's AADDS. + MsiResourceID *string `json:"msiResourceId,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, only to be specified for WASB storage accounts. + Container *string `json:"container,omitempty"` + // FileSystem - The filesystem, only to be specified for Azure Data Lake Storage type Gen 2. + FileSystem *string `json:"fileSystem,omitempty"` + // Key - The storage account access key. + Key *string `json:"key,omitempty"` + // ResourceID - The resource ID of storage account, only to be specified for Azure Data Lake Storage Gen 2. + ResourceID *string `json:"resourceId,omitempty"` + // MsiResourceID - The managed identity (MSI) that is allowed to access the storage account, only to be specified for Azure Data Lake Storage Gen 2. + MsiResourceID *string `json:"msiResourceId,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) +} + +// UpdateGatewaySettingsParameters the update gateway settings request parameters. +type UpdateGatewaySettingsParameters struct { + // IsCredentialEnabled - Indicates whether or not the gateway settings based authorization is enabled. + IsCredentialEnabled *bool `json:"restAuthCredential.isEnabled,omitempty"` + // UserName - The gateway settings user name. + UserName *string `json:"restAuthCredential.username,omitempty"` + // Password - The gateway settings user password. + Password *string `json:"restAuthCredential.password,omitempty"` +} + +// 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/hdinsight/mgmt/2018-06-01-preview/hdinsight/operations.go b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/operations.go new file mode 100644 index 000000000000..93dc55e4796b --- /dev/null +++ b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/operations.go @@ -0,0 +1,147 @@ +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/tracing" + "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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptactions.go b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptactions.go new file mode 100644 index 000000000000..495ea2ca0679 --- /dev/null +++ b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptactions.go @@ -0,0 +1,313 @@ +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/tracing" + "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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScriptActionsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScriptActionsClient.GetExecutionDetail") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScriptActionsClient.ListByCluster") + defer func() { + sc := -1 + if result.sal.Response.Response != nil { + sc = result.sal.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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(ctx context.Context, lastResults ScriptActionsList) (result ScriptActionsList, err error) { + req, err := lastResults.scriptActionsListPreparer(ctx) + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScriptActionsClient.ListByCluster") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByCluster(ctx, resourceGroupName, clusterName) + return +} diff --git a/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptexecutionhistory.go b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptexecutionhistory.go new file mode 100644 index 000000000000..b4f53664b65d --- /dev/null +++ b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptexecutionhistory.go @@ -0,0 +1,234 @@ +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/tracing" + "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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScriptExecutionHistoryClient.ListByCluster") + defer func() { + sc := -1 + if result.saehl.Response.Response != nil { + sc = result.saehl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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(ctx context.Context, lastResults ScriptActionExecutionHistoryList) (result ScriptActionExecutionHistoryList, err error) { + req, err := lastResults.scriptActionExecutionHistoryListPreparer(ctx) + 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScriptExecutionHistoryClient.ListByCluster") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScriptExecutionHistoryClient.Promote") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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/hdinsight/mgmt/2018-06-01-preview/hdinsight/version.go b/services/hdinsight/mgmt/2018-06-01-preview/hdinsight/version.go new file mode 100644 index 000000000000..ab4bbf64a50e --- /dev/null +++ b/services/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 +}