From 95a7c9362b496a556b0ba66ffeff40fc88fb39b5 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 29 Jul 2019 10:21:12 -0700 Subject: [PATCH] [AutoPR hdinsight/resource-manager] [HDInsight] Add Capabilities to Stable API version,Modify ApplicationType,AccessModes to enum (#5291) * Generated from 6fd28f5f0db51b2cf7a71835ac10e3dc2c4cb390 Add Capabilities to stable version, Modify ApplicationType and AccessMode to Enum. In order to be consistent with the response from RP side, add suppression for DefinitionsPropertiesNamesCamelCase * Generated from cef6f97615ded43f65dab5eda4a5837d5ec45621 Add Capabilities to stable version, Modify ApplicationType and AccessMode to Enum. In order to be consistent with the response from RP side, add suppression for DefinitionsPropertiesNamesCamelCase * Generated from a22cf02eb2898daaac88819d82f4ccc1fba62a75 Add Capabilities to stable version, Modify ApplicationType and AccessMode to Enum. In order to be consistent with the response from RP side, add suppression for DefinitionsPropertiesNamesCamelCase --- .../hdinsight/mgmt/hdinsight/models.go | 27 +++ .../2015-03-01-preview/hdinsight/models.go | 44 ++++- .../hdinsight/hdinsightapi/interfaces.go | 1 + .../2018-06-01-preview/hdinsight/locations.go | 75 ++++++++ .../2018-06-01-preview/hdinsight/models.go | 161 +++++++++++++++++- 5 files changed, 300 insertions(+), 8 deletions(-) diff --git a/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go b/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go index 926044b77826..506072d9bc3e 100644 --- a/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go +++ b/profiles/preview/preview/hdinsight/mgmt/hdinsight/models.go @@ -29,6 +29,19 @@ const ( DefaultBaseURI = original.DefaultBaseURI ) +type ApplicationHTTPSEndpointAccessMode = original.ApplicationHTTPSEndpointAccessMode + +const ( + WebPage ApplicationHTTPSEndpointAccessMode = original.WebPage +) + +type ApplicationType = original.ApplicationType + +const ( + CustomApplication ApplicationType = original.CustomApplication + RServer ApplicationType = original.RServer +) + type AsyncOperationState = original.AsyncOperationState const ( @@ -122,6 +135,7 @@ type BaseClient = original.BaseClient type BillingMeters = original.BillingMeters type BillingResources = original.BillingResources type BillingResponseListResult = original.BillingResponseListResult +type CapabilitiesResult = original.CapabilitiesResult type Cluster = original.Cluster type ClusterConfigurations = original.ClusterConfigurations type ClusterCreateParametersExtended = original.ClusterCreateParametersExtended @@ -177,7 +191,10 @@ type OperationResource = original.OperationResource type OperationsClient = original.OperationsClient type OsProfile = original.OsProfile type ProxyResource = original.ProxyResource +type QuotaCapability = original.QuotaCapability type QuotaInfo = original.QuotaInfo +type RegionalQuotaCapability = original.RegionalQuotaCapability +type RegionsCapability = original.RegionsCapability type Resource = original.Resource type Role = original.Role type RuntimeScriptAction = original.RuntimeScriptAction @@ -203,7 +220,11 @@ type TrackedResource = original.TrackedResource type UpdateGatewaySettingsParameters = original.UpdateGatewaySettingsParameters type Usage = original.Usage type UsagesListResult = original.UsagesListResult +type VMSizeCompatibilityFilter = original.VMSizeCompatibilityFilter type VMSizeCompatibilityFilterV2 = original.VMSizeCompatibilityFilterV2 +type VMSizesCapability = original.VMSizesCapability +type VersionSpec = original.VersionSpec +type VersionsCapability = original.VersionsCapability type VirtualNetworkProfile = original.VirtualNetworkProfile func New(subscriptionID string) BaseClient { @@ -290,6 +311,12 @@ func NewScriptExecutionHistoryClientWithBaseURI(baseURI string, subscriptionID s func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return original.NewWithBaseURI(baseURI, subscriptionID) } +func PossibleApplicationHTTPSEndpointAccessModeValues() []ApplicationHTTPSEndpointAccessMode { + return original.PossibleApplicationHTTPSEndpointAccessModeValues() +} +func PossibleApplicationTypeValues() []ApplicationType { + return original.PossibleApplicationTypeValues() +} func PossibleAsyncOperationStateValues() []AsyncOperationState { return original.PossibleAsyncOperationStateValues() } 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 bde17fe23cb1..9bb620534336 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 @@ -30,6 +30,34 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/hdinsight/mgmt/2015-03-01-preview/hdinsight" +// ApplicationHTTPSEndpointAccessMode enumerates the values for application https endpoint access mode. +type ApplicationHTTPSEndpointAccessMode string + +const ( + // WebPage ... + WebPage ApplicationHTTPSEndpointAccessMode = "WebPage" +) + +// PossibleApplicationHTTPSEndpointAccessModeValues returns an array of possible values for the ApplicationHTTPSEndpointAccessMode const type. +func PossibleApplicationHTTPSEndpointAccessModeValues() []ApplicationHTTPSEndpointAccessMode { + return []ApplicationHTTPSEndpointAccessMode{WebPage} +} + +// ApplicationType enumerates the values for application type. +type ApplicationType string + +const ( + // CustomApplication ... + CustomApplication ApplicationType = "CustomApplication" + // RServer ... + RServer ApplicationType = "RServer" +) + +// PossibleApplicationTypeValues returns an array of possible values for the ApplicationType const type. +func PossibleApplicationTypeValues() []ApplicationType { + return []ApplicationType{CustomApplication, RServer} +} + // AsyncOperationState enumerates the values for async operation state. type AsyncOperationState string @@ -232,13 +260,17 @@ type ApplicationGetEndpoint struct { // ApplicationGetHTTPSEndpoint gets the application HTTP endpoints. type ApplicationGetHTTPSEndpoint struct { // AccessModes - The list of access modes for the application. - AccessModes *[]string `json:"accessModes,omitempty"` + AccessModes *[]ApplicationHTTPSEndpointAccessMode `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"` + // SubDomainSuffix - The subdomain suffix of the application. + SubDomainSuffix *string `json:"subDomainSuffix,omitempty"` + // DisableGatewayAuth - Disable gateway authentication. + DisableGatewayAuth *bool `json:"disableGatewayAuth,omitempty"` } // ApplicationListResult result of the request to list cluster Applications. It contains a list of @@ -402,8 +434,8 @@ type ApplicationProperties struct { SSHEndpoints *[]ApplicationGetEndpoint `json:"sshEndpoints,omitempty"` // ProvisioningState - READ-ONLY; The provisioning state of the application. ProvisioningState *string `json:"provisioningState,omitempty"` - // ApplicationType - The application type. - ApplicationType *string `json:"applicationType,omitempty"` + // ApplicationType - The application type. Possible values include: 'CustomApplication', 'RServer' + ApplicationType ApplicationType `json:"applicationType,omitempty"` // ApplicationState - READ-ONLY; The application state. ApplicationState *string `json:"applicationState,omitempty"` // Errors - The list of errors. @@ -1517,6 +1549,10 @@ type ProxyResource struct { // QuotaCapability the regional quota capability. type QuotaCapability struct { + // CoresUsed - The number of cores used in the subscription. + CoresUsed *int64 `json:"cores_used,omitempty"` + // MaxCoresAllowed - The number of cores that the subscription allowed. + MaxCoresAllowed *int64 `json:"max_cores_allowed,omitempty"` // RegionalQuotas - The list of region quota capabilities. RegionalQuotas *[]RegionalQuotaCapability `json:"regionalQuotas,omitempty"` } @@ -1533,7 +1569,7 @@ type RegionalQuotaCapability struct { RegionName *string `json:"region_name,omitempty"` // CoresUsed - The number of cores used in the region. CoresUsed *int64 `json:"cores_used,omitempty"` - // CoresAvailable - The number of courses available in the region. + // CoresAvailable - The number of cores available in the region. CoresAvailable *int64 `json:"cores_available,omitempty"` } 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 789b47636a5d..473f035bab0b 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 @@ -52,6 +52,7 @@ var _ ApplicationsClientAPI = (*hdinsight.ApplicationsClient)(nil) // LocationsClientAPI contains the set of methods on the LocationsClient type. type LocationsClientAPI interface { + GetCapabilities(ctx context.Context, location string) (result hdinsight.CapabilitiesResult, err error) ListBillingSpecs(ctx context.Context, location string) (result hdinsight.BillingResponseListResult, err error) ListUsages(ctx context.Context, location string) (result hdinsight.UsagesListResult, err error) } 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 a5c657ce7205..4ad0c4ccaef8 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 @@ -40,6 +40,81 @@ func NewLocationsClientWithBaseURI(baseURI string, subscriptionID string) Locati return LocationsClient{NewWithBaseURI(baseURI, subscriptionID)} } +// GetCapabilities gets the capabilities for the specified location. +// Parameters: +// location - the Azure location (region) for which to make the request. +func (client LocationsClient) GetCapabilities(ctx context.Context, location string) (result CapabilitiesResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationsClient.GetCapabilities") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetCapabilitiesPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.LocationsClient", "GetCapabilities", nil, "Failure preparing request") + return + } + + resp, err := client.GetCapabilitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.LocationsClient", "GetCapabilities", resp, "Failure sending request") + return + } + + result, err = client.GetCapabilitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.LocationsClient", "GetCapabilities", resp, "Failure responding to request") + } + + return +} + +// GetCapabilitiesPreparer prepares the GetCapabilities request. +func (client LocationsClient) GetCapabilitiesPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "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}/capabilities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCapabilitiesSender sends the GetCapabilities request. The method will close the +// http.Response Body if it receives an error. +func (client LocationsClient) GetCapabilitiesSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetCapabilitiesResponder handles the response to the GetCapabilities request. The method always +// closes the http.Response Body. +func (client LocationsClient) GetCapabilitiesResponder(resp *http.Response) (result CapabilitiesResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // ListBillingSpecs lists the billingSpecs for the specified subscription and location. // Parameters: // location - the Azure location (region) for which to make the request. 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 2757f1da6100..c8679a059aff 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 @@ -30,6 +30,34 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/hdinsight/mgmt/2018-06-01-preview/hdinsight" +// ApplicationHTTPSEndpointAccessMode enumerates the values for application https endpoint access mode. +type ApplicationHTTPSEndpointAccessMode string + +const ( + // WebPage ... + WebPage ApplicationHTTPSEndpointAccessMode = "WebPage" +) + +// PossibleApplicationHTTPSEndpointAccessModeValues returns an array of possible values for the ApplicationHTTPSEndpointAccessMode const type. +func PossibleApplicationHTTPSEndpointAccessModeValues() []ApplicationHTTPSEndpointAccessMode { + return []ApplicationHTTPSEndpointAccessMode{WebPage} +} + +// ApplicationType enumerates the values for application type. +type ApplicationType string + +const ( + // CustomApplication ... + CustomApplication ApplicationType = "CustomApplication" + // RServer ... + RServer ApplicationType = "RServer" +) + +// PossibleApplicationTypeValues returns an array of possible values for the ApplicationType const type. +func PossibleApplicationTypeValues() []ApplicationType { + return []ApplicationType{CustomApplication, RServer} +} + // AsyncOperationState enumerates the values for async operation state. type AsyncOperationState string @@ -232,14 +260,14 @@ type ApplicationGetEndpoint struct { // ApplicationGetHTTPSEndpoint gets the application HTTP endpoints. type ApplicationGetHTTPSEndpoint struct { // AccessModes - The list of access modes for the application. - AccessModes *[]string `json:"accessModes,omitempty"` + AccessModes *[]ApplicationHTTPSEndpointAccessMode `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"` - // SubDomainSuffix - The subDomainSuffix of the application. + // SubDomainSuffix - The subdomain suffix of the application. SubDomainSuffix *string `json:"subDomainSuffix,omitempty"` // DisableGatewayAuth - The value indicates whether to disable GatewayAuth. DisableGatewayAuth *bool `json:"disableGatewayAuth,omitempty"` @@ -406,8 +434,8 @@ type ApplicationProperties struct { SSHEndpoints *[]ApplicationGetEndpoint `json:"sshEndpoints,omitempty"` // ProvisioningState - READ-ONLY; The provisioning state of the application. ProvisioningState *string `json:"provisioningState,omitempty"` - // ApplicationType - The application type. - ApplicationType *string `json:"applicationType,omitempty"` + // ApplicationType - The application type. Possible values include: 'CustomApplication', 'RServer' + ApplicationType ApplicationType `json:"applicationType,omitempty"` // ApplicationState - READ-ONLY; The application state. ApplicationState *string `json:"applicationState,omitempty"` // Errors - The list of errors. @@ -545,6 +573,47 @@ type BillingResponseListResult struct { BillingResources *[]BillingResources `json:"billingResources,omitempty"` } +// CapabilitiesResult the Get Capabilities operation response. +type CapabilitiesResult struct { + autorest.Response `json:"-"` + // Versions - The version capability. + Versions map[string]*VersionsCapability `json:"versions"` + // Regions - The virtual machine size compatibility features. + Regions map[string]*RegionsCapability `json:"regions"` + // VMSizes - The virtual machine sizes. + VMSizes map[string]*VMSizesCapability `json:"vmSizes"` + // VMSizeFilters - The virtual machine size compatibility filters. + VMSizeFilters *[]VMSizeCompatibilityFilter `json:"vmSize_filters,omitempty"` + // Features - The capability features. + Features *[]string `json:"features,omitempty"` + // Quota - The quota capability. + Quota *QuotaCapability `json:"quota,omitempty"` +} + +// MarshalJSON is the custom marshaler for CapabilitiesResult. +func (cr CapabilitiesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cr.Versions != nil { + objectMap["versions"] = cr.Versions + } + if cr.Regions != nil { + objectMap["regions"] = cr.Regions + } + if cr.VMSizes != nil { + objectMap["vmSizes"] = cr.VMSizes + } + if cr.VMSizeFilters != nil { + objectMap["vmSize_filters"] = cr.VMSizeFilters + } + if cr.Features != nil { + objectMap["features"] = cr.Features + } + if cr.Quota != nil { + objectMap["quota"] = cr.Quota + } + return json.Marshal(objectMap) +} + // Cluster the HDInsight cluster. type Cluster struct { autorest.Response `json:"-"` @@ -1524,12 +1593,38 @@ type ProxyResource struct { Type *string `json:"type,omitempty"` } +// QuotaCapability the regional quota capability. +type QuotaCapability struct { + // CoresUsed - The number of cores used in the subscription. + CoresUsed *int64 `json:"cores_used,omitempty"` + // MaxCoresAllowed - The number of cores that the subscription allowed. + MaxCoresAllowed *int64 `json:"max_cores_allowed,omitempty"` + // RegionalQuotas - The list of region quota capabilities. + RegionalQuotas *[]RegionalQuotaCapability `json:"regionalQuotas,omitempty"` +} + // QuotaInfo the quota properties for the cluster. type QuotaInfo struct { // CoresUsed - The cores used by the cluster. CoresUsed *int32 `json:"coresUsed,omitempty"` } +// RegionalQuotaCapability the regional quota capacity. +type RegionalQuotaCapability struct { + // RegionName - The region name. + RegionName *string `json:"region_name,omitempty"` + // CoresUsed - The number of cores used in the region. + CoresUsed *int64 `json:"cores_used,omitempty"` + // CoresAvailable - The number of cores available in the region. + CoresAvailable *int64 `json:"cores_available,omitempty"` +} + +// RegionsCapability the regions capability. +type RegionsCapability struct { + // Available - The list of region capabilities. + Available *[]string `json:"available,omitempty"` +} + // Resource the core properties of ARM resources type Resource struct { // ID - READ-ONLY; Fully qualified resource Id for the resource. @@ -2058,6 +2153,42 @@ type UsagesListResult struct { Value *[]Usage `json:"value,omitempty"` } +// VersionsCapability the version capability. +type VersionsCapability struct { + // Available - The list of version capabilities. + Available *[]VersionSpec `json:"available,omitempty"` +} + +// VersionSpec the version properties. +type VersionSpec struct { + // FriendlyName - The friendly name + FriendlyName *string `json:"friendlyName,omitempty"` + // DisplayName - The display name + DisplayName *string `json:"displayName,omitempty"` + // IsDefault - Whether or not the version is the default version. + IsDefault *string `json:"isDefault,omitempty"` + // ComponentVersions - The component version property. + ComponentVersions map[string]*string `json:"componentVersions"` +} + +// MarshalJSON is the custom marshaler for VersionSpec. +func (vs VersionSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vs.FriendlyName != nil { + objectMap["friendlyName"] = vs.FriendlyName + } + if vs.DisplayName != nil { + objectMap["displayName"] = vs.DisplayName + } + if vs.IsDefault != nil { + objectMap["isDefault"] = vs.IsDefault + } + if vs.ComponentVersions != nil { + objectMap["componentVersions"] = vs.ComponentVersions + } + return json.Marshal(objectMap) +} + // VirtualNetworkProfile the virtual network properties. type VirtualNetworkProfile struct { // ID - The ID of the virtual network. @@ -2066,6 +2197,22 @@ type VirtualNetworkProfile struct { Subnet *string `json:"subnet,omitempty"` } +// VMSizeCompatibilityFilter the virtual machine type compatibility filter. +type VMSizeCompatibilityFilter struct { + // FilterMode - The mode for the filter. + FilterMode *string `json:"FilterMode,omitempty"` + // Regions - The list of regions. + Regions *[]string `json:"Regions,omitempty"` + // ClusterFlavors - The list of cluster types available. + ClusterFlavors *[]string `json:"ClusterFlavors,omitempty"` + // NodeTypes - The list of node types. + NodeTypes *[]string `json:"NodeTypes,omitempty"` + // ClusterVersions - The list of cluster versions. + ClusterVersions *[]string `json:"ClusterVersions,omitempty"` + // Vmsizes - The list of virtual machine sizes. + Vmsizes *[]string `json:"vmsizes,omitempty"` +} + // VMSizeCompatibilityFilterV2 this class represent a single filter object that defines a multidimensional // set. The dimensions of this set are Regions, ClusterFlavors, NodeTypes and ClusterVersions. The // constraint should be defined based on the following: FilterMode (Exclude vs Include), VMSizes (the vm @@ -2087,3 +2234,9 @@ type VMSizeCompatibilityFilterV2 struct { // VMSizes - The list of virtual machine sizes to include or exclude. VMSizes *[]string `json:"vmSizes,omitempty"` } + +// VMSizesCapability the virtual machine sizes capability. +type VMSizesCapability struct { + // Available - The list of virtual machine size capabilities. + Available *[]string `json:"available,omitempty"` +}