From a86611efb3c1f41a1de9527f464e7a99c2130242 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Wed, 1 Jul 2020 09:01:25 +0000 Subject: [PATCH] Generated from 0d8c9dfa424aaea0b1919d7eb4e33bcd3e34e4d1 Support encryption in transit feature: Add a property when creating a cluster --- .../hdinsight/applications.go | 4 - .../2018-06-01-preview/hdinsight/clusters.go | 11 - .../hdinsight/configurations.go | 3 - .../hdinsight/extensions.go | 6 - .../hdinsight/hdinsightapi/interfaces.go | 8 + .../2018-06-01-preview/hdinsight/locations.go | 3 - .../2018-06-01-preview/hdinsight/models.go | 89 ++++++++ .../hdinsight/operations.go | 1 - .../hdinsight/scriptactions.go | 3 - .../hdinsight/scriptexecutionhistory.go | 2 - .../2018-06-01-preview/hdinsight/version.go | 2 +- .../hdinsight/virtualmachines.go | 201 ++++++++++++++++++ 12 files changed, 299 insertions(+), 34 deletions(-) create mode 100644 services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/virtualmachines.go diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/applications.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/applications.go index 37d730c67b71..9585fd74197a 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/applications.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/applications.go @@ -114,7 +114,6 @@ func (client ApplicationsClient) CreateSender(req *http.Request) (future Applica 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()) @@ -192,7 +191,6 @@ func (client ApplicationsClient) DeleteSender(req *http.Request) (future Applica 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 @@ -269,7 +267,6 @@ func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, e 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()) @@ -346,7 +343,6 @@ func (client ApplicationsClient) ListByClusterSender(req *http.Request) (*http.R 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()) 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 6936930d2f3e..3adc29e9b90f 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 @@ -113,7 +113,6 @@ func (client ClustersClient) CreateSender(req *http.Request) (future ClustersCre 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()) @@ -189,7 +188,6 @@ func (client ClustersClient) DeleteSender(req *http.Request) (future ClustersDel 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 @@ -273,7 +271,6 @@ func (client ClustersClient) ExecuteScriptActionsSender(req *http.Request) (futu 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 @@ -348,7 +345,6 @@ func (client ClustersClient) GetSender(req *http.Request) (*http.Response, error 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()) @@ -424,7 +420,6 @@ func (client ClustersClient) GetGatewaySettingsSender(req *http.Request) (*http. 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()) @@ -496,7 +491,6 @@ func (client ClustersClient) ListSender(req *http.Request) (*http.Response, erro 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()) @@ -608,7 +602,6 @@ func (client ClustersClient) ListByResourceGroupSender(req *http.Request) (*http 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()) @@ -725,7 +718,6 @@ func (client ClustersClient) ResizeSender(req *http.Request) (future ClustersRes 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 @@ -803,7 +795,6 @@ func (client ClustersClient) RotateDiskEncryptionKeySender(req *http.Request) (f 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 @@ -881,7 +872,6 @@ func (client ClustersClient) UpdateSender(req *http.Request) (*http.Response, er 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()) @@ -960,7 +950,6 @@ func (client ClustersClient) UpdateGatewaySettingsSender(req *http.Request) (fut 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 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 6b72f68edfd4..ad9aba42bd03 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 @@ -113,7 +113,6 @@ func (client ConfigurationsClient) GetSender(req *http.Request) (*http.Response, 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()) @@ -189,7 +188,6 @@ func (client ConfigurationsClient) ListSender(req *http.Request) (*http.Response 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()) @@ -277,7 +275,6 @@ func (client ConfigurationsClient) UpdateSender(req *http.Request) (future Confi 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 diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/extensions.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/extensions.go index 312bc3dcba27..c1de5eb5b06a 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/extensions.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/extensions.go @@ -114,7 +114,6 @@ func (client ExtensionsClient) CreateSender(req *http.Request) (future Extension 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 @@ -191,7 +190,6 @@ func (client ExtensionsClient) DeleteSender(req *http.Request) (future Extension 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 @@ -266,7 +264,6 @@ func (client ExtensionsClient) DisableMonitoringSender(req *http.Request) (futur 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 @@ -344,7 +341,6 @@ func (client ExtensionsClient) EnableMonitoringSender(req *http.Request) (future 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 @@ -421,7 +417,6 @@ func (client ExtensionsClient) GetSender(req *http.Request) (*http.Response, err 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()) @@ -497,7 +492,6 @@ func (client ExtensionsClient) GetMonitoringStatusSender(req *http.Request) (*ht 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()) 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 a3cad5a86b28..ecf84696ff3f 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 @@ -109,3 +109,11 @@ type OperationsClientAPI interface { } var _ OperationsClientAPI = (*hdinsight.OperationsClient)(nil) + +// VirtualMachinesClientAPI contains the set of methods on the VirtualMachinesClient type. +type VirtualMachinesClientAPI interface { + ListHosts(ctx context.Context, resourceGroupName string, clusterName string) (result hdinsight.ListHostInfo, err error) + RestartHosts(ctx context.Context, resourceGroupName string, clusterName string, hosts []string) (result hdinsight.VirtualMachinesRestartHostsFuture, err error) +} + +var _ VirtualMachinesClientAPI = (*hdinsight.VirtualMachinesClient)(nil) diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/locations.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/locations.go index 289e9d39b898..e880a36525bb 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/locations.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/locations.go @@ -107,7 +107,6 @@ func (client LocationsClient) GetCapabilitiesSender(req *http.Request) (*http.Re func (client LocationsClient) GetCapabilitiesResponder(resp *http.Response) (result CapabilitiesResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -181,7 +180,6 @@ func (client LocationsClient) ListBillingSpecsSender(req *http.Request) (*http.R func (client LocationsClient) ListBillingSpecsResponder(resp *http.Response) (result BillingResponseListResult, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -255,7 +253,6 @@ func (client LocationsClient) ListUsagesSender(req *http.Request) (*http.Respons 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()) 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 804440086344..d8c7b59c0847 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 @@ -153,6 +153,36 @@ func PossibleOSTypeValues() []OSType { return []OSType{Linux, Windows} } +// OutboundOnlyPublicNetworkAccessType enumerates the values for outbound only public network access type. +type OutboundOnlyPublicNetworkAccessType string + +const ( + // PublicLoadBalancer ... + PublicLoadBalancer OutboundOnlyPublicNetworkAccessType = "PublicLoadBalancer" + // UDR ... + UDR OutboundOnlyPublicNetworkAccessType = "UDR" +) + +// PossibleOutboundOnlyPublicNetworkAccessTypeValues returns an array of possible values for the OutboundOnlyPublicNetworkAccessType const type. +func PossibleOutboundOnlyPublicNetworkAccessTypeValues() []OutboundOnlyPublicNetworkAccessType { + return []OutboundOnlyPublicNetworkAccessType{PublicLoadBalancer, UDR} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // InboundAndOutbound ... + InboundAndOutbound PublicNetworkAccess = "InboundAndOutbound" + // OutboundOnly ... + OutboundOnly PublicNetworkAccess = "OutboundOnly" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{InboundAndOutbound, OutboundOnly} +} + // ResourceIdentityType enumerates the values for resource identity type. type ResourceIdentityType string @@ -702,8 +732,12 @@ type ClusterCreateProperties struct { StorageProfile *StorageProfile `json:"storageProfile,omitempty"` // DiskEncryptionProperties - The disk encryption properties. DiskEncryptionProperties *DiskEncryptionProperties `json:"diskEncryptionProperties,omitempty"` + // EncryptionInTransitProperties - The encryption-in-transit properties. + EncryptionInTransitProperties *EncryptionInTransitProperties `json:"encryptionInTransitProperties,omitempty"` // MinSupportedTLSVersion - The minimal supported tls version. MinSupportedTLSVersion *string `json:"minSupportedTlsVersion,omitempty"` + // NetworkSettings - The network settings. + NetworkSettings *NetworkSettings `json:"networkSettings,omitempty"` } // ClusterDefinition the cluster definition. @@ -776,8 +810,12 @@ type ClusterGetProperties struct { ConnectivityEndpoints *[]ConnectivityEndpoint `json:"connectivityEndpoints,omitempty"` // DiskEncryptionProperties - The disk encryption properties. DiskEncryptionProperties *DiskEncryptionProperties `json:"diskEncryptionProperties,omitempty"` + // EncryptionInTransitProperties - The encryption-in-transit properties. + EncryptionInTransitProperties *EncryptionInTransitProperties `json:"encryptionInTransitProperties,omitempty"` // MinSupportedTLSVersion - The minimal supported tls version. MinSupportedTLSVersion *string `json:"minSupportedTlsVersion,omitempty"` + // NetworkSettings - The network settings. + NetworkSettings *NetworkSettings `json:"networkSettings,omitempty"` } // ClusterIdentity identity for the cluster. @@ -1229,6 +1267,14 @@ type DiskEncryptionProperties struct { EncryptionAlgorithm JSONWebKeyEncryptionAlgorithm `json:"encryptionAlgorithm,omitempty"` // MsiResourceID - Resource ID of Managed Identity that is used to access the key vault. MsiResourceID *string `json:"msiResourceId,omitempty"` + // EncryptionAtHost - Indicates whether or not resource disk encryption is enabled. + EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` +} + +// EncryptionInTransitProperties the encryption-in-transit properties. +type EncryptionInTransitProperties struct { + // IsEncryptionInTransitEnabled - Indicates whether or not inter cluster node communication is encrypted in transit. + IsEncryptionInTransitEnabled *bool `json:"isEncryptionInTransitEnabled,omitempty"` } // ErrorResponse describes the format of Error response. @@ -1373,6 +1419,12 @@ type HardwareProfile struct { VMSize *string `json:"vmSize,omitempty"` } +// HostInfo the cluster host information. +type HostInfo struct { + // Name - The host name + Name *string `json:"name,omitempty"` +} + // KafkaRestProperties the kafka rest proxy configuration which contains AAD security group information. type KafkaRestProperties struct { // ClientGroupInfo - The information of AAD security group. @@ -1389,6 +1441,12 @@ type LinuxOperatingSystemProfile struct { SSHProfile *SSHProfile `json:"sshProfile,omitempty"` } +// ListHostInfo ... +type ListHostInfo struct { + autorest.Response `json:"-"` + Value *[]HostInfo `json:"value,omitempty"` +} + // LocalizedName the details about the localizable name of a type of usage. type LocalizedName struct { // Value - The name of the used resource. @@ -1397,6 +1455,14 @@ type LocalizedName struct { LocalizedValue *string `json:"localizedValue,omitempty"` } +// NetworkSettings the network settings. +type NetworkSettings struct { + // PublicNetworkAccess - Specifies whether public network access is enabled for inbound and outbound, or outbound only. Possible values include: 'InboundAndOutbound', 'OutboundOnly' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // OutboundOnlyPublicNetworkAccessType - The mechanism through which the cluster will have outbound access to the public network. Possible values include: 'PublicLoadBalancer', 'UDR' + OutboundOnlyPublicNetworkAccessType OutboundOnlyPublicNetworkAccessType `json:"outboundOnlyPublicNetworkAccessType,omitempty"` +} + // Operation the HDInsight REST API operation. type Operation struct { // Name - The operation name: {provider}/{resource}/{operation} @@ -2183,6 +2249,29 @@ func (vs VersionSpec) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// VirtualMachinesRestartHostsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachinesRestartHostsFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualMachinesRestartHostsFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.VirtualMachinesRestartHostsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hdinsight.VirtualMachinesRestartHostsFuture") + return + } + ar.Response = future.Response() + return +} + // VirtualNetworkProfile the virtual network properties. type VirtualNetworkProfile struct { // ID - The ID of the virtual network. diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/operations.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/operations.go index c6fe6a5c843e..bcaead6b27f4 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/operations.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/operations.go @@ -101,7 +101,6 @@ func (client OperationsClient) ListSender(req *http.Request) (*http.Response, er 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()) diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptactions.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptactions.go index 367420bafc62..142097881571 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptactions.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptactions.go @@ -111,7 +111,6 @@ func (client ScriptActionsClient) DeleteSender(req *http.Request) (*http.Respons 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 @@ -188,7 +187,6 @@ func (client ScriptActionsClient) GetExecutionDetailSender(req *http.Request) (* 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()) @@ -265,7 +263,6 @@ func (client ScriptActionsClient) ListByClusterSender(req *http.Request) (*http. 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()) diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptexecutionhistory.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptexecutionhistory.go index 38957b660e74..ab3d9a76e472 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptexecutionhistory.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/scriptexecutionhistory.go @@ -111,7 +111,6 @@ func (client ScriptExecutionHistoryClient) ListByClusterSender(req *http.Request 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()) @@ -226,7 +225,6 @@ func (client ScriptExecutionHistoryClient) PromoteSender(req *http.Request) (*ht 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 diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/version.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/version.go index ab4bbf64a50e..f96877c07bfe 100644 --- a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/version.go +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // 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" + return "Azure-SDK-For-Go/" + Version() + " hdinsight/2018-06-01-preview" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/virtualmachines.go b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/virtualmachines.go new file mode 100644 index 000000000000..ec4548dd2be8 --- /dev/null +++ b/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight/virtualmachines.go @@ -0,0 +1,201 @@ +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" +) + +// VirtualMachinesClient is the hDInsight Management Client +type VirtualMachinesClient struct { + BaseClient +} + +// NewVirtualMachinesClient creates an instance of the VirtualMachinesClient client. +func NewVirtualMachinesClient(subscriptionID string) VirtualMachinesClient { + return NewVirtualMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachinesClientWithBaseURI creates an instance of the VirtualMachinesClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachinesClient { + return VirtualMachinesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListHosts lists the HDInsight clusters hosts +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +func (client VirtualMachinesClient) ListHosts(ctx context.Context, resourceGroupName string, clusterName string) (result ListHostInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.ListHosts") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListHostsPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.VirtualMachinesClient", "ListHosts", nil, "Failure preparing request") + return + } + + resp, err := client.ListHostsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.VirtualMachinesClient", "ListHosts", resp, "Failure sending request") + return + } + + result, err = client.ListHostsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.VirtualMachinesClient", "ListHosts", resp, "Failure responding to request") + } + + return +} + +// ListHostsPreparer prepares the ListHosts request. +func (client VirtualMachinesClient) ListHostsPreparer(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}/listHosts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHostsSender sends the ListHosts request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ListHostsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListHostsResponder handles the response to the ListHosts request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ListHostsResponder(resp *http.Response) (result ListHostInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RestartHosts restarts the specified HDInsight cluster hosts. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterName - the name of the cluster. +// hosts - the list of hosts to restart +func (client VirtualMachinesClient) RestartHosts(ctx context.Context, resourceGroupName string, clusterName string, hosts []string) (result VirtualMachinesRestartHostsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.RestartHosts") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: hosts, + Constraints: []validation.Constraint{{Target: "hosts", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("hdinsight.VirtualMachinesClient", "RestartHosts", err.Error()) + } + + req, err := client.RestartHostsPreparer(ctx, resourceGroupName, clusterName, hosts) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.VirtualMachinesClient", "RestartHosts", nil, "Failure preparing request") + return + } + + result, err = client.RestartHostsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.VirtualMachinesClient", "RestartHosts", result.Response(), "Failure sending request") + return + } + + return +} + +// RestartHostsPreparer prepares the RestartHosts request. +func (client VirtualMachinesClient) RestartHostsPreparer(ctx context.Context, resourceGroupName string, clusterName string, hosts []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.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts", pathParameters), + autorest.WithJSON(hosts), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestartHostsSender sends the RestartHosts request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) RestartHostsSender(req *http.Request) (future VirtualMachinesRestartHostsFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RestartHostsResponder handles the response to the RestartHosts request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) RestartHostsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +}