diff --git a/services/azurestackhci/mgmt/2020-10-01/azurestackhci/CHANGELOG.md b/services/azurestackhci/mgmt/2020-10-01/azurestackhci/CHANGELOG.md index 52911e4cc5e4..28323fe3325a 100644 --- a/services/azurestackhci/mgmt/2020-10-01/azurestackhci/CHANGELOG.md +++ b/services/azurestackhci/mgmt/2020-10-01/azurestackhci/CHANGELOG.md @@ -1,2 +1,24 @@ -# Change History +# Unreleased +## Additive Changes + +### New Constants + +1. CreatedByType.Application +1. CreatedByType.Key +1. CreatedByType.ManagedIdentity +1. CreatedByType.User + +### New Funcs + +1. PossibleCreatedByTypeValues() []CreatedByType + +### Struct Changes + +#### New Structs + +1. SystemData + +#### New Struct Fields + +1. Cluster.*SystemData diff --git a/services/azurestackhci/mgmt/2020-10-01/azurestackhci/_meta.json b/services/azurestackhci/mgmt/2020-10-01/azurestackhci/_meta.json index cb79c14a28d3..94ffe2b55edb 100644 --- a/services/azurestackhci/mgmt/2020-10-01/azurestackhci/_meta.json +++ b/services/azurestackhci/mgmt/2020-10-01/azurestackhci/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "57738094303195dca7e576b4dec8fa0cb79d487e", "readme": "/_/azure-rest-api-specs/specification/azurestackhci/resource-manager/readme.md", "tag": "package-2020-10", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/azurestackhci/mgmt/2020-10-01/azurestackhci/clusters.go b/services/azurestackhci/mgmt/2020-10-01/azurestackhci/clusters.go index da08688084dd..7730996153d8 100644 --- a/services/azurestackhci/mgmt/2020-10-01/azurestackhci/clusters.go +++ b/services/azurestackhci/mgmt/2020-10-01/azurestackhci/clusters.go @@ -52,8 +52,7 @@ func (client ClustersClient) Create(ctx context.Context, resourceGroupName strin Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: cluster, Constraints: []validation.Constraint{{Target: "cluster.ClusterProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "cluster.ClusterProperties.AadClientID", Name: validation.Null, Rule: true, Chain: nil}, @@ -97,6 +96,7 @@ func (client ClustersClient) CreatePreparer(ctx context.Context, resourceGroupNa "api-version": APIVersion, } + cluster.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), @@ -145,8 +145,7 @@ func (client ClustersClient) Delete(ctx context.Context, resourceGroupName strin Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("azurestackhci.ClustersClient", "Delete", err.Error()) } @@ -230,8 +229,7 @@ func (client ClustersClient) Get(ctx context.Context, resourceGroupName string, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("azurestackhci.ClustersClient", "Get", err.Error()) } @@ -315,8 +313,7 @@ func (client ClustersClient) ListByResourceGroup(ctx context.Context, resourceGr Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("azurestackhci.ClustersClient", "ListByResourceGroup", err.Error()) } @@ -562,8 +559,7 @@ func (client ClustersClient) Update(ctx context.Context, resourceGroupName strin Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("azurestackhci.ClustersClient", "Update", err.Error()) } diff --git a/services/azurestackhci/mgmt/2020-10-01/azurestackhci/enums.go b/services/azurestackhci/mgmt/2020-10-01/azurestackhci/enums.go index 76d5de2164d2..444ad417e5e4 100644 --- a/services/azurestackhci/mgmt/2020-10-01/azurestackhci/enums.go +++ b/services/azurestackhci/mgmt/2020-10-01/azurestackhci/enums.go @@ -6,6 +6,25 @@ package azurestackhci // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + // ProvisioningState enumerates the values for provisioning state. type ProvisioningState string diff --git a/services/azurestackhci/mgmt/2020-10-01/azurestackhci/models.go b/services/azurestackhci/mgmt/2020-10-01/azurestackhci/models.go index 02fcceff5bfb..320c5223095f 100644 --- a/services/azurestackhci/mgmt/2020-10-01/azurestackhci/models.go +++ b/services/azurestackhci/mgmt/2020-10-01/azurestackhci/models.go @@ -50,6 +50,8 @@ func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { // Cluster cluster details. type Cluster struct { autorest.Response `json:"-"` + // SystemData - READ-ONLY; System data of Cluster resource + *SystemData `json:"systemData,omitempty"` // ClusterProperties - Cluster properties. *ClusterProperties `json:"properties,omitempty"` // Tags - Resource tags. @@ -88,6 +90,15 @@ func (c *Cluster) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + c.SystemData = &systemData + } case "properties": if v != nil { var clusterProperties ClusterProperties @@ -487,8 +498,8 @@ type OperationDisplay struct { Description *string `json:"description,omitempty"` } -// ProxyResource the resource model definition for an Azure Resource Manager proxy resource. It will have -// everything other than required location and tags +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location type ProxyResource struct { // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string `json:"id,omitempty"` @@ -520,7 +531,24 @@ func (r Resource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + // TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' type TrackedResource struct { // Tags - Resource tags. Tags map[string]*string `json:"tags"` diff --git a/services/azurestackhci/mgmt/2022-01-01/azurestackhci/CHANGELOG.md b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/azurestackhci/mgmt/2022-01-01/azurestackhci/_meta.json b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/_meta.json new file mode 100644 index 000000000000..73c005f7afdd --- /dev/null +++ b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "57738094303195dca7e576b4dec8fa0cb79d487e", + "readme": "/_/azure-rest-api-specs/specification/azurestackhci/resource-manager/readme.md", + "tag": "package-2022-01", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2022-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/azurestackhci/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/azurestackhci/mgmt/2022-01-01/azurestackhci/arcsettings.go b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/arcsettings.go new file mode 100644 index 000000000000..b26bca3e74f3 --- /dev/null +++ b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/arcsettings.go @@ -0,0 +1,426 @@ +package azurestackhci + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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" +) + +// ArcSettingsClient is the azure Stack HCI management service +type ArcSettingsClient struct { + BaseClient +} + +// NewArcSettingsClient creates an instance of the ArcSettingsClient client. +func NewArcSettingsClient(subscriptionID string) ArcSettingsClient { + return NewArcSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewArcSettingsClientWithBaseURI creates an instance of the ArcSettingsClient 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 NewArcSettingsClientWithBaseURI(baseURI string, subscriptionID string) ArcSettingsClient { + return ArcSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create ArcSetting for HCI cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// arcSettingName - the name of the proxy resource holding details of HCI ArcSetting information. +// arcSetting - parameters supplied to the Create ArcSetting resource for this HCI cluster. +func (client ArcSettingsClient) Create(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting ArcSetting) (result ArcSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ArcSettingsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ArcSettingsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterName, arcSettingName, arcSetting) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ArcSettingsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurestackhci.ArcSettingsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ArcSettingsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ArcSettingsClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting ArcSetting) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "arcSettingName": autorest.Encode("path", arcSettingName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + arcSetting.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}", pathParameters), + autorest.WithJSON(arcSetting), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ArcSettingsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ArcSettingsClient) CreateResponder(resp *http.Response) (result ArcSetting, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete ArcSetting resource details of HCI Cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// arcSettingName - the name of the proxy resource holding details of HCI ArcSetting information. +func (client ArcSettingsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string) (result ArcSettingsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ArcSettingsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ArcSettingsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, arcSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ArcSettingsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ArcSettingsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ArcSettingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "arcSettingName": autorest.Encode("path", arcSettingName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ArcSettingsClient) DeleteSender(req *http.Request) (future ArcSettingsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ArcSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get ArcSetting resource details of HCI Cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// arcSettingName - the name of the proxy resource holding details of HCI ArcSetting information. +func (client ArcSettingsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string) (result ArcSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ArcSettingsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ArcSettingsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, arcSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ArcSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurestackhci.ArcSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ArcSettingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ArcSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "arcSettingName": autorest.Encode("path", arcSettingName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ArcSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ArcSettingsClient) GetResponder(resp *http.Response) (result ArcSetting, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByCluster get ArcSetting resources of HCI Cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +func (client ArcSettingsClient) ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result ArcSettingListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ArcSettingsClient.ListByCluster") + defer func() { + sc := -1 + if result.asl.Response.Response != nil { + sc = result.asl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ArcSettingsClient", "ListByCluster", err.Error()) + } + + result.fn = client.listByClusterNextResults + req, err := client.ListByClusterPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ArcSettingsClient", "ListByCluster", nil, "Failure preparing request") + return + } + + resp, err := client.ListByClusterSender(req) + if err != nil { + result.asl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurestackhci.ArcSettingsClient", "ListByCluster", resp, "Failure sending request") + return + } + + result.asl, err = client.ListByClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ArcSettingsClient", "ListByCluster", resp, "Failure responding to request") + return + } + if result.asl.hasNextLink() && result.asl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByClusterPreparer prepares the ListByCluster request. +func (client ArcSettingsClient) ListByClusterPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByClusterSender sends the ListByCluster request. The method will close the +// http.Response Body if it receives an error. +func (client ArcSettingsClient) ListByClusterSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByClusterResponder handles the response to the ListByCluster request. The method always +// closes the http.Response Body. +func (client ArcSettingsClient) ListByClusterResponder(resp *http.Response) (result ArcSettingList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByClusterNextResults retrieves the next set of results, if any. +func (client ArcSettingsClient) listByClusterNextResults(ctx context.Context, lastResults ArcSettingList) (result ArcSettingList, err error) { + req, err := lastResults.arcSettingListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "azurestackhci.ArcSettingsClient", "listByClusterNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByClusterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "azurestackhci.ArcSettingsClient", "listByClusterNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ArcSettingsClient", "listByClusterNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByClusterComplete enumerates all values, automatically crossing page boundaries as required. +func (client ArcSettingsClient) ListByClusterComplete(ctx context.Context, resourceGroupName string, clusterName string) (result ArcSettingListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ArcSettingsClient.ListByCluster") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByCluster(ctx, resourceGroupName, clusterName) + return +} diff --git a/services/azurestackhci/mgmt/2022-01-01/azurestackhci/azurestackhciapi/interfaces.go b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/azurestackhciapi/interfaces.go new file mode 100644 index 000000000000..8b787be518e4 --- /dev/null +++ b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/azurestackhciapi/interfaces.go @@ -0,0 +1,57 @@ +package azurestackhciapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2022-01-01/azurestackhci" + "github.com/Azure/go-autorest/autorest" +) + +// ArcSettingsClientAPI contains the set of methods on the ArcSettingsClient type. +type ArcSettingsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting azurestackhci.ArcSetting) (result azurestackhci.ArcSetting, err error) + Delete(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string) (result azurestackhci.ArcSettingsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string) (result azurestackhci.ArcSetting, err error) + ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result azurestackhci.ArcSettingListPage, err error) + ListByClusterComplete(ctx context.Context, resourceGroupName string, clusterName string) (result azurestackhci.ArcSettingListIterator, err error) +} + +var _ ArcSettingsClientAPI = (*azurestackhci.ArcSettingsClient)(nil) + +// ClustersClientAPI contains the set of methods on the ClustersClient type. +type ClustersClientAPI interface { + Create(ctx context.Context, resourceGroupName string, clusterName string, cluster azurestackhci.Cluster) (result azurestackhci.Cluster, err error) + Delete(ctx context.Context, resourceGroupName string, clusterName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, clusterName string) (result azurestackhci.Cluster, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result azurestackhci.ClusterListPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result azurestackhci.ClusterListIterator, err error) + ListBySubscription(ctx context.Context) (result azurestackhci.ClusterListPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result azurestackhci.ClusterListIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterName string, cluster azurestackhci.ClusterPatch) (result azurestackhci.Cluster, err error) +} + +var _ ClustersClientAPI = (*azurestackhci.ClustersClient)(nil) + +// ExtensionsClientAPI contains the set of methods on the ExtensionsClient type. +type ExtensionsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension azurestackhci.Extension) (result azurestackhci.ExtensionsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string) (result azurestackhci.ExtensionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string) (result azurestackhci.Extension, err error) + ListByArcSetting(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string) (result azurestackhci.ExtensionListPage, err error) + ListByArcSettingComplete(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string) (result azurestackhci.ExtensionListIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension azurestackhci.Extension) (result azurestackhci.ExtensionsUpdateFuture, err error) +} + +var _ ExtensionsClientAPI = (*azurestackhci.ExtensionsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result azurestackhci.OperationListResult, err error) +} + +var _ OperationsClientAPI = (*azurestackhci.OperationsClient)(nil) diff --git a/services/azurestackhci/mgmt/2022-01-01/azurestackhci/client.go b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/client.go new file mode 100644 index 000000000000..9fad13abe79e --- /dev/null +++ b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/client.go @@ -0,0 +1,41 @@ +// Package azurestackhci implements the Azure ARM Azurestackhci service API version 2022-01-01. +// +// Azure Stack HCI management service +package azurestackhci + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Azurestackhci + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Azurestackhci. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/azurestackhci/mgmt/2022-01-01/azurestackhci/clusters.go b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/clusters.go new file mode 100644 index 000000000000..64ee281f0719 --- /dev/null +++ b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/clusters.go @@ -0,0 +1,627 @@ +package azurestackhci + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ClustersClient is the azure Stack HCI management service +type ClustersClient struct { + BaseClient +} + +// NewClustersClient creates an instance of the ClustersClient client. +func NewClustersClient(subscriptionID string) ClustersClient { + return NewClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClustersClientWithBaseURI creates an instance of the ClustersClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { + return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create an HCI cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// cluster - details of the HCI cluster. +func (client ClustersClient) Create(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster) (result Cluster, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: cluster, + Constraints: []validation.Constraint{{Target: "cluster.ClusterProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cluster.ClusterProperties.AadClientID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cluster.ClusterProperties.AadTenantID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("azurestackhci.ClustersClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterName, cluster) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ClustersClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster) (*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 = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + cluster.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", pathParameters), + autorest.WithJSON(cluster), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ClustersClient) CreateResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an HCI cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +func (client ClustersClient) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ClustersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get HCI cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +func (client ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string) (result Cluster, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ClustersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ClustersClient) GetResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup list all HCI clusters in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client ClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ClusterListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.cl.Response.Response != nil { + sc = result.cl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ClustersClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.cl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.cl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.cl.hasNextLink() && result.cl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ClustersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ClustersClient) listByResourceGroupNextResults(ctx context.Context, lastResults ClusterList) (result ClusterList, err error) { + req, err := lastResults.clusterListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClustersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ClusterListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscription list all HCI clusters in a subscription. +func (client ClustersClient) ListBySubscription(ctx context.Context) (result ClusterListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListBySubscription") + defer func() { + sc := -1 + if result.cl.Response.Response != nil { + sc = result.cl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ClustersClient", "ListBySubscription", err.Error()) + } + + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.cl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.cl, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.cl.hasNextLink() && result.cl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client ClustersClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListBySubscriptionResponder(resp *http.Response) (result ClusterList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client ClustersClient) listBySubscriptionNextResults(ctx context.Context, lastResults ClusterList) (result ClusterList, err error) { + req, err := lastResults.clusterListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClustersClient) ListBySubscriptionComplete(ctx context.Context) (result ClusterListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// Update update an HCI cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// cluster - details of the HCI cluster. +func (client ClustersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, cluster ClusterPatch) (result Cluster, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ClustersClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, cluster) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, cluster ClusterPatch) (*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 = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", pathParameters), + autorest.WithJSON(cluster), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/azurestackhci/mgmt/2022-01-01/azurestackhci/enums.go b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/enums.go new file mode 100644 index 000000000000..9abbdd351530 --- /dev/null +++ b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/enums.go @@ -0,0 +1,297 @@ +package azurestackhci + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // Internal ... + Internal ActionType = "Internal" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{Internal} +} + +// ArcSettingAggregateState enumerates the values for arc setting aggregate state. +type ArcSettingAggregateState string + +const ( + // Canceled ... + Canceled ArcSettingAggregateState = "Canceled" + // Connected ... + Connected ArcSettingAggregateState = "Connected" + // Creating ... + Creating ArcSettingAggregateState = "Creating" + // Deleted ... + Deleted ArcSettingAggregateState = "Deleted" + // Deleting ... + Deleting ArcSettingAggregateState = "Deleting" + // Disconnected ... + Disconnected ArcSettingAggregateState = "Disconnected" + // Error ... + Error ArcSettingAggregateState = "Error" + // Failed ... + Failed ArcSettingAggregateState = "Failed" + // InProgress ... + InProgress ArcSettingAggregateState = "InProgress" + // Moving ... + Moving ArcSettingAggregateState = "Moving" + // NotSpecified ... + NotSpecified ArcSettingAggregateState = "NotSpecified" + // PartiallyConnected ... + PartiallyConnected ArcSettingAggregateState = "PartiallyConnected" + // PartiallySucceeded ... + PartiallySucceeded ArcSettingAggregateState = "PartiallySucceeded" + // Succeeded ... + Succeeded ArcSettingAggregateState = "Succeeded" + // Updating ... + Updating ArcSettingAggregateState = "Updating" +) + +// PossibleArcSettingAggregateStateValues returns an array of possible values for the ArcSettingAggregateState const type. +func PossibleArcSettingAggregateStateValues() []ArcSettingAggregateState { + return []ArcSettingAggregateState{Canceled, Connected, Creating, Deleted, Deleting, Disconnected, Error, Failed, InProgress, Moving, NotSpecified, PartiallyConnected, PartiallySucceeded, Succeeded, Updating} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// DiagnosticLevel enumerates the values for diagnostic level. +type DiagnosticLevel string + +const ( + // Basic ... + Basic DiagnosticLevel = "Basic" + // Enhanced ... + Enhanced DiagnosticLevel = "Enhanced" + // Off ... + Off DiagnosticLevel = "Off" +) + +// PossibleDiagnosticLevelValues returns an array of possible values for the DiagnosticLevel const type. +func PossibleDiagnosticLevelValues() []DiagnosticLevel { + return []DiagnosticLevel{Basic, Enhanced, Off} +} + +// ExtensionAggregateState enumerates the values for extension aggregate state. +type ExtensionAggregateState string + +const ( + // ExtensionAggregateStateCanceled ... + ExtensionAggregateStateCanceled ExtensionAggregateState = "Canceled" + // ExtensionAggregateStateConnected ... + ExtensionAggregateStateConnected ExtensionAggregateState = "Connected" + // ExtensionAggregateStateCreating ... + ExtensionAggregateStateCreating ExtensionAggregateState = "Creating" + // ExtensionAggregateStateDeleted ... + ExtensionAggregateStateDeleted ExtensionAggregateState = "Deleted" + // ExtensionAggregateStateDeleting ... + ExtensionAggregateStateDeleting ExtensionAggregateState = "Deleting" + // ExtensionAggregateStateDisconnected ... + ExtensionAggregateStateDisconnected ExtensionAggregateState = "Disconnected" + // ExtensionAggregateStateError ... + ExtensionAggregateStateError ExtensionAggregateState = "Error" + // ExtensionAggregateStateFailed ... + ExtensionAggregateStateFailed ExtensionAggregateState = "Failed" + // ExtensionAggregateStateInProgress ... + ExtensionAggregateStateInProgress ExtensionAggregateState = "InProgress" + // ExtensionAggregateStateMoving ... + ExtensionAggregateStateMoving ExtensionAggregateState = "Moving" + // ExtensionAggregateStateNotSpecified ... + ExtensionAggregateStateNotSpecified ExtensionAggregateState = "NotSpecified" + // ExtensionAggregateStatePartiallyConnected ... + ExtensionAggregateStatePartiallyConnected ExtensionAggregateState = "PartiallyConnected" + // ExtensionAggregateStatePartiallySucceeded ... + ExtensionAggregateStatePartiallySucceeded ExtensionAggregateState = "PartiallySucceeded" + // ExtensionAggregateStateSucceeded ... + ExtensionAggregateStateSucceeded ExtensionAggregateState = "Succeeded" + // ExtensionAggregateStateUpdating ... + ExtensionAggregateStateUpdating ExtensionAggregateState = "Updating" +) + +// PossibleExtensionAggregateStateValues returns an array of possible values for the ExtensionAggregateState const type. +func PossibleExtensionAggregateStateValues() []ExtensionAggregateState { + return []ExtensionAggregateState{ExtensionAggregateStateCanceled, ExtensionAggregateStateConnected, ExtensionAggregateStateCreating, ExtensionAggregateStateDeleted, ExtensionAggregateStateDeleting, ExtensionAggregateStateDisconnected, ExtensionAggregateStateError, ExtensionAggregateStateFailed, ExtensionAggregateStateInProgress, ExtensionAggregateStateMoving, ExtensionAggregateStateNotSpecified, ExtensionAggregateStatePartiallyConnected, ExtensionAggregateStatePartiallySucceeded, ExtensionAggregateStateSucceeded, ExtensionAggregateStateUpdating} +} + +// ImdsAttestation enumerates the values for imds attestation. +type ImdsAttestation string + +const ( + // Disabled ... + Disabled ImdsAttestation = "Disabled" + // Enabled ... + Enabled ImdsAttestation = "Enabled" +) + +// PossibleImdsAttestationValues returns an array of possible values for the ImdsAttestation const type. +func PossibleImdsAttestationValues() []ImdsAttestation { + return []ImdsAttestation{Disabled, Enabled} +} + +// NodeArcState enumerates the values for node arc state. +type NodeArcState string + +const ( + // NodeArcStateCanceled ... + NodeArcStateCanceled NodeArcState = "Canceled" + // NodeArcStateConnected ... + NodeArcStateConnected NodeArcState = "Connected" + // NodeArcStateCreating ... + NodeArcStateCreating NodeArcState = "Creating" + // NodeArcStateDeleted ... + NodeArcStateDeleted NodeArcState = "Deleted" + // NodeArcStateDeleting ... + NodeArcStateDeleting NodeArcState = "Deleting" + // NodeArcStateDisconnected ... + NodeArcStateDisconnected NodeArcState = "Disconnected" + // NodeArcStateError ... + NodeArcStateError NodeArcState = "Error" + // NodeArcStateFailed ... + NodeArcStateFailed NodeArcState = "Failed" + // NodeArcStateMoving ... + NodeArcStateMoving NodeArcState = "Moving" + // NodeArcStateNotSpecified ... + NodeArcStateNotSpecified NodeArcState = "NotSpecified" + // NodeArcStateSucceeded ... + NodeArcStateSucceeded NodeArcState = "Succeeded" + // NodeArcStateUpdating ... + NodeArcStateUpdating NodeArcState = "Updating" +) + +// PossibleNodeArcStateValues returns an array of possible values for the NodeArcState const type. +func PossibleNodeArcStateValues() []NodeArcState { + return []NodeArcState{NodeArcStateCanceled, NodeArcStateConnected, NodeArcStateCreating, NodeArcStateDeleted, NodeArcStateDeleting, NodeArcStateDisconnected, NodeArcStateError, NodeArcStateFailed, NodeArcStateMoving, NodeArcStateNotSpecified, NodeArcStateSucceeded, NodeArcStateUpdating} +} + +// NodeExtensionState enumerates the values for node extension state. +type NodeExtensionState string + +const ( + // NodeExtensionStateCanceled ... + NodeExtensionStateCanceled NodeExtensionState = "Canceled" + // NodeExtensionStateConnected ... + NodeExtensionStateConnected NodeExtensionState = "Connected" + // NodeExtensionStateCreating ... + NodeExtensionStateCreating NodeExtensionState = "Creating" + // NodeExtensionStateDeleted ... + NodeExtensionStateDeleted NodeExtensionState = "Deleted" + // NodeExtensionStateDeleting ... + NodeExtensionStateDeleting NodeExtensionState = "Deleting" + // NodeExtensionStateDisconnected ... + NodeExtensionStateDisconnected NodeExtensionState = "Disconnected" + // NodeExtensionStateError ... + NodeExtensionStateError NodeExtensionState = "Error" + // NodeExtensionStateFailed ... + NodeExtensionStateFailed NodeExtensionState = "Failed" + // NodeExtensionStateMoving ... + NodeExtensionStateMoving NodeExtensionState = "Moving" + // NodeExtensionStateNotSpecified ... + NodeExtensionStateNotSpecified NodeExtensionState = "NotSpecified" + // NodeExtensionStateSucceeded ... + NodeExtensionStateSucceeded NodeExtensionState = "Succeeded" + // NodeExtensionStateUpdating ... + NodeExtensionStateUpdating NodeExtensionState = "Updating" +) + +// PossibleNodeExtensionStateValues returns an array of possible values for the NodeExtensionState const type. +func PossibleNodeExtensionStateValues() []NodeExtensionState { + return []NodeExtensionState{NodeExtensionStateCanceled, NodeExtensionStateConnected, NodeExtensionStateCreating, NodeExtensionStateDeleted, NodeExtensionStateDeleting, NodeExtensionStateDisconnected, NodeExtensionStateError, NodeExtensionStateFailed, NodeExtensionStateMoving, NodeExtensionStateNotSpecified, NodeExtensionStateSucceeded, NodeExtensionStateUpdating} +} + +// Origin enumerates the values for origin. +type Origin string + +const ( + // OriginSystem ... + OriginSystem Origin = "system" + // OriginUser ... + OriginUser Origin = "user" + // OriginUsersystem ... + OriginUsersystem Origin = "user,system" +) + +// PossibleOriginValues returns an array of possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{OriginSystem, OriginUser, OriginUsersystem} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted ... + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning ... + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateAccepted, ProvisioningStateCanceled, ProvisioningStateFailed, ProvisioningStateProvisioning, ProvisioningStateSucceeded} +} + +// Status enumerates the values for status. +type Status string + +const ( + // StatusConnectedRecently ... + StatusConnectedRecently Status = "ConnectedRecently" + // StatusDisconnected ... + StatusDisconnected Status = "Disconnected" + // StatusError ... + StatusError Status = "Error" + // StatusNotConnectedRecently ... + StatusNotConnectedRecently Status = "NotConnectedRecently" + // StatusNotYetRegistered ... + StatusNotYetRegistered Status = "NotYetRegistered" +) + +// PossibleStatusValues returns an array of possible values for the Status const type. +func PossibleStatusValues() []Status { + return []Status{StatusConnectedRecently, StatusDisconnected, StatusError, StatusNotConnectedRecently, StatusNotYetRegistered} +} + +// WindowsServerSubscription enumerates the values for windows server subscription. +type WindowsServerSubscription string + +const ( + // WindowsServerSubscriptionDisabled ... + WindowsServerSubscriptionDisabled WindowsServerSubscription = "Disabled" + // WindowsServerSubscriptionEnabled ... + WindowsServerSubscriptionEnabled WindowsServerSubscription = "Enabled" +) + +// PossibleWindowsServerSubscriptionValues returns an array of possible values for the WindowsServerSubscription const type. +func PossibleWindowsServerSubscriptionValues() []WindowsServerSubscription { + return []WindowsServerSubscription{WindowsServerSubscriptionDisabled, WindowsServerSubscriptionEnabled} +} diff --git a/services/azurestackhci/mgmt/2022-01-01/azurestackhci/extensions.go b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/extensions.go new file mode 100644 index 000000000000..7b45a2634a80 --- /dev/null +++ b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/extensions.go @@ -0,0 +1,533 @@ +package azurestackhci + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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" +) + +// ExtensionsClient is the azure Stack HCI management service +type ExtensionsClient struct { + BaseClient +} + +// NewExtensionsClient creates an instance of the ExtensionsClient client. +func NewExtensionsClient(subscriptionID string) ExtensionsClient { + return NewExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionsClientWithBaseURI creates an instance of the ExtensionsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { + return ExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create Extension for HCI cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// arcSettingName - the name of the proxy resource holding details of HCI ArcSetting information. +// extensionName - the name of the machine extension. +// extension - details of the Machine Extension to be created. +func (client ExtensionsClient) Create(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension) (result ExtensionsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ExtensionsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extension) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ExtensionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "arcSettingName": autorest.Encode("path", arcSettingName), + "clusterName": autorest.Encode("path", clusterName), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + extension.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}", pathParameters), + autorest.WithJSON(extension), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) CreateSender(req *http.Request) (future ExtensionsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) CreateResponder(resp *http.Response) (result Extension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete particular Arc Extension of HCI Cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// arcSettingName - the name of the proxy resource holding details of HCI ArcSetting information. +// extensionName - the name of the machine extension. +func (client ExtensionsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string) (result ExtensionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ExtensionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, arcSettingName, extensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "arcSettingName": autorest.Encode("path", arcSettingName), + "clusterName": autorest.Encode("path", clusterName), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) DeleteSender(req *http.Request) (future ExtensionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get particular Arc Extension of HCI Cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// arcSettingName - the name of the proxy resource holding details of HCI ArcSetting information. +// extensionName - the name of the machine extension. +func (client ExtensionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string) (result Extension, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ExtensionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, arcSettingName, extensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "arcSettingName": autorest.Encode("path", arcSettingName), + "clusterName": autorest.Encode("path", clusterName), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) GetResponder(resp *http.Response) (result Extension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByArcSetting list all Extensions under ArcSetting resource. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// arcSettingName - the name of the proxy resource holding details of HCI ArcSetting information. +func (client ExtensionsClient) ListByArcSetting(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string) (result ExtensionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.ListByArcSetting") + defer func() { + sc := -1 + if result.el.Response.Response != nil { + sc = result.el.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ExtensionsClient", "ListByArcSetting", err.Error()) + } + + result.fn = client.listByArcSettingNextResults + req, err := client.ListByArcSettingPreparer(ctx, resourceGroupName, clusterName, arcSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsClient", "ListByArcSetting", nil, "Failure preparing request") + return + } + + resp, err := client.ListByArcSettingSender(req) + if err != nil { + result.el.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsClient", "ListByArcSetting", resp, "Failure sending request") + return + } + + result.el, err = client.ListByArcSettingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsClient", "ListByArcSetting", resp, "Failure responding to request") + return + } + if result.el.hasNextLink() && result.el.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByArcSettingPreparer prepares the ListByArcSetting request. +func (client ExtensionsClient) ListByArcSettingPreparer(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "arcSettingName": autorest.Encode("path", arcSettingName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByArcSettingSender sends the ListByArcSetting request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) ListByArcSettingSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByArcSettingResponder handles the response to the ListByArcSetting request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) ListByArcSettingResponder(resp *http.Response) (result ExtensionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByArcSettingNextResults retrieves the next set of results, if any. +func (client ExtensionsClient) listByArcSettingNextResults(ctx context.Context, lastResults ExtensionList) (result ExtensionList, err error) { + req, err := lastResults.extensionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "azurestackhci.ExtensionsClient", "listByArcSettingNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByArcSettingSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "azurestackhci.ExtensionsClient", "listByArcSettingNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByArcSettingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsClient", "listByArcSettingNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByArcSettingComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionsClient) ListByArcSettingComplete(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string) (result ExtensionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.ListByArcSetting") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByArcSetting(ctx, resourceGroupName, clusterName, arcSettingName) + return +} + +// Update update Extension for HCI cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// arcSettingName - the name of the proxy resource holding details of HCI ArcSetting information. +// extensionName - the name of the machine extension. +// extension - details of the Machine Extension to be created. +func (client ExtensionsClient) Update(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension) (result ExtensionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("azurestackhci.ExtensionsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extension) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ExtensionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "arcSettingName": autorest.Encode("path", arcSettingName), + "clusterName": autorest.Encode("path", clusterName), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + extension.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}", pathParameters), + autorest.WithJSON(extension), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) UpdateSender(req *http.Request) (future ExtensionsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) UpdateResponder(resp *http.Response) (result Extension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/azurestackhci/mgmt/2022-01-01/azurestackhci/models.go b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/models.go new file mode 100644 index 000000000000..69022bfbd1c8 --- /dev/null +++ b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/models.go @@ -0,0 +1,1473 @@ +package azurestackhci + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2022-01-01/azurestackhci" + +// ArcSetting arcSetting details. +type ArcSetting struct { + autorest.Response `json:"-"` + // SystemData - READ-ONLY; System data of ArcSetting resource + *SystemData `json:"systemData,omitempty"` + // ArcSettingProperties - ArcSetting properties. + *ArcSettingProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ArcSetting. +func (as ArcSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if as.ArcSettingProperties != nil { + objectMap["properties"] = as.ArcSettingProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ArcSetting struct. +func (as *ArcSetting) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + as.SystemData = &systemData + } + case "properties": + if v != nil { + var arcSettingProperties ArcSettingProperties + err = json.Unmarshal(*v, &arcSettingProperties) + if err != nil { + return err + } + as.ArcSettingProperties = &arcSettingProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + as.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + as.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + as.Type = &typeVar + } + } + } + + return nil +} + +// ArcSettingList list of ArcSetting proxy resources for the HCI cluster. +type ArcSettingList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of ArcSetting proxy resources. + Value *[]ArcSetting `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ArcSettingList. +func (asl ArcSettingList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ArcSettingListIterator provides access to a complete listing of ArcSetting values. +type ArcSettingListIterator struct { + i int + page ArcSettingListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ArcSettingListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ArcSettingListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ArcSettingListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ArcSettingListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ArcSettingListIterator) Response() ArcSettingList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ArcSettingListIterator) Value() ArcSetting { + if !iter.page.NotDone() { + return ArcSetting{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ArcSettingListIterator type. +func NewArcSettingListIterator(page ArcSettingListPage) ArcSettingListIterator { + return ArcSettingListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (asl ArcSettingList) IsEmpty() bool { + return asl.Value == nil || len(*asl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (asl ArcSettingList) hasNextLink() bool { + return asl.NextLink != nil && len(*asl.NextLink) != 0 +} + +// arcSettingListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (asl ArcSettingList) arcSettingListPreparer(ctx context.Context) (*http.Request, error) { + if !asl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(asl.NextLink))) +} + +// ArcSettingListPage contains a page of ArcSetting values. +type ArcSettingListPage struct { + fn func(context.Context, ArcSettingList) (ArcSettingList, error) + asl ArcSettingList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ArcSettingListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ArcSettingListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.asl) + if err != nil { + return err + } + page.asl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ArcSettingListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ArcSettingListPage) NotDone() bool { + return !page.asl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ArcSettingListPage) Response() ArcSettingList { + return page.asl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ArcSettingListPage) Values() []ArcSetting { + if page.asl.IsEmpty() { + return nil + } + return *page.asl.Value +} + +// Creates a new instance of the ArcSettingListPage type. +func NewArcSettingListPage(cur ArcSettingList, getNextPage func(context.Context, ArcSettingList) (ArcSettingList, error)) ArcSettingListPage { + return ArcSettingListPage{ + fn: getNextPage, + asl: cur, + } +} + +// ArcSettingProperties arcSetting properties. +type ArcSettingProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the ArcSetting proxy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateAccepted', 'ProvisioningStateProvisioning' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ArcInstanceResourceGroup - The resource group that hosts the Arc agents, ie. Hybrid Compute Machine resources. + ArcInstanceResourceGroup *string `json:"arcInstanceResourceGroup,omitempty"` + // AggregateState - READ-ONLY; Aggregate state of Arc agent across the nodes in this HCI cluster. Possible values include: 'NotSpecified', 'Error', 'Succeeded', 'Canceled', 'Failed', 'Connected', 'Disconnected', 'Deleted', 'Creating', 'Updating', 'Deleting', 'Moving', 'PartiallySucceeded', 'PartiallyConnected', 'InProgress' + AggregateState ArcSettingAggregateState `json:"aggregateState,omitempty"` + // PerNodeDetails - READ-ONLY; State of Arc agent in each of the nodes. + PerNodeDetails *[]PerNodeState `json:"perNodeDetails,omitempty"` +} + +// MarshalJSON is the custom marshaler for ArcSettingProperties. +func (asp ArcSettingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asp.ArcInstanceResourceGroup != nil { + objectMap["arcInstanceResourceGroup"] = asp.ArcInstanceResourceGroup + } + return json.Marshal(objectMap) +} + +// ArcSettingsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ArcSettingsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ArcSettingsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ArcSettingsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ArcSettingsDeleteFuture.Result. +func (future *ArcSettingsDeleteFuture) result(client ArcSettingsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ArcSettingsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("azurestackhci.ArcSettingsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Cluster cluster details. +type Cluster struct { + autorest.Response `json:"-"` + // SystemData - READ-ONLY; System data of Cluster resource + *SystemData `json:"systemData,omitempty"` + // ClusterProperties - Cluster properties. + *ClusterProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Cluster. +func (c Cluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.ClusterProperties != nil { + objectMap["properties"] = c.ClusterProperties + } + if c.Tags != nil { + objectMap["tags"] = c.Tags + } + if c.Location != nil { + objectMap["location"] = c.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Cluster struct. +func (c *Cluster) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + c.SystemData = &systemData + } + case "properties": + if v != nil { + var clusterProperties ClusterProperties + err = json.Unmarshal(*v, &clusterProperties) + if err != nil { + return err + } + c.ClusterProperties = &clusterProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + c.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + c.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + c.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + c.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + c.Type = &typeVar + } + } + } + + return nil +} + +// ClusterDesiredProperties desired properties of the cluster. +type ClusterDesiredProperties struct { + // WindowsServerSubscription - Desired state of Windows Server Subscription. Possible values include: 'WindowsServerSubscriptionDisabled', 'WindowsServerSubscriptionEnabled' + WindowsServerSubscription WindowsServerSubscription `json:"windowsServerSubscription,omitempty"` + // DiagnosticLevel - Desired level of diagnostic data emitted by the cluster. Possible values include: 'Off', 'Basic', 'Enhanced' + DiagnosticLevel DiagnosticLevel `json:"diagnosticLevel,omitempty"` +} + +// ClusterList list of clusters. +type ClusterList struct { + autorest.Response `json:"-"` + // Value - List of clusters. + Value *[]Cluster `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterList. +func (cl ClusterList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cl.Value != nil { + objectMap["value"] = cl.Value + } + return json.Marshal(objectMap) +} + +// ClusterListIterator provides access to a complete listing of Cluster values. +type ClusterListIterator struct { + i int + page ClusterListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ClusterListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ClusterListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ClusterListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ClusterListIterator) Response() ClusterList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ClusterListIterator) Value() Cluster { + if !iter.page.NotDone() { + return Cluster{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ClusterListIterator type. +func NewClusterListIterator(page ClusterListPage) ClusterListIterator { + return ClusterListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cl ClusterList) IsEmpty() bool { + return cl.Value == nil || len(*cl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cl ClusterList) hasNextLink() bool { + return cl.NextLink != nil && len(*cl.NextLink) != 0 +} + +// clusterListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cl ClusterList) clusterListPreparer(ctx context.Context) (*http.Request, error) { + if !cl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cl.NextLink))) +} + +// ClusterListPage contains a page of Cluster values. +type ClusterListPage struct { + fn func(context.Context, ClusterList) (ClusterList, error) + cl ClusterList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ClusterListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cl) + if err != nil { + return err + } + page.cl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ClusterListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ClusterListPage) NotDone() bool { + return !page.cl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ClusterListPage) Response() ClusterList { + return page.cl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ClusterListPage) Values() []Cluster { + if page.cl.IsEmpty() { + return nil + } + return *page.cl.Value +} + +// Creates a new instance of the ClusterListPage type. +func NewClusterListPage(cur ClusterList, getNextPage func(context.Context, ClusterList) (ClusterList, error)) ClusterListPage { + return ClusterListPage{ + fn: getNextPage, + cl: cur, + } +} + +// ClusterNode cluster node details. +type ClusterNode struct { + // Name - READ-ONLY; Name of the cluster node. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; Id of the node in the cluster. + ID *float64 `json:"id,omitempty"` + // WindowsServerSubscription - READ-ONLY; State of Windows Server Subscription. Possible values include: 'WindowsServerSubscriptionDisabled', 'WindowsServerSubscriptionEnabled' + WindowsServerSubscription WindowsServerSubscription `json:"windowsServerSubscription,omitempty"` + // Manufacturer - READ-ONLY; Manufacturer of the cluster node hardware. + Manufacturer *string `json:"manufacturer,omitempty"` + // Model - READ-ONLY; Model name of the cluster node hardware. + Model *string `json:"model,omitempty"` + // OsName - READ-ONLY; Operating system running on the cluster node. + OsName *string `json:"osName,omitempty"` + // OsVersion - READ-ONLY; Version of the operating system running on the cluster node. + OsVersion *string `json:"osVersion,omitempty"` + // SerialNumber - READ-ONLY; Immutable id of the cluster node. + SerialNumber *string `json:"serialNumber,omitempty"` + // CoreCount - READ-ONLY; Number of physical cores on the cluster node. + CoreCount *float64 `json:"coreCount,omitempty"` + // MemoryInGiB - READ-ONLY; Total available memory on the cluster node (in GiB). + MemoryInGiB *float64 `json:"memoryInGiB,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterNode. +func (cn ClusterNode) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ClusterPatch cluster details to update. +type ClusterPatch struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ClusterPatchProperties - Cluster properties. + *ClusterPatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterPatch. +func (cp ClusterPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.Tags != nil { + objectMap["tags"] = cp.Tags + } + if cp.ClusterPatchProperties != nil { + objectMap["properties"] = cp.ClusterPatchProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ClusterPatch struct. +func (cp *ClusterPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cp.Tags = tags + } + case "properties": + if v != nil { + var clusterPatchProperties ClusterPatchProperties + err = json.Unmarshal(*v, &clusterPatchProperties) + if err != nil { + return err + } + cp.ClusterPatchProperties = &clusterPatchProperties + } + } + } + + return nil +} + +// ClusterPatchProperties cluster properties. +type ClusterPatchProperties struct { + // CloudManagementEndpoint - Endpoint configured for management from the Azure portal + CloudManagementEndpoint *string `json:"cloudManagementEndpoint,omitempty"` + // AadClientID - App id of cluster AAD identity. + AadClientID *string `json:"aadClientId,omitempty"` + // AadTenantID - Tenant id of cluster AAD identity. + AadTenantID *string `json:"aadTenantId,omitempty"` + // DesiredProperties - Desired properties of the cluster. + DesiredProperties *ClusterDesiredProperties `json:"desiredProperties,omitempty"` +} + +// ClusterProperties cluster properties. +type ClusterProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateAccepted', 'ProvisioningStateProvisioning' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Status - READ-ONLY; Status of the cluster agent. Possible values include: 'StatusNotYetRegistered', 'StatusConnectedRecently', 'StatusNotConnectedRecently', 'StatusDisconnected', 'StatusError' + Status Status `json:"status,omitempty"` + // CloudID - READ-ONLY; Unique, immutable resource id. + CloudID *string `json:"cloudId,omitempty"` + // CloudManagementEndpoint - Endpoint configured for management from the Azure portal. + CloudManagementEndpoint *string `json:"cloudManagementEndpoint,omitempty"` + // AadClientID - App id of cluster AAD identity. + AadClientID *string `json:"aadClientId,omitempty"` + // AadTenantID - Tenant id of cluster AAD identity. + AadTenantID *string `json:"aadTenantId,omitempty"` + // DesiredProperties - Desired properties of the cluster. + DesiredProperties *ClusterDesiredProperties `json:"desiredProperties,omitempty"` + // ReportedProperties - READ-ONLY; Properties reported by cluster agent. + ReportedProperties *ClusterReportedProperties `json:"reportedProperties,omitempty"` + // TrialDaysRemaining - READ-ONLY; Number of days remaining in the trial period. + TrialDaysRemaining *float64 `json:"trialDaysRemaining,omitempty"` + // BillingModel - READ-ONLY; Type of billing applied to the resource. + BillingModel *string `json:"billingModel,omitempty"` + // RegistrationTimestamp - READ-ONLY; First cluster sync timestamp. + RegistrationTimestamp *date.Time `json:"registrationTimestamp,omitempty"` + // LastSyncTimestamp - READ-ONLY; Most recent cluster sync timestamp. + LastSyncTimestamp *date.Time `json:"lastSyncTimestamp,omitempty"` + // LastBillingTimestamp - READ-ONLY; Most recent billing meter timestamp. + LastBillingTimestamp *date.Time `json:"lastBillingTimestamp,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterProperties. +func (cp ClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.CloudManagementEndpoint != nil { + objectMap["cloudManagementEndpoint"] = cp.CloudManagementEndpoint + } + if cp.AadClientID != nil { + objectMap["aadClientId"] = cp.AadClientID + } + if cp.AadTenantID != nil { + objectMap["aadTenantId"] = cp.AadTenantID + } + if cp.DesiredProperties != nil { + objectMap["desiredProperties"] = cp.DesiredProperties + } + return json.Marshal(objectMap) +} + +// ClusterReportedProperties properties reported by cluster agent. +type ClusterReportedProperties struct { + // ClusterName - READ-ONLY; Name of the on-prem cluster connected to this resource. + ClusterName *string `json:"clusterName,omitempty"` + // ClusterID - READ-ONLY; Unique id generated by the on-prem cluster. + ClusterID *string `json:"clusterId,omitempty"` + // ClusterVersion - READ-ONLY; Version of the cluster software. + ClusterVersion *string `json:"clusterVersion,omitempty"` + // Nodes - READ-ONLY; List of nodes reported by the cluster. + Nodes *[]ClusterNode `json:"nodes,omitempty"` + // LastUpdated - READ-ONLY; Last time the cluster reported the data. + LastUpdated *date.Time `json:"lastUpdated,omitempty"` + // ImdsAttestation - READ-ONLY; IMDS attestation status of the cluster. Possible values include: 'Disabled', 'Enabled' + ImdsAttestation ImdsAttestation `json:"imdsAttestation,omitempty"` + // DiagnosticLevel - Level of diagnostic data emitted by the cluster. Possible values include: 'Off', 'Basic', 'Enhanced' + DiagnosticLevel DiagnosticLevel `json:"diagnosticLevel,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterReportedProperties. +func (crp ClusterReportedProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if crp.DiagnosticLevel != "" { + objectMap["diagnosticLevel"] = crp.DiagnosticLevel + } + return json.Marshal(objectMap) +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// Extension details of a particular extension in HCI Cluster. +type Extension struct { + autorest.Response `json:"-"` + // SystemData - READ-ONLY; System data of Extension resource. + *SystemData `json:"systemData,omitempty"` + // ExtensionProperties - Describes Machine Extension Properties. + *ExtensionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Extension. +func (e Extension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionProperties != nil { + objectMap["properties"] = e.ExtensionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Extension struct. +func (e *Extension) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + e.SystemData = &systemData + } + case "properties": + if v != nil { + var extensionProperties ExtensionProperties + err = json.Unmarshal(*v, &extensionProperties) + if err != nil { + return err + } + e.ExtensionProperties = &extensionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + e.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + e.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + e.Type = &typeVar + } + } + } + + return nil +} + +// ExtensionList list of Extensions in HCI cluster. +type ExtensionList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Extensions in HCI cluster. + Value *[]Extension `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionList. +func (el ExtensionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionListIterator provides access to a complete listing of Extension values. +type ExtensionListIterator struct { + i int + page ExtensionListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExtensionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExtensionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExtensionListIterator) Response() ExtensionList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExtensionListIterator) Value() Extension { + if !iter.page.NotDone() { + return Extension{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionListIterator type. +func NewExtensionListIterator(page ExtensionListPage) ExtensionListIterator { + return ExtensionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (el ExtensionList) IsEmpty() bool { + return el.Value == nil || len(*el.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (el ExtensionList) hasNextLink() bool { + return el.NextLink != nil && len(*el.NextLink) != 0 +} + +// extensionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (el ExtensionList) extensionListPreparer(ctx context.Context) (*http.Request, error) { + if !el.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(el.NextLink))) +} + +// ExtensionListPage contains a page of Extension values. +type ExtensionListPage struct { + fn func(context.Context, ExtensionList) (ExtensionList, error) + el ExtensionList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExtensionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.el) + if err != nil { + return err + } + page.el = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExtensionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionListPage) NotDone() bool { + return !page.el.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionListPage) Response() ExtensionList { + return page.el +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionListPage) Values() []Extension { + if page.el.IsEmpty() { + return nil + } + return *page.el.Value +} + +// Creates a new instance of the ExtensionListPage type. +func NewExtensionListPage(cur ExtensionList, getNextPage func(context.Context, ExtensionList) (ExtensionList, error)) ExtensionListPage { + return ExtensionListPage{ + fn: getNextPage, + el: cur, + } +} + +// ExtensionParameters describes the properties of a Machine Extension. This object mirrors the definition +// in HybridCompute. +type ExtensionParameters struct { + // ForceUpdateTag - How the extension handler should be forced to update even if the extension configuration has not changed. + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + // Publisher - The name of the extension handler publisher. + Publisher *string `json:"publisher,omitempty"` + // Type - Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + // TypeHandlerVersion - Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // Settings - Json formatted public settings for the extension. + Settings interface{} `json:"settings,omitempty"` + // ProtectedSettings - Protected settings (may contain secrets). + ProtectedSettings interface{} `json:"protectedSettings,omitempty"` +} + +// ExtensionProperties status of Arc Extension for a particular node in HCI Cluster. +type ExtensionProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the Extension proxy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateAccepted', 'ProvisioningStateProvisioning' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ExtensionParameters - Parameters specific to this extension type. + *ExtensionParameters `json:"extensionParameters,omitempty"` + // AggregateState - READ-ONLY; Aggregate state of Arc Extensions across the nodes in this HCI cluster. Possible values include: 'ExtensionAggregateStateNotSpecified', 'ExtensionAggregateStateError', 'ExtensionAggregateStateSucceeded', 'ExtensionAggregateStateCanceled', 'ExtensionAggregateStateFailed', 'ExtensionAggregateStateConnected', 'ExtensionAggregateStateDisconnected', 'ExtensionAggregateStateDeleted', 'ExtensionAggregateStateCreating', 'ExtensionAggregateStateUpdating', 'ExtensionAggregateStateDeleting', 'ExtensionAggregateStateMoving', 'ExtensionAggregateStatePartiallySucceeded', 'ExtensionAggregateStatePartiallyConnected', 'ExtensionAggregateStateInProgress' + AggregateState ExtensionAggregateState `json:"aggregateState,omitempty"` + // PerNodeExtensionDetails - READ-ONLY; State of Arc Extension in each of the nodes. + PerNodeExtensionDetails *[]PerNodeExtensionState `json:"perNodeExtensionDetails,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionProperties. +func (ep ExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ep.ExtensionParameters != nil { + objectMap["extensionParameters"] = ep.ExtensionParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExtensionProperties struct. +func (ep *ExtensionProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "provisioningState": + if v != nil { + var provisioningState ProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + ep.ProvisioningState = provisioningState + } + case "extensionParameters": + if v != nil { + var extensionParameters ExtensionParameters + err = json.Unmarshal(*v, &extensionParameters) + if err != nil { + return err + } + ep.ExtensionParameters = &extensionParameters + } + case "aggregateState": + if v != nil { + var aggregateState ExtensionAggregateState + err = json.Unmarshal(*v, &aggregateState) + if err != nil { + return err + } + ep.AggregateState = aggregateState + } + case "perNodeExtensionDetails": + if v != nil { + var perNodeExtensionDetails []PerNodeExtensionState + err = json.Unmarshal(*v, &perNodeExtensionDetails) + if err != nil { + return err + } + ep.PerNodeExtensionDetails = &perNodeExtensionDetails + } + } + } + + return nil +} + +// ExtensionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExtensionsCreateFuture.Result. +func (future *ExtensionsCreateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("azurestackhci.ExtensionsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.CreateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsCreateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExtensionsDeleteFuture.Result. +func (future *ExtensionsDeleteFuture) result(client ExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("azurestackhci.ExtensionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExtensionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExtensionsUpdateFuture.Result. +func (future *ExtensionsUpdateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("azurestackhci.ExtensionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.UpdateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.ExtensionsUpdateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// Operation details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Name - READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + Name *string `json:"name,omitempty"` + // IsDataAction - READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - Localized display information for this particular operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". Possible values include: 'OriginUser', 'OriginSystem', 'OriginUsersystem' + Origin Origin `json:"origin,omitempty"` + // ActionType - READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: 'Internal' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Display != nil { + objectMap["display"] = o.Display + } + return json.Marshal(objectMap) +} + +// OperationDisplay localized display information for this particular operation. +type OperationDisplay struct { + // Provider - READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + Provider *string `json:"provider,omitempty"` + // Resource - READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + Resource *string `json:"resource,omitempty"` + // Operation - READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + Operation *string `json:"operation,omitempty"` + // Description - READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationListResult a list of REST API operations supported by an Azure Resource Provider. It contains +// an URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of operations supported by the resource provider + Value *[]Operation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationListResult. +func (olr OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PerNodeExtensionState status of Arc Extension for a particular node in HCI Cluster. +type PerNodeExtensionState struct { + // Name - READ-ONLY; Name of the node in HCI Cluster. + Name *string `json:"name,omitempty"` + // Extension - READ-ONLY; Fully qualified resource ID for the particular Arc Extension on this node. + Extension *string `json:"extension,omitempty"` + // State - READ-ONLY; State of Arc Extension in this node. Possible values include: 'NodeExtensionStateNotSpecified', 'NodeExtensionStateError', 'NodeExtensionStateSucceeded', 'NodeExtensionStateCanceled', 'NodeExtensionStateFailed', 'NodeExtensionStateConnected', 'NodeExtensionStateDisconnected', 'NodeExtensionStateDeleted', 'NodeExtensionStateCreating', 'NodeExtensionStateUpdating', 'NodeExtensionStateDeleting', 'NodeExtensionStateMoving' + State NodeExtensionState `json:"state,omitempty"` +} + +// MarshalJSON is the custom marshaler for PerNodeExtensionState. +func (pnes PerNodeExtensionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PerNodeState status of Arc agent for a particular node in HCI Cluster. +type PerNodeState struct { + // Name - READ-ONLY; Name of the Node in HCI Cluster + Name *string `json:"name,omitempty"` + // ArcInstance - READ-ONLY; Fully qualified resource ID for the Arc agent of this node. + ArcInstance *string `json:"arcInstance,omitempty"` + // State - READ-ONLY; State of Arc agent in this node. Possible values include: 'NodeArcStateNotSpecified', 'NodeArcStateError', 'NodeArcStateSucceeded', 'NodeArcStateCanceled', 'NodeArcStateFailed', 'NodeArcStateConnected', 'NodeArcStateDisconnected', 'NodeArcStateDeleted', 'NodeArcStateCreating', 'NodeArcStateUpdating', 'NodeArcStateDeleting', 'NodeArcStateMoving' + State NodeArcState `json:"state,omitempty"` +} + +// MarshalJSON is the custom marshaler for PerNodeState. +func (pns PerNodeState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} diff --git a/services/azurestackhci/mgmt/2022-01-01/azurestackhci/operations.go b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/operations.go new file mode 100644 index 000000000000..25b13941ac83 --- /dev/null +++ b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/operations.go @@ -0,0 +1,98 @@ +package azurestackhci + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the azure Stack HCI management service +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all available Microsoft.AzureStackHCI provider operations +func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.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) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurestackhci.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurestackhci.OperationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.AzureStackHCI/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/azurestackhci/mgmt/2022-01-01/azurestackhci/version.go b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/version.go new file mode 100644 index 000000000000..4cc294d6a6cc --- /dev/null +++ b/services/azurestackhci/mgmt/2022-01-01/azurestackhci/version.go @@ -0,0 +1,19 @@ +package azurestackhci + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " azurestackhci/2022-01-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/CHANGELOG.md b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/CHANGELOG.md +++ b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/_meta.json b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/_meta.json index 5bd781a802a5..12ff75a4fea0 100644 --- a/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/_meta.json +++ b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "57738094303195dca7e576b4dec8fa0cb79d487e", "readme": "/_/azure-rest-api-specs/specification/azurestackhci/resource-manager/readme.md", "tag": "package-2020-03-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/clusters.go b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/clusters.go index 7af93a1eb29d..96a24d59876e 100644 --- a/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/clusters.go +++ b/services/preview/azurestackhci/mgmt/2020-03-01-preview/azurestackhci/clusters.go @@ -52,8 +52,7 @@ func (client ClustersClient) Create(ctx context.Context, resourceGroupName strin Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: cluster, Constraints: []validation.Constraint{{Target: "cluster.ClusterProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "cluster.ClusterProperties.AadClientID", Name: validation.Null, Rule: true, Chain: nil}, @@ -145,8 +144,7 @@ func (client ClustersClient) Delete(ctx context.Context, resourceGroupName strin Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("azurestackhci.ClustersClient", "Delete", err.Error()) } @@ -230,8 +228,7 @@ func (client ClustersClient) Get(ctx context.Context, resourceGroupName string, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("azurestackhci.ClustersClient", "Get", err.Error()) } @@ -434,8 +431,7 @@ func (client ClustersClient) ListByResourceGroup(ctx context.Context, resourceGr Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("azurestackhci.ClustersClient", "ListByResourceGroup", err.Error()) } @@ -562,8 +558,7 @@ func (client ClustersClient) Update(ctx context.Context, resourceGroupName strin Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("azurestackhci.ClustersClient", "Update", err.Error()) } diff --git a/services/preview/azurestackhci/mgmt/2021-01-01-preview/azurestackhci/CHANGELOG.md b/services/preview/azurestackhci/mgmt/2021-01-01-preview/azurestackhci/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/azurestackhci/mgmt/2021-01-01-preview/azurestackhci/CHANGELOG.md +++ b/services/preview/azurestackhci/mgmt/2021-01-01-preview/azurestackhci/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/azurestackhci/mgmt/2021-01-01-preview/azurestackhci/_meta.json b/services/preview/azurestackhci/mgmt/2021-01-01-preview/azurestackhci/_meta.json index 88c6a6efb598..aa83351429fd 100644 --- a/services/preview/azurestackhci/mgmt/2021-01-01-preview/azurestackhci/_meta.json +++ b/services/preview/azurestackhci/mgmt/2021-01-01-preview/azurestackhci/_meta.json @@ -1,5 +1,5 @@ { - "commit": "8dff86df71bee429af84ea4713288ef3cdd1db2f", + "commit": "57738094303195dca7e576b4dec8fa0cb79d487e", "readme": "/_/azure-rest-api-specs/specification/azurestackhci/resource-manager/readme.md", "tag": "package-preview-2021-01", "use": "@microsoft.azure/autorest.go@2.1.187",