diff --git a/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go b/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go index c23600f2b7be..3603dd2eb155 100644 --- a/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go +++ b/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go @@ -96,6 +96,7 @@ 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 @@ -118,6 +119,7 @@ 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 @@ -133,6 +135,7 @@ 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 @@ -169,6 +172,7 @@ 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 diff --git a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/clusters.go b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/clusters.go index a3b08e734ed4..cbae79efff87 100644 --- a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/clusters.go +++ b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/clusters.go @@ -359,6 +359,83 @@ func (client ClustersClient) GetResponder(resp *http.Response) (result Cluster, 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 = "2015-03-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() { @@ -820,3 +897,82 @@ func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluste 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 = "2015-03-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/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/configurations.go b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/configurations.go index e2870c52c705..35cceb32b19c 100644 --- a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/configurations.go +++ b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/configurations.go @@ -41,7 +41,8 @@ func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) C return ConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Get the configuration object for the specified cluster. +// 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. @@ -120,15 +121,93 @@ func (client ConfigurationsClient) GetResponder(resp *http.Response) (result Set return } -// UpdateHTTPSettings configures the HTTP settings on the specified cluster. +// 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 = "2015-03-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) UpdateHTTPSettings(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters map[string]*string) (result ConfigurationsUpdateHTTPSettingsFuture, err error) { +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.UpdateHTTPSettings") + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.Update") defer func() { sc := -1 if result.Response() != nil { @@ -140,26 +219,26 @@ func (client ConfigurationsClient) UpdateHTTPSettings(ctx context.Context, resou if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("hdinsight.ConfigurationsClient", "UpdateHTTPSettings", err.Error()) + return result, validation.NewError("hdinsight.ConfigurationsClient", "Update", err.Error()) } - req, err := client.UpdateHTTPSettingsPreparer(ctx, resourceGroupName, clusterName, configurationName, parameters) + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, configurationName, parameters) if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "UpdateHTTPSettings", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Update", nil, "Failure preparing request") return } - result, err = client.UpdateHTTPSettingsSender(req) + result, err = client.UpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "UpdateHTTPSettings", result.Response(), "Failure sending request") + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Update", result.Response(), "Failure sending request") return } return } -// UpdateHTTPSettingsPreparer prepares the UpdateHTTPSettings request. -func (client ConfigurationsClient) UpdateHTTPSettingsPreparer(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters map[string]*string) (*http.Request, error) { +// 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), @@ -182,9 +261,9 @@ func (client ConfigurationsClient) UpdateHTTPSettingsPreparer(ctx context.Contex return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// UpdateHTTPSettingsSender sends the UpdateHTTPSettings request. The method will close the +// UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. -func (client ConfigurationsClient) UpdateHTTPSettingsSender(req *http.Request) (future ConfigurationsUpdateHTTPSettingsFuture, err error) { +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)) @@ -195,9 +274,9 @@ func (client ConfigurationsClient) UpdateHTTPSettingsSender(req *http.Request) ( return } -// UpdateHTTPSettingsResponder handles the response to the UpdateHTTPSettings request. The method always +// UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client ConfigurationsClient) UpdateHTTPSettingsResponder(resp *http.Response) (result autorest.Response, err error) { +func (client ConfigurationsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/hdinsightapi/interfaces.go b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/hdinsightapi/interfaces.go index 228de4c10c97..f5bdc2547367 100644 --- a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/hdinsightapi/interfaces.go +++ b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/hdinsightapi/interfaces.go @@ -29,11 +29,13 @@ type ClustersClientAPI interface { 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) @@ -59,7 +61,8 @@ 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) - UpdateHTTPSettings(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters map[string]*string) (result hdinsight.ConfigurationsUpdateHTTPSettingsFuture, 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) diff --git a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/models.go b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/models.go index 51ac34f75ee4..97c14b302d43 100644 --- a/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/models.go +++ b/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight/models.go @@ -527,6 +527,22 @@ func (c Cluster) MarshalJSON() ([]byte, error) { 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. @@ -1006,29 +1022,52 @@ func (future *ClustersRotateDiskEncryptionKeyFuture) Result(client ClustersClien 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"` } -// ConfigurationsUpdateHTTPSettingsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConfigurationsUpdateHTTPSettingsFuture struct { +// 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 *ConfigurationsUpdateHTTPSettingsFuture) Result(client ConfigurationsClient) (ar autorest.Response, err 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.ConfigurationsUpdateHTTPSettingsFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - err = azure.NewAsyncOpIncompleteError("hdinsight.ConfigurationsUpdateHTTPSettingsFuture") + err = azure.NewAsyncOpIncompleteError("hdinsight.ConfigurationsUpdateFuture") return } ar.Response = future.Response() @@ -1150,6 +1189,17 @@ func (future *ExtensionEnableMonitoringFuture) Result(client ExtensionClient) (a 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 @@ -1898,6 +1948,16 @@ func (tr TrackedResource) MarshalJSON() ([]byte, error) { 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. diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go index c3f244287d7a..e6adf44a9c73 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/clusters.go @@ -359,6 +359,83 @@ func (client ClustersClient) GetResponder(resp *http.Response) (result Cluster, 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() { @@ -820,3 +897,82 @@ func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluste 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/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/configurations.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/configurations.go index db8b2d91c198..ad0389668067 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/configurations.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/configurations.go @@ -41,7 +41,8 @@ func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) C return ConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Get the configuration object for the specified cluster. +// 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. @@ -120,7 +121,85 @@ func (client ConfigurationsClient) GetResponder(resp *http.Response) (result Set return } -// Update configures the configuration on the specified cluster. +// 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. diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi/interfaces.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi/interfaces.go index 992b2eb3b91b..038f6fd3014f 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi/interfaces.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/hdinsightapi/interfaces.go @@ -29,11 +29,13 @@ type ClustersClientAPI interface { 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) @@ -58,6 +60,7 @@ 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) } diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go index 9ccaaaa063d5..cc7c34a3a832 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/models.go @@ -486,6 +486,22 @@ func (c Cluster) MarshalJSON() ([]byte, error) { 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. @@ -965,6 +981,29 @@ func (future *ClustersRotateDiskEncryptionKeyFuture) Result(client ClustersClien 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. @@ -1155,6 +1194,17 @@ func (future *ExtensionsEnableMonitoringFuture) Result(client ExtensionsClient) 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 @@ -1881,6 +1931,16 @@ func (tr TrackedResource) MarshalJSON() ([]byte, error) { 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.