diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md b/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md index 6f7c91a290d5..9eea04b8bfc1 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md @@ -1,5 +1,162 @@ # Release History +## 1.1.0 (2022-10-01) +### Features Added + +- New const `StateDownloading` +- New const `UpdateSummariesPropertiesStateAppliedSuccessfully` +- New const `UpdateRunPropertiesStateInProgress` +- New const `StatePreparationFailed` +- New const `AvailabilityTypeOnline` +- New const `SoftwareAssuranceStatusEnabled` +- New const `StateHealthCheckFailed` +- New const `StateScanInProgress` +- New const `StateInstalling` +- New const `ClusterNodeTypeThirdParty` +- New const `UpdateSummariesPropertiesStateUpdateInProgress` +- New const `UpdateRunPropertiesStateSucceeded` +- New const `StateInstallationFailed` +- New const `UpdateSummariesPropertiesStateUnknown` +- New const `SoftwareAssuranceIntentEnable` +- New const `UpdateSummariesPropertiesStateUpdateFailed` +- New const `AvailabilityTypeNotify` +- New const `UpdateSummariesPropertiesStatePreparationFailed` +- New const `UpdateSummariesPropertiesStateUpdateAvailable` +- New const `ManagedServiceIdentityTypeNone` +- New const `StateInstalled` +- New const `ManagedServiceIdentityTypeSystemAssignedUserAssigned` +- New const `StatePreparing` +- New const `StateReadyToInstall` +- New const `StateDownloadFailed` +- New const `StateObsolete` +- New const `ManagedServiceIdentityTypeSystemAssigned` +- New const `StateRecalled` +- New const `StateScanFailed` +- New const `StateHasPrerequisite` +- New const `StateInvalid` +- New const `StateReady` +- New const `ClusterNodeTypeFirstParty` +- New const `UpdateRunPropertiesStateUnknown` +- New const `UpdateSummariesPropertiesStatePreparationInProgress` +- New const `AvailabilityTypeLocal` +- New const `ManagedServiceIdentityTypeUserAssigned` +- New const `SoftwareAssuranceIntentDisable` +- New const `UpdateRunPropertiesStateFailed` +- New const `SoftwareAssuranceStatusDisabled` +- New const `StateNotApplicableBecauseAnotherUpdateIsInProgress` +- New const `UpdateSummariesPropertiesStateNeedsAttention` +- New const `StateHealthChecking` +- New type alias `UpdateSummariesPropertiesState` +- New type alias `SoftwareAssuranceIntent` +- New type alias `SoftwareAssuranceStatus` +- New type alias `ManagedServiceIdentityType` +- New type alias `UpdateRunPropertiesState` +- New type alias `State` +- New type alias `AvailabilityType` +- New type alias `ClusterNodeType` +- New function `*SKUsClient.NewListByOfferPager(string, string, string, string, *SKUsClientListByOfferOptions) *runtime.Pager[SKUsClientListByOfferResponse]` +- New function `PossibleClusterNodeTypeValues() []ClusterNodeType` +- New function `NewOffersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OffersClient, error)` +- New function `PossibleAvailabilityTypeValues() []AvailabilityType` +- New function `*SKUsClient.Get(context.Context, string, string, string, string, string, *SKUsClientGetOptions) (SKUsClientGetResponse, error)` +- New function `NewSKUsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SKUsClient, error)` +- New function `*UpdateRunsClient.Get(context.Context, string, string, string, string, *UpdateRunsClientGetOptions) (UpdateRunsClientGetResponse, error)` +- New function `*OffersClient.NewListByPublisherPager(string, string, string, *OffersClientListByPublisherOptions) *runtime.Pager[OffersClientListByPublisherResponse]` +- New function `*OffersClient.Get(context.Context, string, string, string, string, *OffersClientGetOptions) (OffersClientGetResponse, error)` +- New function `*UpdatesClient.Get(context.Context, string, string, string, *UpdatesClientGetOptions) (UpdatesClientGetResponse, error)` +- New function `*PublishersClient.Get(context.Context, string, string, string, *PublishersClientGetOptions) (PublishersClientGetResponse, error)` +- New function `PossibleSoftwareAssuranceIntentValues() []SoftwareAssuranceIntent` +- New function `*PublishersClient.NewListByClusterPager(string, string, *PublishersClientListByClusterOptions) *runtime.Pager[PublishersClientListByClusterResponse]` +- New function `*UpdatesClient.NewListPager(string, string, *UpdatesClientListOptions) *runtime.Pager[UpdatesClientListResponse]` +- New function `*UpdateSummariesClient.Get(context.Context, string, string, *UpdateSummariesClientGetOptions) (UpdateSummariesClientGetResponse, error)` +- New function `NewUpdatesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*UpdatesClient, error)` +- New function `*OffersClient.NewListByClusterPager(string, string, *OffersClientListByClusterOptions) *runtime.Pager[OffersClientListByClusterResponse]` +- New function `PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType` +- New function `NewUpdateSummariesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*UpdateSummariesClient, error)` +- New function `*ClustersClient.BeginExtendSoftwareAssuranceBenefit(context.Context, string, string, SoftwareAssuranceChangeRequest, *ClustersClientBeginExtendSoftwareAssuranceBenefitOptions) (*runtime.Poller[ClustersClientExtendSoftwareAssuranceBenefitResponse], error)` +- New function `*UpdateRunsClient.NewListPager(string, string, string, *UpdateRunsClientListOptions) *runtime.Pager[UpdateRunsClientListResponse]` +- New function `PossibleStateValues() []State` +- New function `PossibleSoftwareAssuranceStatusValues() []SoftwareAssuranceStatus` +- New function `*UpdateSummariesClient.NewListPager(string, string, *UpdateSummariesClientListOptions) *runtime.Pager[UpdateSummariesClientListResponse]` +- New function `PossibleUpdateSummariesPropertiesStateValues() []UpdateSummariesPropertiesState` +- New function `NewPublishersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PublishersClient, error)` +- New function `PossibleUpdateRunPropertiesStateValues() []UpdateRunPropertiesState` +- New function `NewUpdateRunsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*UpdateRunsClient, error)` +- New function `*UpdatesClient.BeginPost(context.Context, string, string, string, *UpdatesClientBeginPostOptions) (*runtime.Poller[UpdatesClientPostResponse], error)` +- New struct `ClustersClientBeginExtendSoftwareAssuranceBenefitOptions` +- New struct `ClustersClientExtendSoftwareAssuranceBenefitResponse` +- New struct `ManagedServiceIdentity` +- New struct `Offer` +- New struct `OfferList` +- New struct `OfferProperties` +- New struct `OffersClient` +- New struct `OffersClientGetOptions` +- New struct `OffersClientGetResponse` +- New struct `OffersClientListByClusterOptions` +- New struct `OffersClientListByClusterResponse` +- New struct `OffersClientListByPublisherOptions` +- New struct `OffersClientListByPublisherResponse` +- New struct `PackageVersionInfo` +- New struct `Publisher` +- New struct `PublisherList` +- New struct `PublisherProperties` +- New struct `PublishersClient` +- New struct `PublishersClientGetOptions` +- New struct `PublishersClientGetResponse` +- New struct `PublishersClientListByClusterOptions` +- New struct `PublishersClientListByClusterResponse` +- New struct `SKU` +- New struct `SKUList` +- New struct `SKUMappings` +- New struct `SKUProperties` +- New struct `SKUsClient` +- New struct `SKUsClientGetOptions` +- New struct `SKUsClientGetResponse` +- New struct `SKUsClientListByOfferOptions` +- New struct `SKUsClientListByOfferResponse` +- New struct `SoftwareAssuranceChangeRequest` +- New struct `SoftwareAssuranceChangeRequestProperties` +- New struct `SoftwareAssuranceProperties` +- New struct `Step` +- New struct `Update` +- New struct `UpdateList` +- New struct `UpdatePrerequisite` +- New struct `UpdateProperties` +- New struct `UpdateRun` +- New struct `UpdateRunList` +- New struct `UpdateRunProperties` +- New struct `UpdateRunsClient` +- New struct `UpdateRunsClientGetOptions` +- New struct `UpdateRunsClientGetResponse` +- New struct `UpdateRunsClientListOptions` +- New struct `UpdateRunsClientListResponse` +- New struct `UpdateStateProperties` +- New struct `UpdateSummaries` +- New struct `UpdateSummariesClient` +- New struct `UpdateSummariesClientGetOptions` +- New struct `UpdateSummariesClientGetResponse` +- New struct `UpdateSummariesClientListOptions` +- New struct `UpdateSummariesClientListResponse` +- New struct `UpdateSummariesList` +- New struct `UpdateSummariesProperties` +- New struct `UpdatesClient` +- New struct `UpdatesClientBeginPostOptions` +- New struct `UpdatesClientGetOptions` +- New struct `UpdatesClientGetResponse` +- New struct `UpdatesClientListOptions` +- New struct `UpdatesClientListResponse` +- New struct `UpdatesClientPostResponse` +- New struct `UserAssignedIdentity` +- New field `SystemData` in struct `TrackedResource` +- New field `Identity` in struct `Cluster` +- New field `SystemData` in struct `Resource` +- New field `SoftwareAssuranceProperties` in struct `ClusterProperties` +- New field `OSDisplayVersion` in struct `ClusterNode` +- New field `NodeType` in struct `ClusterNode` +- New field `Identity` in struct `ClusterPatch` +- New field `SystemData` in struct `ProxyResource` + + ## 1.0.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_arcsettings_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/arcsettings_client.go similarity index 97% rename from sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_arcsettings_client.go rename to sdk/resourcemanager/azurestackhci/armazurestackhci/arcsettings_client.go index 970779c5bb14..c73984666b87 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_arcsettings_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/arcsettings_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armazurestackhci @@ -56,7 +57,7 @@ func NewArcSettingsClient(subscriptionID string, credential azcore.TokenCredenti // Create - Create ArcSetting for HCI cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // 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. @@ -101,7 +102,7 @@ func (client *ArcSettingsClient) createCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, arcSetting) @@ -118,7 +119,7 @@ func (client *ArcSettingsClient) createHandleResponse(resp *http.Response) (ArcS // BeginCreateIdentity - Create Aad identity for arc settings. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // 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. @@ -140,7 +141,7 @@ func (client *ArcSettingsClient) BeginCreateIdentity(ctx context.Context, resour // CreateIdentity - Create Aad identity for arc settings. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 func (client *ArcSettingsClient) createIdentity(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginCreateIdentityOptions) (*http.Response, error) { req, err := client.createIdentityCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, options) if err != nil { @@ -180,7 +181,7 @@ func (client *ArcSettingsClient) createIdentityCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,7 +189,7 @@ func (client *ArcSettingsClient) createIdentityCreateRequest(ctx context.Context // BeginDelete - Delete ArcSetting resource details of HCI Cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // 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. @@ -209,7 +210,7 @@ func (client *ArcSettingsClient) BeginDelete(ctx context.Context, resourceGroupN // Delete - Delete ArcSetting resource details of HCI Cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 func (client *ArcSettingsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, options) if err != nil { @@ -249,7 +250,7 @@ func (client *ArcSettingsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -257,7 +258,7 @@ func (client *ArcSettingsClient) deleteCreateRequest(ctx context.Context, resour // GeneratePassword - Generate password for arc settings. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // 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. @@ -302,7 +303,7 @@ func (client *ArcSettingsClient) generatePasswordCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -319,7 +320,7 @@ func (client *ArcSettingsClient) generatePasswordHandleResponse(resp *http.Respo // Get - Get ArcSetting resource details of HCI Cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // 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. @@ -363,7 +364,7 @@ func (client *ArcSettingsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -379,8 +380,7 @@ func (client *ArcSettingsClient) getHandleResponse(resp *http.Response) (ArcSett } // NewListByClusterPager - Get ArcSetting resources of HCI Cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // clusterName - The name of the cluster. // options - ArcSettingsClientListByClusterOptions contains the optional parameters for the ArcSettingsClient.ListByCluster @@ -433,7 +433,7 @@ func (client *ArcSettingsClient) listByClusterCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -450,7 +450,7 @@ func (client *ArcSettingsClient) listByClusterHandleResponse(resp *http.Response // Update - Update ArcSettings for HCI cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // 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. @@ -495,7 +495,7 @@ func (client *ArcSettingsClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, arcSetting) diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/autorest.md b/sdk/resourcemanager/azurestackhci/armazurestackhci/autorest.md index 9072abd17357..1d21aae9b653 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/autorest.md +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurestackhci/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurestackhci/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurestackhci/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 1.1.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_clusters_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/clusters_client.go similarity index 84% rename from sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_clusters_client.go rename to sdk/resourcemanager/azurestackhci/armazurestackhci/clusters_client.go index 41c81e0a8117..0dc46b17930a 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_clusters_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/clusters_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armazurestackhci @@ -56,7 +57,7 @@ func NewClustersClient(subscriptionID string, credential azcore.TokenCredential, // Create - Create an HCI cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // clusterName - The name of the cluster. // cluster - Details of the HCI cluster. @@ -96,7 +97,7 @@ func (client *ClustersClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, cluster) @@ -113,7 +114,7 @@ func (client *ClustersClient) createHandleResponse(resp *http.Response) (Cluster // BeginCreateIdentity - Create cluster identity. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // clusterName - The name of the cluster. // options - ClustersClientBeginCreateIdentityOptions contains the optional parameters for the ClustersClient.BeginCreateIdentity @@ -134,7 +135,7 @@ func (client *ClustersClient) BeginCreateIdentity(ctx context.Context, resourceG // CreateIdentity - Create cluster identity. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 func (client *ClustersClient) createIdentity(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginCreateIdentityOptions) (*http.Response, error) { req, err := client.createIdentityCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { @@ -170,7 +171,7 @@ func (client *ClustersClient) createIdentityCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -178,7 +179,7 @@ func (client *ClustersClient) createIdentityCreateRequest(ctx context.Context, r // BeginDelete - Delete an HCI cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // clusterName - The name of the cluster. // options - ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. @@ -196,7 +197,7 @@ func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete an HCI cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { @@ -232,15 +233,81 @@ func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } +// BeginExtendSoftwareAssuranceBenefit - Extends Software Assurance Benefit to a cluster +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// softwareAssuranceChangeRequest - Software Assurance Change Request Payload +// options - ClustersClientBeginExtendSoftwareAssuranceBenefitOptions contains the optional parameters for the ClustersClient.BeginExtendSoftwareAssuranceBenefit +// method. +func (client *ClustersClient) BeginExtendSoftwareAssuranceBenefit(ctx context.Context, resourceGroupName string, clusterName string, softwareAssuranceChangeRequest SoftwareAssuranceChangeRequest, options *ClustersClientBeginExtendSoftwareAssuranceBenefitOptions) (*runtime.Poller[ClustersClientExtendSoftwareAssuranceBenefitResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.extendSoftwareAssuranceBenefit(ctx, resourceGroupName, clusterName, softwareAssuranceChangeRequest, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ClustersClientExtendSoftwareAssuranceBenefitResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ClustersClientExtendSoftwareAssuranceBenefitResponse](options.ResumeToken, client.pl, nil) + } +} + +// ExtendSoftwareAssuranceBenefit - Extends Software Assurance Benefit to a cluster +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +func (client *ClustersClient) extendSoftwareAssuranceBenefit(ctx context.Context, resourceGroupName string, clusterName string, softwareAssuranceChangeRequest SoftwareAssuranceChangeRequest, options *ClustersClientBeginExtendSoftwareAssuranceBenefitOptions) (*http.Response, error) { + req, err := client.extendSoftwareAssuranceBenefitCreateRequest(ctx, resourceGroupName, clusterName, softwareAssuranceChangeRequest, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// extendSoftwareAssuranceBenefitCreateRequest creates the ExtendSoftwareAssuranceBenefit request. +func (client *ClustersClient) extendSoftwareAssuranceBenefitCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, softwareAssuranceChangeRequest SoftwareAssuranceChangeRequest, options *ClustersClientBeginExtendSoftwareAssuranceBenefitOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/extendSoftwareAssuranceBenefit" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, softwareAssuranceChangeRequest) +} + // Get - Get HCI cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // clusterName - The name of the cluster. // options - ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. @@ -279,7 +346,7 @@ func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -295,8 +362,7 @@ func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersCl } // NewListByResourceGroupPager - List all HCI clusters in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // options - ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.ListByResourceGroup // method. @@ -344,7 +410,7 @@ func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -360,8 +426,7 @@ func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Respo } // NewListBySubscriptionPager - List all HCI clusters in a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // options - ClustersClientListBySubscriptionOptions contains the optional parameters for the ClustersClient.ListBySubscription // method. func (client *ClustersClient) NewListBySubscriptionPager(options *ClustersClientListBySubscriptionOptions) *runtime.Pager[ClustersClientListBySubscriptionResponse] { @@ -404,7 +469,7 @@ func (client *ClustersClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -421,7 +486,7 @@ func (client *ClustersClient) listBySubscriptionHandleResponse(resp *http.Respon // Update - Update an HCI cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // clusterName - The name of the cluster. // cluster - Details of the HCI cluster. @@ -461,7 +526,7 @@ func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, cluster) @@ -478,7 +543,7 @@ func (client *ClustersClient) updateHandleResponse(resp *http.Response) (Cluster // BeginUploadCertificate - Upload certificate. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // clusterName - The name of the cluster. // uploadCertificateRequest - Upload certificate request. @@ -500,7 +565,7 @@ func (client *ClustersClient) BeginUploadCertificate(ctx context.Context, resour // UploadCertificate - Upload certificate. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 func (client *ClustersClient) uploadCertificate(ctx context.Context, resourceGroupName string, clusterName string, uploadCertificateRequest UploadCertificateRequest, options *ClustersClientBeginUploadCertificateOptions) (*http.Response, error) { req, err := client.uploadCertificateCreateRequest(ctx, resourceGroupName, clusterName, uploadCertificateRequest, options) if err != nil { @@ -536,7 +601,7 @@ func (client *ClustersClient) uploadCertificateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, uploadCertificateRequest) diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_constants.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go similarity index 60% rename from sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_constants.go rename to sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go index 85a5ca687d8e..a94e7309d208 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_constants.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go @@ -5,12 +5,13 @@ // 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. +// DO NOT EDIT. package armazurestackhci const ( moduleName = "armazurestackhci" - moduleVersion = "v1.0.0" + moduleVersion = "v1.1.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -69,6 +70,40 @@ func PossibleArcSettingAggregateStateValues() []ArcSettingAggregateState { } } +// AvailabilityType - Indicates the way the update content can be downloaded. +type AvailabilityType string + +const ( + AvailabilityTypeLocal AvailabilityType = "Local" + AvailabilityTypeNotify AvailabilityType = "Notify" + AvailabilityTypeOnline AvailabilityType = "Online" +) + +// PossibleAvailabilityTypeValues returns the possible values for the AvailabilityType const type. +func PossibleAvailabilityTypeValues() []AvailabilityType { + return []AvailabilityType{ + AvailabilityTypeLocal, + AvailabilityTypeNotify, + AvailabilityTypeOnline, + } +} + +// ClusterNodeType - Type of the cluster node hardware. +type ClusterNodeType string + +const ( + ClusterNodeTypeFirstParty ClusterNodeType = "FirstParty" + ClusterNodeTypeThirdParty ClusterNodeType = "ThirdParty" +) + +// PossibleClusterNodeTypeValues returns the possible values for the ClusterNodeType const type. +func PossibleClusterNodeTypeValues() []ClusterNodeType { + return []ClusterNodeType{ + ClusterNodeTypeFirstParty, + ClusterNodeTypeThirdParty, + } +} + // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -165,6 +200,26 @@ func PossibleImdsAttestationValues() []ImdsAttestation { } } +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned, UserAssigned" + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeUserAssigned, + } +} + // NodeArcState - State of Arc agent in this node. type NodeArcState string @@ -278,6 +333,86 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } +// SoftwareAssuranceIntent - Customer Intent for Software Assurance Benefit. +type SoftwareAssuranceIntent string + +const ( + SoftwareAssuranceIntentDisable SoftwareAssuranceIntent = "Disable" + SoftwareAssuranceIntentEnable SoftwareAssuranceIntent = "Enable" +) + +// PossibleSoftwareAssuranceIntentValues returns the possible values for the SoftwareAssuranceIntent const type. +func PossibleSoftwareAssuranceIntentValues() []SoftwareAssuranceIntent { + return []SoftwareAssuranceIntent{ + SoftwareAssuranceIntentDisable, + SoftwareAssuranceIntentEnable, + } +} + +// SoftwareAssuranceStatus - Status of the Software Assurance for the cluster. +type SoftwareAssuranceStatus string + +const ( + SoftwareAssuranceStatusDisabled SoftwareAssuranceStatus = "Disabled" + SoftwareAssuranceStatusEnabled SoftwareAssuranceStatus = "Enabled" +) + +// PossibleSoftwareAssuranceStatusValues returns the possible values for the SoftwareAssuranceStatus const type. +func PossibleSoftwareAssuranceStatusValues() []SoftwareAssuranceStatus { + return []SoftwareAssuranceStatus{ + SoftwareAssuranceStatusDisabled, + SoftwareAssuranceStatusEnabled, + } +} + +// State - State of the update as it relates to this stamp. +type State string + +const ( + StateDownloadFailed State = "DownloadFailed" + StateDownloading State = "Downloading" + StateHasPrerequisite State = "HasPrerequisite" + StateHealthCheckFailed State = "HealthCheckFailed" + StateHealthChecking State = "HealthChecking" + StateInstallationFailed State = "InstallationFailed" + StateInstalled State = "Installed" + StateInstalling State = "Installing" + StateInvalid State = "Invalid" + StateNotApplicableBecauseAnotherUpdateIsInProgress State = "NotApplicableBecauseAnotherUpdateIsInProgress" + StateObsolete State = "Obsolete" + StatePreparationFailed State = "PreparationFailed" + StatePreparing State = "Preparing" + StateReady State = "Ready" + StateReadyToInstall State = "ReadyToInstall" + StateRecalled State = "Recalled" + StateScanFailed State = "ScanFailed" + StateScanInProgress State = "ScanInProgress" +) + +// PossibleStateValues returns the possible values for the State const type. +func PossibleStateValues() []State { + return []State{ + StateDownloadFailed, + StateDownloading, + StateHasPrerequisite, + StateHealthCheckFailed, + StateHealthChecking, + StateInstallationFailed, + StateInstalled, + StateInstalling, + StateInvalid, + StateNotApplicableBecauseAnotherUpdateIsInProgress, + StateObsolete, + StatePreparationFailed, + StatePreparing, + StateReady, + StateReadyToInstall, + StateRecalled, + StateScanFailed, + StateScanInProgress, + } +} + // Status - Status of the cluster agent. type Status string @@ -300,6 +435,54 @@ func PossibleStatusValues() []Status { } } +// UpdateRunPropertiesState - State of the update run. +type UpdateRunPropertiesState string + +const ( + UpdateRunPropertiesStateFailed UpdateRunPropertiesState = "Failed" + UpdateRunPropertiesStateInProgress UpdateRunPropertiesState = "InProgress" + UpdateRunPropertiesStateSucceeded UpdateRunPropertiesState = "Succeeded" + UpdateRunPropertiesStateUnknown UpdateRunPropertiesState = "Unknown" +) + +// PossibleUpdateRunPropertiesStateValues returns the possible values for the UpdateRunPropertiesState const type. +func PossibleUpdateRunPropertiesStateValues() []UpdateRunPropertiesState { + return []UpdateRunPropertiesState{ + UpdateRunPropertiesStateFailed, + UpdateRunPropertiesStateInProgress, + UpdateRunPropertiesStateSucceeded, + UpdateRunPropertiesStateUnknown, + } +} + +// UpdateSummariesPropertiesState - Overall update state of the stamp. +type UpdateSummariesPropertiesState string + +const ( + UpdateSummariesPropertiesStateAppliedSuccessfully UpdateSummariesPropertiesState = "AppliedSuccessfully" + UpdateSummariesPropertiesStateNeedsAttention UpdateSummariesPropertiesState = "NeedsAttention" + UpdateSummariesPropertiesStatePreparationFailed UpdateSummariesPropertiesState = "PreparationFailed" + UpdateSummariesPropertiesStatePreparationInProgress UpdateSummariesPropertiesState = "PreparationInProgress" + UpdateSummariesPropertiesStateUnknown UpdateSummariesPropertiesState = "Unknown" + UpdateSummariesPropertiesStateUpdateAvailable UpdateSummariesPropertiesState = "UpdateAvailable" + UpdateSummariesPropertiesStateUpdateFailed UpdateSummariesPropertiesState = "UpdateFailed" + UpdateSummariesPropertiesStateUpdateInProgress UpdateSummariesPropertiesState = "UpdateInProgress" +) + +// PossibleUpdateSummariesPropertiesStateValues returns the possible values for the UpdateSummariesPropertiesState const type. +func PossibleUpdateSummariesPropertiesStateValues() []UpdateSummariesPropertiesState { + return []UpdateSummariesPropertiesState{ + UpdateSummariesPropertiesStateAppliedSuccessfully, + UpdateSummariesPropertiesStateNeedsAttention, + UpdateSummariesPropertiesStatePreparationFailed, + UpdateSummariesPropertiesStatePreparationInProgress, + UpdateSummariesPropertiesStateUnknown, + UpdateSummariesPropertiesStateUpdateAvailable, + UpdateSummariesPropertiesStateUpdateFailed, + UpdateSummariesPropertiesStateUpdateInProgress, + } +} + // WindowsServerSubscription - Desired state of Windows Server Subscription. type WindowsServerSubscription string diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_extensions_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/extensions_client.go similarity index 97% rename from sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_extensions_client.go rename to sdk/resourcemanager/azurestackhci/armazurestackhci/extensions_client.go index 9a36e328bc39..6eee57f5d45e 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_extensions_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/extensions_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armazurestackhci @@ -56,7 +57,7 @@ func NewExtensionsClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreate - Create Extension for HCI cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // 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. @@ -79,7 +80,7 @@ func (client *ExtensionsClient) BeginCreate(ctx context.Context, resourceGroupNa // Create - Create Extension for HCI cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 func (client *ExtensionsClient) create(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension, options *ExtensionsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extension, options) if err != nil { @@ -123,7 +124,7 @@ func (client *ExtensionsClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extension) @@ -131,7 +132,7 @@ func (client *ExtensionsClient) createCreateRequest(ctx context.Context, resourc // BeginDelete - Delete particular Arc Extension of HCI Cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // 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. @@ -153,7 +154,7 @@ func (client *ExtensionsClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Delete particular Arc Extension of HCI Cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 func (client *ExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *ExtensionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, options) if err != nil { @@ -197,7 +198,7 @@ func (client *ExtensionsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +206,7 @@ func (client *ExtensionsClient) deleteCreateRequest(ctx context.Context, resourc // Get - Get particular Arc Extension of HCI Cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // 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. @@ -254,7 +255,7 @@ func (client *ExtensionsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -270,8 +271,7 @@ func (client *ExtensionsClient) getHandleResponse(resp *http.Response) (Extensio } // NewListByArcSettingPager - List all Extensions under ArcSetting resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // 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. @@ -329,7 +329,7 @@ func (client *ExtensionsClient) listByArcSettingCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -346,7 +346,7 @@ func (client *ExtensionsClient) listByArcSettingHandleResponse(resp *http.Respon // BeginUpdate - Update Extension for HCI cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // 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. @@ -369,7 +369,7 @@ func (client *ExtensionsClient) BeginUpdate(ctx context.Context, resourceGroupNa // Update - Update Extension for HCI cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 func (client *ExtensionsClient) update(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension, options *ExtensionsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extension, options) if err != nil { @@ -413,7 +413,7 @@ func (client *ExtensionsClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extension) diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod index 48c8af4e475c..d7724b31c8aa 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armaz go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_models.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go similarity index 55% rename from sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_models.go rename to sdk/resourcemanager/azurestackhci/armazurestackhci/models.go index 024b3ee258d3..adf4605b5047 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_models.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armazurestackhci @@ -40,7 +41,7 @@ type ArcSetting struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; System data of ArcSetting resource + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -144,6 +145,9 @@ type Cluster struct { // REQUIRED; The geo-location where the resource lives Location *string `json:"location,omitempty"` + // Identity of Cluster resource + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Cluster properties. Properties *ClusterProperties `json:"properties,omitempty"` @@ -156,7 +160,7 @@ type Cluster struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; System data of Cluster resource + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -214,6 +218,12 @@ type ClusterNode struct { // READ-ONLY; Name of the cluster node. Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Type of the cluster node hardware. + NodeType *ClusterNodeType `json:"nodeType,omitempty" azure:"ro"` + + // READ-ONLY; Display version of the operating system running on the cluster node. + OSDisplayVersion *string `json:"osDisplayVersion,omitempty" azure:"ro"` + // READ-ONLY; Operating system running on the cluster node. OSName *string `json:"osName,omitempty" azure:"ro"` @@ -229,6 +239,9 @@ type ClusterNode struct { // ClusterPatch - Cluster details to update. type ClusterPatch struct { + // Identity of Cluster resource + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Cluster properties. Properties *ClusterPatchProperties `json:"properties,omitempty"` @@ -271,6 +284,9 @@ type ClusterProperties struct { // Desired properties of the cluster. DesiredProperties *ClusterDesiredProperties `json:"desiredProperties,omitempty"` + // Software Assurance properties of the cluster. + SoftwareAssuranceProperties *SoftwareAssuranceProperties `json:"softwareAssuranceProperties,omitempty"` + // READ-ONLY; Type of billing applied to the resource. BillingModel *string `json:"billingModel,omitempty" azure:"ro"` @@ -338,6 +354,13 @@ type ClustersClientBeginDeleteOptions struct { ResumeToken string } +// ClustersClientBeginExtendSoftwareAssuranceBenefitOptions contains the optional parameters for the ClustersClient.BeginExtendSoftwareAssuranceBenefit +// method. +type ClustersClientBeginExtendSoftwareAssuranceBenefitOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // ClustersClientBeginUploadCertificateOptions contains the optional parameters for the ClustersClient.BeginUploadCertificate // method. type ClustersClientBeginUploadCertificateOptions struct { @@ -415,7 +438,7 @@ type Extension struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; System data of Extension resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -500,6 +523,89 @@ type ExtensionsClientListByArcSettingOptions struct { // placeholder for future optional parameters } +// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + Type *ManagedServiceIdentityType `json:"type,omitempty"` + + // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM + // resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + // The dictionary values can be empty objects ({}) in + // requests. + UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities,omitempty"` + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + +// Offer details. +type Offer struct { + // Offer properties. + Properties *OfferProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// OfferList - List of Offer proxy resources for the HCI cluster. +type OfferList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; List of Offer proxy resources. + Value []*Offer `json:"value,omitempty" azure:"ro"` +} + +// OfferProperties - Publisher properties. +type OfferProperties struct { + // JSON serialized catalog content of the offer + Content *string `json:"content,omitempty"` + + // The API version of the catalog service used to serve the catalog content + ContentVersion *string `json:"contentVersion,omitempty"` + + // Identifier of the Publisher for the offer + PublisherID *string `json:"publisherId,omitempty"` + + // Array of SKU mappings + SKUMappings []*SKUMappings `json:"skuMappings,omitempty"` + + // READ-ONLY; Provisioning State + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// OffersClientGetOptions contains the optional parameters for the OffersClient.Get method. +type OffersClientGetOptions struct { + // Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + Expand *string +} + +// OffersClientListByClusterOptions contains the optional parameters for the OffersClient.ListByCluster method. +type OffersClientListByClusterOptions struct { + // Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + Expand *string +} + +// OffersClientListByPublisherOptions contains the optional parameters for the OffersClient.ListByPublisher method. +type OffersClientListByPublisherOptions struct { + // Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + Expand *string +} + // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. @@ -554,6 +660,18 @@ type OperationsClientListOptions struct { // placeholder for future optional parameters } +// PackageVersionInfo - Current version of each updatable component. +type PackageVersionInfo struct { + // Last time this component was updated. + LastUpdated *time.Time `json:"lastUpdated,omitempty"` + + // Package type + PackageType *string `json:"packageType,omitempty"` + + // Package version + Version *string `json:"version,omitempty"` +} + type PasswordCredential struct { EndDateTime *time.Time `json:"endDateTime,omitempty"` KeyID *string `json:"keyId,omitempty"` @@ -594,10 +712,56 @@ type ProxyResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// Publisher details. +type Publisher struct { + // Publisher properties. + Properties *PublisherProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } +// PublisherList - List of Publisher proxy resources for the HCI cluster. +type PublisherList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; List of Publisher proxy resources. + Value []*Publisher `json:"value,omitempty" azure:"ro"` +} + +// PublisherProperties - Publisher properties. +type PublisherProperties struct { + // READ-ONLY; Provisioning State + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// PublishersClientGetOptions contains the optional parameters for the PublishersClient.Get method. +type PublishersClientGetOptions struct { + // placeholder for future optional parameters +} + +// PublishersClientListByClusterOptions contains the optional parameters for the PublishersClient.ListByCluster method. +type PublishersClientListByClusterOptions struct { + // placeholder for future optional parameters +} + type RawCertificateData struct { Certificates []*string `json:"certificates,omitempty"` } @@ -610,10 +774,134 @@ type Resource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// SKU - Sku details. +type SKU struct { + // SKU properties. + Properties *SKUProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } +// SKUList - List of SKU proxy resources for the HCI cluster. +type SKUList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; List of SKU proxy resources. + Value []*SKU `json:"value,omitempty" azure:"ro"` +} + +// SKUMappings - SKU Mapping details. +type SKUMappings struct { + // Identifier of the CatalogPlan for the sku + CatalogPlanID *string `json:"catalogPlanId,omitempty"` + + // Identifier for the sku + MarketplaceSKUID *string `json:"marketplaceSkuId,omitempty"` + + // Array of SKU versions available + MarketplaceSKUVersions []*string `json:"marketplaceSkuVersions,omitempty"` +} + +// SKUProperties - SKU properties. +type SKUProperties struct { + // JSON serialized catalog content of the sku offer + Content *string `json:"content,omitempty"` + + // The API version of the catalog service used to serve the catalog content + ContentVersion *string `json:"contentVersion,omitempty"` + + // Identifier of the Offer for the sku + OfferID *string `json:"offerId,omitempty"` + + // Identifier of the Publisher for the offer + PublisherID *string `json:"publisherId,omitempty"` + + // Array of SKU mappings + SKUMappings []*SKUMappings `json:"skuMappings,omitempty"` + + // READ-ONLY; Provisioning State + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// SKUsClientGetOptions contains the optional parameters for the SKUsClient.Get method. +type SKUsClientGetOptions struct { + // Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + Expand *string +} + +// SKUsClientListByOfferOptions contains the optional parameters for the SKUsClient.ListByOffer method. +type SKUsClientListByOfferOptions struct { + // Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + Expand *string +} + +type SoftwareAssuranceChangeRequest struct { + Properties *SoftwareAssuranceChangeRequestProperties `json:"properties,omitempty"` +} + +type SoftwareAssuranceChangeRequestProperties struct { + // Customer Intent for Software Assurance Benefit. + SoftwareAssuranceIntent *SoftwareAssuranceIntent `json:"softwareAssuranceIntent,omitempty"` +} + +// SoftwareAssuranceProperties - Software Assurance properties of the cluster. +type SoftwareAssuranceProperties struct { + // Customer Intent for Software Assurance Benefit. + SoftwareAssuranceIntent *SoftwareAssuranceIntent `json:"softwareAssuranceIntent,omitempty"` + + // Status of the Software Assurance for the cluster. + SoftwareAssuranceStatus *SoftwareAssuranceStatus `json:"softwareAssuranceStatus,omitempty"` + + // READ-ONLY; TimeStamp denoting the latest SA benefit applicability is validated. + LastUpdated *time.Time `json:"lastUpdated,omitempty" azure:"ro"` +} + +// Step - Progress representation of the update run steps. +type Step struct { + // More detailed description of the step. + Description *string `json:"description,omitempty"` + + // When the step reached a terminal state. + EndTimeUTC *time.Time `json:"endTimeUtc,omitempty"` + + // Error message, specified if the step is in a failed state. + ErrorMessage *string `json:"errorMessage,omitempty"` + + // Completion time of this step or the last completed sub-step. + LastUpdatedTimeUTC *time.Time `json:"lastUpdatedTimeUtc,omitempty"` + + // Name of the step. + Name *string `json:"name,omitempty"` + + // When the step started, or empty if it has not started executing. + StartTimeUTC *time.Time `json:"startTimeUtc,omitempty"` + + // Status of the step, bubbled up from the ECE action plan for installation attempts. Values are: 'Success', 'Error', 'InProgress', + // and 'Unknown status' + Status *string `json:"status,omitempty"` + + // Recursive model for child steps of this step. + Steps []*Step `json:"steps,omitempty"` +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -650,10 +938,260 @@ type TrackedResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// Update details +type Update struct { + // The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Update properties + Properties *UpdateProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// UpdateList - List of Updates +type UpdateList struct { + // List of Updates + Value []*Update `json:"value,omitempty"` + + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// UpdatePrerequisite - If update State is HasPrerequisite, this property contains an array of objects describing prerequisite +// updates before installing this update. Otherwise, it is empty. +type UpdatePrerequisite struct { + // Friendly name of the prerequisite. + PackageName *string `json:"packageName,omitempty"` + + // Updatable component type. + UpdateType *string `json:"updateType,omitempty"` + + // Version of the prerequisite. + Version *string `json:"version,omitempty"` +} + +// UpdateProperties - Details of a singular Update in HCI Cluster +type UpdateProperties struct { + // Extensible KV pairs serialized as a string. This is currently used to report the stamp OEM family and hardware model information + // when an update is flagged as Invalid for the stamp based on OEM type. + AdditionalProperties *string `json:"additionalProperties,omitempty"` + + // Indicates the way the update content can be downloaded. + AvailabilityType *AvailabilityType `json:"availabilityType,omitempty"` + + // Description of the update. + Description *string `json:"description,omitempty"` + + // Display name of the Update + DisplayName *string `json:"displayName,omitempty"` + + // Date that the update was installed. + InstalledDate *time.Time `json:"installedDate,omitempty"` + + // Path where the update package is available. + PackagePath *string `json:"packagePath,omitempty"` + + // Size of the package. This value is a combination of the size from update metadata and size of the payload that results + // from the live scan operation for OS update content. + PackageSizeInMb *float32 `json:"packageSizeInMb,omitempty"` + + // Customer-visible type of the update. + PackageType *string `json:"packageType,omitempty"` + + // If update State is HasPrerequisite, this property contains an array of objects describing prerequisite updates before installing + // this update. Otherwise, it is empty. + Prerequisites []*UpdatePrerequisite `json:"prerequisites,omitempty"` + + // Publisher of the update package. + Publisher *string `json:"publisher,omitempty"` + + // Link to release notes for the update. + ReleaseLink *string `json:"releaseLink,omitempty"` + + // State of the update as it relates to this stamp. + State *State `json:"state,omitempty"` + + // Additional information regarding the state of the update. See definition of UpdateStateProperties type below for more details + // on this property. + UpdateStateProperties *UpdateStateProperties `json:"updateStateProperties,omitempty"` + + // Version of the update. + Version *string `json:"version,omitempty"` + + // READ-ONLY; Provisioning state of the Updates proxy resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// UpdateRun - Details of an Update run +type UpdateRun struct { + // The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Describes Update Run Properties. + Properties *UpdateRunProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// UpdateRunList - List of Update runs +type UpdateRunList struct { + // List of Update runs + Value []*UpdateRun `json:"value,omitempty"` + + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// UpdateRunProperties - Properties of an Update run +type UpdateRunProperties struct { + // Duration of the update run. + Duration *string `json:"duration,omitempty"` + + // Progress representation of the update run steps. + Progress *Step `json:"progress,omitempty"` + + // State of the update run. + State *UpdateRunPropertiesState `json:"state,omitempty"` + + // READ-ONLY; Provisioning state of the UpdateRuns proxy resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// UpdateRunsClientGetOptions contains the optional parameters for the UpdateRunsClient.Get method. +type UpdateRunsClientGetOptions struct { + // placeholder for future optional parameters +} + +// UpdateRunsClientListOptions contains the optional parameters for the UpdateRunsClient.List method. +type UpdateRunsClientListOptions struct { + // placeholder for future optional parameters +} + +// UpdateStateProperties - Additional information regarding the state of the update. See definition of UpdateStateProperties +// type below for more details on this property. +type UpdateStateProperties struct { + // Brief message with instructions for updates of AvailabilityType Notify. + NotifyMessage *string `json:"notifyMessage,omitempty"` + + // Progress percentage of ongoing operation. Currently this property is only valid when the update is in the Downloading state, + // where it maps to how much of the update content has been downloaded. + ProgressPercentage *float32 `json:"progressPercentage,omitempty"` +} + +// UpdateSummaries - Get the update summaries for the cluster +type UpdateSummaries struct { + // The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Update summaries properties + Properties *UpdateSummariesProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } +// UpdateSummariesClientGetOptions contains the optional parameters for the UpdateSummariesClient.Get method. +type UpdateSummariesClientGetOptions struct { + // placeholder for future optional parameters +} + +// UpdateSummariesClientListOptions contains the optional parameters for the UpdateSummariesClient.List method. +type UpdateSummariesClientListOptions struct { + // placeholder for future optional parameters +} + +// UpdateSummariesList - List of Update Summaries +type UpdateSummariesList struct { + // List of Update Summaries + Value []*UpdateSummaries `json:"value,omitempty"` + + // READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// UpdateSummariesProperties - Properties of Update summaries +type UpdateSummariesProperties struct { + // Current Solution Bundle version of the stamp. + CurrentVersion *string `json:"currentVersion,omitempty"` + + // Name of the hardware model. + HardwareModel *string `json:"hardwareModel,omitempty"` + + // OEM family name. + OemFamily *string `json:"oemFamily,omitempty"` + + // Current version of each updatable component. + PackageVersions []*PackageVersionInfo `json:"packageVersions,omitempty"` + + // Overall update state of the stamp. + State *UpdateSummariesPropertiesState `json:"state,omitempty"` + + // READ-ONLY; Provisioning state of the UpdateSummaries proxy resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// UpdatesClientBeginPostOptions contains the optional parameters for the UpdatesClient.BeginPost method. +type UpdatesClientBeginPostOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// UpdatesClientGetOptions contains the optional parameters for the UpdatesClient.Get method. +type UpdatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// UpdatesClientListOptions contains the optional parameters for the UpdatesClient.List method. +type UpdatesClientListOptions struct { + // placeholder for future optional parameters +} + type UploadCertificateRequest struct { Properties *RawCertificateData `json:"properties,omitempty"` } + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string `json:"clientId,omitempty" azure:"ro"` + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go new file mode 100644 index 000000000000..dc3e48d950a3 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go @@ -0,0 +1,2596 @@ +//go:build go1.18 +// +build go1.18 + +// 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. +// DO NOT EDIT. + +package armazurestackhci + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type ArcConnectivityProperties. +func (a ArcConnectivityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", a.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcConnectivityProperties. +func (a *ArcConnectivityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ArcIdentityResponse. +func (a ArcIdentityResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcIdentityResponse. +func (a *ArcIdentityResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ArcIdentityResponseProperties. +func (a ArcIdentityResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "arcApplicationClientId", a.ArcApplicationClientID) + populate(objectMap, "arcApplicationObjectId", a.ArcApplicationObjectID) + populate(objectMap, "arcApplicationTenantId", a.ArcApplicationTenantID) + populate(objectMap, "arcServicePrincipalObjectId", a.ArcServicePrincipalObjectID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcIdentityResponseProperties. +func (a *ArcIdentityResponseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "arcApplicationClientId": + err = unpopulate(val, "ArcApplicationClientID", &a.ArcApplicationClientID) + delete(rawMsg, key) + case "arcApplicationObjectId": + err = unpopulate(val, "ArcApplicationObjectID", &a.ArcApplicationObjectID) + delete(rawMsg, key) + case "arcApplicationTenantId": + err = unpopulate(val, "ArcApplicationTenantID", &a.ArcApplicationTenantID) + delete(rawMsg, key) + case "arcServicePrincipalObjectId": + err = unpopulate(val, "ArcServicePrincipalObjectID", &a.ArcServicePrincipalObjectID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ArcSetting. +func (a ArcSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSetting. +func (a *ArcSetting) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ArcSettingList. +func (a ArcSettingList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingList. +func (a *ArcSettingList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ArcSettingProperties. +func (a ArcSettingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregateState", a.AggregateState) + populate(objectMap, "arcApplicationClientId", a.ArcApplicationClientID) + populate(objectMap, "arcApplicationObjectId", a.ArcApplicationObjectID) + populate(objectMap, "arcApplicationTenantId", a.ArcApplicationTenantID) + populate(objectMap, "arcInstanceResourceGroup", a.ArcInstanceResourceGroup) + populate(objectMap, "arcServicePrincipalObjectId", a.ArcServicePrincipalObjectID) + populate(objectMap, "connectivityProperties", &a.ConnectivityProperties) + populate(objectMap, "perNodeDetails", a.PerNodeDetails) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingProperties. +func (a *ArcSettingProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregateState": + err = unpopulate(val, "AggregateState", &a.AggregateState) + delete(rawMsg, key) + case "arcApplicationClientId": + err = unpopulate(val, "ArcApplicationClientID", &a.ArcApplicationClientID) + delete(rawMsg, key) + case "arcApplicationObjectId": + err = unpopulate(val, "ArcApplicationObjectID", &a.ArcApplicationObjectID) + delete(rawMsg, key) + case "arcApplicationTenantId": + err = unpopulate(val, "ArcApplicationTenantID", &a.ArcApplicationTenantID) + delete(rawMsg, key) + case "arcInstanceResourceGroup": + err = unpopulate(val, "ArcInstanceResourceGroup", &a.ArcInstanceResourceGroup) + delete(rawMsg, key) + case "arcServicePrincipalObjectId": + err = unpopulate(val, "ArcServicePrincipalObjectID", &a.ArcServicePrincipalObjectID) + delete(rawMsg, key) + case "connectivityProperties": + err = unpopulate(val, "ConnectivityProperties", &a.ConnectivityProperties) + delete(rawMsg, key) + case "perNodeDetails": + err = unpopulate(val, "PerNodeDetails", &a.PerNodeDetails) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ArcSettingsPatch. +func (a ArcSettingsPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingsPatch. +func (a *ArcSettingsPatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ArcSettingsPatchProperties. +func (a ArcSettingsPatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectivityProperties", &a.ConnectivityProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingsPatchProperties. +func (a *ArcSettingsPatchProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectivityProperties": + err = unpopulate(val, "ConnectivityProperties", &a.ConnectivityProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Cluster. +func (c Cluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Cluster. +func (c *Cluster) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterDesiredProperties. +func (c ClusterDesiredProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diagnosticLevel", c.DiagnosticLevel) + populate(objectMap, "windowsServerSubscription", c.WindowsServerSubscription) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterDesiredProperties. +func (c *ClusterDesiredProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diagnosticLevel": + err = unpopulate(val, "DiagnosticLevel", &c.DiagnosticLevel) + delete(rawMsg, key) + case "windowsServerSubscription": + err = unpopulate(val, "WindowsServerSubscription", &c.WindowsServerSubscription) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterIdentityResponse. +func (c ClusterIdentityResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterIdentityResponse. +func (c *ClusterIdentityResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterIdentityResponseProperties. +func (c ClusterIdentityResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aadApplicationObjectId", c.AADApplicationObjectID) + populate(objectMap, "aadClientId", c.AADClientID) + populate(objectMap, "aadServicePrincipalObjectId", c.AADServicePrincipalObjectID) + populate(objectMap, "aadTenantId", c.AADTenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterIdentityResponseProperties. +func (c *ClusterIdentityResponseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aadApplicationObjectId": + err = unpopulate(val, "AADApplicationObjectID", &c.AADApplicationObjectID) + delete(rawMsg, key) + case "aadClientId": + err = unpopulate(val, "AADClientID", &c.AADClientID) + delete(rawMsg, key) + case "aadServicePrincipalObjectId": + err = unpopulate(val, "AADServicePrincipalObjectID", &c.AADServicePrincipalObjectID) + delete(rawMsg, key) + case "aadTenantId": + err = unpopulate(val, "AADTenantID", &c.AADTenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterList. +func (c ClusterList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterList. +func (c *ClusterList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterNode. +func (c ClusterNode) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "coreCount", c.CoreCount) + populate(objectMap, "id", c.ID) + populate(objectMap, "manufacturer", c.Manufacturer) + populate(objectMap, "memoryInGiB", c.MemoryInGiB) + populate(objectMap, "model", c.Model) + populate(objectMap, "name", c.Name) + populate(objectMap, "nodeType", c.NodeType) + populate(objectMap, "osDisplayVersion", c.OSDisplayVersion) + populate(objectMap, "osName", c.OSName) + populate(objectMap, "osVersion", c.OSVersion) + populate(objectMap, "serialNumber", c.SerialNumber) + populate(objectMap, "windowsServerSubscription", c.WindowsServerSubscription) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterNode. +func (c *ClusterNode) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "coreCount": + err = unpopulate(val, "CoreCount", &c.CoreCount) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "manufacturer": + err = unpopulate(val, "Manufacturer", &c.Manufacturer) + delete(rawMsg, key) + case "memoryInGiB": + err = unpopulate(val, "MemoryInGiB", &c.MemoryInGiB) + delete(rawMsg, key) + case "model": + err = unpopulate(val, "Model", &c.Model) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "nodeType": + err = unpopulate(val, "NodeType", &c.NodeType) + delete(rawMsg, key) + case "osDisplayVersion": + err = unpopulate(val, "OSDisplayVersion", &c.OSDisplayVersion) + delete(rawMsg, key) + case "osName": + err = unpopulate(val, "OSName", &c.OSName) + delete(rawMsg, key) + case "osVersion": + err = unpopulate(val, "OSVersion", &c.OSVersion) + delete(rawMsg, key) + case "serialNumber": + err = unpopulate(val, "SerialNumber", &c.SerialNumber) + delete(rawMsg, key) + case "windowsServerSubscription": + err = unpopulate(val, "WindowsServerSubscription", &c.WindowsServerSubscription) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPatch. +func (c ClusterPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPatch. +func (c *ClusterPatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPatchProperties. +func (c ClusterPatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aadClientId", c.AADClientID) + populate(objectMap, "aadTenantId", c.AADTenantID) + populate(objectMap, "cloudManagementEndpoint", c.CloudManagementEndpoint) + populate(objectMap, "desiredProperties", c.DesiredProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPatchProperties. +func (c *ClusterPatchProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aadClientId": + err = unpopulate(val, "AADClientID", &c.AADClientID) + delete(rawMsg, key) + case "aadTenantId": + err = unpopulate(val, "AADTenantID", &c.AADTenantID) + delete(rawMsg, key) + case "cloudManagementEndpoint": + err = unpopulate(val, "CloudManagementEndpoint", &c.CloudManagementEndpoint) + delete(rawMsg, key) + case "desiredProperties": + err = unpopulate(val, "DesiredProperties", &c.DesiredProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterProperties. +func (c ClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aadApplicationObjectId", c.AADApplicationObjectID) + populate(objectMap, "aadClientId", c.AADClientID) + populate(objectMap, "aadServicePrincipalObjectId", c.AADServicePrincipalObjectID) + populate(objectMap, "aadTenantId", c.AADTenantID) + populate(objectMap, "billingModel", c.BillingModel) + populate(objectMap, "cloudId", c.CloudID) + populate(objectMap, "cloudManagementEndpoint", c.CloudManagementEndpoint) + populate(objectMap, "desiredProperties", c.DesiredProperties) + populateTimeRFC3339(objectMap, "lastBillingTimestamp", c.LastBillingTimestamp) + populateTimeRFC3339(objectMap, "lastSyncTimestamp", c.LastSyncTimestamp) + populate(objectMap, "provisioningState", c.ProvisioningState) + populateTimeRFC3339(objectMap, "registrationTimestamp", c.RegistrationTimestamp) + populate(objectMap, "reportedProperties", c.ReportedProperties) + populate(objectMap, "serviceEndpoint", c.ServiceEndpoint) + populate(objectMap, "softwareAssuranceProperties", c.SoftwareAssuranceProperties) + populate(objectMap, "status", c.Status) + populate(objectMap, "trialDaysRemaining", c.TrialDaysRemaining) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterProperties. +func (c *ClusterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aadApplicationObjectId": + err = unpopulate(val, "AADApplicationObjectID", &c.AADApplicationObjectID) + delete(rawMsg, key) + case "aadClientId": + err = unpopulate(val, "AADClientID", &c.AADClientID) + delete(rawMsg, key) + case "aadServicePrincipalObjectId": + err = unpopulate(val, "AADServicePrincipalObjectID", &c.AADServicePrincipalObjectID) + delete(rawMsg, key) + case "aadTenantId": + err = unpopulate(val, "AADTenantID", &c.AADTenantID) + delete(rawMsg, key) + case "billingModel": + err = unpopulate(val, "BillingModel", &c.BillingModel) + delete(rawMsg, key) + case "cloudId": + err = unpopulate(val, "CloudID", &c.CloudID) + delete(rawMsg, key) + case "cloudManagementEndpoint": + err = unpopulate(val, "CloudManagementEndpoint", &c.CloudManagementEndpoint) + delete(rawMsg, key) + case "desiredProperties": + err = unpopulate(val, "DesiredProperties", &c.DesiredProperties) + delete(rawMsg, key) + case "lastBillingTimestamp": + err = unpopulateTimeRFC3339(val, "LastBillingTimestamp", &c.LastBillingTimestamp) + delete(rawMsg, key) + case "lastSyncTimestamp": + err = unpopulateTimeRFC3339(val, "LastSyncTimestamp", &c.LastSyncTimestamp) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "registrationTimestamp": + err = unpopulateTimeRFC3339(val, "RegistrationTimestamp", &c.RegistrationTimestamp) + delete(rawMsg, key) + case "reportedProperties": + err = unpopulate(val, "ReportedProperties", &c.ReportedProperties) + delete(rawMsg, key) + case "serviceEndpoint": + err = unpopulate(val, "ServiceEndpoint", &c.ServiceEndpoint) + delete(rawMsg, key) + case "softwareAssuranceProperties": + err = unpopulate(val, "SoftwareAssuranceProperties", &c.SoftwareAssuranceProperties) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "trialDaysRemaining": + err = unpopulate(val, "TrialDaysRemaining", &c.TrialDaysRemaining) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterReportedProperties. +func (c ClusterReportedProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clusterId", c.ClusterID) + populate(objectMap, "clusterName", c.ClusterName) + populate(objectMap, "clusterVersion", c.ClusterVersion) + populate(objectMap, "diagnosticLevel", c.DiagnosticLevel) + populate(objectMap, "imdsAttestation", c.ImdsAttestation) + populateTimeRFC3339(objectMap, "lastUpdated", c.LastUpdated) + populate(objectMap, "nodes", c.Nodes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterReportedProperties. +func (c *ClusterReportedProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterId": + err = unpopulate(val, "ClusterID", &c.ClusterID) + delete(rawMsg, key) + case "clusterName": + err = unpopulate(val, "ClusterName", &c.ClusterName) + delete(rawMsg, key) + case "clusterVersion": + err = unpopulate(val, "ClusterVersion", &c.ClusterVersion) + delete(rawMsg, key) + case "diagnosticLevel": + err = unpopulate(val, "DiagnosticLevel", &c.DiagnosticLevel) + delete(rawMsg, key) + case "imdsAttestation": + err = unpopulate(val, "ImdsAttestation", &c.ImdsAttestation) + delete(rawMsg, key) + case "lastUpdated": + err = unpopulateTimeRFC3339(val, "LastUpdated", &c.LastUpdated) + delete(rawMsg, key) + case "nodes": + err = unpopulate(val, "Nodes", &c.Nodes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Extension. +func (e Extension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Extension. +func (e *Extension) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExtensionList. +func (e ExtensionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionList. +func (e *ExtensionList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExtensionParameters. +func (e ExtensionParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoUpgradeMinorVersion", e.AutoUpgradeMinorVersion) + populate(objectMap, "forceUpdateTag", e.ForceUpdateTag) + populate(objectMap, "protectedSettings", &e.ProtectedSettings) + populate(objectMap, "publisher", e.Publisher) + populate(objectMap, "settings", &e.Settings) + populate(objectMap, "type", e.Type) + populate(objectMap, "typeHandlerVersion", e.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionParameters. +func (e *ExtensionParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoUpgradeMinorVersion": + err = unpopulate(val, "AutoUpgradeMinorVersion", &e.AutoUpgradeMinorVersion) + delete(rawMsg, key) + case "forceUpdateTag": + err = unpopulate(val, "ForceUpdateTag", &e.ForceUpdateTag) + delete(rawMsg, key) + case "protectedSettings": + err = unpopulate(val, "ProtectedSettings", &e.ProtectedSettings) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &e.Publisher) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &e.Settings) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &e.TypeHandlerVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExtensionProperties. +func (e ExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregateState", e.AggregateState) + populate(objectMap, "extensionParameters", e.ExtensionParameters) + populate(objectMap, "perNodeExtensionDetails", e.PerNodeExtensionDetails) + populate(objectMap, "provisioningState", e.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionProperties. +func (e *ExtensionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregateState": + err = unpopulate(val, "AggregateState", &e.AggregateState) + delete(rawMsg, key) + case "extensionParameters": + err = unpopulate(val, "ExtensionParameters", &e.ExtensionParameters) + delete(rawMsg, key) + case "perNodeExtensionDetails": + err = unpopulate(val, "PerNodeExtensionDetails", &e.PerNodeExtensionDetails) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Offer. +func (o Offer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Offer. +func (o *Offer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfferList. +func (o OfferList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfferList. +func (o *OfferList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfferProperties. +func (o OfferProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "content", o.Content) + populate(objectMap, "contentVersion", o.ContentVersion) + populate(objectMap, "provisioningState", o.ProvisioningState) + populate(objectMap, "publisherId", o.PublisherID) + populate(objectMap, "skuMappings", o.SKUMappings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfferProperties. +func (o *OfferProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "content": + err = unpopulate(val, "Content", &o.Content) + delete(rawMsg, key) + case "contentVersion": + err = unpopulate(val, "ContentVersion", &o.ContentVersion) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &o.ProvisioningState) + delete(rawMsg, key) + case "publisherId": + err = unpopulate(val, "PublisherID", &o.PublisherID) + delete(rawMsg, key) + case "skuMappings": + err = unpopulate(val, "SKUMappings", &o.SKUMappings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PackageVersionInfo. +func (p PackageVersionInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "lastUpdated", p.LastUpdated) + populate(objectMap, "packageType", p.PackageType) + populate(objectMap, "version", p.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageVersionInfo. +func (p *PackageVersionInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lastUpdated": + err = unpopulateTimeRFC3339(val, "LastUpdated", &p.LastUpdated) + delete(rawMsg, key) + case "packageType": + err = unpopulate(val, "PackageType", &p.PackageType) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &p.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PasswordCredential. +func (p PasswordCredential) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endDateTime", p.EndDateTime) + populate(objectMap, "keyId", p.KeyID) + populate(objectMap, "secretText", p.SecretText) + populateTimeRFC3339(objectMap, "startDateTime", p.StartDateTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PasswordCredential. +func (p *PasswordCredential) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endDateTime": + err = unpopulateTimeRFC3339(val, "EndDateTime", &p.EndDateTime) + delete(rawMsg, key) + case "keyId": + err = unpopulate(val, "KeyID", &p.KeyID) + delete(rawMsg, key) + case "secretText": + err = unpopulate(val, "SecretText", &p.SecretText) + delete(rawMsg, key) + case "startDateTime": + err = unpopulateTimeRFC3339(val, "StartDateTime", &p.StartDateTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PerNodeExtensionState. +func (p PerNodeExtensionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extension", p.Extension) + populate(objectMap, "name", p.Name) + populate(objectMap, "state", p.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PerNodeExtensionState. +func (p *PerNodeExtensionState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extension": + err = unpopulate(val, "Extension", &p.Extension) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PerNodeState. +func (p PerNodeState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "arcInstance", p.ArcInstance) + populate(objectMap, "name", p.Name) + populate(objectMap, "state", p.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PerNodeState. +func (p *PerNodeState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "arcInstance": + err = unpopulate(val, "ArcInstance", &p.ArcInstance) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Publisher. +func (p Publisher) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Publisher. +func (p *Publisher) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PublisherList. +func (p PublisherList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublisherList. +func (p *PublisherList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PublisherProperties. +func (p PublisherProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublisherProperties. +func (p *PublisherProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RawCertificateData. +func (r RawCertificateData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "certificates", r.Certificates) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RawCertificateData. +func (r *RawCertificateData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certificates": + err = unpopulate(val, "Certificates", &r.Certificates) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKU. +func (s SKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. +func (s *SKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKUList. +func (s SKUList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUList. +func (s *SKUList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKUMappings. +func (s SKUMappings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "catalogPlanId", s.CatalogPlanID) + populate(objectMap, "marketplaceSkuId", s.MarketplaceSKUID) + populate(objectMap, "marketplaceSkuVersions", s.MarketplaceSKUVersions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUMappings. +func (s *SKUMappings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "catalogPlanId": + err = unpopulate(val, "CatalogPlanID", &s.CatalogPlanID) + delete(rawMsg, key) + case "marketplaceSkuId": + err = unpopulate(val, "MarketplaceSKUID", &s.MarketplaceSKUID) + delete(rawMsg, key) + case "marketplaceSkuVersions": + err = unpopulate(val, "MarketplaceSKUVersions", &s.MarketplaceSKUVersions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKUProperties. +func (s SKUProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "content", s.Content) + populate(objectMap, "contentVersion", s.ContentVersion) + populate(objectMap, "offerId", s.OfferID) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "publisherId", s.PublisherID) + populate(objectMap, "skuMappings", s.SKUMappings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUProperties. +func (s *SKUProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "content": + err = unpopulate(val, "Content", &s.Content) + delete(rawMsg, key) + case "contentVersion": + err = unpopulate(val, "ContentVersion", &s.ContentVersion) + delete(rawMsg, key) + case "offerId": + err = unpopulate(val, "OfferID", &s.OfferID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "publisherId": + err = unpopulate(val, "PublisherID", &s.PublisherID) + delete(rawMsg, key) + case "skuMappings": + err = unpopulate(val, "SKUMappings", &s.SKUMappings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SoftwareAssuranceChangeRequest. +func (s SoftwareAssuranceChangeRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SoftwareAssuranceChangeRequest. +func (s *SoftwareAssuranceChangeRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SoftwareAssuranceChangeRequestProperties. +func (s SoftwareAssuranceChangeRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "softwareAssuranceIntent", s.SoftwareAssuranceIntent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SoftwareAssuranceChangeRequestProperties. +func (s *SoftwareAssuranceChangeRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "softwareAssuranceIntent": + err = unpopulate(val, "SoftwareAssuranceIntent", &s.SoftwareAssuranceIntent) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SoftwareAssuranceProperties. +func (s SoftwareAssuranceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "lastUpdated", s.LastUpdated) + populate(objectMap, "softwareAssuranceIntent", s.SoftwareAssuranceIntent) + populate(objectMap, "softwareAssuranceStatus", s.SoftwareAssuranceStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SoftwareAssuranceProperties. +func (s *SoftwareAssuranceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lastUpdated": + err = unpopulateTimeRFC3339(val, "LastUpdated", &s.LastUpdated) + delete(rawMsg, key) + case "softwareAssuranceIntent": + err = unpopulate(val, "SoftwareAssuranceIntent", &s.SoftwareAssuranceIntent) + delete(rawMsg, key) + case "softwareAssuranceStatus": + err = unpopulate(val, "SoftwareAssuranceStatus", &s.SoftwareAssuranceStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Step. +func (s Step) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", s.Description) + populateTimeRFC3339(objectMap, "endTimeUtc", s.EndTimeUTC) + populate(objectMap, "errorMessage", s.ErrorMessage) + populateTimeRFC3339(objectMap, "lastUpdatedTimeUtc", s.LastUpdatedTimeUTC) + populate(objectMap, "name", s.Name) + populateTimeRFC3339(objectMap, "startTimeUtc", s.StartTimeUTC) + populate(objectMap, "status", s.Status) + populate(objectMap, "steps", s.Steps) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Step. +func (s *Step) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "endTimeUtc": + err = unpopulateTimeRFC3339(val, "EndTimeUTC", &s.EndTimeUTC) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &s.ErrorMessage) + delete(rawMsg, key) + case "lastUpdatedTimeUtc": + err = unpopulateTimeRFC3339(val, "LastUpdatedTimeUTC", &s.LastUpdatedTimeUTC) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulateTimeRFC3339(val, "StartTimeUTC", &s.StartTimeUTC) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "steps": + err = unpopulate(val, "Steps", &s.Steps) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Update. +func (u Update) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", u.ID) + populate(objectMap, "location", u.Location) + populate(objectMap, "name", u.Name) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "systemData", u.SystemData) + populate(objectMap, "type", u.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Update. +func (u *Update) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &u.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &u.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &u.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateList. +func (u UpdateList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateList. +func (u *UpdateList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &u.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &u.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdatePrerequisite. +func (u UpdatePrerequisite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "packageName", u.PackageName) + populate(objectMap, "updateType", u.UpdateType) + populate(objectMap, "version", u.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdatePrerequisite. +func (u *UpdatePrerequisite) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "packageName": + err = unpopulate(val, "PackageName", &u.PackageName) + delete(rawMsg, key) + case "updateType": + err = unpopulate(val, "UpdateType", &u.UpdateType) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &u.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateProperties. +func (u UpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalProperties", u.AdditionalProperties) + populate(objectMap, "availabilityType", u.AvailabilityType) + populate(objectMap, "description", u.Description) + populate(objectMap, "displayName", u.DisplayName) + populateTimeRFC3339(objectMap, "installedDate", u.InstalledDate) + populate(objectMap, "packagePath", u.PackagePath) + populate(objectMap, "packageSizeInMb", u.PackageSizeInMb) + populate(objectMap, "packageType", u.PackageType) + populate(objectMap, "prerequisites", u.Prerequisites) + populate(objectMap, "provisioningState", u.ProvisioningState) + populate(objectMap, "publisher", u.Publisher) + populate(objectMap, "releaseLink", u.ReleaseLink) + populate(objectMap, "state", u.State) + populate(objectMap, "updateStateProperties", u.UpdateStateProperties) + populate(objectMap, "version", u.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateProperties. +func (u *UpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalProperties": + err = unpopulate(val, "AdditionalProperties", &u.AdditionalProperties) + delete(rawMsg, key) + case "availabilityType": + err = unpopulate(val, "AvailabilityType", &u.AvailabilityType) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &u.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &u.DisplayName) + delete(rawMsg, key) + case "installedDate": + err = unpopulateTimeRFC3339(val, "InstalledDate", &u.InstalledDate) + delete(rawMsg, key) + case "packagePath": + err = unpopulate(val, "PackagePath", &u.PackagePath) + delete(rawMsg, key) + case "packageSizeInMb": + err = unpopulate(val, "PackageSizeInMb", &u.PackageSizeInMb) + delete(rawMsg, key) + case "packageType": + err = unpopulate(val, "PackageType", &u.PackageType) + delete(rawMsg, key) + case "prerequisites": + err = unpopulate(val, "Prerequisites", &u.Prerequisites) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &u.ProvisioningState) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &u.Publisher) + delete(rawMsg, key) + case "releaseLink": + err = unpopulate(val, "ReleaseLink", &u.ReleaseLink) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &u.State) + delete(rawMsg, key) + case "updateStateProperties": + err = unpopulate(val, "UpdateStateProperties", &u.UpdateStateProperties) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &u.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateRun. +func (u UpdateRun) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", u.ID) + populate(objectMap, "location", u.Location) + populate(objectMap, "name", u.Name) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "systemData", u.SystemData) + populate(objectMap, "type", u.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateRun. +func (u *UpdateRun) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &u.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &u.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &u.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateRunList. +func (u UpdateRunList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateRunList. +func (u *UpdateRunList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &u.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &u.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateRunProperties. +func (u UpdateRunProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "duration", u.Duration) + populate(objectMap, "progress", u.Progress) + populate(objectMap, "provisioningState", u.ProvisioningState) + populate(objectMap, "state", u.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateRunProperties. +func (u *UpdateRunProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "duration": + err = unpopulate(val, "Duration", &u.Duration) + delete(rawMsg, key) + case "progress": + err = unpopulate(val, "Progress", &u.Progress) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &u.ProvisioningState) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &u.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateStateProperties. +func (u UpdateStateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "notifyMessage", u.NotifyMessage) + populate(objectMap, "progressPercentage", u.ProgressPercentage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateStateProperties. +func (u *UpdateStateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "notifyMessage": + err = unpopulate(val, "NotifyMessage", &u.NotifyMessage) + delete(rawMsg, key) + case "progressPercentage": + err = unpopulate(val, "ProgressPercentage", &u.ProgressPercentage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateSummaries. +func (u UpdateSummaries) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", u.ID) + populate(objectMap, "location", u.Location) + populate(objectMap, "name", u.Name) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "systemData", u.SystemData) + populate(objectMap, "type", u.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSummaries. +func (u *UpdateSummaries) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &u.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &u.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &u.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateSummariesList. +func (u UpdateSummariesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSummariesList. +func (u *UpdateSummariesList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &u.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &u.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateSummariesProperties. +func (u UpdateSummariesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentVersion", u.CurrentVersion) + populate(objectMap, "hardwareModel", u.HardwareModel) + populate(objectMap, "oemFamily", u.OemFamily) + populate(objectMap, "packageVersions", u.PackageVersions) + populate(objectMap, "provisioningState", u.ProvisioningState) + populate(objectMap, "state", u.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSummariesProperties. +func (u *UpdateSummariesProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentVersion": + err = unpopulate(val, "CurrentVersion", &u.CurrentVersion) + delete(rawMsg, key) + case "hardwareModel": + err = unpopulate(val, "HardwareModel", &u.HardwareModel) + delete(rawMsg, key) + case "oemFamily": + err = unpopulate(val, "OemFamily", &u.OemFamily) + delete(rawMsg, key) + case "packageVersions": + err = unpopulate(val, "PackageVersions", &u.PackageVersions) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &u.ProvisioningState) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &u.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UploadCertificateRequest. +func (u UploadCertificateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", u.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UploadCertificateRequest. +func (u *UploadCertificateRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/offers_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/offers_client.go new file mode 100644 index 000000000000..08f908325b6e --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/offers_client.go @@ -0,0 +1,272 @@ +//go:build go1.18 +// +build go1.18 + +// 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. +// DO NOT EDIT. + +package armazurestackhci + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// OffersClient contains the methods for the Offers group. +// Don't use this type directly, use NewOffersClient() instead. +type OffersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewOffersClient creates a new instance of OffersClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewOffersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OffersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &OffersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get Offer resource details within a publisher of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// publisherName - The name of the publisher available within HCI cluster. +// offerName - The name of the offer available within HCI cluster. +// options - OffersClientGetOptions contains the optional parameters for the OffersClient.Get method. +func (client *OffersClient) Get(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, options *OffersClientGetOptions) (OffersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, publisherName, offerName, options) + if err != nil { + return OffersClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OffersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OffersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *OffersClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, options *OffersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if offerName == "" { + return nil, errors.New("parameter offerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{offerName}", url.PathEscape(offerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OffersClient) getHandleResponse(resp *http.Response) (OffersClientGetResponse, error) { + result := OffersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Offer); err != nil { + return OffersClientGetResponse{}, err + } + return result, nil +} + +// NewListByClusterPager - List Offers available across publishers for the HCI Cluster. +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// options - OffersClientListByClusterOptions contains the optional parameters for the OffersClient.ListByCluster method. +func (client *OffersClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *OffersClientListByClusterOptions) *runtime.Pager[OffersClientListByClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[OffersClientListByClusterResponse]{ + More: func(page OffersClientListByClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OffersClientListByClusterResponse) (OffersClientListByClusterResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OffersClientListByClusterResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OffersClientListByClusterResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OffersClientListByClusterResponse{}, runtime.NewResponseError(resp) + } + return client.listByClusterHandleResponse(resp) + }, + }) +} + +// listByClusterCreateRequest creates the ListByCluster request. +func (client *OffersClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *OffersClientListByClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/offers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClusterHandleResponse handles the ListByCluster response. +func (client *OffersClient) listByClusterHandleResponse(resp *http.Response) (OffersClientListByClusterResponse, error) { + result := OffersClientListByClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OfferList); err != nil { + return OffersClientListByClusterResponse{}, err + } + return result, nil +} + +// NewListByPublisherPager - List Offers available for a publisher within the HCI Cluster. +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// publisherName - The name of the publisher available within HCI cluster. +// options - OffersClientListByPublisherOptions contains the optional parameters for the OffersClient.ListByPublisher method. +func (client *OffersClient) NewListByPublisherPager(resourceGroupName string, clusterName string, publisherName string, options *OffersClientListByPublisherOptions) *runtime.Pager[OffersClientListByPublisherResponse] { + return runtime.NewPager(runtime.PagingHandler[OffersClientListByPublisherResponse]{ + More: func(page OffersClientListByPublisherResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OffersClientListByPublisherResponse) (OffersClientListByPublisherResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByPublisherCreateRequest(ctx, resourceGroupName, clusterName, publisherName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OffersClientListByPublisherResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OffersClientListByPublisherResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OffersClientListByPublisherResponse{}, runtime.NewResponseError(resp) + } + return client.listByPublisherHandleResponse(resp) + }, + }) +} + +// listByPublisherCreateRequest creates the ListByPublisher request. +func (client *OffersClient) listByPublisherCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, options *OffersClientListByPublisherOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByPublisherHandleResponse handles the ListByPublisher response. +func (client *OffersClient) listByPublisherHandleResponse(resp *http.Response) (OffersClientListByPublisherResponse, error) { + result := OffersClientListByPublisherResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OfferList); err != nil { + return OffersClientListByPublisherResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_operations_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go similarity index 97% rename from sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_operations_client.go rename to sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go index c0438a4031bf..eac4e5609944 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_operations_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armazurestackhci @@ -50,7 +51,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // List - List all available Microsoft.AzureStackHCI provider operations // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-10-01 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) List(ctx context.Context, options *OperationsClientListOptions) (OperationsClientListResponse, error) { req, err := client.listCreateRequest(ctx, options) @@ -75,7 +76,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/publishers_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/publishers_client.go new file mode 100644 index 000000000000..a859d44786ae --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/publishers_client.go @@ -0,0 +1,186 @@ +//go:build go1.18 +// +build go1.18 + +// 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. +// DO NOT EDIT. + +package armazurestackhci + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PublishersClient contains the methods for the Publishers group. +// Don't use this type directly, use NewPublishersClient() instead. +type PublishersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewPublishersClient creates a new instance of PublishersClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewPublishersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PublishersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &PublishersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get Publisher resource details of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// publisherName - The name of the publisher available within HCI cluster. +// options - PublishersClientGetOptions contains the optional parameters for the PublishersClient.Get method. +func (client *PublishersClient) Get(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, options *PublishersClientGetOptions) (PublishersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, publisherName, options) + if err != nil { + return PublishersClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublishersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublishersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PublishersClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, options *PublishersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PublishersClient) getHandleResponse(resp *http.Response) (PublishersClientGetResponse, error) { + result := PublishersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Publisher); err != nil { + return PublishersClientGetResponse{}, err + } + return result, nil +} + +// NewListByClusterPager - List Publishers available for the HCI Cluster. +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// options - PublishersClientListByClusterOptions contains the optional parameters for the PublishersClient.ListByCluster +// method. +func (client *PublishersClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *PublishersClientListByClusterOptions) *runtime.Pager[PublishersClientListByClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[PublishersClientListByClusterResponse]{ + More: func(page PublishersClientListByClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PublishersClientListByClusterResponse) (PublishersClientListByClusterResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PublishersClientListByClusterResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublishersClientListByClusterResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublishersClientListByClusterResponse{}, runtime.NewResponseError(resp) + } + return client.listByClusterHandleResponse(resp) + }, + }) +} + +// listByClusterCreateRequest creates the ListByCluster request. +func (client *PublishersClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *PublishersClientListByClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClusterHandleResponse handles the ListByCluster response. +func (client *PublishersClient) listByClusterHandleResponse(resp *http.Response) (PublishersClientListByClusterResponse, error) { + result := PublishersClientListByClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublisherList); err != nil { + return PublishersClientListByClusterResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_response_types.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/response_types.go similarity index 62% rename from sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_response_types.go rename to sdk/resourcemanager/azurestackhci/armazurestackhci/response_types.go index 7952c66160fb..54db6200ec7b 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_response_types.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/response_types.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armazurestackhci @@ -58,6 +59,11 @@ type ClustersClientDeleteResponse struct { // placeholder for future response values } +// ClustersClientExtendSoftwareAssuranceBenefitResponse contains the response from method ClustersClient.ExtendSoftwareAssuranceBenefit. +type ClustersClientExtendSoftwareAssuranceBenefitResponse struct { + Cluster +} + // ClustersClientGetResponse contains the response from method ClustersClient.Get. type ClustersClientGetResponse struct { Cluster @@ -108,7 +114,77 @@ type ExtensionsClientUpdateResponse struct { Extension } +// OffersClientGetResponse contains the response from method OffersClient.Get. +type OffersClientGetResponse struct { + Offer +} + +// OffersClientListByClusterResponse contains the response from method OffersClient.ListByCluster. +type OffersClientListByClusterResponse struct { + OfferList +} + +// OffersClientListByPublisherResponse contains the response from method OffersClient.ListByPublisher. +type OffersClientListByPublisherResponse struct { + OfferList +} + // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { OperationListResult } + +// PublishersClientGetResponse contains the response from method PublishersClient.Get. +type PublishersClientGetResponse struct { + Publisher +} + +// PublishersClientListByClusterResponse contains the response from method PublishersClient.ListByCluster. +type PublishersClientListByClusterResponse struct { + PublisherList +} + +// SKUsClientGetResponse contains the response from method SKUsClient.Get. +type SKUsClientGetResponse struct { + SKU +} + +// SKUsClientListByOfferResponse contains the response from method SKUsClient.ListByOffer. +type SKUsClientListByOfferResponse struct { + SKUList +} + +// UpdateRunsClientGetResponse contains the response from method UpdateRunsClient.Get. +type UpdateRunsClientGetResponse struct { + UpdateRun +} + +// UpdateRunsClientListResponse contains the response from method UpdateRunsClient.List. +type UpdateRunsClientListResponse struct { + UpdateRunList +} + +// UpdateSummariesClientGetResponse contains the response from method UpdateSummariesClient.Get. +type UpdateSummariesClientGetResponse struct { + UpdateSummaries +} + +// UpdateSummariesClientListResponse contains the response from method UpdateSummariesClient.List. +type UpdateSummariesClientListResponse struct { + UpdateSummariesList +} + +// UpdatesClientGetResponse contains the response from method UpdatesClient.Get. +type UpdatesClientGetResponse struct { + Update +} + +// UpdatesClientListResponse contains the response from method UpdatesClient.List. +type UpdatesClientListResponse struct { + UpdateList +} + +// UpdatesClientPostResponse contains the response from method UpdatesClient.Post. +type UpdatesClientPostResponse struct { + // placeholder for future response values +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/skus_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/skus_client.go new file mode 100644 index 000000000000..4e75926675a6 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/skus_client.go @@ -0,0 +1,211 @@ +//go:build go1.18 +// +build go1.18 + +// 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. +// DO NOT EDIT. + +package armazurestackhci + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SKUsClient contains the methods for the SKUs group. +// Don't use this type directly, use NewSKUsClient() instead. +type SKUsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSKUsClient creates a new instance of SKUsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SKUsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SKUsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get SKU resource details within a offer of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// publisherName - The name of the publisher available within HCI cluster. +// offerName - The name of the offer available within HCI cluster. +// skuName - The name of the SKU available within HCI cluster. +// options - SKUsClientGetOptions contains the optional parameters for the SKUsClient.Get method. +func (client *SKUsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, skuName string, options *SKUsClientGetOptions) (SKUsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, publisherName, offerName, skuName, options) + if err != nil { + return SKUsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SKUsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SKUsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SKUsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, skuName string, options *SKUsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}/skus/{skuName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if offerName == "" { + return nil, errors.New("parameter offerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{offerName}", url.PathEscape(offerName)) + if skuName == "" { + return nil, errors.New("parameter skuName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skuName}", url.PathEscape(skuName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SKUsClient) getHandleResponse(resp *http.Response) (SKUsClientGetResponse, error) { + result := SKUsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SKU); err != nil { + return SKUsClientGetResponse{}, err + } + return result, nil +} + +// NewListByOfferPager - List Skus available for a offer within the HCI Cluster. +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// publisherName - The name of the publisher available within HCI cluster. +// offerName - The name of the offer available within HCI cluster. +// options - SKUsClientListByOfferOptions contains the optional parameters for the SKUsClient.ListByOffer method. +func (client *SKUsClient) NewListByOfferPager(resourceGroupName string, clusterName string, publisherName string, offerName string, options *SKUsClientListByOfferOptions) *runtime.Pager[SKUsClientListByOfferResponse] { + return runtime.NewPager(runtime.PagingHandler[SKUsClientListByOfferResponse]{ + More: func(page SKUsClientListByOfferResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SKUsClientListByOfferResponse) (SKUsClientListByOfferResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByOfferCreateRequest(ctx, resourceGroupName, clusterName, publisherName, offerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SKUsClientListByOfferResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SKUsClientListByOfferResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SKUsClientListByOfferResponse{}, runtime.NewResponseError(resp) + } + return client.listByOfferHandleResponse(resp) + }, + }) +} + +// listByOfferCreateRequest creates the ListByOffer request. +func (client *SKUsClient) listByOfferCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, options *SKUsClientListByOfferOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}/skus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if offerName == "" { + return nil, errors.New("parameter offerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{offerName}", url.PathEscape(offerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByOfferHandleResponse handles the ListByOffer response. +func (client *SKUsClient) listByOfferHandleResponse(resp *http.Response) (SKUsClientListByOfferResponse, error) { + result := SKUsClientListByOfferResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SKUList); err != nil { + return SKUsClientListByOfferResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_time_rfc3339.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/azurestackhci/armazurestackhci/time_rfc3339.go index 8734d07ac8bb..0cbd92d70348 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/time_rfc3339.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armazurestackhci diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/updateruns_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/updateruns_client.go new file mode 100644 index 000000000000..da24e9393ade --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/updateruns_client.go @@ -0,0 +1,195 @@ +//go:build go1.18 +// +build go1.18 + +// 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. +// DO NOT EDIT. + +package armazurestackhci + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// UpdateRunsClient contains the methods for the UpdateRuns group. +// Don't use this type directly, use NewUpdateRunsClient() instead. +type UpdateRunsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewUpdateRunsClient creates a new instance of UpdateRunsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewUpdateRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UpdateRunsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &UpdateRunsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - List all Update runs for a specified update +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// updateName - The name of the Update +// updateRunName - The name of the Update Run +// options - UpdateRunsClientGetOptions contains the optional parameters for the UpdateRunsClient.Get method. +func (client *UpdateRunsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *UpdateRunsClientGetOptions) (UpdateRunsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, updateName, updateRunName, options) + if err != nil { + return UpdateRunsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return UpdateRunsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UpdateRunsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *UpdateRunsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *UpdateRunsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + if updateRunName == "" { + return nil, errors.New("parameter updateRunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateRunName}", url.PathEscape(updateRunName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *UpdateRunsClient) getHandleResponse(resp *http.Response) (UpdateRunsClientGetResponse, error) { + result := UpdateRunsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateRun); err != nil { + return UpdateRunsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all Update runs for a specified update +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// updateName - The name of the Update +// options - UpdateRunsClientListOptions contains the optional parameters for the UpdateRunsClient.List method. +func (client *UpdateRunsClient) NewListPager(resourceGroupName string, clusterName string, updateName string, options *UpdateRunsClientListOptions) *runtime.Pager[UpdateRunsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[UpdateRunsClientListResponse]{ + More: func(page UpdateRunsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *UpdateRunsClientListResponse) (UpdateRunsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, clusterName, updateName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return UpdateRunsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return UpdateRunsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UpdateRunsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *UpdateRunsClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdateRunsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *UpdateRunsClient) listHandleResponse(resp *http.Response) (UpdateRunsClientListResponse, error) { + result := UpdateRunsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateRunList); err != nil { + return UpdateRunsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/updates_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/updates_client.go new file mode 100644 index 000000000000..421d3cc57518 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/updates_client.go @@ -0,0 +1,254 @@ +//go:build go1.18 +// +build go1.18 + +// 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. +// DO NOT EDIT. + +package armazurestackhci + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// UpdatesClient contains the methods for the Updates group. +// Don't use this type directly, use NewUpdatesClient() instead. +type UpdatesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewUpdatesClient creates a new instance of UpdatesClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewUpdatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UpdatesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &UpdatesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get specified Update +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// updateName - The name of the Update +// options - UpdatesClientGetOptions contains the optional parameters for the UpdatesClient.Get method. +func (client *UpdatesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientGetOptions) (UpdatesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, updateName, options) + if err != nil { + return UpdatesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return UpdatesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UpdatesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *UpdatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *UpdatesClient) getHandleResponse(resp *http.Response) (UpdatesClientGetResponse, error) { + result := UpdatesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Update); err != nil { + return UpdatesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all Updates +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// options - UpdatesClientListOptions contains the optional parameters for the UpdatesClient.List method. +func (client *UpdatesClient) NewListPager(resourceGroupName string, clusterName string, options *UpdatesClientListOptions) *runtime.Pager[UpdatesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[UpdatesClientListResponse]{ + More: func(page UpdatesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *UpdatesClientListResponse) (UpdatesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, clusterName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return UpdatesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return UpdatesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UpdatesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *UpdatesClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *UpdatesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *UpdatesClient) listHandleResponse(resp *http.Response) (UpdatesClientListResponse, error) { + result := UpdatesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateList); err != nil { + return UpdatesClientListResponse{}, err + } + return result, nil +} + +// BeginPost - Apply Update +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// updateName - The name of the Update +// options - UpdatesClientBeginPostOptions contains the optional parameters for the UpdatesClient.BeginPost method. +func (client *UpdatesClient) BeginPost(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientBeginPostOptions) (*runtime.Poller[UpdatesClientPostResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.post(ctx, resourceGroupName, clusterName, updateName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[UpdatesClientPostResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[UpdatesClientPostResponse](options.ResumeToken, client.pl, nil) + } +} + +// Post - Apply Update +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +func (client *UpdatesClient) post(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientBeginPostOptions) (*http.Response, error) { + req, err := client.postCreateRequest(ctx, resourceGroupName, clusterName, updateName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// postCreateRequest creates the Post request. +func (client *UpdatesClient) postCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientBeginPostOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/apply" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/updatesummaries_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/updatesummaries_client.go new file mode 100644 index 000000000000..2acbcb3bffa5 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/updatesummaries_client.go @@ -0,0 +1,180 @@ +//go:build go1.18 +// +build go1.18 + +// 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. +// DO NOT EDIT. + +package armazurestackhci + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// UpdateSummariesClient contains the methods for the UpdateSummaries group. +// Don't use this type directly, use NewUpdateSummariesClient() instead. +type UpdateSummariesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewUpdateSummariesClient creates a new instance of UpdateSummariesClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewUpdateSummariesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UpdateSummariesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &UpdateSummariesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get all Update summaries under the HCI cluster +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// options - UpdateSummariesClientGetOptions contains the optional parameters for the UpdateSummariesClient.Get method. +func (client *UpdateSummariesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, options *UpdateSummariesClientGetOptions) (UpdateSummariesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return UpdateSummariesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return UpdateSummariesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UpdateSummariesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *UpdateSummariesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *UpdateSummariesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *UpdateSummariesClient) getHandleResponse(resp *http.Response) (UpdateSummariesClientGetResponse, error) { + result := UpdateSummariesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateSummaries); err != nil { + return UpdateSummariesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all Update summaries under the HCI cluster +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// options - UpdateSummariesClientListOptions contains the optional parameters for the UpdateSummariesClient.List method. +func (client *UpdateSummariesClient) NewListPager(resourceGroupName string, clusterName string, options *UpdateSummariesClientListOptions) *runtime.Pager[UpdateSummariesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[UpdateSummariesClientListResponse]{ + More: func(page UpdateSummariesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *UpdateSummariesClientListResponse) (UpdateSummariesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, clusterName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return UpdateSummariesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return UpdateSummariesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UpdateSummariesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *UpdateSummariesClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *UpdateSummariesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *UpdateSummariesClient) listHandleResponse(resp *http.Response) (UpdateSummariesClientListResponse, error) { + result := UpdateSummariesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateSummariesList); err != nil { + return UpdateSummariesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/ze_generated_example_arcsettings_client_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/ze_generated_example_arcsettings_client_test.go deleted file mode 100644 index 420c3998b423..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/ze_generated_example_arcsettings_client_test.go +++ /dev/null @@ -1,195 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. - -package armazurestackhci_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/ListArcSettingsByCluster.json -func ExampleArcSettingsClient_NewListByClusterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewArcSettingsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByClusterPager("test-rg", - "myCluster", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/GetArcSetting.json -func ExampleArcSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewArcSettingsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "test-rg", - "myCluster", - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/PutArcSetting.json -func ExampleArcSettingsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewArcSettingsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "test-rg", - "myCluster", - "default", - armazurestackhci.ArcSetting{}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/PatchArcSetting.json -func ExampleArcSettingsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewArcSettingsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "test-rg", - "myCluster", - "default", - armazurestackhci.ArcSettingsPatch{ - Properties: &armazurestackhci.ArcSettingsPatchProperties{ - ConnectivityProperties: map[string]interface{}{ - "enabled": true, - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/DeleteArcSetting.json -func ExampleArcSettingsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewArcSettingsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "test-rg", - "myCluster", - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/GeneratePassword.json -func ExampleArcSettingsClient_GeneratePassword() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewArcSettingsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GeneratePassword(ctx, - "test-rg", - "myCluster", - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/CreateArcIdentity.json -func ExampleArcSettingsClient_BeginCreateIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewArcSettingsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateIdentity(ctx, - "test-rg", - "myCluster", - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/ze_generated_example_clusters_client_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/ze_generated_example_clusters_client_test.go deleted file mode 100644 index 9d9b8540639e..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/ze_generated_example_clusters_client_test.go +++ /dev/null @@ -1,235 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. - -package armazurestackhci_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/ListClustersBySubscription.json -func ExampleClustersClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewClustersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/ListClustersByResourceGroup.json -func ExampleClustersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewClustersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("test-rg", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/GetCluster.json -func ExampleClustersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewClustersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "test-rg", - "myCluster", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/CreateCluster.json -func ExampleClustersClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewClustersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "test-rg", - "myCluster", - armazurestackhci.Cluster{ - Location: to.Ptr("East US"), - Properties: &armazurestackhci.ClusterProperties{ - AADClientID: to.Ptr("24a6e53d-04e5-44d2-b7cc-1b732a847dfc"), - AADTenantID: to.Ptr("7e589cc1-a8b6-4dff-91bd-5ec0fa18db94"), - CloudManagementEndpoint: to.Ptr("https://98294836-31be-4668-aeae-698667faf99b.waconazure.com"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/UpdateCluster.json -func ExampleClustersClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewClustersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "test-rg", - "myCluster", - armazurestackhci.ClusterPatch{ - Properties: &armazurestackhci.ClusterPatchProperties{ - CloudManagementEndpoint: to.Ptr("https://98294836-31be-4668-aeae-698667faf99b.waconazure.com"), - DesiredProperties: &armazurestackhci.ClusterDesiredProperties{ - DiagnosticLevel: to.Ptr(armazurestackhci.DiagnosticLevelBasic), - WindowsServerSubscription: to.Ptr(armazurestackhci.WindowsServerSubscriptionEnabled), - }, - }, - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/DeleteCluster.json -func ExampleClustersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewClustersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "test-rg", - "myCluster", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/UploadCertificate.json -func ExampleClustersClient_BeginUploadCertificate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewClustersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUploadCertificate(ctx, - "test-rg", - "myCluster", - armazurestackhci.UploadCertificateRequest{ - Properties: &armazurestackhci.RawCertificateData{ - Certificates: []*string{ - to.Ptr("base64cert"), - to.Ptr("base64cert")}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/CreateClusterIdentity.json -func ExampleClustersClient_BeginCreateIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewClustersClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateIdentity(ctx, - "test-rg", - "myCluster", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/ze_generated_example_extensions_client_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/ze_generated_example_extensions_client_test.go deleted file mode 100644 index 6ab848f9a833..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/ze_generated_example_extensions_client_test.go +++ /dev/null @@ -1,178 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. - -package armazurestackhci_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/ListExtensionsByArcSetting.json -func ExampleExtensionsClient_NewListByArcSettingPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewExtensionsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByArcSettingPager("test-rg", - "myCluster", - "default", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/GetExtension.json -func ExampleExtensionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewExtensionsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "test-rg", - "myCluster", - "default", - "MicrosoftMonitoringAgent", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/PutExtension.json -func ExampleExtensionsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewExtensionsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "test-rg", - "myCluster", - "default", - "MicrosoftMonitoringAgent", - armazurestackhci.Extension{ - Properties: &armazurestackhci.ExtensionProperties{ - ExtensionParameters: &armazurestackhci.ExtensionParameters{ - Type: to.Ptr("MicrosoftMonitoringAgent"), - ProtectedSettings: map[string]interface{}{ - "workspaceKey": "xx", - }, - Publisher: to.Ptr("Microsoft.Compute"), - Settings: map[string]interface{}{ - "workspaceId": "xx", - }, - TypeHandlerVersion: to.Ptr("1.10"), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/PatchExtension.json -func ExampleExtensionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewExtensionsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "test-rg", - "myCluster", - "default", - "MicrosoftMonitoringAgent", - armazurestackhci.Extension{ - Properties: &armazurestackhci.ExtensionProperties{ - ExtensionParameters: &armazurestackhci.ExtensionParameters{ - Type: to.Ptr("MicrosoftMonitoringAgent"), - Publisher: to.Ptr("Microsoft.Compute"), - Settings: map[string]interface{}{ - "workspaceId": "xx", - }, - TypeHandlerVersion: to.Ptr("1.10"), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/DeleteExtension.json -func ExampleExtensionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewExtensionsClient("fd3c3665-1729-4b7b-9a38-238e83b0f98b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "test-rg", - "myCluster", - "default", - "MicrosoftMonitoringAgent", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/ze_generated_example_operations_client_test.go deleted file mode 100644 index 34899c650445..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,37 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. - -package armazurestackhci_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2022-05-01/examples/ListOperations.json -func ExampleOperationsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurestackhci.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_models_serde.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_models_serde.go deleted file mode 100644 index 2b80032a2afc..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/zz_generated_models_serde.go +++ /dev/null @@ -1,333 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. - -package armazurestackhci - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type ArcSettingProperties. -func (a ArcSettingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aggregateState", a.AggregateState) - populate(objectMap, "arcApplicationClientId", a.ArcApplicationClientID) - populate(objectMap, "arcApplicationObjectId", a.ArcApplicationObjectID) - populate(objectMap, "arcApplicationTenantId", a.ArcApplicationTenantID) - populate(objectMap, "arcInstanceResourceGroup", a.ArcInstanceResourceGroup) - populate(objectMap, "arcServicePrincipalObjectId", a.ArcServicePrincipalObjectID) - populate(objectMap, "connectivityProperties", &a.ConnectivityProperties) - populate(objectMap, "perNodeDetails", a.PerNodeDetails) - populate(objectMap, "provisioningState", a.ProvisioningState) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ArcSettingsPatch. -func (a ArcSettingsPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Cluster. -func (c Cluster) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "tags", c.Tags) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ClusterPatch. -func (c ClusterPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "tags", c.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ClusterProperties. -func (c ClusterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aadApplicationObjectId", c.AADApplicationObjectID) - populate(objectMap, "aadClientId", c.AADClientID) - populate(objectMap, "aadServicePrincipalObjectId", c.AADServicePrincipalObjectID) - populate(objectMap, "aadTenantId", c.AADTenantID) - populate(objectMap, "billingModel", c.BillingModel) - populate(objectMap, "cloudId", c.CloudID) - populate(objectMap, "cloudManagementEndpoint", c.CloudManagementEndpoint) - populate(objectMap, "desiredProperties", c.DesiredProperties) - populateTimeRFC3339(objectMap, "lastBillingTimestamp", c.LastBillingTimestamp) - populateTimeRFC3339(objectMap, "lastSyncTimestamp", c.LastSyncTimestamp) - populate(objectMap, "provisioningState", c.ProvisioningState) - populateTimeRFC3339(objectMap, "registrationTimestamp", c.RegistrationTimestamp) - populate(objectMap, "reportedProperties", c.ReportedProperties) - populate(objectMap, "serviceEndpoint", c.ServiceEndpoint) - populate(objectMap, "status", c.Status) - populate(objectMap, "trialDaysRemaining", c.TrialDaysRemaining) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterProperties. -func (c *ClusterProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "aadApplicationObjectId": - err = unpopulate(val, "AADApplicationObjectID", &c.AADApplicationObjectID) - delete(rawMsg, key) - case "aadClientId": - err = unpopulate(val, "AADClientID", &c.AADClientID) - delete(rawMsg, key) - case "aadServicePrincipalObjectId": - err = unpopulate(val, "AADServicePrincipalObjectID", &c.AADServicePrincipalObjectID) - delete(rawMsg, key) - case "aadTenantId": - err = unpopulate(val, "AADTenantID", &c.AADTenantID) - delete(rawMsg, key) - case "billingModel": - err = unpopulate(val, "BillingModel", &c.BillingModel) - delete(rawMsg, key) - case "cloudId": - err = unpopulate(val, "CloudID", &c.CloudID) - delete(rawMsg, key) - case "cloudManagementEndpoint": - err = unpopulate(val, "CloudManagementEndpoint", &c.CloudManagementEndpoint) - delete(rawMsg, key) - case "desiredProperties": - err = unpopulate(val, "DesiredProperties", &c.DesiredProperties) - delete(rawMsg, key) - case "lastBillingTimestamp": - err = unpopulateTimeRFC3339(val, "LastBillingTimestamp", &c.LastBillingTimestamp) - delete(rawMsg, key) - case "lastSyncTimestamp": - err = unpopulateTimeRFC3339(val, "LastSyncTimestamp", &c.LastSyncTimestamp) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) - delete(rawMsg, key) - case "registrationTimestamp": - err = unpopulateTimeRFC3339(val, "RegistrationTimestamp", &c.RegistrationTimestamp) - delete(rawMsg, key) - case "reportedProperties": - err = unpopulate(val, "ReportedProperties", &c.ReportedProperties) - delete(rawMsg, key) - case "serviceEndpoint": - err = unpopulate(val, "ServiceEndpoint", &c.ServiceEndpoint) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &c.Status) - delete(rawMsg, key) - case "trialDaysRemaining": - err = unpopulate(val, "TrialDaysRemaining", &c.TrialDaysRemaining) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ClusterReportedProperties. -func (c ClusterReportedProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "clusterId", c.ClusterID) - populate(objectMap, "clusterName", c.ClusterName) - populate(objectMap, "clusterVersion", c.ClusterVersion) - populate(objectMap, "diagnosticLevel", c.DiagnosticLevel) - populate(objectMap, "imdsAttestation", c.ImdsAttestation) - populateTimeRFC3339(objectMap, "lastUpdated", c.LastUpdated) - populate(objectMap, "nodes", c.Nodes) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterReportedProperties. -func (c *ClusterReportedProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "clusterId": - err = unpopulate(val, "ClusterID", &c.ClusterID) - delete(rawMsg, key) - case "clusterName": - err = unpopulate(val, "ClusterName", &c.ClusterName) - delete(rawMsg, key) - case "clusterVersion": - err = unpopulate(val, "ClusterVersion", &c.ClusterVersion) - delete(rawMsg, key) - case "diagnosticLevel": - err = unpopulate(val, "DiagnosticLevel", &c.DiagnosticLevel) - delete(rawMsg, key) - case "imdsAttestation": - err = unpopulate(val, "ImdsAttestation", &c.ImdsAttestation) - delete(rawMsg, key) - case "lastUpdated": - err = unpopulateTimeRFC3339(val, "LastUpdated", &c.LastUpdated) - delete(rawMsg, key) - case "nodes": - err = unpopulate(val, "Nodes", &c.Nodes) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Extension. -func (e Extension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ExtensionProperties. -func (e ExtensionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aggregateState", e.AggregateState) - populate(objectMap, "extensionParameters", e.ExtensionParameters) - populate(objectMap, "perNodeExtensionDetails", e.PerNodeExtensionDetails) - populate(objectMap, "provisioningState", e.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PasswordCredential. -func (p *PasswordCredential) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endDateTime": - err = unpopulateTimeRFC3339(val, "EndDateTime", &p.EndDateTime) - delete(rawMsg, key) - case "keyId": - err = unpopulate(val, "KeyID", &p.KeyID) - delete(rawMsg, key) - case "secretText": - err = unpopulate(val, "SecretText", &p.SecretText) - delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &p.StartDateTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RawCertificateData. -func (r RawCertificateData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "certificates", r.Certificates) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}