diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md b/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md index 8d1b2a7d7e2b..fc30fbd091ca 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md @@ -1,5 +1,63 @@ # Release History +## 0.7.0 (2022-11-29) +### Features Added + +- New const `CredentialHealthStatusHealthy` +- New const `CredentialHealthStatusUnhealthy` +- New const `CredentialNameCredential1` +- New type alias `CredentialHealthStatus` +- New type alias `CredentialName` +- New function `NewCacheRulesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CacheRulesClient, error)` +- New function `*CacheRulesClient.BeginCreate(context.Context, string, string, string, CacheRule, *CacheRulesClientBeginCreateOptions) (*runtime.Poller[CacheRulesClientCreateResponse], error)` +- New function `*CacheRulesClient.BeginDelete(context.Context, string, string, string, *CacheRulesClientBeginDeleteOptions) (*runtime.Poller[CacheRulesClientDeleteResponse], error)` +- New function `*CacheRulesClient.GetAsync(context.Context, string, string, string, *CacheRulesClientGetAsyncOptions) (CacheRulesClientGetAsyncResponse, error)` +- New function `*CacheRulesClient.NewListAsyncPager(string, string, *CacheRulesClientListAsyncOptions) *runtime.Pager[CacheRulesClientListAsyncResponse]` +- New function `*CacheRulesClient.BeginUpdate(context.Context, string, string, string, CacheRuleUpdateParameters, *CacheRulesClientBeginUpdateOptions) (*runtime.Poller[CacheRulesClientUpdateResponse], error)` +- New function `NewCredentialSetsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CredentialSetsClient, error)` +- New function `*CredentialSetsClient.BeginCreate(context.Context, string, string, string, CredentialSet, *CredentialSetsClientBeginCreateOptions) (*runtime.Poller[CredentialSetsClientCreateResponse], error)` +- New function `*CredentialSetsClient.BeginDelete(context.Context, string, string, string, *CredentialSetsClientBeginDeleteOptions) (*runtime.Poller[CredentialSetsClientDeleteResponse], error)` +- New function `*CredentialSetsClient.Get(context.Context, string, string, string, *CredentialSetsClientGetOptions) (CredentialSetsClientGetResponse, error)` +- New function `*CredentialSetsClient.NewListPager(string, string, *CredentialSetsClientListOptions) *runtime.Pager[CredentialSetsClientListResponse]` +- New function `*CredentialSetsClient.BeginUpdate(context.Context, string, string, string, CredentialSetUpdateParameters, *CredentialSetsClientBeginUpdateOptions) (*runtime.Poller[CredentialSetsClientUpdateResponse], error)` +- New function `PossibleCredentialHealthStatusValues() []CredentialHealthStatus` +- New function `PossibleCredentialNameValues() []CredentialName` +- New struct `AuthCredential` +- New struct `CacheRule` +- New struct `CacheRuleProperties` +- New struct `CacheRuleUpdateParameters` +- New struct `CacheRuleUpdateProperties` +- New struct `CacheRulesClient` +- New struct `CacheRulesClientBeginCreateOptions` +- New struct `CacheRulesClientBeginDeleteOptions` +- New struct `CacheRulesClientBeginUpdateOptions` +- New struct `CacheRulesClientCreateResponse` +- New struct `CacheRulesClientDeleteResponse` +- New struct `CacheRulesClientGetAsyncOptions` +- New struct `CacheRulesClientGetAsyncResponse` +- New struct `CacheRulesClientListAsyncOptions` +- New struct `CacheRulesClientListAsyncResponse` +- New struct `CacheRulesClientUpdateResponse` +- New struct `CacheRulesListResult` +- New struct `CredentialHealth` +- New struct `CredentialSet` +- New struct `CredentialSetListResult` +- New struct `CredentialSetProperties` +- New struct `CredentialSetUpdateParameters` +- New struct `CredentialSetUpdateProperties` +- New struct `CredentialSetsClient` +- New struct `CredentialSetsClientBeginCreateOptions` +- New struct `CredentialSetsClientBeginDeleteOptions` +- New struct `CredentialSetsClientBeginUpdateOptions` +- New struct `CredentialSetsClientCreateResponse` +- New struct `CredentialSetsClientDeleteResponse` +- New struct `CredentialSetsClientGetOptions` +- New struct `CredentialSetsClientGetResponse` +- New struct `CredentialSetsClientListOptions` +- New struct `CredentialSetsClientListResponse` +- New struct `CredentialSetsClientUpdateResponse` + + ## 0.6.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.6.0, which contains breaking changes. diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_agentpools_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client.go similarity index 99% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_agentpools_client.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client.go index 3b3b7da1b5c4..50eb876047c4 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_agentpools_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_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 armcontainerregistry @@ -313,7 +314,6 @@ func (client *AgentPoolsClient) getQueueStatusHandleResponse(resp *http.Response } // NewListPager - Lists all the agent pools for a specified container registry. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-06-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md b/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md index 07cca00aaea8..6b193d25028b 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/containerregistry/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/containerregistry/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.6.0 +module-version: 0.7.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go new file mode 100644 index 000000000000..114f7a542524 --- /dev/null +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go @@ -0,0 +1,392 @@ +//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 armcontainerregistry + +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" +) + +// CacheRulesClient contains the methods for the CacheRules group. +// Don't use this type directly, use NewCacheRulesClient() instead. +type CacheRulesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCacheRulesClient creates a new instance of CacheRulesClient with the specified values. +// subscriptionID - The Microsoft Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCacheRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CacheRulesClient, 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 := &CacheRulesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreate - Creates a cache rule for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-01-01-preview +// resourceGroupName - The name of the resource group to which the container registry belongs. +// registryName - The name of the container registry. +// cacheRuleName - The name of the cache rule. +// cacheRuleCreateParameters - The parameters for creating a cache rule. +// options - CacheRulesClientBeginCreateOptions contains the optional parameters for the CacheRulesClient.BeginCreate method. +func (client *CacheRulesClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleCreateParameters CacheRule, options *CacheRulesClientBeginCreateOptions) (*runtime.Poller[CacheRulesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, registryName, cacheRuleName, cacheRuleCreateParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[CacheRulesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[CacheRulesClientCreateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Create - Creates a cache rule for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-01-01-preview +func (client *CacheRulesClient) create(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleCreateParameters CacheRule, options *CacheRulesClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, cacheRuleName, cacheRuleCreateParameters, 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.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *CacheRulesClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleCreateParameters CacheRule, options *CacheRulesClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if cacheRuleName == "" { + return nil, errors.New("parameter cacheRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheRuleName}", url.PathEscape(cacheRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, cacheRuleCreateParameters) +} + +// BeginDelete - Deletes a cache rule resource from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-01-01-preview +// resourceGroupName - The name of the resource group to which the container registry belongs. +// registryName - The name of the container registry. +// cacheRuleName - The name of the cache rule. +// options - CacheRulesClientBeginDeleteOptions contains the optional parameters for the CacheRulesClient.BeginDelete method. +func (client *CacheRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *CacheRulesClientBeginDeleteOptions) (*runtime.Poller[CacheRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, cacheRuleName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[CacheRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[CacheRulesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a cache rule resource from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-01-01-preview +func (client *CacheRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *CacheRulesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, cacheRuleName, 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, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CacheRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *CacheRulesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if cacheRuleName == "" { + return nil, errors.New("parameter cacheRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheRuleName}", url.PathEscape(cacheRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetAsync - Gets the properties of the specified cache rule resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-01-01-preview +// resourceGroupName - The name of the resource group to which the container registry belongs. +// registryName - The name of the container registry. +// cacheRuleName - The name of the cache rule. +// options - CacheRulesClientGetAsyncOptions contains the optional parameters for the CacheRulesClient.GetAsync method. +func (client *CacheRulesClient) GetAsync(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *CacheRulesClientGetAsyncOptions) (CacheRulesClientGetAsyncResponse, error) { + req, err := client.getAsyncCreateRequest(ctx, resourceGroupName, registryName, cacheRuleName, options) + if err != nil { + return CacheRulesClientGetAsyncResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CacheRulesClientGetAsyncResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CacheRulesClientGetAsyncResponse{}, runtime.NewResponseError(resp) + } + return client.getAsyncHandleResponse(resp) +} + +// getAsyncCreateRequest creates the GetAsync request. +func (client *CacheRulesClient) getAsyncCreateRequest(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *CacheRulesClientGetAsyncOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if cacheRuleName == "" { + return nil, errors.New("parameter cacheRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheRuleName}", url.PathEscape(cacheRuleName)) + 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", "2023-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAsyncHandleResponse handles the GetAsync response. +func (client *CacheRulesClient) getAsyncHandleResponse(resp *http.Response) (CacheRulesClientGetAsyncResponse, error) { + result := CacheRulesClientGetAsyncResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CacheRule); err != nil { + return CacheRulesClientGetAsyncResponse{}, err + } + return result, nil +} + +// NewListAsyncPager - Lists all cache rule resources for the specified container registry. +// Generated from API version 2023-01-01-preview +// resourceGroupName - The name of the resource group to which the container registry belongs. +// registryName - The name of the container registry. +// options - CacheRulesClientListAsyncOptions contains the optional parameters for the CacheRulesClient.ListAsync method. +func (client *CacheRulesClient) NewListAsyncPager(resourceGroupName string, registryName string, options *CacheRulesClientListAsyncOptions) *runtime.Pager[CacheRulesClientListAsyncResponse] { + return runtime.NewPager(runtime.PagingHandler[CacheRulesClientListAsyncResponse]{ + More: func(page CacheRulesClientListAsyncResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CacheRulesClientListAsyncResponse) (CacheRulesClientListAsyncResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAsyncCreateRequest(ctx, resourceGroupName, registryName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CacheRulesClientListAsyncResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CacheRulesClientListAsyncResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CacheRulesClientListAsyncResponse{}, runtime.NewResponseError(resp) + } + return client.listAsyncHandleResponse(resp) + }, + }) +} + +// listAsyncCreateRequest creates the ListAsync request. +func (client *CacheRulesClient) listAsyncCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *CacheRulesClientListAsyncOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + 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", "2023-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAsyncHandleResponse handles the ListAsync response. +func (client *CacheRulesClient) listAsyncHandleResponse(resp *http.Response) (CacheRulesClientListAsyncResponse, error) { + result := CacheRulesClientListAsyncResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CacheRulesListResult); err != nil { + return CacheRulesClientListAsyncResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates a cache rule for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-01-01-preview +// resourceGroupName - The name of the resource group to which the container registry belongs. +// registryName - The name of the container registry. +// cacheRuleName - The name of the cache rule. +// cacheRuleUpdateParameters - The parameters for updating a cache rule. +// options - CacheRulesClientBeginUpdateOptions contains the optional parameters for the CacheRulesClient.BeginUpdate method. +func (client *CacheRulesClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleUpdateParameters CacheRuleUpdateParameters, options *CacheRulesClientBeginUpdateOptions) (*runtime.Poller[CacheRulesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, registryName, cacheRuleName, cacheRuleUpdateParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CacheRulesClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CacheRulesClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Updates a cache rule for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-01-01-preview +func (client *CacheRulesClient) update(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleUpdateParameters CacheRuleUpdateParameters, options *CacheRulesClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, cacheRuleName, cacheRuleUpdateParameters, 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 +} + +// updateCreateRequest creates the Update request. +func (client *CacheRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleUpdateParameters CacheRuleUpdateParameters, options *CacheRulesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if cacheRuleName == "" { + return nil, errors.New("parameter cacheRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheRuleName}", url.PathEscape(cacheRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, cacheRuleUpdateParameters) +} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_connectedregistries_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client.go similarity index 95% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_connectedregistries_client.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client.go index 2d4cc09eccaf..4d18b0f5a590 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_connectedregistries_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_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 armcontainerregistry @@ -56,7 +57,7 @@ func NewConnectedRegistriesClient(subscriptionID string, credential azcore.Token // BeginCreate - Creates a connected registry for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // connectedRegistryName - The name of the connected registry. @@ -69,7 +70,9 @@ func (client *ConnectedRegistriesClient) BeginCreate(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller[ConnectedRegistriesClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConnectedRegistriesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[ConnectedRegistriesClientCreateResponse](options.ResumeToken, client.pl, nil) } @@ -77,7 +80,7 @@ func (client *ConnectedRegistriesClient) BeginCreate(ctx context.Context, resour // Create - Creates a connected registry for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *ConnectedRegistriesClient) create(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters ConnectedRegistry, options *ConnectedRegistriesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryCreateParameters, options) if err != nil { @@ -117,7 +120,7 @@ func (client *ConnectedRegistriesClient) createCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, connectedRegistryCreateParameters) @@ -125,7 +128,7 @@ func (client *ConnectedRegistriesClient) createCreateRequest(ctx context.Context // BeginDeactivate - Deactivates the connected registry instance. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // connectedRegistryName - The name of the connected registry. @@ -145,7 +148,7 @@ func (client *ConnectedRegistriesClient) BeginDeactivate(ctx context.Context, re // Deactivate - Deactivates the connected registry instance. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *ConnectedRegistriesClient) deactivate(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientBeginDeactivateOptions) (*http.Response, error) { req, err := client.deactivateCreateRequest(ctx, resourceGroupName, registryName, connectedRegistryName, options) if err != nil { @@ -185,7 +188,7 @@ func (client *ConnectedRegistriesClient) deactivateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,7 +196,7 @@ func (client *ConnectedRegistriesClient) deactivateCreateRequest(ctx context.Con // BeginDelete - Deletes a connected registry from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // connectedRegistryName - The name of the connected registry. @@ -205,7 +208,9 @@ func (client *ConnectedRegistriesClient) BeginDelete(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller[ConnectedRegistriesClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConnectedRegistriesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[ConnectedRegistriesClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -213,7 +218,7 @@ func (client *ConnectedRegistriesClient) BeginDelete(ctx context.Context, resour // Delete - Deletes a connected registry from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *ConnectedRegistriesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, connectedRegistryName, options) if err != nil { @@ -253,7 +258,7 @@ func (client *ConnectedRegistriesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,7 +266,7 @@ func (client *ConnectedRegistriesClient) deleteCreateRequest(ctx context.Context // Get - Gets the properties of the connected registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // connectedRegistryName - The name of the connected registry. @@ -305,7 +310,7 @@ func (client *ConnectedRegistriesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,8 +326,7 @@ func (client *ConnectedRegistriesClient) getHandleResponse(resp *http.Response) } // NewListPager - Lists all connected registries for the specified container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // options - ConnectedRegistriesClientListOptions contains the optional parameters for the ConnectedRegistriesClient.List @@ -375,7 +379,7 @@ func (client *ConnectedRegistriesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -395,7 +399,7 @@ func (client *ConnectedRegistriesClient) listHandleResponse(resp *http.Response) // BeginUpdate - Updates a connected registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // connectedRegistryName - The name of the connected registry. @@ -416,7 +420,7 @@ func (client *ConnectedRegistriesClient) BeginUpdate(ctx context.Context, resour // Update - Updates a connected registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *ConnectedRegistriesClient) update(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters ConnectedRegistryUpdateParameters, options *ConnectedRegistriesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryUpdateParameters, options) if err != nil { @@ -456,7 +460,7 @@ func (client *ConnectedRegistriesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, connectedRegistryUpdateParameters) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_constants.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go similarity index 96% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_constants.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go index f703213b81a1..24d88096fac6 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_constants.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/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 armcontainerregistry const ( moduleName = "armcontainerregistry" - moduleVersion = "v0.6.0" + moduleVersion = "v0.7.0" ) // Action - The action of IP ACL rule. @@ -239,6 +240,36 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// CredentialHealthStatus - The health status of credential. +type CredentialHealthStatus string + +const ( + CredentialHealthStatusHealthy CredentialHealthStatus = "Healthy" + CredentialHealthStatusUnhealthy CredentialHealthStatus = "Unhealthy" +) + +// PossibleCredentialHealthStatusValues returns the possible values for the CredentialHealthStatus const type. +func PossibleCredentialHealthStatusValues() []CredentialHealthStatus { + return []CredentialHealthStatus{ + CredentialHealthStatusHealthy, + CredentialHealthStatusUnhealthy, + } +} + +// CredentialName - The name of the credential. +type CredentialName string + +const ( + CredentialNameCredential1 CredentialName = "Credential1" +) + +// PossibleCredentialNameValues returns the possible values for the CredentialName const type. +func PossibleCredentialNameValues() []CredentialName { + return []CredentialName{ + CredentialNameCredential1, + } +} + // DefaultAction - The default action of allow or deny when no other rules match. type DefaultAction string diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/containerregistry_build_live_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/containerregistry_build_live_test.go deleted file mode 100644 index 6eb43d47f5d3..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/containerregistry_build_live_test.go +++ /dev/null @@ -1,357 +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 armcontainerregistry_test - -import ( - "context" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/stretchr/testify/suite" -) - -type ContainerregistryBuildTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - agentPoolName string - registryName string - taskName string - taskRunName string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *ContainerregistryBuildTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/containerregistry/armcontainerregistry/testdata") - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.agentPoolName = testutil.GenerateAlphaNumericID(testsuite.T(), "agentpooln", 6) - testsuite.registryName = testutil.GenerateAlphaNumericID(testsuite.T(), "registryna2", 6) - testsuite.taskName = testutil.GenerateAlphaNumericID(testsuite.T(), "taskname", 6) - testsuite.taskRunName = testutil.GenerateAlphaNumericID(testsuite.T(), "taskrunnam", 6) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name - testsuite.Prepare() -} - -func (testsuite *ContainerregistryBuildTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestContainerregistryBuildTestSuite(t *testing.T) { - suite.Run(t, new(ContainerregistryBuildTestSuite)) -} - -func (testsuite *ContainerregistryBuildTestSuite) Prepare() { - var err error - // From step Registries_Create2 - registriesClient, err := armcontainerregistry.NewRegistriesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - registriesClientCreateResponsePoller, err := registriesClient.BeginCreate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, armcontainerregistry.Registry{ - Location: to.Ptr(testsuite.location), - Properties: &armcontainerregistry.RegistryProperties{ - AdminUserEnabled: to.Ptr(true), - }, - SKU: &armcontainerregistry.SKU{ - Name: to.Ptr(armcontainerregistry.SKUNamePremium), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, registriesClientCreateResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.ContainerRegistry/registries/agentPools -func (testsuite *ContainerregistryBuildTestSuite) TestAgentpools() { - var err error - // From step AgentPools_Create - agentPoolsClient, err := armcontainerregistry.NewAgentPoolsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - agentPoolsClientCreateResponsePoller, err := agentPoolsClient.BeginCreate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.agentPoolName, armcontainerregistry.AgentPool{ - Location: to.Ptr(testsuite.location), - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - Properties: &armcontainerregistry.AgentPoolProperties{ - Count: to.Ptr[int32](1), - OS: to.Ptr(armcontainerregistry.OSLinux), - Tier: to.Ptr("S1"), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, agentPoolsClientCreateResponsePoller) - testsuite.Require().NoError(err) - - // From step AgentPools_List - agentPoolsClientNewListPager := agentPoolsClient.NewListPager(testsuite.resourceGroupName, testsuite.registryName, nil) - for agentPoolsClientNewListPager.More() { - _, err := agentPoolsClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step AgentPools_Get - _, err = agentPoolsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.agentPoolName, nil) - testsuite.Require().NoError(err) - - // From step AgentPools_Update - agentPoolsClientUpdateResponsePoller, err := agentPoolsClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.agentPoolName, armcontainerregistry.AgentPoolUpdateParameters{ - Properties: &armcontainerregistry.AgentPoolPropertiesUpdateParameters{ - Count: to.Ptr[int32](1), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, agentPoolsClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step AgentPools_GetQueueStatus - _, err = agentPoolsClient.GetQueueStatus(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.agentPoolName, nil) - testsuite.Require().NoError(err) - - // From step AgentPools_Delete - agentPoolsClientDeleteResponsePoller, err := agentPoolsClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.agentPoolName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, agentPoolsClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.ContainerRegistry/registries/tasks -func (testsuite *ContainerregistryBuildTestSuite) TestTasks() { - var runId string - var err error - // From step Tasks_Create - tasksClient, err := armcontainerregistry.NewTasksClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - tasksClientCreateResponsePoller, err := tasksClient.BeginCreate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.taskName, armcontainerregistry.Task{ - Location: to.Ptr(testsuite.location), - Tags: map[string]*string{ - "testkey": to.Ptr("value"), - }, - Properties: &armcontainerregistry.TaskProperties{ - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](2), - }, - IsSystemTask: to.Ptr(false), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - Step: &armcontainerregistry.DockerBuildStep{ - Type: to.Ptr(armcontainerregistry.StepTypeDocker), - ContextPath: to.Ptr("https://github.com/SteveLasker/node-helloworld"), - DockerFilePath: to.Ptr("DockerFile"), - ImageNames: []*string{ - to.Ptr("testtask:v1")}, - IsPushEnabled: to.Ptr(true), - NoCache: to.Ptr(false), - }, - Trigger: &armcontainerregistry.TriggerProperties{ - BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - Name: to.Ptr("myBaseImageTrigger"), - BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - UpdateTriggerPayloadType: to.Ptr(armcontainerregistry.UpdateTriggerPayloadTypeDefault), - }, - }, - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, tasksClientCreateResponsePoller) - testsuite.Require().NoError(err) - - // From step Tasks_List - tasksClientNewListPager := tasksClient.NewListPager(testsuite.resourceGroupName, testsuite.registryName, nil) - for tasksClientNewListPager.More() { - _, err := tasksClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step Tasks_Get - _, err = tasksClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.taskName, nil) - testsuite.Require().NoError(err) - - // From step Tasks_Update - tasksClientUpdateResponsePoller, err := tasksClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.taskName, armcontainerregistry.TaskUpdateParameters{ - Tags: map[string]*string{ - "testkey": to.Ptr("value"), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, tasksClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step Tasks_GetDetails - _, err = tasksClient.GetDetails(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.taskName, nil) - testsuite.Require().NoError(err) - - // From step TaskRuns_Create - taskRunsClient, err := armcontainerregistry.NewTaskRunsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - taskRunsClientCreateResponsePoller, err := taskRunsClient.BeginCreate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.taskRunName, armcontainerregistry.TaskRun{ - Properties: &armcontainerregistry.TaskRunProperties{ - ForceUpdateTag: to.Ptr("test"), - RunRequest: &armcontainerregistry.EncodedTaskRunRequest{ - Type: to.Ptr("EncodedTaskRunRequest"), - Credentials: &armcontainerregistry.Credentials{}, - EncodedTaskContent: to.Ptr("c3RlcHM6IAogIC0gY21kOiB7eyAuVmFsdWVzLmNvbW1hbmQgfX0K"), - EncodedValuesContent: to.Ptr("Y29tbWFuZDogYmFzaCBlY2hvIHt7LlJ1bi5SZWdpc3RyeX19Cg=="), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - Values: []*armcontainerregistry.SetValue{}, - }, - }, - }, nil) - testsuite.Require().NoError(err) - var taskRunsClientCreateResponse *armcontainerregistry.TaskRunsClientCreateResponse - taskRunsClientCreateResponse, err = testutil.PollForTest(testsuite.ctx, taskRunsClientCreateResponsePoller) - testsuite.Require().NoError(err) - runId = *taskRunsClientCreateResponse.Properties.RunResult.Properties.RunID - - // From step TaskRuns_List - taskRunsClientNewListPager := taskRunsClient.NewListPager(testsuite.resourceGroupName, testsuite.registryName, nil) - for taskRunsClientNewListPager.More() { - _, err := taskRunsClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step TaskRuns_Get - _, err = taskRunsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.taskRunName, nil) - testsuite.Require().NoError(err) - - // From step TaskRuns_Update - taskRunsClientUpdateResponsePoller, err := taskRunsClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.taskRunName, armcontainerregistry.TaskRunUpdateParameters{ - Properties: &armcontainerregistry.TaskRunPropertiesUpdateParameters{ - ForceUpdateTag: to.Ptr("test"), - RunRequest: &armcontainerregistry.EncodedTaskRunRequest{ - Type: to.Ptr("EncodedTaskRunRequest"), - IsArchiveEnabled: to.Ptr(true), - Credentials: &armcontainerregistry.Credentials{}, - EncodedTaskContent: to.Ptr("c3RlcHM6IAogIC0gY21kOiB7eyAuVmFsdWVzLmNvbW1hbmQgfX0K"), - EncodedValuesContent: to.Ptr("Y29tbWFuZDogYmFzaCBlY2hvIHt7LlJ1bi5SZWdpc3RyeX19Cg=="), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - Values: []*armcontainerregistry.SetValue{}, - }, - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, taskRunsClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step TaskRuns_GetDetails - _, err = taskRunsClient.GetDetails(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.taskRunName, nil) - testsuite.Require().NoError(err) - - // From step Registries_GetBuildSourceUploadUrl - registriesClient, err := armcontainerregistry.NewRegistriesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = registriesClient.GetBuildSourceUploadURL(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, nil) - testsuite.Require().NoError(err) - - // From step Runs_List - runsClient, err := armcontainerregistry.NewRunsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - runsClientNewListPager := runsClient.NewListPager(testsuite.resourceGroupName, testsuite.registryName, &armcontainerregistry.RunsClientListOptions{Filter: nil, - Top: to.Ptr[int32](10), - }) - for runsClientNewListPager.More() { - _, err := runsClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step Runs_Get - _, err = runsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, runId, nil) - testsuite.Require().NoError(err) - - // From step Runs_Cancel - runsClientCancelResponsePoller, err := runsClient.BeginCancel(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, runId, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, runsClientCancelResponsePoller) - testsuite.Require().NoError(err) - - // From step Runs_GetLogSasUrl - _, err = runsClient.GetLogSasURL(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, runId, nil) - testsuite.Require().NoError(err) - - // From step Registries_ScheduleRun - registriesClientScheduleRunResponsePoller, err := registriesClient.BeginScheduleRun(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, &armcontainerregistry.DockerBuildRequest{ - Type: to.Ptr("DockerBuildRequest"), - IsArchiveEnabled: to.Ptr(true), - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](2), - }, - Arguments: []*armcontainerregistry.Argument{ - { - Name: to.Ptr("mytestargument"), - IsSecret: to.Ptr(false), - Value: to.Ptr("mytestvalue"), - }, - { - Name: to.Ptr("mysecrettestargument"), - IsSecret: to.Ptr(true), - Value: to.Ptr("mysecrettestvalue"), - }}, - DockerFilePath: to.Ptr("DockerFile"), - ImageNames: []*string{ - to.Ptr("azurerest:testtag")}, - IsPushEnabled: to.Ptr(true), - NoCache: to.Ptr(true), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - SourceLocation: to.Ptr("https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, registriesClientScheduleRunResponsePoller) - testsuite.Require().NoError(err) - - // From step TaskRuns_Delete - taskRunsClientDeleteResponsePoller, err := taskRunsClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.taskRunName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, taskRunsClientDeleteResponsePoller) - testsuite.Require().NoError(err) - - // From step Runs_Update - runsClientUpdateResponsePoller, err := runsClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, runId, armcontainerregistry.RunUpdateParameters{ - IsArchiveEnabled: to.Ptr(true), - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, runsClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step Tasks_Delete - tasksClientDeleteResponsePoller, err := tasksClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.taskName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, tasksClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/containerregistry_live_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/containerregistry_live_test.go deleted file mode 100644 index 47f01ad68093..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/containerregistry_live_test.go +++ /dev/null @@ -1,528 +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 armcontainerregistry_test - -import ( - "context" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/stretchr/testify/suite" -) - -type ContainerregistryTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - exportPipelineName string - importPipelineName string - registryName string - replicationName string - scopeMapId string - scopeMapName string - tokenId string - tokenName string - webhookName string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *ContainerregistryTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/containerregistry/armcontainerregistry/testdata") - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.exportPipelineName = testutil.GenerateAlphaNumericID(testsuite.T(), "exportpipe", 6) - testsuite.importPipelineName = testutil.GenerateAlphaNumericID(testsuite.T(), "importpipe", 6) - testsuite.registryName = testutil.GenerateAlphaNumericID(testsuite.T(), "registryna", 6) - testsuite.replicationName = testutil.GenerateAlphaNumericID(testsuite.T(), "replicatio", 6) - testsuite.scopeMapName = testutil.GenerateAlphaNumericID(testsuite.T(), "scopemapna", 6) - testsuite.tokenName = testutil.GenerateAlphaNumericID(testsuite.T(), "tokenname", 6) - testsuite.webhookName = testutil.GenerateAlphaNumericID(testsuite.T(), "webhooknam", 6) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name - testsuite.Prepare() -} - -func (testsuite *ContainerregistryTestSuite) TearDownSuite() { - testsuite.Cleanup() - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestContainerregistryTestSuite(t *testing.T) { - suite.Run(t, new(ContainerregistryTestSuite)) -} - -func (testsuite *ContainerregistryTestSuite) Prepare() { - var err error - // From step Registries_Create - registriesClient, err := armcontainerregistry.NewRegistriesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - registriesClientCreateResponsePoller, err := registriesClient.BeginCreate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, armcontainerregistry.Registry{ - Location: to.Ptr(testsuite.location), - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - Properties: &armcontainerregistry.RegistryProperties{ - AdminUserEnabled: to.Ptr(true), - }, - SKU: &armcontainerregistry.SKU{ - Name: to.Ptr(armcontainerregistry.SKUNamePremium), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, registriesClientCreateResponsePoller) - testsuite.Require().NoError(err) - - // From step ScopeMaps_Create - scopeMapsClient, err := armcontainerregistry.NewScopeMapsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - scopeMapsClientCreateResponsePoller, err := scopeMapsClient.BeginCreate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.scopeMapName, armcontainerregistry.ScopeMap{ - Properties: &armcontainerregistry.ScopeMapProperties{ - Description: to.Ptr("Developer Scopes"), - Actions: []*string{ - to.Ptr("repositories/myrepository/content/write"), - to.Ptr("repositories/myrepository/content/delete")}, - }, - }, nil) - testsuite.Require().NoError(err) - var scopeMapsClientCreateResponse *armcontainerregistry.ScopeMapsClientCreateResponse - scopeMapsClientCreateResponse, err = testutil.PollForTest(testsuite.ctx, scopeMapsClientCreateResponsePoller) - testsuite.Require().NoError(err) - testsuite.scopeMapId = *scopeMapsClientCreateResponse.ID - - // From step Tokens_Create - tokensClient, err := armcontainerregistry.NewTokensClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - tokensClientCreateResponsePoller, err := tokensClient.BeginCreate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.tokenName, armcontainerregistry.Token{ - Properties: &armcontainerregistry.TokenProperties{ - ScopeMapID: to.Ptr(testsuite.scopeMapId), - Status: to.Ptr(armcontainerregistry.TokenStatusDisabled), - }, - }, nil) - testsuite.Require().NoError(err) - var tokensClientCreateResponse *armcontainerregistry.TokensClientCreateResponse - tokensClientCreateResponse, err = testutil.PollForTest(testsuite.ctx, tokensClientCreateResponsePoller) - testsuite.Require().NoError(err) - testsuite.tokenId = *tokensClientCreateResponse.ID -} - -// Microsoft.ContainerRegistry/registries -func (testsuite *ContainerregistryTestSuite) TestContainerregister() { - var err error - // From step Registries_CheckNameAvailability - registriesClient, err := armcontainerregistry.NewRegistriesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = registriesClient.CheckNameAvailability(testsuite.ctx, armcontainerregistry.RegistryNameCheckRequest{ - Name: to.Ptr("myRegistry"), - Type: to.Ptr("Microsoft.ContainerRegistry/registries"), - }, nil) - testsuite.Require().NoError(err) - - // From step Registries_List - registriesClientNewListPager := registriesClient.NewListPager(nil) - for registriesClientNewListPager.More() { - _, err := registriesClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step Registries_Get - _, err = registriesClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, nil) - testsuite.Require().NoError(err) - - // From step Registries_ListByResourceGroup - registriesClientNewListByResourceGroupPager := registriesClient.NewListByResourceGroupPager(testsuite.resourceGroupName, nil) - for registriesClientNewListByResourceGroupPager.More() { - _, err := registriesClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step Registries_ListUsages - _, err = registriesClient.ListUsages(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, nil) - testsuite.Require().NoError(err) - - // From step Registries_Update - registriesClientUpdateResponsePoller, err := registriesClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, armcontainerregistry.RegistryUpdateParameters{ - Properties: &armcontainerregistry.RegistryPropertiesUpdateParameters{ - AdminUserEnabled: to.Ptr(true), - }, - SKU: &armcontainerregistry.SKU{ - Name: to.Ptr(armcontainerregistry.SKUNamePremium), - }, - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, registriesClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step Registries_ListPrivateLinkResources - registriesClientNewListPrivateLinkResourcesPager := registriesClient.NewListPrivateLinkResourcesPager(testsuite.resourceGroupName, testsuite.registryName, nil) - for registriesClientNewListPrivateLinkResourcesPager.More() { - _, err := registriesClientNewListPrivateLinkResourcesPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step Registries_GetPrivateLinkResource - _, err = registriesClient.GetPrivateLinkResource(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, "registry", nil) - testsuite.Require().NoError(err) -} - -// Microsoft.ContainerRegistry/registries/webhooks -func (testsuite *ContainerregistryTestSuite) TestWebhooks() { - var err error - // From step Webhooks_Create - webhooksClient, err := armcontainerregistry.NewWebhooksClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - webhooksClientCreateResponsePoller, err := webhooksClient.BeginCreate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.webhookName, armcontainerregistry.WebhookCreateParameters{ - Location: to.Ptr(testsuite.location), - Properties: &armcontainerregistry.WebhookPropertiesCreateParameters{ - Actions: []*armcontainerregistry.WebhookAction{ - to.Ptr(armcontainerregistry.WebhookActionPush)}, - CustomHeaders: map[string]*string{ - "Authorization": to.Ptr("Basic 000000000000000000000000000000000000000000000000000"), - }, - ServiceURI: to.Ptr("http://myservice.com"), - Status: to.Ptr(armcontainerregistry.WebhookStatusEnabled), - }, - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, webhooksClientCreateResponsePoller) - testsuite.Require().NoError(err) - - // From step Webhooks_List - webhooksClientNewListPager := webhooksClient.NewListPager(testsuite.resourceGroupName, testsuite.registryName, nil) - for webhooksClientNewListPager.More() { - _, err := webhooksClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step Webhooks_Get - _, err = webhooksClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.webhookName, nil) - testsuite.Require().NoError(err) - - // From step Webhooks_Update - webhooksClientUpdateResponsePoller, err := webhooksClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.webhookName, armcontainerregistry.WebhookUpdateParameters{ - Properties: &armcontainerregistry.WebhookPropertiesUpdateParameters{ - Actions: []*armcontainerregistry.WebhookAction{ - to.Ptr(armcontainerregistry.WebhookActionPush)}, - CustomHeaders: map[string]*string{ - "Authorization": to.Ptr("Basic 000000000000000000000000000000000000000000000000000"), - }, - Scope: to.Ptr("repository"), - ServiceURI: to.Ptr("http://myservice.com"), - Status: to.Ptr(armcontainerregistry.WebhookStatusEnabled), - }, - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, webhooksClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step Webhooks_GetCallbackConfig - _, err = webhooksClient.GetCallbackConfig(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.webhookName, nil) - testsuite.Require().NoError(err) - - // From step Webhooks_Ping - _, err = webhooksClient.Ping(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.webhookName, nil) - testsuite.Require().NoError(err) - - // From step Webhooks_ListEvents - webhooksClientNewListEventsPager := webhooksClient.NewListEventsPager(testsuite.resourceGroupName, testsuite.registryName, testsuite.webhookName, nil) - for webhooksClientNewListEventsPager.More() { - _, err := webhooksClientNewListEventsPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step Webhooks_Delete - webhooksClientDeleteResponsePoller, err := webhooksClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.webhookName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, webhooksClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.ContainerRegistry/registries/replications -func (testsuite *ContainerregistryTestSuite) TestReplications() { - var err error - // From step Replications_Create - replicationsClient, err := armcontainerregistry.NewReplicationsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - replicationsClientCreateResponsePoller, err := replicationsClient.BeginCreate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.replicationName, armcontainerregistry.Replication{ - Location: to.Ptr("westus2"), - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, replicationsClientCreateResponsePoller) - testsuite.Require().NoError(err) - - // From step Replications_List - replicationsClientNewListPager := replicationsClient.NewListPager(testsuite.resourceGroupName, testsuite.registryName, nil) - for replicationsClientNewListPager.More() { - _, err := replicationsClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step Replications_Get - _, err = replicationsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.replicationName, nil) - testsuite.Require().NoError(err) - - // From step Replications_Update - replicationsClientUpdateResponsePoller, err := replicationsClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.replicationName, armcontainerregistry.ReplicationUpdateParameters{ - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, replicationsClientUpdateResponsePoller) - testsuite.Require().NoError(err) - - // From step Replications_Delete - replicationsClientDeleteResponsePoller, err := replicationsClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.replicationName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, replicationsClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.ContainerRegistry/registries/scopeMaps -func (testsuite *ContainerregistryTestSuite) TestScopemaps() { - var err error - // From step ScopeMaps_List - scopeMapsClient, err := armcontainerregistry.NewScopeMapsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - scopeMapsClientNewListPager := scopeMapsClient.NewListPager(testsuite.resourceGroupName, testsuite.registryName, nil) - for scopeMapsClientNewListPager.More() { - _, err := scopeMapsClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step ScopeMaps_Get - _, err = scopeMapsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.scopeMapName, nil) - testsuite.Require().NoError(err) - - // From step ScopeMaps_Update - scopeMapsClientUpdateResponsePoller, err := scopeMapsClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.scopeMapName, armcontainerregistry.ScopeMapUpdateParameters{ - Properties: &armcontainerregistry.ScopeMapPropertiesUpdateParameters{ - Description: to.Ptr("Developer Scopes"), - Actions: []*string{ - to.Ptr("repositories/myrepository/content/write"), - to.Ptr("repositories/myrepository/content/read")}, - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, scopeMapsClientUpdateResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.ContainerRegistry/registries/tokens -func (testsuite *ContainerregistryTestSuite) TestTokens() { - var err error - // From step Tokens_List - tokensClient, err := armcontainerregistry.NewTokensClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - tokensClientNewListPager := tokensClient.NewListPager(testsuite.resourceGroupName, testsuite.registryName, nil) - for tokensClientNewListPager.More() { - _, err := tokensClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step Tokens_Get - _, err = tokensClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.tokenName, nil) - testsuite.Require().NoError(err) - - // From step Tokens_Update - tokensClientUpdateResponsePoller, err := tokensClient.BeginUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.tokenName, armcontainerregistry.TokenUpdateParameters{ - Properties: &armcontainerregistry.TokenUpdateProperties{ - ScopeMapID: to.Ptr(testsuite.scopeMapId), - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, tokensClientUpdateResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.ContainerRegistry/registries/generateCredentials -func (testsuite *ContainerregistryTestSuite) TestRegistrycredentials() { - var err error - // From step Registries_GenerateCredentials - registriesClient, err := armcontainerregistry.NewRegistriesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - registriesClientGenerateCredentialsResponsePoller, err := registriesClient.BeginGenerateCredentials(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, armcontainerregistry.GenerateCredentialsParameters{ - TokenID: to.Ptr(testsuite.tokenId), - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, registriesClientGenerateCredentialsResponsePoller) - testsuite.Require().NoError(err) - - // From step Registries_RegenerateCredential - _, err = registriesClient.RegenerateCredential(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, armcontainerregistry.RegenerateCredentialParameters{ - Name: to.Ptr(armcontainerregistry.PasswordNamePassword), - }, nil) - testsuite.Require().NoError(err) - - // From step Registries_ListCredentials - _, err = registriesClient.ListCredentials(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, nil) - testsuite.Require().NoError(err) -} - -// Microsoft.ContainerRegistry/registries/exportPipelines -func (testsuite *ContainerregistryTestSuite) TestExportpipelines() { - var err error - // From step ExportPipelines_Create - exportPipelinesClient, err := armcontainerregistry.NewExportPipelinesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - exportPipelinesClientCreateResponsePoller, err := exportPipelinesClient.BeginCreate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.exportPipelineName, armcontainerregistry.ExportPipeline{ - Identity: &armcontainerregistry.IdentityProperties{ - Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - }, - Location: to.Ptr(testsuite.location), - Properties: &armcontainerregistry.ExportPipelineProperties{ - Options: []*armcontainerregistry.PipelineOptions{ - to.Ptr(armcontainerregistry.PipelineOptionsOverwriteBlobs)}, - Target: &armcontainerregistry.ExportPipelineTargetProperties{ - Type: to.Ptr("AzureStorageBlobContainer"), - KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - }, - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, exportPipelinesClientCreateResponsePoller) - testsuite.Require().NoError(err) - - // From step ExportPipelines_List - exportPipelinesClientNewListPager := exportPipelinesClient.NewListPager(testsuite.resourceGroupName, testsuite.registryName, nil) - for exportPipelinesClientNewListPager.More() { - _, err := exportPipelinesClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step ExportPipelines_Get - _, err = exportPipelinesClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.exportPipelineName, nil) - testsuite.Require().NoError(err) - - // From step ExportPipelines_Delete - exportPipelinesClientDeleteResponsePoller, err := exportPipelinesClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.exportPipelineName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, exportPipelinesClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.ContainerRegistry/registries/importPipelines -func (testsuite *ContainerregistryTestSuite) TestImportpipelines() { - var err error - // From step ImportPipelines_Create - importPipelinesClient, err := armcontainerregistry.NewImportPipelinesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - importPipelinesClientCreateResponsePoller, err := importPipelinesClient.BeginCreate(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.importPipelineName, armcontainerregistry.ImportPipeline{ - Identity: &armcontainerregistry.IdentityProperties{ - Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - }, - Location: to.Ptr(testsuite.location), - Properties: &armcontainerregistry.ImportPipelineProperties{ - Options: []*armcontainerregistry.PipelineOptions{ - to.Ptr(armcontainerregistry.PipelineOptionsOverwriteTags), - to.Ptr(armcontainerregistry.PipelineOptionsDeleteSourceBlobOnSuccess), - to.Ptr(armcontainerregistry.PipelineOptionsContinueOnErrors)}, - Source: &armcontainerregistry.ImportPipelineSourceProperties{ - Type: to.Ptr(armcontainerregistry.PipelineSourceTypeAzureStorageBlobContainer), - KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrimportsas"), - URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - }, - }, - }, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, importPipelinesClientCreateResponsePoller) - testsuite.Require().NoError(err) - - // From step ImportPipelines_List - importPipelinesClientNewListPager := importPipelinesClient.NewListPager(testsuite.resourceGroupName, testsuite.registryName, nil) - for importPipelinesClientNewListPager.More() { - _, err := importPipelinesClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step ImportPipelines_Get - _, err = importPipelinesClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.importPipelineName, nil) - testsuite.Require().NoError(err) - - // From step ImportPipelines_Delete - importPipelinesClientDeleteResponsePoller, err := importPipelinesClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.importPipelineName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, importPipelinesClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} - -// Microsoft.ContainerRegistry/operations -func (testsuite *ContainerregistryTestSuite) TestOperations() { - var err error - // From step Operations_List - operationsClient, err := armcontainerregistry.NewOperationsClient(testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - operationsClientNewListPager := operationsClient.NewListPager(nil) - for operationsClientNewListPager.More() { - _, err := operationsClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } -} - -func (testsuite *ContainerregistryTestSuite) Cleanup() { - var err error - // From step Tokens_Delete - tokensClient, err := armcontainerregistry.NewTokensClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - tokensClientDeleteResponsePoller, err := tokensClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.tokenName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, tokensClientDeleteResponsePoller) - testsuite.Require().NoError(err) - - // From step ScopeMaps_Delete - scopeMapsClient, err := armcontainerregistry.NewScopeMapsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - scopeMapsClientDeleteResponsePoller, err := scopeMapsClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, testsuite.scopeMapName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, scopeMapsClientDeleteResponsePoller) - testsuite.Require().NoError(err) - - // From step Registries_Delete - registriesClient, err := armcontainerregistry.NewRegistriesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - registriesClientDeleteResponsePoller, err := registriesClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.registryName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, registriesClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go new file mode 100644 index 000000000000..bb5b059b449a --- /dev/null +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go @@ -0,0 +1,395 @@ +//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 armcontainerregistry + +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" +) + +// CredentialSetsClient contains the methods for the CredentialSets group. +// Don't use this type directly, use NewCredentialSetsClient() instead. +type CredentialSetsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCredentialSetsClient creates a new instance of CredentialSetsClient with the specified values. +// subscriptionID - The Microsoft Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCredentialSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CredentialSetsClient, 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 := &CredentialSetsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreate - Creates a credential set for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-01-01-preview +// resourceGroupName - The name of the resource group to which the container registry belongs. +// registryName - The name of the container registry. +// credentialSetName - The name of the credential set. +// credentialSetCreateParameters - The parameters for creating a credential set. +// options - CredentialSetsClientBeginCreateOptions contains the optional parameters for the CredentialSetsClient.BeginCreate +// method. +func (client *CredentialSetsClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetCreateParameters CredentialSet, options *CredentialSetsClientBeginCreateOptions) (*runtime.Poller[CredentialSetsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, registryName, credentialSetName, credentialSetCreateParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[CredentialSetsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[CredentialSetsClientCreateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Create - Creates a credential set for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-01-01-preview +func (client *CredentialSetsClient) create(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetCreateParameters CredentialSet, options *CredentialSetsClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, credentialSetName, credentialSetCreateParameters, 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.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *CredentialSetsClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetCreateParameters CredentialSet, options *CredentialSetsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if credentialSetName == "" { + return nil, errors.New("parameter credentialSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{credentialSetName}", url.PathEscape(credentialSetName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, credentialSetCreateParameters) +} + +// BeginDelete - Deletes a credential set from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-01-01-preview +// resourceGroupName - The name of the resource group to which the container registry belongs. +// registryName - The name of the container registry. +// credentialSetName - The name of the credential set. +// options - CredentialSetsClientBeginDeleteOptions contains the optional parameters for the CredentialSetsClient.BeginDelete +// method. +func (client *CredentialSetsClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *CredentialSetsClientBeginDeleteOptions) (*runtime.Poller[CredentialSetsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, credentialSetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[CredentialSetsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[CredentialSetsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a credential set from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-01-01-preview +func (client *CredentialSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *CredentialSetsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, credentialSetName, 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, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CredentialSetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *CredentialSetsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if credentialSetName == "" { + return nil, errors.New("parameter credentialSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{credentialSetName}", url.PathEscape(credentialSetName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the properties of the specified credential set resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-01-01-preview +// resourceGroupName - The name of the resource group to which the container registry belongs. +// registryName - The name of the container registry. +// credentialSetName - The name of the credential set. +// options - CredentialSetsClientGetOptions contains the optional parameters for the CredentialSetsClient.Get method. +func (client *CredentialSetsClient) Get(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *CredentialSetsClientGetOptions) (CredentialSetsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, credentialSetName, options) + if err != nil { + return CredentialSetsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CredentialSetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CredentialSetsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CredentialSetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *CredentialSetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if credentialSetName == "" { + return nil, errors.New("parameter credentialSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{credentialSetName}", url.PathEscape(credentialSetName)) + 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", "2023-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CredentialSetsClient) getHandleResponse(resp *http.Response) (CredentialSetsClientGetResponse, error) { + result := CredentialSetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CredentialSet); err != nil { + return CredentialSetsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all credential set resources for the specified container registry. +// Generated from API version 2023-01-01-preview +// resourceGroupName - The name of the resource group to which the container registry belongs. +// registryName - The name of the container registry. +// options - CredentialSetsClientListOptions contains the optional parameters for the CredentialSetsClient.List method. +func (client *CredentialSetsClient) NewListPager(resourceGroupName string, registryName string, options *CredentialSetsClientListOptions) *runtime.Pager[CredentialSetsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[CredentialSetsClientListResponse]{ + More: func(page CredentialSetsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CredentialSetsClientListResponse) (CredentialSetsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CredentialSetsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CredentialSetsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CredentialSetsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *CredentialSetsClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *CredentialSetsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + 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", "2023-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *CredentialSetsClient) listHandleResponse(resp *http.Response) (CredentialSetsClientListResponse, error) { + result := CredentialSetsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CredentialSetListResult); err != nil { + return CredentialSetsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates a credential set for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-01-01-preview +// resourceGroupName - The name of the resource group to which the container registry belongs. +// registryName - The name of the container registry. +// credentialSetName - The name of the credential set. +// credentialSetUpdateParameters - The parameters for updating a credential set. +// options - CredentialSetsClientBeginUpdateOptions contains the optional parameters for the CredentialSetsClient.BeginUpdate +// method. +func (client *CredentialSetsClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetUpdateParameters CredentialSetUpdateParameters, options *CredentialSetsClientBeginUpdateOptions) (*runtime.Poller[CredentialSetsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, registryName, credentialSetName, credentialSetUpdateParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CredentialSetsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CredentialSetsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Updates a credential set for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-01-01-preview +func (client *CredentialSetsClient) update(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetUpdateParameters CredentialSetUpdateParameters, options *CredentialSetsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, credentialSetName, credentialSetUpdateParameters, 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 +} + +// updateCreateRequest creates the Update request. +func (client *CredentialSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetUpdateParameters CredentialSetUpdateParameters, options *CredentialSetsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}" + 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 registryName == "" { + return nil, errors.New("parameter registryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) + if credentialSetName == "" { + return nil, errors.New("parameter credentialSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{credentialSetName}", url.PathEscape(credentialSetName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, credentialSetUpdateParameters) +} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_exportpipelines_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client.go similarity index 94% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_exportpipelines_client.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client.go index 7e7480d116e1..45f0af3affd1 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_exportpipelines_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_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 armcontainerregistry @@ -56,7 +57,7 @@ func NewExportPipelinesClient(subscriptionID string, credential azcore.TokenCred // BeginCreate - Creates an export pipeline for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // exportPipelineName - The name of the export pipeline. @@ -69,7 +70,9 @@ func (client *ExportPipelinesClient) BeginCreate(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller[ExportPipelinesClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExportPipelinesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[ExportPipelinesClientCreateResponse](options.ResumeToken, client.pl, nil) } @@ -77,7 +80,7 @@ func (client *ExportPipelinesClient) BeginCreate(ctx context.Context, resourceGr // Create - Creates an export pipeline for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *ExportPipelinesClient) create(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters ExportPipeline, options *ExportPipelinesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, exportPipelineName, exportPipelineCreateParameters, options) if err != nil { @@ -117,7 +120,7 @@ func (client *ExportPipelinesClient) createCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, exportPipelineCreateParameters) @@ -125,7 +128,7 @@ func (client *ExportPipelinesClient) createCreateRequest(ctx context.Context, re // BeginDelete - Deletes an export pipeline from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // exportPipelineName - The name of the export pipeline. @@ -137,7 +140,9 @@ func (client *ExportPipelinesClient) BeginDelete(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller[ExportPipelinesClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExportPipelinesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[ExportPipelinesClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -145,7 +150,7 @@ func (client *ExportPipelinesClient) BeginDelete(ctx context.Context, resourceGr // Delete - Deletes an export pipeline from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *ExportPipelinesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, options *ExportPipelinesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, exportPipelineName, options) if err != nil { @@ -185,7 +190,7 @@ func (client *ExportPipelinesClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,7 +198,7 @@ func (client *ExportPipelinesClient) deleteCreateRequest(ctx context.Context, re // Get - Gets the properties of the export pipeline. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // exportPipelineName - The name of the export pipeline. @@ -237,7 +242,7 @@ func (client *ExportPipelinesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,8 +258,7 @@ func (client *ExportPipelinesClient) getHandleResponse(resp *http.Response) (Exp } // NewListPager - Lists all export pipelines for the specified container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // options - ExportPipelinesClientListOptions contains the optional parameters for the ExportPipelinesClient.List method. @@ -306,7 +310,7 @@ func (client *ExportPipelinesClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod index afd6a9ed177e..3d5fb261a12a 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod @@ -2,28 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/a go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.1 - github.com/stretchr/testify v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/dnaeon/go-vcr v1.1.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 - github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // 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.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum index 07096d31831b..fcd024b572be 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum @@ -1,50 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.0 h1:Ut0ZGdOwJDw0npYEg+TLlPls3Pq6JiZaP2/aGKir7Zw= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.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/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.1 h1:BZOe7ExNYNGmapT91ZUrxtMYsqVljMxTHEnwjOdG7pk= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.1/go.mod h1:TSPEzbGHEgqFa3kUn09SpCrfKNbj7+mMulU/72Vg84E= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0/go.mod h1:s1tW/At+xHqjNFvWU4G0c0Qv33KOhvbGNj0RCTQDV8s= -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.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= -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/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -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/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 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/containerregistry/armcontainerregistry/zz_generated_importpipelines_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client.go similarity index 94% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_importpipelines_client.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client.go index 28a6f0b1af52..3571283b2d87 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_importpipelines_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_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 armcontainerregistry @@ -56,7 +57,7 @@ func NewImportPipelinesClient(subscriptionID string, credential azcore.TokenCred // BeginCreate - Creates an import pipeline for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // importPipelineName - The name of the import pipeline. @@ -69,7 +70,9 @@ func (client *ImportPipelinesClient) BeginCreate(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller[ImportPipelinesClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ImportPipelinesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[ImportPipelinesClientCreateResponse](options.ResumeToken, client.pl, nil) } @@ -77,7 +80,7 @@ func (client *ImportPipelinesClient) BeginCreate(ctx context.Context, resourceGr // Create - Creates an import pipeline for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *ImportPipelinesClient) create(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters ImportPipeline, options *ImportPipelinesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, importPipelineName, importPipelineCreateParameters, options) if err != nil { @@ -117,7 +120,7 @@ func (client *ImportPipelinesClient) createCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, importPipelineCreateParameters) @@ -125,7 +128,7 @@ func (client *ImportPipelinesClient) createCreateRequest(ctx context.Context, re // BeginDelete - Deletes an import pipeline from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // importPipelineName - The name of the import pipeline. @@ -137,7 +140,9 @@ func (client *ImportPipelinesClient) BeginDelete(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller[ImportPipelinesClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ImportPipelinesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[ImportPipelinesClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -145,7 +150,7 @@ func (client *ImportPipelinesClient) BeginDelete(ctx context.Context, resourceGr // Delete - Deletes an import pipeline from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *ImportPipelinesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, options *ImportPipelinesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, importPipelineName, options) if err != nil { @@ -185,7 +190,7 @@ func (client *ImportPipelinesClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,7 +198,7 @@ func (client *ImportPipelinesClient) deleteCreateRequest(ctx context.Context, re // Get - Gets the properties of the import pipeline. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // importPipelineName - The name of the import pipeline. @@ -237,7 +242,7 @@ func (client *ImportPipelinesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,8 +258,7 @@ func (client *ImportPipelinesClient) getHandleResponse(resp *http.Response) (Imp } // NewListPager - Lists all import pipelines for the specified container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // options - ImportPipelinesClientListOptions contains the optional parameters for the ImportPipelinesClient.List method. @@ -306,7 +310,7 @@ func (client *ImportPipelinesClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_models.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go similarity index 94% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_models.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/models.go index 3e0b5132de83..21418cd3457e 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_models.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/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 armcontainerregistry @@ -156,6 +157,21 @@ type Argument struct { IsSecret *bool `json:"isSecret,omitempty"` } +// AuthCredential - Authentication credential stored for an upstream. +type AuthCredential struct { + // The name of the credential. + Name *CredentialName `json:"name,omitempty"` + + // KeyVault Secret URI for accessing the password. + PasswordSecretIdentifier *string `json:"passwordSecretIdentifier,omitempty"` + + // KeyVault Secret URI for accessing the username. + UsernameSecretIdentifier *string `json:"usernameSecretIdentifier,omitempty"` + + // READ-ONLY; This provides data pertaining to the health of the auth credential. + CredentialHealth *CredentialHealth `json:"credentialHealth,omitempty" azure:"ro"` +} + // AuthInfo - The authorization properties for accessing the source code repository. type AuthInfo struct { // REQUIRED; The access token used to access the source control provider. @@ -252,6 +268,91 @@ type BaseImageTriggerUpdateParameters struct { UpdateTriggerPayloadType *UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` } +// CacheRule - An object that represents a cache rule for a container registry. +type CacheRule struct { + // The properties of the cache rule. + Properties *CacheRuleProperties `json:"properties,omitempty"` + + // READ-ONLY; The resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// CacheRuleProperties - The properties of a cache rule. +type CacheRuleProperties struct { + // The ARM resource ID of the credential store which is associated with the cache rule. + CredentialSetResourceID *string `json:"credentialSetResourceId,omitempty"` + + // Source repository pulled from upstream. + SourceRepository *string `json:"sourceRepository,omitempty"` + + // Target repository specified in docker pull command. Eg: docker pull myregistry.azurecr.io/{targetRepository}:{tag} + TargetRepository *string `json:"targetRepository,omitempty"` + + // READ-ONLY; The creation date of the cache rule. + CreationDate *time.Time `json:"creationDate,omitempty" azure:"ro"` + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// CacheRuleUpdateParameters - The parameters for updating a cache rule. +type CacheRuleUpdateParameters struct { + // The properties of the cache rule update parameters. + Properties *CacheRuleUpdateProperties `json:"properties,omitempty"` +} + +// CacheRuleUpdateProperties - The parameters for updating cache rule properties. +type CacheRuleUpdateProperties struct { + // The ARM resource ID of the credential store which is associated with the Cache rule. + CredentialSetResourceID *string `json:"credentialSetResourceId,omitempty"` +} + +// CacheRulesClientBeginCreateOptions contains the optional parameters for the CacheRulesClient.BeginCreate method. +type CacheRulesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CacheRulesClientBeginDeleteOptions contains the optional parameters for the CacheRulesClient.BeginDelete method. +type CacheRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CacheRulesClientBeginUpdateOptions contains the optional parameters for the CacheRulesClient.BeginUpdate method. +type CacheRulesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CacheRulesClientGetAsyncOptions contains the optional parameters for the CacheRulesClient.GetAsync method. +type CacheRulesClientGetAsyncOptions struct { + // placeholder for future optional parameters +} + +// CacheRulesClientListAsyncOptions contains the optional parameters for the CacheRulesClient.ListAsync method. +type CacheRulesClientListAsyncOptions struct { + // placeholder for future optional parameters +} + +// CacheRulesListResult - The result of a request to list cache rules for a container registry. +type CacheRulesListResult struct { + // If provided, client must use NextLink URI to request next list of cache rules. + NextLink *string `json:"nextLink,omitempty"` + + // The list of cache rules. + Value []*CacheRule `json:"value,omitempty"` +} + // CallbackConfig - The configuration of service URI and custom headers for the webhook. type CallbackConfig struct { // REQUIRED; The service URI for the webhook to post notifications. @@ -390,6 +491,107 @@ type ConnectedRegistryUpdateProperties struct { SyncProperties *SyncUpdateProperties `json:"syncProperties,omitempty"` } +// CredentialHealth - The health of the auth credential. +type CredentialHealth struct { + // Error code representing the health check error. + ErrorCode *string `json:"errorCode,omitempty"` + + // Descriptive message representing the health check error. + ErrorMessage *string `json:"errorMessage,omitempty"` + + // The health status of credential. + Status *CredentialHealthStatus `json:"status,omitempty"` +} + +// CredentialSet - An object that represents a credential set resource for a container registry. +type CredentialSet struct { + // Identities associated with the resource. This is used to access the KeyVault secrets. + Identity *IdentityProperties `json:"identity,omitempty"` + + // The properties of the credential set. + Properties *CredentialSetProperties `json:"properties,omitempty"` + + // READ-ONLY; The resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// CredentialSetListResult - The result of a request to list credential sets for a container registry. +type CredentialSetListResult struct { + // The URI that can be used to request the next list of credential sets. + NextLink *string `json:"nextLink,omitempty"` + + // The list of credential sets. Since this list may be incomplete, the nextLink field should be used to request the next list + // of credential sets. + Value []*CredentialSet `json:"value,omitempty"` +} + +// CredentialSetProperties - The properties of a credential set resource. +type CredentialSetProperties struct { + // List of authentication credentials stored for an upstream. Usually consists of a primary and an optional secondary credential. + AuthCredentials []*AuthCredential `json:"authCredentials,omitempty"` + + // The credentials are stored for this upstream or login server. + LoginServer *string `json:"loginServer,omitempty"` + + // READ-ONLY; The creation date of credential store resource. + CreationDate *time.Time `json:"creationDate,omitempty" azure:"ro"` + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// CredentialSetUpdateParameters - The parameters for updating a credential set +type CredentialSetUpdateParameters struct { + // Identities associated with the resource. This is used to access the KeyVault secrets. + Identity *IdentityProperties `json:"identity,omitempty"` + + // The properties of the credential set update parameters + Properties *CredentialSetUpdateProperties `json:"properties,omitempty"` +} + +// CredentialSetUpdateProperties - The parameters for updating credential set properties. +type CredentialSetUpdateProperties struct { + // List of authentication credentials stored for an upstream. Usually consists of a primary and an optional secondary credential. + AuthCredentials []*AuthCredential `json:"authCredentials,omitempty"` +} + +// CredentialSetsClientBeginCreateOptions contains the optional parameters for the CredentialSetsClient.BeginCreate method. +type CredentialSetsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CredentialSetsClientBeginDeleteOptions contains the optional parameters for the CredentialSetsClient.BeginDelete method. +type CredentialSetsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CredentialSetsClientBeginUpdateOptions contains the optional parameters for the CredentialSetsClient.BeginUpdate method. +type CredentialSetsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CredentialSetsClientGetOptions contains the optional parameters for the CredentialSetsClient.Get method. +type CredentialSetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// CredentialSetsClientListOptions contains the optional parameters for the CredentialSetsClient.List method. +type CredentialSetsClientListOptions struct { + // placeholder for future optional parameters +} + // Credentials - The parameters that describes a set of credentials that will be used when a run is invoked. type Credentials struct { // Describes the credential parameters for accessing other custom registries. The key for the dictionary item will be the @@ -1882,7 +2084,8 @@ type RegistryNameCheckRequest struct { // REQUIRED; The name of the container registry. Name *string `json:"name,omitempty"` - // REQUIRED; The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. + // CONSTANT; The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. + // Field has constant value "Microsoft.ContainerRegistry/registries", any specified value is ignored. Type *string `json:"type,omitempty"` } diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go new file mode 100644 index 000000000000..d0adf4e8ac42 --- /dev/null +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go @@ -0,0 +1,7744 @@ +//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 armcontainerregistry + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type ActivationProperties. +func (a ActivationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActivationProperties. +func (a *ActivationProperties) 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 "status": + err = unpopulate(val, "Status", &a.Status) + 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 ActiveDirectoryObject. +func (a ActiveDirectoryObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "objectId", a.ObjectID) + populate(objectMap, "tenantId", a.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDirectoryObject. +func (a *ActiveDirectoryObject) 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 "objectId": + err = unpopulate(val, "ObjectID", &a.ObjectID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) + 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 Actor. +func (a Actor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", a.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Actor. +func (a *Actor) 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 "name": + err = unpopulate(val, "Name", &a.Name) + 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 AgentPool. +func (a AgentPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPool. +func (a *AgentPool) 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 "location": + err = unpopulate(val, "Location", &a.Location) + 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 "tags": + err = unpopulate(val, "Tags", &a.Tags) + 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 AgentPoolListResult. +func (a AgentPoolListResult) 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 AgentPoolListResult. +func (a *AgentPoolListResult) 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 AgentPoolProperties. +func (a AgentPoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "count", a.Count) + populate(objectMap, "os", a.OS) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "tier", a.Tier) + populate(objectMap, "virtualNetworkSubnetResourceId", a.VirtualNetworkSubnetResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolProperties. +func (a *AgentPoolProperties) 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 "count": + err = unpopulate(val, "Count", &a.Count) + delete(rawMsg, key) + case "os": + err = unpopulate(val, "OS", &a.OS) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &a.Tier) + delete(rawMsg, key) + case "virtualNetworkSubnetResourceId": + err = unpopulate(val, "VirtualNetworkSubnetResourceID", &a.VirtualNetworkSubnetResourceID) + 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 AgentPoolPropertiesUpdateParameters. +func (a AgentPoolPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "count", a.Count) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolPropertiesUpdateParameters. +func (a *AgentPoolPropertiesUpdateParameters) 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 "count": + err = unpopulate(val, "Count", &a.Count) + 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 AgentPoolQueueStatus. +func (a AgentPoolQueueStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "count", a.Count) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolQueueStatus. +func (a *AgentPoolQueueStatus) 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 "count": + err = unpopulate(val, "Count", &a.Count) + 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 AgentPoolUpdateParameters. +func (a AgentPoolUpdateParameters) 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 AgentPoolUpdateParameters. +func (a *AgentPoolUpdateParameters) 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 AgentProperties. +func (a AgentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cpu", a.CPU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentProperties. +func (a *AgentProperties) 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 "cpu": + err = unpopulate(val, "CPU", &a.CPU) + 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 Argument. +func (a Argument) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isSecret", a.IsSecret) + populate(objectMap, "name", a.Name) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Argument. +func (a *Argument) 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 "isSecret": + err = unpopulate(val, "IsSecret", &a.IsSecret) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + 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 AuthCredential. +func (a AuthCredential) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "credentialHealth", a.CredentialHealth) + populate(objectMap, "name", a.Name) + populate(objectMap, "passwordSecretIdentifier", a.PasswordSecretIdentifier) + populate(objectMap, "usernameSecretIdentifier", a.UsernameSecretIdentifier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthCredential. +func (a *AuthCredential) 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 "credentialHealth": + err = unpopulate(val, "CredentialHealth", &a.CredentialHealth) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "passwordSecretIdentifier": + err = unpopulate(val, "PasswordSecretIdentifier", &a.PasswordSecretIdentifier) + delete(rawMsg, key) + case "usernameSecretIdentifier": + err = unpopulate(val, "UsernameSecretIdentifier", &a.UsernameSecretIdentifier) + 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 AuthInfo. +func (a AuthInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "expiresIn", a.ExpiresIn) + populate(objectMap, "refreshToken", a.RefreshToken) + populate(objectMap, "scope", a.Scope) + populate(objectMap, "token", a.Token) + populate(objectMap, "tokenType", a.TokenType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthInfo. +func (a *AuthInfo) 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 "expiresIn": + err = unpopulate(val, "ExpiresIn", &a.ExpiresIn) + delete(rawMsg, key) + case "refreshToken": + err = unpopulate(val, "RefreshToken", &a.RefreshToken) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &a.Scope) + delete(rawMsg, key) + case "token": + err = unpopulate(val, "Token", &a.Token) + delete(rawMsg, key) + case "tokenType": + err = unpopulate(val, "TokenType", &a.TokenType) + 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 AuthInfoUpdateParameters. +func (a AuthInfoUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "expiresIn", a.ExpiresIn) + populate(objectMap, "refreshToken", a.RefreshToken) + populate(objectMap, "scope", a.Scope) + populate(objectMap, "token", a.Token) + populate(objectMap, "tokenType", a.TokenType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthInfoUpdateParameters. +func (a *AuthInfoUpdateParameters) 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 "expiresIn": + err = unpopulate(val, "ExpiresIn", &a.ExpiresIn) + delete(rawMsg, key) + case "refreshToken": + err = unpopulate(val, "RefreshToken", &a.RefreshToken) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &a.Scope) + delete(rawMsg, key) + case "token": + err = unpopulate(val, "Token", &a.Token) + delete(rawMsg, key) + case "tokenType": + err = unpopulate(val, "TokenType", &a.TokenType) + 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 AzureADAuthenticationAsArmPolicy. +func (a AzureADAuthenticationAsArmPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureADAuthenticationAsArmPolicy. +func (a *AzureADAuthenticationAsArmPolicy) 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 "status": + err = unpopulate(val, "Status", &a.Status) + 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 BaseImageDependency. +func (b BaseImageDependency) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "digest", b.Digest) + populate(objectMap, "registry", b.Registry) + populate(objectMap, "repository", b.Repository) + populate(objectMap, "tag", b.Tag) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaseImageDependency. +func (b *BaseImageDependency) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "digest": + err = unpopulate(val, "Digest", &b.Digest) + delete(rawMsg, key) + case "registry": + err = unpopulate(val, "Registry", &b.Registry) + delete(rawMsg, key) + case "repository": + err = unpopulate(val, "Repository", &b.Repository) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &b.Tag) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BaseImageTrigger. +func (b BaseImageTrigger) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "baseImageTriggerType", b.BaseImageTriggerType) + populate(objectMap, "name", b.Name) + populate(objectMap, "status", b.Status) + populate(objectMap, "updateTriggerEndpoint", b.UpdateTriggerEndpoint) + populate(objectMap, "updateTriggerPayloadType", b.UpdateTriggerPayloadType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaseImageTrigger. +func (b *BaseImageTrigger) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "baseImageTriggerType": + err = unpopulate(val, "BaseImageTriggerType", &b.BaseImageTriggerType) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &b.Status) + delete(rawMsg, key) + case "updateTriggerEndpoint": + err = unpopulate(val, "UpdateTriggerEndpoint", &b.UpdateTriggerEndpoint) + delete(rawMsg, key) + case "updateTriggerPayloadType": + err = unpopulate(val, "UpdateTriggerPayloadType", &b.UpdateTriggerPayloadType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BaseImageTriggerUpdateParameters. +func (b BaseImageTriggerUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "baseImageTriggerType", b.BaseImageTriggerType) + populate(objectMap, "name", b.Name) + populate(objectMap, "status", b.Status) + populate(objectMap, "updateTriggerEndpoint", b.UpdateTriggerEndpoint) + populate(objectMap, "updateTriggerPayloadType", b.UpdateTriggerPayloadType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaseImageTriggerUpdateParameters. +func (b *BaseImageTriggerUpdateParameters) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "baseImageTriggerType": + err = unpopulate(val, "BaseImageTriggerType", &b.BaseImageTriggerType) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &b.Status) + delete(rawMsg, key) + case "updateTriggerEndpoint": + err = unpopulate(val, "UpdateTriggerEndpoint", &b.UpdateTriggerEndpoint) + delete(rawMsg, key) + case "updateTriggerPayloadType": + err = unpopulate(val, "UpdateTriggerPayloadType", &b.UpdateTriggerPayloadType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheRule. +func (c CacheRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRule. +func (c *CacheRule) 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 "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 "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 CacheRuleProperties. +func (c CacheRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "creationDate", c.CreationDate) + populate(objectMap, "credentialSetResourceId", c.CredentialSetResourceID) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "sourceRepository", c.SourceRepository) + populate(objectMap, "targetRepository", c.TargetRepository) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRuleProperties. +func (c *CacheRuleProperties) 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 "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &c.CreationDate) + delete(rawMsg, key) + case "credentialSetResourceId": + err = unpopulate(val, "CredentialSetResourceID", &c.CredentialSetResourceID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "sourceRepository": + err = unpopulate(val, "SourceRepository", &c.SourceRepository) + delete(rawMsg, key) + case "targetRepository": + err = unpopulate(val, "TargetRepository", &c.TargetRepository) + 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 CacheRuleUpdateParameters. +func (c CacheRuleUpdateParameters) 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 CacheRuleUpdateParameters. +func (c *CacheRuleUpdateParameters) 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 CacheRuleUpdateProperties. +func (c CacheRuleUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "credentialSetResourceId", c.CredentialSetResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRuleUpdateProperties. +func (c *CacheRuleUpdateProperties) 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 "credentialSetResourceId": + err = unpopulate(val, "CredentialSetResourceID", &c.CredentialSetResourceID) + 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 CacheRulesListResult. +func (c CacheRulesListResult) 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 CacheRulesListResult. +func (c *CacheRulesListResult) 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 CallbackConfig. +func (c CallbackConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customHeaders", c.CustomHeaders) + populate(objectMap, "serviceUri", c.ServiceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CallbackConfig. +func (c *CallbackConfig) 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 "customHeaders": + err = unpopulate(val, "CustomHeaders", &c.CustomHeaders) + delete(rawMsg, key) + case "serviceUri": + err = unpopulate(val, "ServiceURI", &c.ServiceURI) + 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 ConnectedRegistry. +func (c ConnectedRegistry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedRegistry. +func (c *ConnectedRegistry) 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 "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 "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 ConnectedRegistryListResult. +func (c ConnectedRegistryListResult) 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 ConnectedRegistryListResult. +func (c *ConnectedRegistryListResult) 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 ConnectedRegistryProperties. +func (c ConnectedRegistryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "activation", c.Activation) + populate(objectMap, "clientTokenIds", c.ClientTokenIDs) + populate(objectMap, "connectionState", c.ConnectionState) + populateTimeRFC3339(objectMap, "lastActivityTime", c.LastActivityTime) + populate(objectMap, "logging", c.Logging) + populate(objectMap, "loginServer", c.LoginServer) + populate(objectMap, "mode", c.Mode) + populate(objectMap, "notificationsList", c.NotificationsList) + populate(objectMap, "parent", c.Parent) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "statusDetails", c.StatusDetails) + populate(objectMap, "version", c.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedRegistryProperties. +func (c *ConnectedRegistryProperties) 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 "activation": + err = unpopulate(val, "Activation", &c.Activation) + delete(rawMsg, key) + case "clientTokenIds": + err = unpopulate(val, "ClientTokenIDs", &c.ClientTokenIDs) + delete(rawMsg, key) + case "connectionState": + err = unpopulate(val, "ConnectionState", &c.ConnectionState) + delete(rawMsg, key) + case "lastActivityTime": + err = unpopulateTimeRFC3339(val, "LastActivityTime", &c.LastActivityTime) + delete(rawMsg, key) + case "logging": + err = unpopulate(val, "Logging", &c.Logging) + delete(rawMsg, key) + case "loginServer": + err = unpopulate(val, "LoginServer", &c.LoginServer) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &c.Mode) + delete(rawMsg, key) + case "notificationsList": + err = unpopulate(val, "NotificationsList", &c.NotificationsList) + delete(rawMsg, key) + case "parent": + err = unpopulate(val, "Parent", &c.Parent) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &c.StatusDetails) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &c.Version) + 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 ConnectedRegistryUpdateParameters. +func (c ConnectedRegistryUpdateParameters) 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 ConnectedRegistryUpdateParameters. +func (c *ConnectedRegistryUpdateParameters) 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 ConnectedRegistryUpdateProperties. +func (c ConnectedRegistryUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientTokenIds", c.ClientTokenIDs) + populate(objectMap, "logging", c.Logging) + populate(objectMap, "notificationsList", c.NotificationsList) + populate(objectMap, "syncProperties", c.SyncProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedRegistryUpdateProperties. +func (c *ConnectedRegistryUpdateProperties) 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 "clientTokenIds": + err = unpopulate(val, "ClientTokenIDs", &c.ClientTokenIDs) + delete(rawMsg, key) + case "logging": + err = unpopulate(val, "Logging", &c.Logging) + delete(rawMsg, key) + case "notificationsList": + err = unpopulate(val, "NotificationsList", &c.NotificationsList) + delete(rawMsg, key) + case "syncProperties": + err = unpopulate(val, "SyncProperties", &c.SyncProperties) + 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 CredentialHealth. +func (c CredentialHealth) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errorCode", c.ErrorCode) + populate(objectMap, "errorMessage", c.ErrorMessage) + populate(objectMap, "status", c.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialHealth. +func (c *CredentialHealth) 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 "errorCode": + err = unpopulate(val, "ErrorCode", &c.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &c.ErrorMessage) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + 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 CredentialSet. +func (c CredentialSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSet. +func (c *CredentialSet) 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 "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 "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 CredentialSetListResult. +func (c CredentialSetListResult) 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 CredentialSetListResult. +func (c *CredentialSetListResult) 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 CredentialSetProperties. +func (c CredentialSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authCredentials", c.AuthCredentials) + populateTimeRFC3339(objectMap, "creationDate", c.CreationDate) + populate(objectMap, "loginServer", c.LoginServer) + populate(objectMap, "provisioningState", c.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSetProperties. +func (c *CredentialSetProperties) 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 "authCredentials": + err = unpopulate(val, "AuthCredentials", &c.AuthCredentials) + delete(rawMsg, key) + case "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &c.CreationDate) + delete(rawMsg, key) + case "loginServer": + err = unpopulate(val, "LoginServer", &c.LoginServer) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + 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 CredentialSetUpdateParameters. +func (c CredentialSetUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSetUpdateParameters. +func (c *CredentialSetUpdateParameters) 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CredentialSetUpdateProperties. +func (c CredentialSetUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authCredentials", c.AuthCredentials) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSetUpdateProperties. +func (c *CredentialSetUpdateProperties) 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 "authCredentials": + err = unpopulate(val, "AuthCredentials", &c.AuthCredentials) + 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 Credentials. +func (c Credentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customRegistries", c.CustomRegistries) + populate(objectMap, "sourceRegistry", c.SourceRegistry) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Credentials. +func (c *Credentials) 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 "customRegistries": + err = unpopulate(val, "CustomRegistries", &c.CustomRegistries) + delete(rawMsg, key) + case "sourceRegistry": + err = unpopulate(val, "SourceRegistry", &c.SourceRegistry) + 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 CustomRegistryCredentials. +func (c CustomRegistryCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "password", c.Password) + populate(objectMap, "userName", c.UserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomRegistryCredentials. +func (c *CustomRegistryCredentials) 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 "password": + err = unpopulate(val, "Password", &c.Password) + delete(rawMsg, key) + case "userName": + err = unpopulate(val, "UserName", &c.UserName) + 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 DockerBuildRequest. +func (d DockerBuildRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "agentConfiguration", d.AgentConfiguration) + populate(objectMap, "agentPoolName", d.AgentPoolName) + populate(objectMap, "arguments", d.Arguments) + populate(objectMap, "credentials", d.Credentials) + populate(objectMap, "dockerFilePath", d.DockerFilePath) + populate(objectMap, "imageNames", d.ImageNames) + populate(objectMap, "isArchiveEnabled", d.IsArchiveEnabled) + populate(objectMap, "isPushEnabled", d.IsPushEnabled) + populate(objectMap, "logTemplate", d.LogTemplate) + populate(objectMap, "noCache", d.NoCache) + populate(objectMap, "platform", d.Platform) + populate(objectMap, "sourceLocation", d.SourceLocation) + populate(objectMap, "target", d.Target) + populate(objectMap, "timeout", d.Timeout) + objectMap["type"] = "DockerBuildRequest" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DockerBuildRequest. +func (d *DockerBuildRequest) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentConfiguration": + err = unpopulate(val, "AgentConfiguration", &d.AgentConfiguration) + delete(rawMsg, key) + case "agentPoolName": + err = unpopulate(val, "AgentPoolName", &d.AgentPoolName) + delete(rawMsg, key) + case "arguments": + err = unpopulate(val, "Arguments", &d.Arguments) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &d.Credentials) + delete(rawMsg, key) + case "dockerFilePath": + err = unpopulate(val, "DockerFilePath", &d.DockerFilePath) + delete(rawMsg, key) + case "imageNames": + err = unpopulate(val, "ImageNames", &d.ImageNames) + delete(rawMsg, key) + case "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &d.IsArchiveEnabled) + delete(rawMsg, key) + case "isPushEnabled": + err = unpopulate(val, "IsPushEnabled", &d.IsPushEnabled) + delete(rawMsg, key) + case "logTemplate": + err = unpopulate(val, "LogTemplate", &d.LogTemplate) + delete(rawMsg, key) + case "noCache": + err = unpopulate(val, "NoCache", &d.NoCache) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &d.Platform) + delete(rawMsg, key) + case "sourceLocation": + err = unpopulate(val, "SourceLocation", &d.SourceLocation) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &d.Target) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &d.Timeout) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DockerBuildStep. +func (d DockerBuildStep) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "arguments", d.Arguments) + populate(objectMap, "baseImageDependencies", d.BaseImageDependencies) + populate(objectMap, "contextAccessToken", d.ContextAccessToken) + populate(objectMap, "contextPath", d.ContextPath) + populate(objectMap, "dockerFilePath", d.DockerFilePath) + populate(objectMap, "imageNames", d.ImageNames) + populate(objectMap, "isPushEnabled", d.IsPushEnabled) + populate(objectMap, "noCache", d.NoCache) + populate(objectMap, "target", d.Target) + objectMap["type"] = StepTypeDocker + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DockerBuildStep. +func (d *DockerBuildStep) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "arguments": + err = unpopulate(val, "Arguments", &d.Arguments) + delete(rawMsg, key) + case "baseImageDependencies": + err = unpopulate(val, "BaseImageDependencies", &d.BaseImageDependencies) + delete(rawMsg, key) + case "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &d.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &d.ContextPath) + delete(rawMsg, key) + case "dockerFilePath": + err = unpopulate(val, "DockerFilePath", &d.DockerFilePath) + delete(rawMsg, key) + case "imageNames": + err = unpopulate(val, "ImageNames", &d.ImageNames) + delete(rawMsg, key) + case "isPushEnabled": + err = unpopulate(val, "IsPushEnabled", &d.IsPushEnabled) + delete(rawMsg, key) + case "noCache": + err = unpopulate(val, "NoCache", &d.NoCache) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &d.Target) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DockerBuildStepUpdateParameters. +func (d DockerBuildStepUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "arguments", d.Arguments) + populate(objectMap, "contextAccessToken", d.ContextAccessToken) + populate(objectMap, "contextPath", d.ContextPath) + populate(objectMap, "dockerFilePath", d.DockerFilePath) + populate(objectMap, "imageNames", d.ImageNames) + populate(objectMap, "isPushEnabled", d.IsPushEnabled) + populate(objectMap, "noCache", d.NoCache) + populate(objectMap, "target", d.Target) + objectMap["type"] = StepTypeDocker + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DockerBuildStepUpdateParameters. +func (d *DockerBuildStepUpdateParameters) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "arguments": + err = unpopulate(val, "Arguments", &d.Arguments) + delete(rawMsg, key) + case "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &d.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &d.ContextPath) + delete(rawMsg, key) + case "dockerFilePath": + err = unpopulate(val, "DockerFilePath", &d.DockerFilePath) + delete(rawMsg, key) + case "imageNames": + err = unpopulate(val, "ImageNames", &d.ImageNames) + delete(rawMsg, key) + case "isPushEnabled": + err = unpopulate(val, "IsPushEnabled", &d.IsPushEnabled) + delete(rawMsg, key) + case "noCache": + err = unpopulate(val, "NoCache", &d.NoCache) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &d.Target) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EncodedTaskRunRequest. +func (e EncodedTaskRunRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "agentConfiguration", e.AgentConfiguration) + populate(objectMap, "agentPoolName", e.AgentPoolName) + populate(objectMap, "credentials", e.Credentials) + populate(objectMap, "encodedTaskContent", e.EncodedTaskContent) + populate(objectMap, "encodedValuesContent", e.EncodedValuesContent) + populate(objectMap, "isArchiveEnabled", e.IsArchiveEnabled) + populate(objectMap, "logTemplate", e.LogTemplate) + populate(objectMap, "platform", e.Platform) + populate(objectMap, "sourceLocation", e.SourceLocation) + populate(objectMap, "timeout", e.Timeout) + objectMap["type"] = "EncodedTaskRunRequest" + populate(objectMap, "values", e.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncodedTaskRunRequest. +func (e *EncodedTaskRunRequest) 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 "agentConfiguration": + err = unpopulate(val, "AgentConfiguration", &e.AgentConfiguration) + delete(rawMsg, key) + case "agentPoolName": + err = unpopulate(val, "AgentPoolName", &e.AgentPoolName) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &e.Credentials) + delete(rawMsg, key) + case "encodedTaskContent": + err = unpopulate(val, "EncodedTaskContent", &e.EncodedTaskContent) + delete(rawMsg, key) + case "encodedValuesContent": + err = unpopulate(val, "EncodedValuesContent", &e.EncodedValuesContent) + delete(rawMsg, key) + case "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &e.IsArchiveEnabled) + delete(rawMsg, key) + case "logTemplate": + err = unpopulate(val, "LogTemplate", &e.LogTemplate) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &e.Platform) + delete(rawMsg, key) + case "sourceLocation": + err = unpopulate(val, "SourceLocation", &e.SourceLocation) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &e.Timeout) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &e.Values) + 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 EncodedTaskStep. +func (e EncodedTaskStep) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "baseImageDependencies", e.BaseImageDependencies) + populate(objectMap, "contextAccessToken", e.ContextAccessToken) + populate(objectMap, "contextPath", e.ContextPath) + populate(objectMap, "encodedTaskContent", e.EncodedTaskContent) + populate(objectMap, "encodedValuesContent", e.EncodedValuesContent) + objectMap["type"] = StepTypeEncodedTask + populate(objectMap, "values", e.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncodedTaskStep. +func (e *EncodedTaskStep) 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 "baseImageDependencies": + err = unpopulate(val, "BaseImageDependencies", &e.BaseImageDependencies) + delete(rawMsg, key) + case "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &e.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &e.ContextPath) + delete(rawMsg, key) + case "encodedTaskContent": + err = unpopulate(val, "EncodedTaskContent", &e.EncodedTaskContent) + delete(rawMsg, key) + case "encodedValuesContent": + err = unpopulate(val, "EncodedValuesContent", &e.EncodedValuesContent) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &e.Values) + 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 EncodedTaskStepUpdateParameters. +func (e EncodedTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contextAccessToken", e.ContextAccessToken) + populate(objectMap, "contextPath", e.ContextPath) + populate(objectMap, "encodedTaskContent", e.EncodedTaskContent) + populate(objectMap, "encodedValuesContent", e.EncodedValuesContent) + objectMap["type"] = StepTypeEncodedTask + populate(objectMap, "values", e.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncodedTaskStepUpdateParameters. +func (e *EncodedTaskStepUpdateParameters) 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 "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &e.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &e.ContextPath) + delete(rawMsg, key) + case "encodedTaskContent": + err = unpopulate(val, "EncodedTaskContent", &e.EncodedTaskContent) + delete(rawMsg, key) + case "encodedValuesContent": + err = unpopulate(val, "EncodedValuesContent", &e.EncodedValuesContent) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &e.Values) + 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 EncryptionProperty. +func (e EncryptionProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyVaultProperties", e.KeyVaultProperties) + populate(objectMap, "status", e.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionProperty. +func (e *EncryptionProperty) 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 "keyVaultProperties": + err = unpopulate(val, "KeyVaultProperties", &e.KeyVaultProperties) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &e.Status) + 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 ErrorResponseBody. +func (e ErrorResponseBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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 ErrorResponseBody. +func (e *ErrorResponseBody) 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 "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 Event. +func (e Event) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "eventRequestMessage", e.EventRequestMessage) + populate(objectMap, "eventResponseMessage", e.EventResponseMessage) + populate(objectMap, "id", e.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Event. +func (e *Event) 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 "eventRequestMessage": + err = unpopulate(val, "EventRequestMessage", &e.EventRequestMessage) + delete(rawMsg, key) + case "eventResponseMessage": + err = unpopulate(val, "EventResponseMessage", &e.EventResponseMessage) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + 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 EventContent. +func (e EventContent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", e.Action) + populate(objectMap, "actor", e.Actor) + populate(objectMap, "id", e.ID) + populate(objectMap, "request", e.Request) + populate(objectMap, "source", e.Source) + populate(objectMap, "target", e.Target) + populateTimeRFC3339(objectMap, "timestamp", e.Timestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventContent. +func (e *EventContent) 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 "action": + err = unpopulate(val, "Action", &e.Action) + delete(rawMsg, key) + case "actor": + err = unpopulate(val, "Actor", &e.Actor) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "request": + err = unpopulate(val, "Request", &e.Request) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &e.Source) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &e.Timestamp) + 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 EventInfo. +func (e EventInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventInfo. +func (e *EventInfo) 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventListResult. +func (e EventListResult) 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 EventListResult. +func (e *EventListResult) 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 EventRequestMessage. +func (e EventRequestMessage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "content", e.Content) + populate(objectMap, "headers", e.Headers) + populate(objectMap, "method", e.Method) + populate(objectMap, "requestUri", e.RequestURI) + populate(objectMap, "version", e.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventRequestMessage. +func (e *EventRequestMessage) 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 "content": + err = unpopulate(val, "Content", &e.Content) + delete(rawMsg, key) + case "headers": + err = unpopulate(val, "Headers", &e.Headers) + delete(rawMsg, key) + case "method": + err = unpopulate(val, "Method", &e.Method) + delete(rawMsg, key) + case "requestUri": + err = unpopulate(val, "RequestURI", &e.RequestURI) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &e.Version) + 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 EventResponseMessage. +func (e EventResponseMessage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "content", e.Content) + populate(objectMap, "headers", e.Headers) + populate(objectMap, "reasonPhrase", e.ReasonPhrase) + populate(objectMap, "statusCode", e.StatusCode) + populate(objectMap, "version", e.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventResponseMessage. +func (e *EventResponseMessage) 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 "content": + err = unpopulate(val, "Content", &e.Content) + delete(rawMsg, key) + case "headers": + err = unpopulate(val, "Headers", &e.Headers) + delete(rawMsg, key) + case "reasonPhrase": + err = unpopulate(val, "ReasonPhrase", &e.ReasonPhrase) + delete(rawMsg, key) + case "statusCode": + err = unpopulate(val, "StatusCode", &e.StatusCode) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &e.Version) + 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 ExportPipeline. +func (e ExportPipeline) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + populate(objectMap, "identity", e.Identity) + populate(objectMap, "location", e.Location) + 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 ExportPipeline. +func (e *ExportPipeline) 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 "identity": + err = unpopulate(val, "Identity", &e.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + 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 ExportPipelineListResult. +func (e ExportPipelineListResult) 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 ExportPipelineListResult. +func (e *ExportPipelineListResult) 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 ExportPipelineProperties. +func (e ExportPipelineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "options", e.Options) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportPipelineProperties. +func (e *ExportPipelineProperties) 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 "options": + err = unpopulate(val, "Options", &e.Options) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + 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 ExportPipelineTargetProperties. +func (e ExportPipelineTargetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyVaultUri", e.KeyVaultURI) + populate(objectMap, "type", e.Type) + populate(objectMap, "uri", e.URI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportPipelineTargetProperties. +func (e *ExportPipelineTargetProperties) 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 "keyVaultUri": + err = unpopulate(val, "KeyVaultURI", &e.KeyVaultURI) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &e.URI) + 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 ExportPolicy. +func (e ExportPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "status", e.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportPolicy. +func (e *ExportPolicy) 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 "status": + err = unpopulate(val, "Status", &e.Status) + 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 FileTaskRunRequest. +func (f FileTaskRunRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "agentConfiguration", f.AgentConfiguration) + populate(objectMap, "agentPoolName", f.AgentPoolName) + populate(objectMap, "credentials", f.Credentials) + populate(objectMap, "isArchiveEnabled", f.IsArchiveEnabled) + populate(objectMap, "logTemplate", f.LogTemplate) + populate(objectMap, "platform", f.Platform) + populate(objectMap, "sourceLocation", f.SourceLocation) + populate(objectMap, "taskFilePath", f.TaskFilePath) + populate(objectMap, "timeout", f.Timeout) + objectMap["type"] = "FileTaskRunRequest" + populate(objectMap, "values", f.Values) + populate(objectMap, "valuesFilePath", f.ValuesFilePath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileTaskRunRequest. +func (f *FileTaskRunRequest) 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentConfiguration": + err = unpopulate(val, "AgentConfiguration", &f.AgentConfiguration) + delete(rawMsg, key) + case "agentPoolName": + err = unpopulate(val, "AgentPoolName", &f.AgentPoolName) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &f.Credentials) + delete(rawMsg, key) + case "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &f.IsArchiveEnabled) + delete(rawMsg, key) + case "logTemplate": + err = unpopulate(val, "LogTemplate", &f.LogTemplate) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &f.Platform) + delete(rawMsg, key) + case "sourceLocation": + err = unpopulate(val, "SourceLocation", &f.SourceLocation) + delete(rawMsg, key) + case "taskFilePath": + err = unpopulate(val, "TaskFilePath", &f.TaskFilePath) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &f.Timeout) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &f.Values) + delete(rawMsg, key) + case "valuesFilePath": + err = unpopulate(val, "ValuesFilePath", &f.ValuesFilePath) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FileTaskStep. +func (f FileTaskStep) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "baseImageDependencies", f.BaseImageDependencies) + populate(objectMap, "contextAccessToken", f.ContextAccessToken) + populate(objectMap, "contextPath", f.ContextPath) + populate(objectMap, "taskFilePath", f.TaskFilePath) + objectMap["type"] = StepTypeFileTask + populate(objectMap, "values", f.Values) + populate(objectMap, "valuesFilePath", f.ValuesFilePath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileTaskStep. +func (f *FileTaskStep) 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "baseImageDependencies": + err = unpopulate(val, "BaseImageDependencies", &f.BaseImageDependencies) + delete(rawMsg, key) + case "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &f.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &f.ContextPath) + delete(rawMsg, key) + case "taskFilePath": + err = unpopulate(val, "TaskFilePath", &f.TaskFilePath) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &f.Values) + delete(rawMsg, key) + case "valuesFilePath": + err = unpopulate(val, "ValuesFilePath", &f.ValuesFilePath) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FileTaskStepUpdateParameters. +func (f FileTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contextAccessToken", f.ContextAccessToken) + populate(objectMap, "contextPath", f.ContextPath) + populate(objectMap, "taskFilePath", f.TaskFilePath) + objectMap["type"] = StepTypeFileTask + populate(objectMap, "values", f.Values) + populate(objectMap, "valuesFilePath", f.ValuesFilePath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileTaskStepUpdateParameters. +func (f *FileTaskStepUpdateParameters) 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &f.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &f.ContextPath) + delete(rawMsg, key) + case "taskFilePath": + err = unpopulate(val, "TaskFilePath", &f.TaskFilePath) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &f.Values) + delete(rawMsg, key) + case "valuesFilePath": + err = unpopulate(val, "ValuesFilePath", &f.ValuesFilePath) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GenerateCredentialsParameters. +func (g GenerateCredentialsParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "expiry", g.Expiry) + populate(objectMap, "name", g.Name) + populate(objectMap, "tokenId", g.TokenID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateCredentialsParameters. +func (g *GenerateCredentialsParameters) 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "expiry": + err = unpopulateTimeRFC3339(val, "Expiry", &g.Expiry) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "tokenId": + err = unpopulate(val, "TokenID", &g.TokenID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GenerateCredentialsResult. +func (g GenerateCredentialsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "passwords", g.Passwords) + populate(objectMap, "username", g.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateCredentialsResult. +func (g *GenerateCredentialsResult) 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "passwords": + err = unpopulate(val, "Passwords", &g.Passwords) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &g.Username) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPRule. +func (i IPRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", i.Action) + populate(objectMap, "value", i.IPAddressOrRange) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPRule. +func (i *IPRule) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &i.Action) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "IPAddressOrRange", &i.IPAddressOrRange) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IdentityProperties. +func (i IdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProperties. +func (i *IdentityProperties) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageDescriptor. +func (i ImageDescriptor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "digest", i.Digest) + populate(objectMap, "registry", i.Registry) + populate(objectMap, "repository", i.Repository) + populate(objectMap, "tag", i.Tag) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDescriptor. +func (i *ImageDescriptor) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "digest": + err = unpopulate(val, "Digest", &i.Digest) + delete(rawMsg, key) + case "registry": + err = unpopulate(val, "Registry", &i.Registry) + delete(rawMsg, key) + case "repository": + err = unpopulate(val, "Repository", &i.Repository) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &i.Tag) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageUpdateTrigger. +func (i ImageUpdateTrigger) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + populate(objectMap, "images", i.Images) + populateTimeRFC3339(objectMap, "timestamp", i.Timestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageUpdateTrigger. +func (i *ImageUpdateTrigger) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "images": + err = unpopulate(val, "Images", &i.Images) + delete(rawMsg, key) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &i.Timestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportImageParameters. +func (i ImportImageParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "mode", i.Mode) + populate(objectMap, "source", i.Source) + populate(objectMap, "targetTags", i.TargetTags) + populate(objectMap, "untaggedTargetRepositories", i.UntaggedTargetRepositories) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportImageParameters. +func (i *ImportImageParameters) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "mode": + err = unpopulate(val, "Mode", &i.Mode) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &i.Source) + delete(rawMsg, key) + case "targetTags": + err = unpopulate(val, "TargetTags", &i.TargetTags) + delete(rawMsg, key) + case "untaggedTargetRepositories": + err = unpopulate(val, "UntaggedTargetRepositories", &i.UntaggedTargetRepositories) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportPipeline. +func (i ImportPipeline) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + populate(objectMap, "identity", i.Identity) + populate(objectMap, "location", i.Location) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportPipeline. +func (i *ImportPipeline) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &i.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &i.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportPipelineListResult. +func (i ImportPipelineListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportPipelineListResult. +func (i *ImportPipelineListResult) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportPipelineProperties. +func (i ImportPipelineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "options", i.Options) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "source", i.Source) + populate(objectMap, "trigger", i.Trigger) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportPipelineProperties. +func (i *ImportPipelineProperties) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "options": + err = unpopulate(val, "Options", &i.Options) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &i.Source) + delete(rawMsg, key) + case "trigger": + err = unpopulate(val, "Trigger", &i.Trigger) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportPipelineSourceProperties. +func (i ImportPipelineSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyVaultUri", i.KeyVaultURI) + populate(objectMap, "type", i.Type) + populate(objectMap, "uri", i.URI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportPipelineSourceProperties. +func (i *ImportPipelineSourceProperties) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyVaultUri": + err = unpopulate(val, "KeyVaultURI", &i.KeyVaultURI) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &i.URI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportSource. +func (i ImportSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "credentials", i.Credentials) + populate(objectMap, "registryUri", i.RegistryURI) + populate(objectMap, "resourceId", i.ResourceID) + populate(objectMap, "sourceImage", i.SourceImage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSource. +func (i *ImportSource) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "credentials": + err = unpopulate(val, "Credentials", &i.Credentials) + delete(rawMsg, key) + case "registryUri": + err = unpopulate(val, "RegistryURI", &i.RegistryURI) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &i.ResourceID) + delete(rawMsg, key) + case "sourceImage": + err = unpopulate(val, "SourceImage", &i.SourceImage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportSourceCredentials. +func (i ImportSourceCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "password", i.Password) + populate(objectMap, "username", i.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSourceCredentials. +func (i *ImportSourceCredentials) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "password": + err = unpopulate(val, "Password", &i.Password) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &i.Username) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InnerErrorDescription. +func (i InnerErrorDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", i.Code) + populate(objectMap, "message", i.Message) + populate(objectMap, "target", i.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InnerErrorDescription. +func (i *InnerErrorDescription) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &i.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &i.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &i.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultProperties. +func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", k.Identity) + populate(objectMap, "keyIdentifier", k.KeyIdentifier) + populate(objectMap, "keyRotationEnabled", k.KeyRotationEnabled) + populateTimeRFC3339(objectMap, "lastKeyRotationTimestamp", k.LastKeyRotationTimestamp) + populate(objectMap, "versionedKeyIdentifier", k.VersionedKeyIdentifier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties. +func (k *KeyVaultProperties) 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", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &k.Identity) + delete(rawMsg, key) + case "keyIdentifier": + err = unpopulate(val, "KeyIdentifier", &k.KeyIdentifier) + delete(rawMsg, key) + case "keyRotationEnabled": + err = unpopulate(val, "KeyRotationEnabled", &k.KeyRotationEnabled) + delete(rawMsg, key) + case "lastKeyRotationTimestamp": + err = unpopulateTimeRFC3339(val, "LastKeyRotationTimestamp", &k.LastKeyRotationTimestamp) + delete(rawMsg, key) + case "versionedKeyIdentifier": + err = unpopulate(val, "VersionedKeyIdentifier", &k.VersionedKeyIdentifier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoggingProperties. +func (l LoggingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "auditLogStatus", l.AuditLogStatus) + populate(objectMap, "logLevel", l.LogLevel) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoggingProperties. +func (l *LoggingProperties) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "auditLogStatus": + err = unpopulate(val, "AuditLogStatus", &l.AuditLogStatus) + delete(rawMsg, key) + case "logLevel": + err = unpopulate(val, "LogLevel", &l.LogLevel) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoginServerProperties. +func (l LoginServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "host", l.Host) + populate(objectMap, "tls", l.TLS) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoginServerProperties. +func (l *LoginServerProperties) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "host": + err = unpopulate(val, "Host", &l.Host) + delete(rawMsg, key) + case "tls": + err = unpopulate(val, "TLS", &l.TLS) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. +func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultAction", n.DefaultAction) + populate(objectMap, "ipRules", n.IPRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSet. +func (n *NetworkRuleSet) 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", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "defaultAction": + err = unpopulate(val, "DefaultAction", &n.DefaultAction) + delete(rawMsg, key) + case "ipRules": + err = unpopulate(val, "IPRules", &n.IPRules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDefinition. +func (o OperationDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populate(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDefinition. +func (o *OperationDefinition) 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 "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) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + 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 OperationDisplayDefinition. +func (o OperationDisplayDefinition) 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 OperationDisplayDefinition. +func (o *OperationDisplayDefinition) 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 OperationLogSpecificationDefinition. +func (o OperationLogSpecificationDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "blobDuration", o.BlobDuration) + populate(objectMap, "displayName", o.DisplayName) + populate(objectMap, "name", o.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationLogSpecificationDefinition. +func (o *OperationLogSpecificationDefinition) 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 "blobDuration": + err = unpopulate(val, "BlobDuration", &o.BlobDuration) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &o.DisplayName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + 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 OperationMetricSpecificationDefinition. +func (o OperationMetricSpecificationDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationType", o.AggregationType) + populate(objectMap, "displayDescription", o.DisplayDescription) + populate(objectMap, "displayName", o.DisplayName) + populate(objectMap, "internalMetricName", o.InternalMetricName) + populate(objectMap, "name", o.Name) + populate(objectMap, "unit", o.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationMetricSpecificationDefinition. +func (o *OperationMetricSpecificationDefinition) 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 "aggregationType": + err = unpopulate(val, "AggregationType", &o.AggregationType) + delete(rawMsg, key) + case "displayDescription": + err = unpopulate(val, "DisplayDescription", &o.DisplayDescription) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &o.DisplayName) + delete(rawMsg, key) + case "internalMetricName": + err = unpopulate(val, "InternalMetricName", &o.InternalMetricName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &o.Unit) + 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 OperationPropertiesDefinition. +func (o OperationPropertiesDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "serviceSpecification", o.ServiceSpecification) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationPropertiesDefinition. +func (o *OperationPropertiesDefinition) 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 "serviceSpecification": + err = unpopulate(val, "ServiceSpecification", &o.ServiceSpecification) + 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 OperationServiceSpecificationDefinition. +func (o OperationServiceSpecificationDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logSpecifications", o.LogSpecifications) + populate(objectMap, "metricSpecifications", o.MetricSpecifications) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationServiceSpecificationDefinition. +func (o *OperationServiceSpecificationDefinition) 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 "logSpecifications": + err = unpopulate(val, "LogSpecifications", &o.LogSpecifications) + delete(rawMsg, key) + case "metricSpecifications": + err = unpopulate(val, "MetricSpecifications", &o.MetricSpecifications) + 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 OverrideTaskStepProperties. +func (o OverrideTaskStepProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "arguments", o.Arguments) + populate(objectMap, "contextPath", o.ContextPath) + populate(objectMap, "file", o.File) + populate(objectMap, "target", o.Target) + populate(objectMap, "updateTriggerToken", o.UpdateTriggerToken) + populate(objectMap, "values", o.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OverrideTaskStepProperties. +func (o *OverrideTaskStepProperties) 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 "arguments": + err = unpopulate(val, "Arguments", &o.Arguments) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &o.ContextPath) + delete(rawMsg, key) + case "file": + err = unpopulate(val, "File", &o.File) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &o.Target) + delete(rawMsg, key) + case "updateTriggerToken": + err = unpopulate(val, "UpdateTriggerToken", &o.UpdateTriggerToken) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &o.Values) + 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 PackageType. +func (p PackageType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endpoint", p.Endpoint) + populate(objectMap, "name", p.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageType. +func (p *PackageType) 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 "endpoint": + err = unpopulate(val, "Endpoint", &p.Endpoint) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + 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 ParentProperties. +func (p ParentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "syncProperties", p.SyncProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ParentProperties. +func (p *ParentProperties) 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 "syncProperties": + err = unpopulate(val, "SyncProperties", &p.SyncProperties) + 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 PipelineRun. +func (p PipelineRun) 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 PipelineRun. +func (p *PipelineRun) 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 PipelineRunListResult. +func (p PipelineRunListResult) 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 PipelineRunListResult. +func (p *PipelineRunListResult) 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 PipelineRunProperties. +func (p PipelineRunProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "forceUpdateTag", p.ForceUpdateTag) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "request", p.Request) + populate(objectMap, "response", p.Response) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunProperties. +func (p *PipelineRunProperties) 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 "forceUpdateTag": + err = unpopulate(val, "ForceUpdateTag", &p.ForceUpdateTag) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "request": + err = unpopulate(val, "Request", &p.Request) + delete(rawMsg, key) + case "response": + err = unpopulate(val, "Response", &p.Response) + 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 PipelineRunRequest. +func (p PipelineRunRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "artifacts", p.Artifacts) + populate(objectMap, "catalogDigest", p.CatalogDigest) + populate(objectMap, "pipelineResourceId", p.PipelineResourceID) + populate(objectMap, "source", p.Source) + populate(objectMap, "target", p.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunRequest. +func (p *PipelineRunRequest) 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 "artifacts": + err = unpopulate(val, "Artifacts", &p.Artifacts) + delete(rawMsg, key) + case "catalogDigest": + err = unpopulate(val, "CatalogDigest", &p.CatalogDigest) + delete(rawMsg, key) + case "pipelineResourceId": + err = unpopulate(val, "PipelineResourceID", &p.PipelineResourceID) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &p.Source) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &p.Target) + 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 PipelineRunResponse. +func (p PipelineRunResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "catalogDigest", p.CatalogDigest) + populateTimeRFC3339(objectMap, "finishTime", p.FinishTime) + populate(objectMap, "importedArtifacts", p.ImportedArtifacts) + populate(objectMap, "pipelineRunErrorMessage", p.PipelineRunErrorMessage) + populate(objectMap, "progress", p.Progress) + populate(objectMap, "source", p.Source) + populateTimeRFC3339(objectMap, "startTime", p.StartTime) + populate(objectMap, "status", p.Status) + populate(objectMap, "target", p.Target) + populate(objectMap, "trigger", p.Trigger) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunResponse. +func (p *PipelineRunResponse) 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 "catalogDigest": + err = unpopulate(val, "CatalogDigest", &p.CatalogDigest) + delete(rawMsg, key) + case "finishTime": + err = unpopulateTimeRFC3339(val, "FinishTime", &p.FinishTime) + delete(rawMsg, key) + case "importedArtifacts": + err = unpopulate(val, "ImportedArtifacts", &p.ImportedArtifacts) + delete(rawMsg, key) + case "pipelineRunErrorMessage": + err = unpopulate(val, "PipelineRunErrorMessage", &p.PipelineRunErrorMessage) + delete(rawMsg, key) + case "progress": + err = unpopulate(val, "Progress", &p.Progress) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &p.Source) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &p.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &p.Target) + delete(rawMsg, key) + case "trigger": + err = unpopulate(val, "Trigger", &p.Trigger) + 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 PipelineRunSourceProperties. +func (p PipelineRunSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunSourceProperties. +func (p *PipelineRunSourceProperties) 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 "name": + err = unpopulate(val, "Name", &p.Name) + 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 PipelineRunTargetProperties. +func (p PipelineRunTargetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunTargetProperties. +func (p *PipelineRunTargetProperties) 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 "name": + err = unpopulate(val, "Name", &p.Name) + 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 PipelineSourceTriggerDescriptor. +func (p PipelineSourceTriggerDescriptor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "timestamp", p.Timestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineSourceTriggerDescriptor. +func (p *PipelineSourceTriggerDescriptor) 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 "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &p.Timestamp) + 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 PipelineSourceTriggerProperties. +func (p PipelineSourceTriggerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineSourceTriggerProperties. +func (p *PipelineSourceTriggerProperties) 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 "status": + err = unpopulate(val, "Status", &p.Status) + 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 PipelineTriggerDescriptor. +func (p PipelineTriggerDescriptor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sourceTrigger", p.SourceTrigger) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineTriggerDescriptor. +func (p *PipelineTriggerDescriptor) 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 "sourceTrigger": + err = unpopulate(val, "SourceTrigger", &p.SourceTrigger) + 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 PipelineTriggerProperties. +func (p PipelineTriggerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sourceTrigger", p.SourceTrigger) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineTriggerProperties. +func (p *PipelineTriggerProperties) 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 "sourceTrigger": + err = unpopulate(val, "SourceTrigger", &p.SourceTrigger) + 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 PlatformProperties. +func (p PlatformProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "architecture", p.Architecture) + populate(objectMap, "os", p.OS) + populate(objectMap, "variant", p.Variant) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PlatformProperties. +func (p *PlatformProperties) 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 "architecture": + err = unpopulate(val, "Architecture", &p.Architecture) + delete(rawMsg, key) + case "os": + err = unpopulate(val, "OS", &p.OS) + delete(rawMsg, key) + case "variant": + err = unpopulate(val, "Variant", &p.Variant) + 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 PlatformUpdateParameters. +func (p PlatformUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "architecture", p.Architecture) + populate(objectMap, "os", p.OS) + populate(objectMap, "variant", p.Variant) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PlatformUpdateParameters. +func (p *PlatformUpdateParameters) 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 "architecture": + err = unpopulate(val, "Architecture", &p.Architecture) + delete(rawMsg, key) + case "os": + err = unpopulate(val, "OS", &p.OS) + delete(rawMsg, key) + case "variant": + err = unpopulate(val, "Variant", &p.Variant) + 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 Policies. +func (p Policies) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureADAuthenticationAsArmPolicy", p.AzureADAuthenticationAsArmPolicy) + populate(objectMap, "exportPolicy", p.ExportPolicy) + populate(objectMap, "quarantinePolicy", p.QuarantinePolicy) + populate(objectMap, "retentionPolicy", p.RetentionPolicy) + populate(objectMap, "softDeletePolicy", p.SoftDeletePolicy) + populate(objectMap, "trustPolicy", p.TrustPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Policies. +func (p *Policies) 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 "azureADAuthenticationAsArmPolicy": + err = unpopulate(val, "AzureADAuthenticationAsArmPolicy", &p.AzureADAuthenticationAsArmPolicy) + delete(rawMsg, key) + case "exportPolicy": + err = unpopulate(val, "ExportPolicy", &p.ExportPolicy) + delete(rawMsg, key) + case "quarantinePolicy": + err = unpopulate(val, "QuarantinePolicy", &p.QuarantinePolicy) + delete(rawMsg, key) + case "retentionPolicy": + err = unpopulate(val, "RetentionPolicy", &p.RetentionPolicy) + delete(rawMsg, key) + case "softDeletePolicy": + err = unpopulate(val, "SoftDeletePolicy", &p.SoftDeletePolicy) + delete(rawMsg, key) + case "trustPolicy": + err = unpopulate(val, "TrustPolicy", &p.TrustPolicy) + 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 PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) 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 PrivateEndpointConnection. +func (p *PrivateEndpointConnection) 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 PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) 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 PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) 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 PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) 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 "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, 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 PrivateLinkResource. +func (p PrivateLinkResource) 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, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) 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 "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 PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) 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 PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) 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 PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) 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 "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + 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 PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) 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 "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + 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 ProgressProperties. +func (p ProgressProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "percentage", p.Percentage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProgressProperties. +func (p *ProgressProperties) 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 "percentage": + err = unpopulate(val, "Percentage", &p.Percentage) + 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 QuarantinePolicy. +func (q QuarantinePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "status", q.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuarantinePolicy. +func (q *QuarantinePolicy) 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", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "status": + err = unpopulate(val, "Status", &q.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegenerateCredentialParameters. +func (r RegenerateCredentialParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegenerateCredentialParameters. +func (r *RegenerateCredentialParameters) 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 "name": + err = unpopulate(val, "Name", &r.Name) + 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 Registry. +func (r Registry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Registry. +func (r *Registry) 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 "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &r.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + 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 RegistryListCredentialsResult. +func (r RegistryListCredentialsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "passwords", r.Passwords) + populate(objectMap, "username", r.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryListCredentialsResult. +func (r *RegistryListCredentialsResult) 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 "passwords": + err = unpopulate(val, "Passwords", &r.Passwords) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &r.Username) + 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 RegistryListResult. +func (r RegistryListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryListResult. +func (r *RegistryListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + 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 RegistryNameCheckRequest. +func (r RegistryNameCheckRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", r.Name) + objectMap["type"] = "Microsoft.ContainerRegistry/registries" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryNameCheckRequest. +func (r *RegistryNameCheckRequest) 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 "name": + err = unpopulate(val, "Name", &r.Name) + 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 RegistryNameStatus. +func (r RegistryNameStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", r.Message) + populate(objectMap, "nameAvailable", r.NameAvailable) + populate(objectMap, "reason", r.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryNameStatus. +func (r *RegistryNameStatus) 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 "message": + err = unpopulate(val, "Message", &r.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &r.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &r.Reason) + 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 RegistryPassword. +func (r RegistryPassword) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", r.Name) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryPassword. +func (r *RegistryPassword) 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 "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + 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 RegistryProperties. +func (r RegistryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "adminUserEnabled", r.AdminUserEnabled) + populate(objectMap, "anonymousPullEnabled", r.AnonymousPullEnabled) + populateTimeRFC3339(objectMap, "creationDate", r.CreationDate) + populate(objectMap, "dataEndpointEnabled", r.DataEndpointEnabled) + populate(objectMap, "dataEndpointHostNames", r.DataEndpointHostNames) + populate(objectMap, "encryption", r.Encryption) + populate(objectMap, "loginServer", r.LoginServer) + populate(objectMap, "networkRuleBypassOptions", r.NetworkRuleBypassOptions) + populate(objectMap, "networkRuleSet", r.NetworkRuleSet) + populate(objectMap, "policies", r.Policies) + populate(objectMap, "privateEndpointConnections", r.PrivateEndpointConnections) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "publicNetworkAccess", r.PublicNetworkAccess) + populate(objectMap, "status", r.Status) + populate(objectMap, "zoneRedundancy", r.ZoneRedundancy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryProperties. +func (r *RegistryProperties) 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 "adminUserEnabled": + err = unpopulate(val, "AdminUserEnabled", &r.AdminUserEnabled) + delete(rawMsg, key) + case "anonymousPullEnabled": + err = unpopulate(val, "AnonymousPullEnabled", &r.AnonymousPullEnabled) + delete(rawMsg, key) + case "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &r.CreationDate) + delete(rawMsg, key) + case "dataEndpointEnabled": + err = unpopulate(val, "DataEndpointEnabled", &r.DataEndpointEnabled) + delete(rawMsg, key) + case "dataEndpointHostNames": + err = unpopulate(val, "DataEndpointHostNames", &r.DataEndpointHostNames) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &r.Encryption) + delete(rawMsg, key) + case "loginServer": + err = unpopulate(val, "LoginServer", &r.LoginServer) + delete(rawMsg, key) + case "networkRuleBypassOptions": + err = unpopulate(val, "NetworkRuleBypassOptions", &r.NetworkRuleBypassOptions) + delete(rawMsg, key) + case "networkRuleSet": + err = unpopulate(val, "NetworkRuleSet", &r.NetworkRuleSet) + delete(rawMsg, key) + case "policies": + err = unpopulate(val, "Policies", &r.Policies) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &r.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &r.PublicNetworkAccess) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "zoneRedundancy": + err = unpopulate(val, "ZoneRedundancy", &r.ZoneRedundancy) + 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 RegistryPropertiesUpdateParameters. +func (r RegistryPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "adminUserEnabled", r.AdminUserEnabled) + populate(objectMap, "anonymousPullEnabled", r.AnonymousPullEnabled) + populate(objectMap, "dataEndpointEnabled", r.DataEndpointEnabled) + populate(objectMap, "encryption", r.Encryption) + populate(objectMap, "networkRuleBypassOptions", r.NetworkRuleBypassOptions) + populate(objectMap, "networkRuleSet", r.NetworkRuleSet) + populate(objectMap, "policies", r.Policies) + populate(objectMap, "publicNetworkAccess", r.PublicNetworkAccess) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryPropertiesUpdateParameters. +func (r *RegistryPropertiesUpdateParameters) 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 "adminUserEnabled": + err = unpopulate(val, "AdminUserEnabled", &r.AdminUserEnabled) + delete(rawMsg, key) + case "anonymousPullEnabled": + err = unpopulate(val, "AnonymousPullEnabled", &r.AnonymousPullEnabled) + delete(rawMsg, key) + case "dataEndpointEnabled": + err = unpopulate(val, "DataEndpointEnabled", &r.DataEndpointEnabled) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &r.Encryption) + delete(rawMsg, key) + case "networkRuleBypassOptions": + err = unpopulate(val, "NetworkRuleBypassOptions", &r.NetworkRuleBypassOptions) + delete(rawMsg, key) + case "networkRuleSet": + err = unpopulate(val, "NetworkRuleSet", &r.NetworkRuleSet) + delete(rawMsg, key) + case "policies": + err = unpopulate(val, "Policies", &r.Policies) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &r.PublicNetworkAccess) + 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 RegistryUpdateParameters. +func (r RegistryUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + populate(objectMap, "tags", r.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryUpdateParameters. +func (r *RegistryUpdateParameters) 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 "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &r.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + 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 RegistryUsage. +func (r RegistryUsage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentValue", r.CurrentValue) + populate(objectMap, "limit", r.Limit) + populate(objectMap, "name", r.Name) + populate(objectMap, "unit", r.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryUsage. +func (r *RegistryUsage) 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 "currentValue": + err = unpopulate(val, "CurrentValue", &r.CurrentValue) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &r.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &r.Unit) + 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 RegistryUsageListResult. +func (r RegistryUsageListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryUsageListResult. +func (r *RegistryUsageListResult) 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 "value": + err = unpopulate(val, "Value", &r.Value) + 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 Replication. +func (r Replication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Replication. +func (r *Replication) 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 "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + 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 ReplicationListResult. +func (r ReplicationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationListResult. +func (r *ReplicationListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + 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 ReplicationProperties. +func (r ReplicationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "regionEndpointEnabled", r.RegionEndpointEnabled) + populate(objectMap, "status", r.Status) + populate(objectMap, "zoneRedundancy", r.ZoneRedundancy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationProperties. +func (r *ReplicationProperties) 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 "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "regionEndpointEnabled": + err = unpopulate(val, "RegionEndpointEnabled", &r.RegionEndpointEnabled) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "zoneRedundancy": + err = unpopulate(val, "ZoneRedundancy", &r.ZoneRedundancy) + 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 ReplicationUpdateParameters. +func (r ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationUpdateParameters. +func (r *ReplicationUpdateParameters) 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 "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + 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 ReplicationUpdateParametersProperties. +func (r ReplicationUpdateParametersProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "regionEndpointEnabled", r.RegionEndpointEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationUpdateParametersProperties. +func (r *ReplicationUpdateParametersProperties) 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 "regionEndpointEnabled": + err = unpopulate(val, "RegionEndpointEnabled", &r.RegionEndpointEnabled) + 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 Request. +func (r Request) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addr", r.Addr) + populate(objectMap, "host", r.Host) + populate(objectMap, "id", r.ID) + populate(objectMap, "method", r.Method) + populate(objectMap, "useragent", r.Useragent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Request. +func (r *Request) 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 "addr": + err = unpopulate(val, "Addr", &r.Addr) + delete(rawMsg, key) + case "host": + err = unpopulate(val, "Host", &r.Host) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "method": + err = unpopulate(val, "Method", &r.Method) + delete(rawMsg, key) + case "useragent": + err = unpopulate(val, "Useragent", &r.Useragent) + 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, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + 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 "location": + err = unpopulate(val, "Location", &r.Location) + 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 "tags": + err = unpopulate(val, "Tags", &r.Tags) + 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 RetentionPolicy. +func (r RetentionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "days", r.Days) + populateTimeRFC3339(objectMap, "lastUpdatedTime", r.LastUpdatedTime) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RetentionPolicy. +func (r *RetentionPolicy) 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 "days": + err = unpopulate(val, "Days", &r.Days) + delete(rawMsg, key) + case "lastUpdatedTime": + err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &r.LastUpdatedTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + 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 Run. +func (r Run) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Run. +func (r *Run) 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 "properties": + err = unpopulate(val, "Properties", &r.Properties) + 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 RunFilter. +func (r RunFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "agentPoolName", r.AgentPoolName) + populateTimeRFC3339(objectMap, "createTime", r.CreateTime) + populateTimeRFC3339(objectMap, "finishTime", r.FinishTime) + populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) + populate(objectMap, "outputImageManifests", r.OutputImageManifests) + populate(objectMap, "runId", r.RunID) + populate(objectMap, "runType", r.RunType) + populate(objectMap, "status", r.Status) + populate(objectMap, "taskName", r.TaskName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunFilter. +func (r *RunFilter) 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 "agentPoolName": + err = unpopulate(val, "AgentPoolName", &r.AgentPoolName) + delete(rawMsg, key) + case "createTime": + err = unpopulateTimeRFC3339(val, "CreateTime", &r.CreateTime) + delete(rawMsg, key) + case "finishTime": + err = unpopulateTimeRFC3339(val, "FinishTime", &r.FinishTime) + delete(rawMsg, key) + case "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &r.IsArchiveEnabled) + delete(rawMsg, key) + case "outputImageManifests": + err = unpopulate(val, "OutputImageManifests", &r.OutputImageManifests) + delete(rawMsg, key) + case "runId": + err = unpopulate(val, "RunID", &r.RunID) + delete(rawMsg, key) + case "runType": + err = unpopulate(val, "RunType", &r.RunType) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "taskName": + err = unpopulate(val, "TaskName", &r.TaskName) + 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 RunGetLogResult. +func (r RunGetLogResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logArtifactLink", r.LogArtifactLink) + populate(objectMap, "logLink", r.LogLink) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunGetLogResult. +func (r *RunGetLogResult) 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 "logArtifactLink": + err = unpopulate(val, "LogArtifactLink", &r.LogArtifactLink) + delete(rawMsg, key) + case "logLink": + err = unpopulate(val, "LogLink", &r.LogLink) + 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 RunListResult. +func (r RunListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunListResult. +func (r *RunListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + 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 RunProperties. +func (r RunProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "agentConfiguration", r.AgentConfiguration) + populate(objectMap, "agentPoolName", r.AgentPoolName) + populateTimeRFC3339(objectMap, "createTime", r.CreateTime) + populate(objectMap, "customRegistries", r.CustomRegistries) + populateTimeRFC3339(objectMap, "finishTime", r.FinishTime) + populate(objectMap, "imageUpdateTrigger", r.ImageUpdateTrigger) + populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) + populateTimeRFC3339(objectMap, "lastUpdatedTime", r.LastUpdatedTime) + populate(objectMap, "logArtifact", r.LogArtifact) + populate(objectMap, "outputImages", r.OutputImages) + populate(objectMap, "platform", r.Platform) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "runErrorMessage", r.RunErrorMessage) + populate(objectMap, "runId", r.RunID) + populate(objectMap, "runType", r.RunType) + populate(objectMap, "sourceRegistryAuth", r.SourceRegistryAuth) + populate(objectMap, "sourceTrigger", r.SourceTrigger) + populateTimeRFC3339(objectMap, "startTime", r.StartTime) + populate(objectMap, "status", r.Status) + populate(objectMap, "task", r.Task) + populate(objectMap, "timerTrigger", r.TimerTrigger) + populate(objectMap, "updateTriggerToken", r.UpdateTriggerToken) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunProperties. +func (r *RunProperties) 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 "agentConfiguration": + err = unpopulate(val, "AgentConfiguration", &r.AgentConfiguration) + delete(rawMsg, key) + case "agentPoolName": + err = unpopulate(val, "AgentPoolName", &r.AgentPoolName) + delete(rawMsg, key) + case "createTime": + err = unpopulateTimeRFC3339(val, "CreateTime", &r.CreateTime) + delete(rawMsg, key) + case "customRegistries": + err = unpopulate(val, "CustomRegistries", &r.CustomRegistries) + delete(rawMsg, key) + case "finishTime": + err = unpopulateTimeRFC3339(val, "FinishTime", &r.FinishTime) + delete(rawMsg, key) + case "imageUpdateTrigger": + err = unpopulate(val, "ImageUpdateTrigger", &r.ImageUpdateTrigger) + delete(rawMsg, key) + case "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &r.IsArchiveEnabled) + delete(rawMsg, key) + case "lastUpdatedTime": + err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &r.LastUpdatedTime) + delete(rawMsg, key) + case "logArtifact": + err = unpopulate(val, "LogArtifact", &r.LogArtifact) + delete(rawMsg, key) + case "outputImages": + err = unpopulate(val, "OutputImages", &r.OutputImages) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &r.Platform) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "runErrorMessage": + err = unpopulate(val, "RunErrorMessage", &r.RunErrorMessage) + delete(rawMsg, key) + case "runId": + err = unpopulate(val, "RunID", &r.RunID) + delete(rawMsg, key) + case "runType": + err = unpopulate(val, "RunType", &r.RunType) + delete(rawMsg, key) + case "sourceRegistryAuth": + err = unpopulate(val, "SourceRegistryAuth", &r.SourceRegistryAuth) + delete(rawMsg, key) + case "sourceTrigger": + err = unpopulate(val, "SourceTrigger", &r.SourceTrigger) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &r.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "task": + err = unpopulate(val, "Task", &r.Task) + delete(rawMsg, key) + case "timerTrigger": + err = unpopulate(val, "TimerTrigger", &r.TimerTrigger) + delete(rawMsg, key) + case "updateTriggerToken": + err = unpopulate(val, "UpdateTriggerToken", &r.UpdateTriggerToken) + 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 RunRequest. +func (r RunRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "agentPoolName", r.AgentPoolName) + populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) + populate(objectMap, "logTemplate", r.LogTemplate) + objectMap["type"] = r.Type + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunRequest. +func (r *RunRequest) 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 "agentPoolName": + err = unpopulate(val, "AgentPoolName", &r.AgentPoolName) + delete(rawMsg, key) + case "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &r.IsArchiveEnabled) + delete(rawMsg, key) + case "logTemplate": + err = unpopulate(val, "LogTemplate", &r.LogTemplate) + 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 RunUpdateParameters. +func (r RunUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunUpdateParameters. +func (r *RunUpdateParameters) 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 "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &r.IsArchiveEnabled) + 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, "name", s.Name) + populate(objectMap, "tier", s.Tier) + 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 "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &s.Tier) + 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 ScopeMap. +func (s ScopeMap) 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 ScopeMap. +func (s *ScopeMap) 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 ScopeMapListResult. +func (s ScopeMapListResult) 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 ScopeMapListResult. +func (s *ScopeMapListResult) 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 ScopeMapProperties. +func (s ScopeMapProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", s.Actions) + populateTimeRFC3339(objectMap, "creationDate", s.CreationDate) + populate(objectMap, "description", s.Description) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMapProperties. +func (s *ScopeMapProperties) 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 "actions": + err = unpopulate(val, "Actions", &s.Actions) + delete(rawMsg, key) + case "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &s.CreationDate) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + 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 ScopeMapPropertiesUpdateParameters. +func (s ScopeMapPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", s.Actions) + populate(objectMap, "description", s.Description) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMapPropertiesUpdateParameters. +func (s *ScopeMapPropertiesUpdateParameters) 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 "actions": + err = unpopulate(val, "Actions", &s.Actions) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + 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 ScopeMapUpdateParameters. +func (s ScopeMapUpdateParameters) 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 ScopeMapUpdateParameters. +func (s *ScopeMapUpdateParameters) 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 SecretObject. +func (s SecretObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", s.Type) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretObject. +func (s *SecretObject) 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 "type": + err = unpopulate(val, "Type", &s.Type) + 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 SetValue. +func (s SetValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isSecret", s.IsSecret) + populate(objectMap, "name", s.Name) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SetValue. +func (s *SetValue) 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 "isSecret": + err = unpopulate(val, "IsSecret", &s.IsSecret) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + 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 SoftDeletePolicy. +func (s SoftDeletePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "lastUpdatedTime", s.LastUpdatedTime) + populate(objectMap, "retentionDays", s.RetentionDays) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SoftDeletePolicy. +func (s *SoftDeletePolicy) 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 "lastUpdatedTime": + err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &s.LastUpdatedTime) + delete(rawMsg, key) + case "retentionDays": + err = unpopulate(val, "RetentionDays", &s.RetentionDays) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + 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 Source. +func (s Source) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addr", s.Addr) + populate(objectMap, "instanceID", s.InstanceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Source. +func (s *Source) 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 "addr": + err = unpopulate(val, "Addr", &s.Addr) + delete(rawMsg, key) + case "instanceID": + err = unpopulate(val, "InstanceID", &s.InstanceID) + 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 SourceProperties. +func (s SourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "branch", s.Branch) + populate(objectMap, "repositoryUrl", s.RepositoryURL) + populate(objectMap, "sourceControlAuthProperties", s.SourceControlAuthProperties) + populate(objectMap, "sourceControlType", s.SourceControlType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceProperties. +func (s *SourceProperties) 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 "branch": + err = unpopulate(val, "Branch", &s.Branch) + delete(rawMsg, key) + case "repositoryUrl": + err = unpopulate(val, "RepositoryURL", &s.RepositoryURL) + delete(rawMsg, key) + case "sourceControlAuthProperties": + err = unpopulate(val, "SourceControlAuthProperties", &s.SourceControlAuthProperties) + delete(rawMsg, key) + case "sourceControlType": + err = unpopulate(val, "SourceControlType", &s.SourceControlType) + 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 SourceRegistryCredentials. +func (s SourceRegistryCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "loginMode", s.LoginMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceRegistryCredentials. +func (s *SourceRegistryCredentials) 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 "loginMode": + err = unpopulate(val, "LoginMode", &s.LoginMode) + 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 SourceTrigger. +func (s SourceTrigger) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + populate(objectMap, "sourceRepository", s.SourceRepository) + populate(objectMap, "sourceTriggerEvents", s.SourceTriggerEvents) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceTrigger. +func (s *SourceTrigger) 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 "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "sourceRepository": + err = unpopulate(val, "SourceRepository", &s.SourceRepository) + delete(rawMsg, key) + case "sourceTriggerEvents": + err = unpopulate(val, "SourceTriggerEvents", &s.SourceTriggerEvents) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + 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 SourceTriggerDescriptor. +func (s SourceTriggerDescriptor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "branchName", s.BranchName) + populate(objectMap, "commitId", s.CommitID) + populate(objectMap, "eventType", s.EventType) + populate(objectMap, "id", s.ID) + populate(objectMap, "providerType", s.ProviderType) + populate(objectMap, "pullRequestId", s.PullRequestID) + populate(objectMap, "repositoryUrl", s.RepositoryURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceTriggerDescriptor. +func (s *SourceTriggerDescriptor) 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 "branchName": + err = unpopulate(val, "BranchName", &s.BranchName) + delete(rawMsg, key) + case "commitId": + err = unpopulate(val, "CommitID", &s.CommitID) + delete(rawMsg, key) + case "eventType": + err = unpopulate(val, "EventType", &s.EventType) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, "ProviderType", &s.ProviderType) + delete(rawMsg, key) + case "pullRequestId": + err = unpopulate(val, "PullRequestID", &s.PullRequestID) + delete(rawMsg, key) + case "repositoryUrl": + err = unpopulate(val, "RepositoryURL", &s.RepositoryURL) + 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 SourceTriggerUpdateParameters. +func (s SourceTriggerUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + populate(objectMap, "sourceRepository", s.SourceRepository) + populate(objectMap, "sourceTriggerEvents", s.SourceTriggerEvents) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceTriggerUpdateParameters. +func (s *SourceTriggerUpdateParameters) 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 "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "sourceRepository": + err = unpopulate(val, "SourceRepository", &s.SourceRepository) + delete(rawMsg, key) + case "sourceTriggerEvents": + err = unpopulate(val, "SourceTriggerEvents", &s.SourceTriggerEvents) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + 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 SourceUpdateParameters. +func (s SourceUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "branch", s.Branch) + populate(objectMap, "repositoryUrl", s.RepositoryURL) + populate(objectMap, "sourceControlAuthProperties", s.SourceControlAuthProperties) + populate(objectMap, "sourceControlType", s.SourceControlType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceUpdateParameters. +func (s *SourceUpdateParameters) 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 "branch": + err = unpopulate(val, "Branch", &s.Branch) + delete(rawMsg, key) + case "repositoryUrl": + err = unpopulate(val, "RepositoryURL", &s.RepositoryURL) + delete(rawMsg, key) + case "sourceControlAuthProperties": + err = unpopulate(val, "SourceControlAuthProperties", &s.SourceControlAuthProperties) + delete(rawMsg, key) + case "sourceControlType": + err = unpopulate(val, "SourceControlType", &s.SourceControlType) + 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 SourceUploadDefinition. +func (s SourceUploadDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "relativePath", s.RelativePath) + populate(objectMap, "uploadUrl", s.UploadURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceUploadDefinition. +func (s *SourceUploadDefinition) 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 "relativePath": + err = unpopulate(val, "RelativePath", &s.RelativePath) + delete(rawMsg, key) + case "uploadUrl": + err = unpopulate(val, "UploadURL", &s.UploadURL) + 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 Status. +func (s Status) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayStatus", s.DisplayStatus) + populate(objectMap, "message", s.Message) + populateTimeRFC3339(objectMap, "timestamp", s.Timestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Status. +func (s *Status) 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 "displayStatus": + err = unpopulate(val, "DisplayStatus", &s.DisplayStatus) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &s.Message) + delete(rawMsg, key) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &s.Timestamp) + 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 StatusDetailProperties. +func (s StatusDetailProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", s.Code) + populate(objectMap, "correlationId", s.CorrelationID) + populate(objectMap, "description", s.Description) + populateTimeRFC3339(objectMap, "timestamp", s.Timestamp) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StatusDetailProperties. +func (s *StatusDetailProperties) 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 "code": + err = unpopulate(val, "Code", &s.Code) + delete(rawMsg, key) + case "correlationId": + err = unpopulate(val, "CorrelationID", &s.CorrelationID) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &s.Timestamp) + 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 StorageAccountProperties. +func (s StorageAccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageAccountProperties. +func (s *StorageAccountProperties) 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SyncProperties. +func (s SyncProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "gatewayEndpoint", s.GatewayEndpoint) + populateTimeRFC3339(objectMap, "lastSyncTime", s.LastSyncTime) + populate(objectMap, "messageTtl", s.MessageTTL) + populate(objectMap, "schedule", s.Schedule) + populate(objectMap, "syncWindow", s.SyncWindow) + populate(objectMap, "tokenId", s.TokenID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncProperties. +func (s *SyncProperties) 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 "gatewayEndpoint": + err = unpopulate(val, "GatewayEndpoint", &s.GatewayEndpoint) + delete(rawMsg, key) + case "lastSyncTime": + err = unpopulateTimeRFC3339(val, "LastSyncTime", &s.LastSyncTime) + delete(rawMsg, key) + case "messageTtl": + err = unpopulate(val, "MessageTTL", &s.MessageTTL) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &s.Schedule) + delete(rawMsg, key) + case "syncWindow": + err = unpopulate(val, "SyncWindow", &s.SyncWindow) + delete(rawMsg, key) + case "tokenId": + err = unpopulate(val, "TokenID", &s.TokenID) + 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 SyncUpdateProperties. +func (s SyncUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "messageTtl", s.MessageTTL) + populate(objectMap, "schedule", s.Schedule) + populate(objectMap, "syncWindow", s.SyncWindow) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncUpdateProperties. +func (s *SyncUpdateProperties) 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 "messageTtl": + err = unpopulate(val, "MessageTTL", &s.MessageTTL) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &s.Schedule) + delete(rawMsg, key) + case "syncWindow": + err = unpopulate(val, "SyncWindow", &s.SyncWindow) + 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 TLSCertificateProperties. +func (t TLSCertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", t.Location) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TLSCertificateProperties. +func (t *TLSCertificateProperties) 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 "location": + err = unpopulate(val, "Location", &t.Location) + 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 TLSProperties. +func (t TLSProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "certificate", t.Certificate) + populate(objectMap, "status", t.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TLSProperties. +func (t *TLSProperties) 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 "certificate": + err = unpopulate(val, "Certificate", &t.Certificate) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + 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 Target. +func (t Target) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "digest", t.Digest) + populate(objectMap, "length", t.Length) + populate(objectMap, "mediaType", t.MediaType) + populate(objectMap, "name", t.Name) + populate(objectMap, "repository", t.Repository) + populate(objectMap, "size", t.Size) + populate(objectMap, "tag", t.Tag) + populate(objectMap, "url", t.URL) + populate(objectMap, "version", t.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Target. +func (t *Target) 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 "digest": + err = unpopulate(val, "Digest", &t.Digest) + delete(rawMsg, key) + case "length": + err = unpopulate(val, "Length", &t.Length) + delete(rawMsg, key) + case "mediaType": + err = unpopulate(val, "MediaType", &t.MediaType) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "repository": + err = unpopulate(val, "Repository", &t.Repository) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &t.Size) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &t.Tag) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &t.URL) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &t.Version) + 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 Task. +func (t Task) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "identity", t.Identity) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + 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 Task. +func (t *Task) 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 "identity": + err = unpopulate(val, "Identity", &t.Identity) + 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 "properties": + err = unpopulate(val, "Properties", &t.Properties) + 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 TaskListResult. +func (t TaskListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskListResult. +func (t *TaskListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + 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 TaskProperties. +func (t TaskProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "agentConfiguration", t.AgentConfiguration) + populate(objectMap, "agentPoolName", t.AgentPoolName) + populateTimeRFC3339(objectMap, "creationDate", t.CreationDate) + populate(objectMap, "credentials", t.Credentials) + populate(objectMap, "isSystemTask", t.IsSystemTask) + populate(objectMap, "logTemplate", t.LogTemplate) + populate(objectMap, "platform", t.Platform) + populate(objectMap, "provisioningState", t.ProvisioningState) + populate(objectMap, "status", t.Status) + populate(objectMap, "step", t.Step) + populate(objectMap, "timeout", t.Timeout) + populate(objectMap, "trigger", t.Trigger) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskProperties. +func (t *TaskProperties) 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 "agentConfiguration": + err = unpopulate(val, "AgentConfiguration", &t.AgentConfiguration) + delete(rawMsg, key) + case "agentPoolName": + err = unpopulate(val, "AgentPoolName", &t.AgentPoolName) + delete(rawMsg, key) + case "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &t.CreationDate) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &t.Credentials) + delete(rawMsg, key) + case "isSystemTask": + err = unpopulate(val, "IsSystemTask", &t.IsSystemTask) + delete(rawMsg, key) + case "logTemplate": + err = unpopulate(val, "LogTemplate", &t.LogTemplate) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &t.Platform) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + delete(rawMsg, key) + case "step": + t.Step, err = unmarshalTaskStepPropertiesClassification(val) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &t.Timeout) + delete(rawMsg, key) + case "trigger": + err = unpopulate(val, "Trigger", &t.Trigger) + 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 TaskPropertiesUpdateParameters. +func (t TaskPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "agentConfiguration", t.AgentConfiguration) + populate(objectMap, "agentPoolName", t.AgentPoolName) + populate(objectMap, "credentials", t.Credentials) + populate(objectMap, "logTemplate", t.LogTemplate) + populate(objectMap, "platform", t.Platform) + populate(objectMap, "status", t.Status) + populate(objectMap, "step", t.Step) + populate(objectMap, "timeout", t.Timeout) + populate(objectMap, "trigger", t.Trigger) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskPropertiesUpdateParameters. +func (t *TaskPropertiesUpdateParameters) 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 "agentConfiguration": + err = unpopulate(val, "AgentConfiguration", &t.AgentConfiguration) + delete(rawMsg, key) + case "agentPoolName": + err = unpopulate(val, "AgentPoolName", &t.AgentPoolName) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &t.Credentials) + delete(rawMsg, key) + case "logTemplate": + err = unpopulate(val, "LogTemplate", &t.LogTemplate) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &t.Platform) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + delete(rawMsg, key) + case "step": + t.Step, err = unmarshalTaskStepUpdateParametersClassification(val) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &t.Timeout) + delete(rawMsg, key) + case "trigger": + err = unpopulate(val, "Trigger", &t.Trigger) + 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 TaskRun. +func (t TaskRun) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "identity", t.Identity) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRun. +func (t *TaskRun) 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 "identity": + err = unpopulate(val, "Identity", &t.Identity) + 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 "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + 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 TaskRunListResult. +func (t TaskRunListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunListResult. +func (t *TaskRunListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + 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 TaskRunProperties. +func (t TaskRunProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "forceUpdateTag", t.ForceUpdateTag) + populate(objectMap, "provisioningState", t.ProvisioningState) + populate(objectMap, "runRequest", t.RunRequest) + populate(objectMap, "runResult", t.RunResult) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunProperties. +func (t *TaskRunProperties) 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 "forceUpdateTag": + err = unpopulate(val, "ForceUpdateTag", &t.ForceUpdateTag) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + case "runRequest": + t.RunRequest, err = unmarshalRunRequestClassification(val) + delete(rawMsg, key) + case "runResult": + err = unpopulate(val, "RunResult", &t.RunResult) + 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 TaskRunPropertiesUpdateParameters. +func (t TaskRunPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "forceUpdateTag", t.ForceUpdateTag) + populate(objectMap, "runRequest", t.RunRequest) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunPropertiesUpdateParameters. +func (t *TaskRunPropertiesUpdateParameters) 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 "forceUpdateTag": + err = unpopulate(val, "ForceUpdateTag", &t.ForceUpdateTag) + delete(rawMsg, key) + case "runRequest": + t.RunRequest, err = unmarshalRunRequestClassification(val) + 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 TaskRunRequest. +func (t TaskRunRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "agentPoolName", t.AgentPoolName) + populate(objectMap, "isArchiveEnabled", t.IsArchiveEnabled) + populate(objectMap, "logTemplate", t.LogTemplate) + populate(objectMap, "overrideTaskStepProperties", t.OverrideTaskStepProperties) + populate(objectMap, "taskId", t.TaskID) + objectMap["type"] = "TaskRunRequest" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunRequest. +func (t *TaskRunRequest) 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 "agentPoolName": + err = unpopulate(val, "AgentPoolName", &t.AgentPoolName) + delete(rawMsg, key) + case "isArchiveEnabled": + err = unpopulate(val, "IsArchiveEnabled", &t.IsArchiveEnabled) + delete(rawMsg, key) + case "logTemplate": + err = unpopulate(val, "LogTemplate", &t.LogTemplate) + delete(rawMsg, key) + case "overrideTaskStepProperties": + err = unpopulate(val, "OverrideTaskStepProperties", &t.OverrideTaskStepProperties) + delete(rawMsg, key) + case "taskId": + err = unpopulate(val, "TaskID", &t.TaskID) + 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 TaskRunUpdateParameters. +func (t TaskRunUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", t.Identity) + populate(objectMap, "location", t.Location) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunUpdateParameters. +func (t *TaskRunUpdateParameters) 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 "identity": + err = unpopulate(val, "Identity", &t.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + 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 TaskStepProperties. +func (t TaskStepProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "baseImageDependencies", t.BaseImageDependencies) + populate(objectMap, "contextAccessToken", t.ContextAccessToken) + populate(objectMap, "contextPath", t.ContextPath) + objectMap["type"] = t.Type + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskStepProperties. +func (t *TaskStepProperties) 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 "baseImageDependencies": + err = unpopulate(val, "BaseImageDependencies", &t.BaseImageDependencies) + delete(rawMsg, key) + case "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &t.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &t.ContextPath) + 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 TaskStepUpdateParameters. +func (t TaskStepUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contextAccessToken", t.ContextAccessToken) + populate(objectMap, "contextPath", t.ContextPath) + objectMap["type"] = t.Type + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskStepUpdateParameters. +func (t *TaskStepUpdateParameters) 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 "contextAccessToken": + err = unpopulate(val, "ContextAccessToken", &t.ContextAccessToken) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &t.ContextPath) + 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 TaskUpdateParameters. +func (t TaskUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", t.Identity) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskUpdateParameters. +func (t *TaskUpdateParameters) 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 "identity": + err = unpopulate(val, "Identity", &t.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + 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 TimerTrigger. +func (t TimerTrigger) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", t.Name) + populate(objectMap, "schedule", t.Schedule) + populate(objectMap, "status", t.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimerTrigger. +func (t *TimerTrigger) 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 "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &t.Schedule) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + 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 TimerTriggerDescriptor. +func (t TimerTriggerDescriptor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "scheduleOccurrence", t.ScheduleOccurrence) + populate(objectMap, "timerTriggerName", t.TimerTriggerName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimerTriggerDescriptor. +func (t *TimerTriggerDescriptor) 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 "scheduleOccurrence": + err = unpopulate(val, "ScheduleOccurrence", &t.ScheduleOccurrence) + delete(rawMsg, key) + case "timerTriggerName": + err = unpopulate(val, "TimerTriggerName", &t.TimerTriggerName) + 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 TimerTriggerUpdateParameters. +func (t TimerTriggerUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", t.Name) + populate(objectMap, "schedule", t.Schedule) + populate(objectMap, "status", t.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimerTriggerUpdateParameters. +func (t *TimerTriggerUpdateParameters) 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 "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &t.Schedule) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + 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 Token. +func (t Token) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Token. +func (t *Token) 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 "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + 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 TokenCertificate. +func (t TokenCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "encodedPemCertificate", t.EncodedPemCertificate) + populateTimeRFC3339(objectMap, "expiry", t.Expiry) + populate(objectMap, "name", t.Name) + populate(objectMap, "thumbprint", t.Thumbprint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TokenCertificate. +func (t *TokenCertificate) 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 "encodedPemCertificate": + err = unpopulate(val, "EncodedPemCertificate", &t.EncodedPemCertificate) + delete(rawMsg, key) + case "expiry": + err = unpopulateTimeRFC3339(val, "Expiry", &t.Expiry) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &t.Thumbprint) + 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 TokenCredentialsProperties. +func (t TokenCredentialsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "certificates", t.Certificates) + populate(objectMap, "passwords", t.Passwords) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TokenCredentialsProperties. +func (t *TokenCredentialsProperties) 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 "certificates": + err = unpopulate(val, "Certificates", &t.Certificates) + delete(rawMsg, key) + case "passwords": + err = unpopulate(val, "Passwords", &t.Passwords) + 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 TokenListResult. +func (t TokenListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TokenListResult. +func (t *TokenListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + 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 TokenPassword. +func (t TokenPassword) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "creationTime", t.CreationTime) + populateTimeRFC3339(objectMap, "expiry", t.Expiry) + populate(objectMap, "name", t.Name) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TokenPassword. +func (t *TokenPassword) 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 "creationTime": + err = unpopulateTimeRFC3339(val, "CreationTime", &t.CreationTime) + delete(rawMsg, key) + case "expiry": + err = unpopulateTimeRFC3339(val, "Expiry", &t.Expiry) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + 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 TokenProperties. +func (t TokenProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "creationDate", t.CreationDate) + populate(objectMap, "credentials", t.Credentials) + populate(objectMap, "provisioningState", t.ProvisioningState) + populate(objectMap, "scopeMapId", t.ScopeMapID) + populate(objectMap, "status", t.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TokenProperties. +func (t *TokenProperties) 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 "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &t.CreationDate) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &t.Credentials) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + case "scopeMapId": + err = unpopulate(val, "ScopeMapID", &t.ScopeMapID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + 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 TokenUpdateParameters. +func (t TokenUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", t.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TokenUpdateParameters. +func (t *TokenUpdateParameters) 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 "properties": + err = unpopulate(val, "Properties", &t.Properties) + 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 TokenUpdateProperties. +func (t TokenUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "credentials", t.Credentials) + populate(objectMap, "scopeMapId", t.ScopeMapID) + populate(objectMap, "status", t.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TokenUpdateProperties. +func (t *TokenUpdateProperties) 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 "credentials": + err = unpopulate(val, "Credentials", &t.Credentials) + delete(rawMsg, key) + case "scopeMapId": + err = unpopulate(val, "ScopeMapID", &t.ScopeMapID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + 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 TriggerProperties. +func (t TriggerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "baseImageTrigger", t.BaseImageTrigger) + populate(objectMap, "sourceTriggers", t.SourceTriggers) + populate(objectMap, "timerTriggers", t.TimerTriggers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TriggerProperties. +func (t *TriggerProperties) 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 "baseImageTrigger": + err = unpopulate(val, "BaseImageTrigger", &t.BaseImageTrigger) + delete(rawMsg, key) + case "sourceTriggers": + err = unpopulate(val, "SourceTriggers", &t.SourceTriggers) + delete(rawMsg, key) + case "timerTriggers": + err = unpopulate(val, "TimerTriggers", &t.TimerTriggers) + 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 TriggerUpdateParameters. +func (t TriggerUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "baseImageTrigger", t.BaseImageTrigger) + populate(objectMap, "sourceTriggers", t.SourceTriggers) + populate(objectMap, "timerTriggers", t.TimerTriggers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TriggerUpdateParameters. +func (t *TriggerUpdateParameters) 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 "baseImageTrigger": + err = unpopulate(val, "BaseImageTrigger", &t.BaseImageTrigger) + delete(rawMsg, key) + case "sourceTriggers": + err = unpopulate(val, "SourceTriggers", &t.SourceTriggers) + delete(rawMsg, key) + case "timerTriggers": + err = unpopulate(val, "TimerTriggers", &t.TimerTriggers) + 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 TrustPolicy. +func (t TrustPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "status", t.Status) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrustPolicy. +func (t *TrustPolicy) 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 "status": + err = unpopulate(val, "Status", &t.Status) + 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 UserIdentityProperties. +func (u UserIdentityProperties) 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 UserIdentityProperties. +func (u *UserIdentityProperties) 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 +} + +// MarshalJSON implements the json.Marshaller interface for type Webhook. +func (w Webhook) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", w.ID) + populate(objectMap, "location", w.Location) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Webhook. +func (w *Webhook) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &w.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebhookCreateParameters. +func (w WebhookCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", w.Location) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "tags", w.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookCreateParameters. +func (w *WebhookCreateParameters) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebhookListResult. +func (w WebhookListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookListResult. +func (w *WebhookListResult) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebhookProperties. +func (w WebhookProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", w.Actions) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "scope", w.Scope) + populate(objectMap, "status", w.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookProperties. +func (w *WebhookProperties) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actions": + err = unpopulate(val, "Actions", &w.Actions) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &w.Scope) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &w.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebhookPropertiesCreateParameters. +func (w WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", w.Actions) + populate(objectMap, "customHeaders", w.CustomHeaders) + populate(objectMap, "scope", w.Scope) + populate(objectMap, "serviceUri", w.ServiceURI) + populate(objectMap, "status", w.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookPropertiesCreateParameters. +func (w *WebhookPropertiesCreateParameters) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actions": + err = unpopulate(val, "Actions", &w.Actions) + delete(rawMsg, key) + case "customHeaders": + err = unpopulate(val, "CustomHeaders", &w.CustomHeaders) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &w.Scope) + delete(rawMsg, key) + case "serviceUri": + err = unpopulate(val, "ServiceURI", &w.ServiceURI) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &w.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebhookPropertiesUpdateParameters. +func (w WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", w.Actions) + populate(objectMap, "customHeaders", w.CustomHeaders) + populate(objectMap, "scope", w.Scope) + populate(objectMap, "serviceUri", w.ServiceURI) + populate(objectMap, "status", w.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookPropertiesUpdateParameters. +func (w *WebhookPropertiesUpdateParameters) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actions": + err = unpopulate(val, "Actions", &w.Actions) + delete(rawMsg, key) + case "customHeaders": + err = unpopulate(val, "CustomHeaders", &w.CustomHeaders) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &w.Scope) + delete(rawMsg, key) + case "serviceUri": + err = unpopulate(val, "ServiceURI", &w.ServiceURI) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &w.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebhookUpdateParameters. +func (w WebhookUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "tags", w.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookUpdateParameters. +func (w *WebhookUpdateParameters) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, 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/containerregistry/armcontainerregistry/zz_generated_operations_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go similarity index 95% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_operations_client.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go index 16068cd2ec38..bc6a8541eac1 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_operations_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/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 armcontainerregistry @@ -49,8 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available Azure Container Registry REST API operations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -88,7 +88,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_pipelineruns_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client.go similarity index 94% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_pipelineruns_client.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client.go index fd5fc5f43373..ee32ae542fdf 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_pipelineruns_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_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 armcontainerregistry @@ -56,7 +57,7 @@ func NewPipelineRunsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreate - Creates a pipeline run for a container registry with the specified parameters // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // pipelineRunName - The name of the pipeline run. @@ -69,7 +70,9 @@ func (client *PipelineRunsClient) BeginCreate(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller[PipelineRunsClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PipelineRunsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[PipelineRunsClientCreateResponse](options.ResumeToken, client.pl, nil) } @@ -77,7 +80,7 @@ func (client *PipelineRunsClient) BeginCreate(ctx context.Context, resourceGroup // Create - Creates a pipeline run for a container registry with the specified parameters // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *PipelineRunsClient) create(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters PipelineRun, options *PipelineRunsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, pipelineRunName, pipelineRunCreateParameters, options) if err != nil { @@ -117,7 +120,7 @@ func (client *PipelineRunsClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, pipelineRunCreateParameters) @@ -125,7 +128,7 @@ func (client *PipelineRunsClient) createCreateRequest(ctx context.Context, resou // BeginDelete - Deletes a pipeline run from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // pipelineRunName - The name of the pipeline run. @@ -137,7 +140,9 @@ func (client *PipelineRunsClient) BeginDelete(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller[PipelineRunsClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PipelineRunsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[PipelineRunsClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -145,7 +150,7 @@ func (client *PipelineRunsClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Deletes a pipeline run from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *PipelineRunsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, options *PipelineRunsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, pipelineRunName, options) if err != nil { @@ -185,7 +190,7 @@ func (client *PipelineRunsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,7 +198,7 @@ func (client *PipelineRunsClient) deleteCreateRequest(ctx context.Context, resou // Get - Gets the detailed information for a given pipeline run. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // pipelineRunName - The name of the pipeline run. @@ -237,7 +242,7 @@ func (client *PipelineRunsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,8 +258,7 @@ func (client *PipelineRunsClient) getHandleResponse(resp *http.Response) (Pipeli } // NewListPager - Lists all the pipeline runs for the specified container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // options - PipelineRunsClientListOptions contains the optional parameters for the PipelineRunsClient.List method. @@ -306,7 +310,7 @@ func (client *PipelineRunsClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/polymorphic_helpers.go similarity index 99% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_polymorphic_helpers.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/polymorphic_helpers.go index 1772a6796943..de0932dd7280 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/polymorphic_helpers.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 armcontainerregistry diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.go similarity index 95% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_privateendpointconnections_client.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.go index d93715956a7f..6d40b574913c 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_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 armcontainerregistry @@ -56,7 +57,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Update the state of specified private endpoint connection associated with the container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // privateEndpointConnectionName - The name of the private endpoint connection. @@ -69,7 +70,9 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateEndpointConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -77,7 +80,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Update the state of specified private endpoint connection associated with the container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, registryName, privateEndpointConnectionName, privateEndpointConnection, options) if err != nil { @@ -117,7 +120,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, privateEndpointConnection) @@ -125,7 +128,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes the specified private endpoint connection associated with the container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // privateEndpointConnectionName - The name of the private endpoint connection. @@ -137,7 +140,9 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -145,7 +150,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes the specified private endpoint connection associated with the container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, privateEndpointConnectionName, options) if err != nil { @@ -185,14 +190,14 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Get the specified private endpoint connection associated with the container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // privateEndpointConnectionName - The name of the private endpoint connection. @@ -237,7 +242,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,8 +258,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res } // NewListPager - List all private endpoint connections in a container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List @@ -307,7 +311,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_registries_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go similarity index 96% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_registries_client.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go index b5edb529a117..656f6fa9f07d 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_registries_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_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 armcontainerregistry @@ -57,7 +58,7 @@ func NewRegistriesClient(subscriptionID string, credential azcore.TokenCredentia // CheckNameAvailability - Checks whether the container registry name is available for use. The name must contain only alphanumeric // characters, be globally unique, and between 5 and 50 characters in length. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // registryNameCheckRequest - The object containing information for the availability request. // options - RegistriesClientCheckNameAvailabilityOptions contains the optional parameters for the RegistriesClient.CheckNameAvailability // method. @@ -88,7 +89,7 @@ func (client *RegistriesClient) checkNameAvailabilityCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, registryNameCheckRequest) @@ -105,7 +106,7 @@ func (client *RegistriesClient) checkNameAvailabilityHandleResponse(resp *http.R // BeginCreate - Creates a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // registry - The parameters for creating a container registry. @@ -116,7 +117,9 @@ func (client *RegistriesClient) BeginCreate(ctx context.Context, resourceGroupNa if err != nil { return nil, err } - return runtime.NewPoller[RegistriesClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RegistriesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[RegistriesClientCreateResponse](options.ResumeToken, client.pl, nil) } @@ -124,7 +127,7 @@ func (client *RegistriesClient) BeginCreate(ctx context.Context, resourceGroupNa // Create - Creates a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *RegistriesClient) create(ctx context.Context, resourceGroupName string, registryName string, registry Registry, options *RegistriesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, registry, options) if err != nil { @@ -160,7 +163,7 @@ func (client *RegistriesClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, registry) @@ -168,7 +171,7 @@ func (client *RegistriesClient) createCreateRequest(ctx context.Context, resourc // BeginDelete - Deletes a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // options - RegistriesClientBeginDeleteOptions contains the optional parameters for the RegistriesClient.BeginDelete method. @@ -178,7 +181,9 @@ func (client *RegistriesClient) BeginDelete(ctx context.Context, resourceGroupNa if err != nil { return nil, err } - return runtime.NewPoller[RegistriesClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RegistriesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[RegistriesClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -186,7 +191,7 @@ func (client *RegistriesClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *RegistriesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, options) if err != nil { @@ -222,14 +227,14 @@ func (client *RegistriesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // BeginGenerateCredentials - Generate keys for a token of a specified container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // generateCredentialsParameters - The parameters for generating credentials. @@ -249,7 +254,7 @@ func (client *RegistriesClient) BeginGenerateCredentials(ctx context.Context, re // GenerateCredentials - Generate keys for a token of a specified container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *RegistriesClient) generateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters, options *RegistriesClientBeginGenerateCredentialsOptions) (*http.Response, error) { req, err := client.generateCredentialsCreateRequest(ctx, resourceGroupName, registryName, generateCredentialsParameters, options) if err != nil { @@ -285,7 +290,7 @@ func (client *RegistriesClient) generateCredentialsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, generateCredentialsParameters) @@ -293,7 +298,7 @@ func (client *RegistriesClient) generateCredentialsCreateRequest(ctx context.Con // Get - Gets the properties of the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // options - RegistriesClientGetOptions contains the optional parameters for the RegistriesClient.Get method. @@ -332,7 +337,7 @@ func (client *RegistriesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -406,7 +411,7 @@ func (client *RegistriesClient) getBuildSourceUploadURLHandleResponse(resp *http // GetPrivateLinkResource - Gets a private link resource by a specified group name for a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // groupName - The name of the private link resource. @@ -451,7 +456,7 @@ func (client *RegistriesClient) getPrivateLinkResourceCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -468,7 +473,7 @@ func (client *RegistriesClient) getPrivateLinkResourceHandleResponse(resp *http. // BeginImportImage - Copies an image to this container registry from the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // parameters - The parameters specifying the image to copy and the source container registry. @@ -488,7 +493,7 @@ func (client *RegistriesClient) BeginImportImage(ctx context.Context, resourceGr // ImportImage - Copies an image to this container registry from the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *RegistriesClient) importImage(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters, options *RegistriesClientBeginImportImageOptions) (*http.Response, error) { req, err := client.importImageCreateRequest(ctx, resourceGroupName, registryName, parameters, options) if err != nil { @@ -524,14 +529,13 @@ func (client *RegistriesClient) importImageCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, runtime.MarshalAsJSON(req, parameters) } // NewListPager - Lists all the container registries under the specified subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // options - RegistriesClientListOptions contains the optional parameters for the RegistriesClient.List method. func (client *RegistriesClient) NewListPager(options *RegistriesClientListOptions) *runtime.Pager[RegistriesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[RegistriesClientListResponse]{ @@ -573,7 +577,7 @@ func (client *RegistriesClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -589,8 +593,7 @@ func (client *RegistriesClient) listHandleResponse(resp *http.Response) (Registr } // NewListByResourceGroupPager - Lists all the container registries under the specified resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // options - RegistriesClientListByResourceGroupOptions contains the optional parameters for the RegistriesClient.ListByResourceGroup // method. @@ -638,7 +641,7 @@ func (client *RegistriesClient) listByResourceGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -655,7 +658,7 @@ func (client *RegistriesClient) listByResourceGroupHandleResponse(resp *http.Res // ListCredentials - Lists the login credentials for the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // options - RegistriesClientListCredentialsOptions contains the optional parameters for the RegistriesClient.ListCredentials @@ -695,7 +698,7 @@ func (client *RegistriesClient) listCredentialsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -711,8 +714,7 @@ func (client *RegistriesClient) listCredentialsHandleResponse(resp *http.Respons } // NewListPrivateLinkResourcesPager - Lists the private link resources for a container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // options - RegistriesClientListPrivateLinkResourcesOptions contains the optional parameters for the RegistriesClient.ListPrivateLinkResources @@ -765,7 +767,7 @@ func (client *RegistriesClient) listPrivateLinkResourcesCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -782,7 +784,7 @@ func (client *RegistriesClient) listPrivateLinkResourcesHandleResponse(resp *htt // ListUsages - Gets the quota usages for the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // options - RegistriesClientListUsagesOptions contains the optional parameters for the RegistriesClient.ListUsages method. @@ -821,7 +823,7 @@ func (client *RegistriesClient) listUsagesCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -838,7 +840,7 @@ func (client *RegistriesClient) listUsagesHandleResponse(resp *http.Response) (R // RegenerateCredential - Regenerates one of the login credentials for the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // regenerateCredentialParameters - Specifies name of the password which should be regenerated -- password or password2. @@ -879,7 +881,7 @@ func (client *RegistriesClient) regenerateCredentialCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, regenerateCredentialParameters) @@ -960,7 +962,7 @@ func (client *RegistriesClient) scheduleRunCreateRequest(ctx context.Context, re // BeginUpdate - Updates a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // registryUpdateParameters - The parameters for updating a container registry. @@ -979,7 +981,7 @@ func (client *RegistriesClient) BeginUpdate(ctx context.Context, resourceGroupNa // Update - Updates a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *RegistriesClient) update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters, options *RegistriesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, registryUpdateParameters, options) if err != nil { @@ -1015,7 +1017,7 @@ func (client *RegistriesClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, registryUpdateParameters) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_replications_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go similarity index 94% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_replications_client.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go index 1f4292d95330..beec4d3e6574 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_replications_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_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 armcontainerregistry @@ -56,7 +57,7 @@ func NewReplicationsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreate - Creates a replication for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // replicationName - The name of the replication. @@ -69,7 +70,9 @@ func (client *ReplicationsClient) BeginCreate(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller[ReplicationsClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ReplicationsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[ReplicationsClientCreateResponse](options.ResumeToken, client.pl, nil) } @@ -77,7 +80,7 @@ func (client *ReplicationsClient) BeginCreate(ctx context.Context, resourceGroup // Create - Creates a replication for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *ReplicationsClient) create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication, options *ReplicationsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, replicationName, replication, options) if err != nil { @@ -117,7 +120,7 @@ func (client *ReplicationsClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, replication) @@ -125,7 +128,7 @@ func (client *ReplicationsClient) createCreateRequest(ctx context.Context, resou // BeginDelete - Deletes a replication from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // replicationName - The name of the replication. @@ -137,7 +140,9 @@ func (client *ReplicationsClient) BeginDelete(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller[ReplicationsClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ReplicationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[ReplicationsClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -145,7 +150,7 @@ func (client *ReplicationsClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Deletes a replication from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *ReplicationsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, replicationName string, options *ReplicationsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, replicationName, options) if err != nil { @@ -185,14 +190,14 @@ func (client *ReplicationsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Gets the properties of the specified replication. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // replicationName - The name of the replication. @@ -236,7 +241,7 @@ func (client *ReplicationsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,8 +257,7 @@ func (client *ReplicationsClient) getHandleResponse(resp *http.Response) (Replic } // NewListPager - Lists all the replications for the specified container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // options - ReplicationsClientListOptions contains the optional parameters for the ReplicationsClient.List method. @@ -305,7 +309,7 @@ func (client *ReplicationsClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,7 +326,7 @@ func (client *ReplicationsClient) listHandleResponse(resp *http.Response) (Repli // BeginUpdate - Updates a replication for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // replicationName - The name of the replication. @@ -343,7 +347,7 @@ func (client *ReplicationsClient) BeginUpdate(ctx context.Context, resourceGroup // Update - Updates a replication for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *ReplicationsClient) update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters, options *ReplicationsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, replicationName, replicationUpdateParameters, options) if err != nil { @@ -383,7 +387,7 @@ func (client *ReplicationsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, replicationUpdateParameters) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_response_types.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/response_types.go similarity index 89% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_response_types.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/response_types.go index 65804a56a0d1..fb75f71ee437 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_response_types.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/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 armcontainerregistry @@ -38,6 +39,31 @@ type AgentPoolsClientUpdateResponse struct { AgentPool } +// CacheRulesClientCreateResponse contains the response from method CacheRulesClient.Create. +type CacheRulesClientCreateResponse struct { + CacheRule +} + +// CacheRulesClientDeleteResponse contains the response from method CacheRulesClient.Delete. +type CacheRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// CacheRulesClientGetAsyncResponse contains the response from method CacheRulesClient.GetAsync. +type CacheRulesClientGetAsyncResponse struct { + CacheRule +} + +// CacheRulesClientListAsyncResponse contains the response from method CacheRulesClient.ListAsync. +type CacheRulesClientListAsyncResponse struct { + CacheRulesListResult +} + +// CacheRulesClientUpdateResponse contains the response from method CacheRulesClient.Update. +type CacheRulesClientUpdateResponse struct { + CacheRule +} + // ConnectedRegistriesClientCreateResponse contains the response from method ConnectedRegistriesClient.Create. type ConnectedRegistriesClientCreateResponse struct { ConnectedRegistry @@ -68,6 +94,31 @@ type ConnectedRegistriesClientUpdateResponse struct { ConnectedRegistry } +// CredentialSetsClientCreateResponse contains the response from method CredentialSetsClient.Create. +type CredentialSetsClientCreateResponse struct { + CredentialSet +} + +// CredentialSetsClientDeleteResponse contains the response from method CredentialSetsClient.Delete. +type CredentialSetsClientDeleteResponse struct { + // placeholder for future response values +} + +// CredentialSetsClientGetResponse contains the response from method CredentialSetsClient.Get. +type CredentialSetsClientGetResponse struct { + CredentialSet +} + +// CredentialSetsClientListResponse contains the response from method CredentialSetsClient.List. +type CredentialSetsClientListResponse struct { + CredentialSetListResult +} + +// CredentialSetsClientUpdateResponse contains the response from method CredentialSetsClient.Update. +type CredentialSetsClientUpdateResponse struct { + CredentialSet +} + // ExportPipelinesClientCreateResponse contains the response from method ExportPipelinesClient.Create. type ExportPipelinesClientCreateResponse struct { ExportPipeline diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_runs_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client.go similarity index 99% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_runs_client.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client.go index 4880b9b238e8..3ac13bb9d296 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_runs_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_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 armcontainerregistry @@ -245,7 +246,6 @@ func (client *RunsClient) getLogSasURLHandleResponse(resp *http.Response) (RunsC } // NewListPager - Gets all the runs for a registry. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-06-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_scopemaps_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client.go similarity index 94% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_scopemaps_client.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client.go index 79b06913310e..6844fd347343 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_scopemaps_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_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 armcontainerregistry @@ -56,7 +57,7 @@ func NewScopeMapsClient(subscriptionID string, credential azcore.TokenCredential // BeginCreate - Creates a scope map for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // scopeMapName - The name of the scope map. @@ -68,7 +69,9 @@ func (client *ScopeMapsClient) BeginCreate(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller[ScopeMapsClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ScopeMapsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[ScopeMapsClientCreateResponse](options.ResumeToken, client.pl, nil) } @@ -76,7 +79,7 @@ func (client *ScopeMapsClient) BeginCreate(ctx context.Context, resourceGroupNam // Create - Creates a scope map for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *ScopeMapsClient) create(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap, options *ScopeMapsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, scopeMapName, scopeMapCreateParameters, options) if err != nil { @@ -116,7 +119,7 @@ func (client *ScopeMapsClient) createCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, scopeMapCreateParameters) @@ -124,7 +127,7 @@ func (client *ScopeMapsClient) createCreateRequest(ctx context.Context, resource // BeginDelete - Deletes a scope map from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // scopeMapName - The name of the scope map. @@ -135,7 +138,9 @@ func (client *ScopeMapsClient) BeginDelete(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller[ScopeMapsClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ScopeMapsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[ScopeMapsClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -143,7 +148,7 @@ func (client *ScopeMapsClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Deletes a scope map from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *ScopeMapsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, options *ScopeMapsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, scopeMapName, options) if err != nil { @@ -183,7 +188,7 @@ func (client *ScopeMapsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,7 +196,7 @@ func (client *ScopeMapsClient) deleteCreateRequest(ctx context.Context, resource // Get - Gets the properties of the specified scope map. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // scopeMapName - The name of the scope map. @@ -235,7 +240,7 @@ func (client *ScopeMapsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,8 +256,7 @@ func (client *ScopeMapsClient) getHandleResponse(resp *http.Response) (ScopeMaps } // NewListPager - Lists all the scope maps for the specified container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // options - ScopeMapsClientListOptions contains the optional parameters for the ScopeMapsClient.List method. @@ -304,7 +308,7 @@ func (client *ScopeMapsClient) listCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +325,7 @@ func (client *ScopeMapsClient) listHandleResponse(resp *http.Response) (ScopeMap // BeginUpdate - Updates a scope map with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // scopeMapName - The name of the scope map. @@ -341,7 +345,7 @@ func (client *ScopeMapsClient) BeginUpdate(ctx context.Context, resourceGroupNam // Update - Updates a scope map with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *ScopeMapsClient) update(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters, options *ScopeMapsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, scopeMapName, scopeMapUpdateParameters, options) if err != nil { @@ -381,7 +385,7 @@ func (client *ScopeMapsClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, scopeMapUpdateParameters) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_taskruns_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client.go similarity index 99% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_taskruns_client.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client.go index b43215207571..47166541aa53 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_taskruns_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_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 armcontainerregistry @@ -312,7 +313,6 @@ func (client *TaskRunsClient) getDetailsHandleResponse(resp *http.Response) (Tas } // NewListPager - Lists all the task runs for a specified container registry. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-06-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_tasks_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client.go similarity index 99% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_tasks_client.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client.go index 8b2c962b2ff0..ea0b34897e12 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_tasks_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_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 armcontainerregistry @@ -312,7 +313,6 @@ func (client *TasksClient) getDetailsHandleResponse(resp *http.Response) (TasksC } // NewListPager - Lists all the tasks for a specified container registry. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-06-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_time_rfc3339.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/time_rfc3339.go index 663d13b40657..31b8976c2406 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/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 armcontainerregistry diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_tokens_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client.go similarity index 94% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_tokens_client.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client.go index eca329a0391a..5c864dbbb38a 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_tokens_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_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 armcontainerregistry @@ -56,7 +57,7 @@ func NewTokensClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreate - Creates a token for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // tokenName - The name of the token. @@ -68,7 +69,9 @@ func (client *TokensClient) BeginCreate(ctx context.Context, resourceGroupName s if err != nil { return nil, err } - return runtime.NewPoller[TokensClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[TokensClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[TokensClientCreateResponse](options.ResumeToken, client.pl, nil) } @@ -76,7 +79,7 @@ func (client *TokensClient) BeginCreate(ctx context.Context, resourceGroupName s // Create - Creates a token for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *TokensClient) create(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token, options *TokensClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, tokenName, tokenCreateParameters, options) if err != nil { @@ -116,7 +119,7 @@ func (client *TokensClient) createCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, tokenCreateParameters) @@ -124,7 +127,7 @@ func (client *TokensClient) createCreateRequest(ctx context.Context, resourceGro // BeginDelete - Deletes a token from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // tokenName - The name of the token. @@ -135,7 +138,9 @@ func (client *TokensClient) BeginDelete(ctx context.Context, resourceGroupName s if err != nil { return nil, err } - return runtime.NewPoller[TokensClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[TokensClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[TokensClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -143,7 +148,7 @@ func (client *TokensClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Deletes a token from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *TokensClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, tokenName string, options *TokensClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, tokenName, options) if err != nil { @@ -183,7 +188,7 @@ func (client *TokensClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,7 +196,7 @@ func (client *TokensClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets the properties of the specified token. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // tokenName - The name of the token. @@ -235,7 +240,7 @@ func (client *TokensClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,8 +256,7 @@ func (client *TokensClient) getHandleResponse(resp *http.Response) (TokensClient } // NewListPager - Lists all the tokens for the specified container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // options - TokensClientListOptions contains the optional parameters for the TokensClient.List method. @@ -304,7 +308,7 @@ func (client *TokensClient) listCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +325,7 @@ func (client *TokensClient) listHandleResponse(resp *http.Response) (TokensClien // BeginUpdate - Updates a token with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // tokenName - The name of the token. @@ -341,7 +345,7 @@ func (client *TokensClient) BeginUpdate(ctx context.Context, resourceGroupName s // Update - Updates a token with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *TokensClient) update(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters, options *TokensClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, tokenName, tokenUpdateParameters, options) if err != nil { @@ -381,7 +385,7 @@ func (client *TokensClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, tokenUpdateParameters) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_webhooks_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go similarity index 95% rename from sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_webhooks_client.go rename to sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go index bc6a45938cea..6ab7cdd7a3f5 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_webhooks_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_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 armcontainerregistry @@ -56,7 +57,7 @@ func NewWebhooksClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Creates a webhook for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // webhookName - The name of the webhook. @@ -68,7 +69,9 @@ func (client *WebhooksClient) BeginCreate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[WebhooksClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[WebhooksClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[WebhooksClientCreateResponse](options.ResumeToken, client.pl, nil) } @@ -76,7 +79,7 @@ func (client *WebhooksClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Creates a webhook for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *WebhooksClient) create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters, options *WebhooksClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, webhookName, webhookCreateParameters, options) if err != nil { @@ -116,7 +119,7 @@ func (client *WebhooksClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, webhookCreateParameters) @@ -124,7 +127,7 @@ func (client *WebhooksClient) createCreateRequest(ctx context.Context, resourceG // BeginDelete - Deletes a webhook from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // webhookName - The name of the webhook. @@ -135,7 +138,9 @@ func (client *WebhooksClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[WebhooksClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[WebhooksClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[WebhooksClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -143,7 +148,7 @@ func (client *WebhooksClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a webhook from a container registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *WebhooksClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, webhookName, options) if err != nil { @@ -183,14 +188,14 @@ func (client *WebhooksClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Gets the properties of the specified webhook. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // webhookName - The name of the webhook. @@ -234,7 +239,7 @@ func (client *WebhooksClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,7 +256,7 @@ func (client *WebhooksClient) getHandleResponse(resp *http.Response) (WebhooksCl // GetCallbackConfig - Gets the configuration of service URI and custom headers for the webhook. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // webhookName - The name of the webhook. @@ -296,7 +301,7 @@ func (client *WebhooksClient) getCallbackConfigCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -312,8 +317,7 @@ func (client *WebhooksClient) getCallbackConfigHandleResponse(resp *http.Respons } // NewListPager - Lists all the webhooks for the specified container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // options - WebhooksClientListOptions contains the optional parameters for the WebhooksClient.List method. @@ -365,7 +369,7 @@ func (client *WebhooksClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -381,8 +385,7 @@ func (client *WebhooksClient) listHandleResponse(resp *http.Response) (WebhooksC } // NewListEventsPager - Lists recent events for the specified webhook. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // webhookName - The name of the webhook. @@ -439,7 +442,7 @@ func (client *WebhooksClient) listEventsCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -456,7 +459,7 @@ func (client *WebhooksClient) listEventsHandleResponse(resp *http.Response) (Web // Ping - Triggers a ping event to be sent to the webhook. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // webhookName - The name of the webhook. @@ -500,7 +503,7 @@ func (client *WebhooksClient) pingCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -517,7 +520,7 @@ func (client *WebhooksClient) pingHandleResponse(resp *http.Response) (WebhooksC // BeginUpdate - Updates a webhook with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview // resourceGroupName - The name of the resource group to which the container registry belongs. // registryName - The name of the container registry. // webhookName - The name of the webhook. @@ -537,7 +540,7 @@ func (client *WebhooksClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Updates a webhook with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01-preview +// Generated from API version 2023-01-01-preview func (client *WebhooksClient) update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters, options *WebhooksClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, webhookName, webhookUpdateParameters, options) if err != nil { @@ -577,7 +580,7 @@ func (client *WebhooksClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, webhookUpdateParameters) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_agentpools_client_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_agentpools_client_test.go deleted file mode 100644 index d2e1fb8e05d3..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_agentpools_client_test.go +++ /dev/null @@ -1,185 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsGet.json -func ExampleAgentPoolsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewAgentPoolsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myRegistry", - "myAgentPool", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsCreate.json -func ExampleAgentPoolsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewAgentPoolsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "myResourceGroup", - "myRegistry", - "myAgentPool", - armcontainerregistry.AgentPool{ - Location: to.Ptr("WESTUS"), - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - Properties: &armcontainerregistry.AgentPoolProperties{ - Count: to.Ptr[int32](1), - OS: to.Ptr(armcontainerregistry.OSLinux), - Tier: to.Ptr("S1"), - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsDelete.json -func ExampleAgentPoolsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewAgentPoolsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myRegistry", - "myAgentPool", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsUpdate.json -func ExampleAgentPoolsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewAgentPoolsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "myResourceGroup", - "myRegistry", - "myAgentPool", - armcontainerregistry.AgentPoolUpdateParameters{ - Properties: &armcontainerregistry.AgentPoolPropertiesUpdateParameters{ - Count: to.Ptr[int32](1), - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsList.json -func ExampleAgentPoolsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewAgentPoolsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsGetQueueStatus.json -func ExampleAgentPoolsClient_GetQueueStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewAgentPoolsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetQueueStatus(ctx, - "myResourceGroup", - "myRegistry", - "myAgentPool", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_connectedregistries_client_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_connectedregistries_client_test.go deleted file mode 100644 index f9b4d5952d71..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_connectedregistries_client_test.go +++ /dev/null @@ -1,208 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ConnectedRegistryList.json -func ExampleConnectedRegistriesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewConnectedRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myRegistry", - &armcontainerregistry.ConnectedRegistriesClientListOptions{Filter: 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ConnectedRegistryGet.json -func ExampleConnectedRegistriesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewConnectedRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myRegistry", - "myConnectedRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ConnectedRegistryCreate.json -func ExampleConnectedRegistriesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewConnectedRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "myResourceGroup", - "myRegistry", - "myConnectedRegistry", - armcontainerregistry.ConnectedRegistry{ - Properties: &armcontainerregistry.ConnectedRegistryProperties{ - ClientTokenIDs: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client1Token")}, - Mode: to.Ptr(armcontainerregistry.ConnectedRegistryModeReadWrite), - NotificationsList: []*string{ - to.Ptr("hello-world:*:*"), - to.Ptr("sample/repo/*:1.0:*")}, - Parent: &armcontainerregistry.ParentProperties{ - SyncProperties: &armcontainerregistry.SyncProperties{ - MessageTTL: to.Ptr("P2D"), - Schedule: to.Ptr("0 9 * * *"), - SyncWindow: to.Ptr("PT3H"), - TokenID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/syncToken"), - }, - }, - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ConnectedRegistryDelete.json -func ExampleConnectedRegistriesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewConnectedRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myRegistry", - "myConnectedRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ConnectedRegistryUpdate.json -func ExampleConnectedRegistriesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewConnectedRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "myResourceGroup", - "myRegistry", - "myScopeMap", - armcontainerregistry.ConnectedRegistryUpdateParameters{ - Properties: &armcontainerregistry.ConnectedRegistryUpdateProperties{ - ClientTokenIDs: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client1Token"), - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client2Token")}, - Logging: &armcontainerregistry.LoggingProperties{ - AuditLogStatus: to.Ptr(armcontainerregistry.AuditLogStatusEnabled), - LogLevel: to.Ptr(armcontainerregistry.LogLevelDebug), - }, - NotificationsList: []*string{ - to.Ptr("hello-world:*:*"), - to.Ptr("sample/repo/*:1.0:*")}, - SyncProperties: &armcontainerregistry.SyncUpdateProperties{ - MessageTTL: to.Ptr("P30D"), - Schedule: to.Ptr("0 0 */10 * *"), - SyncWindow: to.Ptr("P2D"), - }, - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ConnectedRegistryDeactivate.json -func ExampleConnectedRegistriesClient_BeginDeactivate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewConnectedRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeactivate(ctx, - "myResourceGroup", - "myRegistry", - "myConnectedRegistry", - 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/containerregistry/armcontainerregistry/ze_generated_example_exportpipelines_client_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_exportpipelines_client_test.go deleted file mode 100644 index 53359ab0450c..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_exportpipelines_client_test.go +++ /dev/null @@ -1,134 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ExportPipelineList.json -func ExampleExportPipelinesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewExportPipelinesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ExportPipelineGet.json -func ExampleExportPipelinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewExportPipelinesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myRegistry", - "myExportPipeline", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ExportPipelineCreate.json -func ExampleExportPipelinesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewExportPipelinesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "myResourceGroup", - "myRegistry", - "myExportPipeline", - armcontainerregistry.ExportPipeline{ - Identity: &armcontainerregistry.IdentityProperties{ - Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - }, - Location: to.Ptr("westus"), - Properties: &armcontainerregistry.ExportPipelineProperties{ - Options: []*armcontainerregistry.PipelineOptions{ - to.Ptr(armcontainerregistry.PipelineOptionsOverwriteBlobs)}, - Target: &armcontainerregistry.ExportPipelineTargetProperties{ - Type: to.Ptr("AzureStorageBlobContainer"), - KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - }, - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ExportPipelineDelete.json -func ExampleExportPipelinesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewExportPipelinesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myRegistry", - "myExportPipeline", - 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/containerregistry/armcontainerregistry/ze_generated_example_importpipelines_client_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_importpipelines_client_test.go deleted file mode 100644 index 56fcdae44077..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_importpipelines_client_test.go +++ /dev/null @@ -1,139 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ImportPipelineList.json -func ExampleImportPipelinesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewImportPipelinesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ImportPipelineGet.json -func ExampleImportPipelinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewImportPipelinesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myRegistry", - "myImportPipeline", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ImportPipelineCreate.json -func ExampleImportPipelinesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewImportPipelinesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "myResourceGroup", - "myRegistry", - "myImportPipeline", - armcontainerregistry.ImportPipeline{ - Identity: &armcontainerregistry.IdentityProperties{ - Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armcontainerregistry.UserIdentityProperties{ - "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": {}, - }, - }, - Location: to.Ptr("westus"), - Properties: &armcontainerregistry.ImportPipelineProperties{ - Options: []*armcontainerregistry.PipelineOptions{ - to.Ptr(armcontainerregistry.PipelineOptionsOverwriteTags), - to.Ptr(armcontainerregistry.PipelineOptionsDeleteSourceBlobOnSuccess), - to.Ptr(armcontainerregistry.PipelineOptionsContinueOnErrors)}, - Source: &armcontainerregistry.ImportPipelineSourceProperties{ - Type: to.Ptr(armcontainerregistry.PipelineSourceTypeAzureStorageBlobContainer), - KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrimportsas"), - URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - }, - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ImportPipelineDelete.json -func ExampleImportPipelinesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewImportPipelinesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myRegistry", - "myImportPipeline", - 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/containerregistry/armcontainerregistry/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_operations_client_test.go deleted file mode 100644 index f57a50b1a7af..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,41 +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 armcontainerregistry_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/OperationList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(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 - } - } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_pipelineruns_client_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_pipelineruns_client_test.go deleted file mode 100644 index f1304da2867a..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_pipelineruns_client_test.go +++ /dev/null @@ -1,133 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/PipelineRunList.json -func ExamplePipelineRunsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewPipelineRunsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/PipelineRunGet.json -func ExamplePipelineRunsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewPipelineRunsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myRegistry", - "myPipelineRun", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/PipelineRunCreate_Export.json -func ExamplePipelineRunsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewPipelineRunsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "myResourceGroup", - "myRegistry", - "myPipelineRun", - armcontainerregistry.PipelineRun{ - Properties: &armcontainerregistry.PipelineRunProperties{ - Request: &armcontainerregistry.PipelineRunRequest{ - Artifacts: []*string{ - to.Ptr("sourceRepository/hello-world"), - to.Ptr("sourceRepository2@sha256:00000000000000000000000000000000000")}, - PipelineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline"), - Target: &armcontainerregistry.PipelineRunTargetProperties{ - Name: to.Ptr("myblob.tar.gz"), - Type: to.Ptr(armcontainerregistry.PipelineRunTargetTypeAzureStorageBlob), - }, - }, - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/PipelineRunDelete.json -func ExamplePipelineRunsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewPipelineRunsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myRegistry", - "myPipelineRun", - 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/containerregistry/armcontainerregistry/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_privateendpointconnections_client_test.go deleted file mode 100644 index cf3a242f4509..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_privateendpointconnections_client_test.go +++ /dev/null @@ -1,127 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/PrivateEndpointConnectionList.json -func ExamplePrivateEndpointConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/PrivateEndpointConnectionGet.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myRegistry", - "myConnection", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/PrivateEndpointConnectionCreateOrUpdate.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "myResourceGroup", - "myRegistry", - "myConnection", - armcontainerregistry.PrivateEndpointConnection{ - Properties: &armcontainerregistry.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armcontainerregistry.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Auto-Approved"), - Status: to.Ptr(armcontainerregistry.ConnectionStatusApproved), - }, - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/PrivateEndpointConnectionDelete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myRegistry", - "myConnection", - 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/containerregistry/armcontainerregistry/ze_generated_example_registries_client_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_registries_client_test.go deleted file mode 100644 index b9ad7b68673b..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_registries_client_test.go +++ /dev/null @@ -1,451 +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 armcontainerregistry_test - -import ( - "context" - "log" - - "time" - - "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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ImportImageByManifestDigest.json -func ExampleRegistriesClient_BeginImportImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginImportImage(ctx, - "myResourceGroup", - "myRegistry", - armcontainerregistry.ImportImageParameters{ - Mode: to.Ptr(armcontainerregistry.ImportModeForce), - Source: &armcontainerregistry.ImportSource{ - ResourceID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/sourceResourceGroup/providers/Microsoft.ContainerRegistry/registries/sourceRegistry"), - SourceImage: to.Ptr("sourceRepository@sha256:0000000000000000000000000000000000000000000000000000000000000000"), - }, - TargetTags: []*string{ - to.Ptr("targetRepository:targetTag")}, - UntaggedTargetRepositories: []*string{ - to.Ptr("targetRepository1")}, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/RegistryCheckNameAvailable.json -func ExampleRegistriesClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, - armcontainerregistry.RegistryNameCheckRequest{ - Name: to.Ptr("myRegistry"), - Type: to.Ptr("Microsoft.ContainerRegistry/registries"), - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/RegistryList.json -func ExampleRegistriesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/RegistryListByResourceGroup.json -func ExampleRegistriesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/RegistryGet.json -func ExampleRegistriesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/RegistryCreate.json -func ExampleRegistriesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "myResourceGroup", - "myRegistry", - armcontainerregistry.Registry{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - Properties: &armcontainerregistry.RegistryProperties{ - AdminUserEnabled: to.Ptr(true), - }, - SKU: &armcontainerregistry.SKU{ - Name: to.Ptr(armcontainerregistry.SKUNameStandard), - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/RegistryDelete.json -func ExampleRegistriesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/RegistryUpdate.json -func ExampleRegistriesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "myResourceGroup", - "myRegistry", - armcontainerregistry.RegistryUpdateParameters{ - Properties: &armcontainerregistry.RegistryPropertiesUpdateParameters{ - AdminUserEnabled: to.Ptr(true), - }, - SKU: &armcontainerregistry.SKU{ - Name: to.Ptr(armcontainerregistry.SKUNameStandard), - }, - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/RegistryListUsages.json -func ExampleRegistriesClient_ListUsages() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListUsages(ctx, - "myResourceGroup", - "myRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/RegistryListPrivateLinkResources.json -func ExampleRegistriesClient_NewListPrivateLinkResourcesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPrivateLinkResourcesPager("myResourceGroup", - "myRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/RegistryGetPrivateLinkResource.json -func ExampleRegistriesClient_GetPrivateLinkResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetPrivateLinkResource(ctx, - "myResourceGroup", - "myRegistry", - "registry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/RegistryListCredentials.json -func ExampleRegistriesClient_ListCredentials() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListCredentials(ctx, - "myResourceGroup", - "myRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/RegistryRegenerateCredential.json -func ExampleRegistriesClient_RegenerateCredential() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.RegenerateCredential(ctx, - "myResourceGroup", - "myRegistry", - armcontainerregistry.RegenerateCredentialParameters{ - Name: to.Ptr(armcontainerregistry.PasswordNamePassword), - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/RegistryGenerateCredentials.json -func ExampleRegistriesClient_BeginGenerateCredentials() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRegistriesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginGenerateCredentials(ctx, - "myResourceGroup", - "myRegistry", - armcontainerregistry.GenerateCredentialsParameters{ - Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-31T15:59:59.0707808Z"); return t }()), - TokenID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/myToken"), - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun.json -func ExampleRegistriesClient_BeginScheduleRun() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRegistriesClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginScheduleRun(ctx, - "myResourceGroup", - "myRegistry", - &armcontainerregistry.DockerBuildRequest{ - Type: to.Ptr("DockerBuildRequest"), - IsArchiveEnabled: to.Ptr(true), - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](2), - }, - Arguments: []*armcontainerregistry.Argument{ - { - Name: to.Ptr("mytestargument"), - IsSecret: to.Ptr(false), - Value: to.Ptr("mytestvalue"), - }, - { - Name: to.Ptr("mysecrettestargument"), - IsSecret: to.Ptr(true), - Value: to.Ptr("mysecrettestvalue"), - }}, - DockerFilePath: to.Ptr("DockerFile"), - ImageNames: []*string{ - to.Ptr("azurerest:testtag")}, - IsPushEnabled: to.Ptr(true), - NoCache: to.Ptr(true), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - SourceLocation: to.Ptr("https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), - }, - 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/containerregistry/armcontainerregistry/ze_generated_example_replications_client_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_replications_client_test.go deleted file mode 100644 index 7de03f0d0249..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_replications_client_test.go +++ /dev/null @@ -1,157 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ReplicationList.json -func ExampleReplicationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewReplicationsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ReplicationGet.json -func ExampleReplicationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewReplicationsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myRegistry", - "myReplication", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ReplicationCreate.json -func ExampleReplicationsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewReplicationsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "myResourceGroup", - "myRegistry", - "myReplication", - armcontainerregistry.Replication{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ReplicationDelete.json -func ExampleReplicationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewReplicationsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myRegistry", - "myReplication", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ReplicationUpdate.json -func ExampleReplicationsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewReplicationsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "myResourceGroup", - "myRegistry", - "myReplication", - armcontainerregistry.ReplicationUpdateParameters{ - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - }, - 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/containerregistry/armcontainerregistry/ze_generated_example_runs_client_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_runs_client_test.go deleted file mode 100644 index e3e87e33f1f1..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_runs_client_test.go +++ /dev/null @@ -1,124 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsList.json -func ExampleRunsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRunsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myRegistry", - &armcontainerregistry.RunsClientListOptions{Filter: to.Ptr(""), - Top: to.Ptr[int32](10), - }) - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsGet.json -func ExampleRunsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRunsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myRegistry", - "0accec26-d6de-4757-8e74-d080f38eaaab", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsUpdate.json -func ExampleRunsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRunsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "myResourceGroup", - "myRegistry", - "0accec26-d6de-4757-8e74-d080f38eaaab", - armcontainerregistry.RunUpdateParameters{ - IsArchiveEnabled: to.Ptr(true), - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsCancel.json -func ExampleRunsClient_BeginCancel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewRunsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCancel(ctx, - "myResourceGroup", - "myRegistry", - "0accec26-d6de-4757-8e74-d080f38eaaab", - 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/containerregistry/armcontainerregistry/ze_generated_example_scopemaps_client_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_scopemaps_client_test.go deleted file mode 100644 index fbb425f4d379..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_scopemaps_client_test.go +++ /dev/null @@ -1,162 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ScopeMapList.json -func ExampleScopeMapsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewScopeMapsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ScopeMapGet.json -func ExampleScopeMapsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewScopeMapsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myRegistry", - "myScopeMap", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ScopeMapCreate.json -func ExampleScopeMapsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewScopeMapsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "myResourceGroup", - "myRegistry", - "myScopeMap", - armcontainerregistry.ScopeMap{ - Properties: &armcontainerregistry.ScopeMapProperties{ - Description: to.Ptr("Developer Scopes"), - Actions: []*string{ - to.Ptr("repositories/myrepository/contentWrite"), - to.Ptr("repositories/myrepository/delete")}, - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ScopeMapDelete.json -func ExampleScopeMapsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewScopeMapsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myRegistry", - "myScopeMap", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/ScopeMapUpdate.json -func ExampleScopeMapsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewScopeMapsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "myResourceGroup", - "myRegistry", - "myScopeMap", - armcontainerregistry.ScopeMapUpdateParameters{ - Properties: &armcontainerregistry.ScopeMapPropertiesUpdateParameters{ - Description: to.Ptr("Developer Scopes"), - Actions: []*string{ - to.Ptr("repositories/myrepository/contentWrite"), - to.Ptr("repositories/myrepository/contentRead")}, - }, - }, - 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/containerregistry/armcontainerregistry/ze_generated_example_taskruns_client_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_taskruns_client_test.go deleted file mode 100644 index af74d8cdee2e..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_taskruns_client_test.go +++ /dev/null @@ -1,202 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsGet.json -func ExampleTaskRunsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTaskRunsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myRegistry", - "myRun", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsCreate.json -func ExampleTaskRunsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTaskRunsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "myResourceGroup", - "myRegistry", - "myRun", - armcontainerregistry.TaskRun{ - Properties: &armcontainerregistry.TaskRunProperties{ - ForceUpdateTag: to.Ptr("test"), - RunRequest: &armcontainerregistry.EncodedTaskRunRequest{ - Type: to.Ptr("EncodedTaskRunRequest"), - Credentials: &armcontainerregistry.Credentials{}, - EncodedTaskContent: to.Ptr("c3RlcHM6IAogIC0gY21kOiB7eyAuVmFsdWVzLmNvbW1hbmQgfX0K"), - EncodedValuesContent: to.Ptr("Y29tbWFuZDogYmFzaCBlY2hvIHt7LlJ1bi5SZWdpc3RyeX19Cg=="), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - Values: []*armcontainerregistry.SetValue{}, - }, - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsDelete.json -func ExampleTaskRunsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTaskRunsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myRegistry", - "myRun", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsUpdate.json -func ExampleTaskRunsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTaskRunsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "myResourceGroup", - "myRegistry", - "myRun", - armcontainerregistry.TaskRunUpdateParameters{ - Properties: &armcontainerregistry.TaskRunPropertiesUpdateParameters{ - ForceUpdateTag: to.Ptr("test"), - RunRequest: &armcontainerregistry.EncodedTaskRunRequest{ - Type: to.Ptr("EncodedTaskRunRequest"), - IsArchiveEnabled: to.Ptr(true), - Credentials: &armcontainerregistry.Credentials{}, - EncodedTaskContent: to.Ptr("c3RlcHM6IAogIC0gY21kOiB7eyAuVmFsdWVzLmNvbW1hbmQgfX0K"), - EncodedValuesContent: to.Ptr("Y29tbWFuZDogYmFzaCBlY2hvIHt7LlJ1bi5SZWdpc3RyeX19Cg=="), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - Values: []*armcontainerregistry.SetValue{}, - }, - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsGetDetails.json -func ExampleTaskRunsClient_GetDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTaskRunsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetDetails(ctx, - "myResourceGroup", - "myRegistry", - "myRun", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsList.json -func ExampleTaskRunsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTaskRunsClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myRegistry", - 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 - } - } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_tasks_client_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_tasks_client_test.go deleted file mode 100644 index fd9e60d54399..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_tasks_client_test.go +++ /dev/null @@ -1,285 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksList.json -func ExampleTasksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTasksClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksGet.json -func ExampleTasksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTasksClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myRegistry", - "myTask", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksCreate.json -func ExampleTasksClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTasksClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "myResourceGroup", - "myRegistry", - "mytTask", - armcontainerregistry.Task{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "testkey": to.Ptr("value"), - }, - Identity: &armcontainerregistry.IdentityProperties{ - Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - }, - Properties: &armcontainerregistry.TaskProperties{ - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](2), - }, - IsSystemTask: to.Ptr(false), - LogTemplate: to.Ptr("acr/tasks:{{.Run.OS}}"), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - Step: &armcontainerregistry.DockerBuildStep{ - Type: to.Ptr(armcontainerregistry.StepTypeDocker), - ContextPath: to.Ptr("src"), - Arguments: []*armcontainerregistry.Argument{ - { - Name: to.Ptr("mytestargument"), - IsSecret: to.Ptr(false), - Value: to.Ptr("mytestvalue"), - }, - { - Name: to.Ptr("mysecrettestargument"), - IsSecret: to.Ptr(true), - Value: to.Ptr("mysecrettestvalue"), - }}, - DockerFilePath: to.Ptr("src/DockerFile"), - ImageNames: []*string{ - to.Ptr("azurerest:testtag")}, - IsPushEnabled: to.Ptr(true), - NoCache: to.Ptr(false), - }, - Trigger: &armcontainerregistry.TriggerProperties{ - BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - Name: to.Ptr("myBaseImageTrigger"), - BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - UpdateTriggerEndpoint: to.Ptr("https://user:pass@mycicd.webhook.com?token=foo"), - UpdateTriggerPayloadType: to.Ptr(armcontainerregistry.UpdateTriggerPayloadTypeToken), - }, - SourceTriggers: []*armcontainerregistry.SourceTrigger{ - { - Name: to.Ptr("mySourceTrigger"), - SourceRepository: &armcontainerregistry.SourceProperties{ - Branch: to.Ptr("master"), - RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - SourceControlAuthProperties: &armcontainerregistry.AuthInfo{ - Token: to.Ptr("xxxxx"), - TokenType: to.Ptr(armcontainerregistry.TokenTypePAT), - }, - SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - }, - SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - }}, - TimerTriggers: []*armcontainerregistry.TimerTrigger{ - { - Name: to.Ptr("myTimerTrigger"), - Schedule: to.Ptr("30 9 * * 1-5"), - }}, - }, - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksDelete.json -func ExampleTasksClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTasksClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myRegistry", - "myTask", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksUpdate.json -func ExampleTasksClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTasksClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "myResourceGroup", - "myRegistry", - "myTask", - armcontainerregistry.TaskUpdateParameters{ - Properties: &armcontainerregistry.TaskPropertiesUpdateParameters{ - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](3), - }, - Credentials: &armcontainerregistry.Credentials{ - CustomRegistries: map[string]*armcontainerregistry.CustomRegistryCredentials{ - "myregistry.azurecr.io": { - Identity: to.Ptr("[system]"), - Password: &armcontainerregistry.SecretObject{ - Type: to.Ptr(armcontainerregistry.SecretObjectTypeVaultsecret), - Value: to.Ptr("https://myacbvault.vault.azure.net/secrets/password"), - }, - UserName: &armcontainerregistry.SecretObject{ - Type: to.Ptr(armcontainerregistry.SecretObjectTypeOpaque), - Value: to.Ptr("username"), - }, - }, - }, - }, - LogTemplate: to.Ptr("acr/tasks:{{.Run.OS}}"), - Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - Step: &armcontainerregistry.DockerBuildStepUpdateParameters{ - Type: to.Ptr(armcontainerregistry.StepTypeDocker), - DockerFilePath: to.Ptr("src/DockerFile"), - ImageNames: []*string{ - to.Ptr("azurerest:testtag1")}, - }, - Trigger: &armcontainerregistry.TriggerUpdateParameters{ - SourceTriggers: []*armcontainerregistry.SourceTriggerUpdateParameters{ - { - Name: to.Ptr("mySourceTrigger"), - SourceRepository: &armcontainerregistry.SourceUpdateParameters{ - SourceControlAuthProperties: &armcontainerregistry.AuthInfoUpdateParameters{ - Token: to.Ptr("xxxxx"), - TokenType: to.Ptr(armcontainerregistry.TokenTypePAT), - }, - }, - SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - }}, - }, - }, - Tags: map[string]*string{ - "testkey": to.Ptr("value"), - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksGetDetails.json -func ExampleTasksClient_GetDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTasksClient("4385cf00-2d3a-425a-832f-f4285b1c9dce", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetDetails(ctx, - "myResourceGroup", - "myRegistry", - "myTask", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_tokens_client_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_tokens_client_test.go deleted file mode 100644 index d59f744d6475..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_tokens_client_test.go +++ /dev/null @@ -1,171 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/TokenList.json -func ExampleTokensClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTokensClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/TokenGet.json -func ExampleTokensClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTokensClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myRegistry", - "myToken", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/TokenCreate.json -func ExampleTokensClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTokensClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "myResourceGroup", - "myRegistry", - "myToken", - armcontainerregistry.Token{ - Properties: &armcontainerregistry.TokenProperties{ - Credentials: &armcontainerregistry.TokenCredentialsProperties{ - Certificates: []*armcontainerregistry.TokenCertificate{ - { - Name: to.Ptr(armcontainerregistry.TokenCertificateNameCertificate1), - EncodedPemCertificate: to.Ptr("LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUc3akNDQk5hZ0F3SUJBZ0lURmdBQlR3UVpyZGdmdmhxdzBnQUFBQUZQQkRBTkJna3Foa2lHOXcwQkFRc0YKQURDQml6RUxNQWtHQTFVRUJoTUNWVk14RXpBUkJnTlZCQWdUQ2xkaGMyaHBibWQwYjI0eEVEQU9CZ05WQkFjVApCMUpsWkcxdmJtUXhIakFjQmdOVkJBb1RGVTFwWTNKdmMyOW1kQ0JEYjNKd2IzSmhkR2x2YmpFVk1CTUdBMVVFCkN4TU1UV2xqY205emIyWjBJRWxVTVI0d0hBWURWUVFERXhWTmFXTnliM052Wm5RZ1NWUWdWRXhUSUVOQklEUXcKSGhjTk1UZ3dOREV5TWpJek1qUTRXaGNOTWpBd05ERXlNakl6TWpRNFdqQTVNVGN3TlFZRFZRUURFeTV6WlhKMgphV05sWTJ4cFpXNTBZMlZ5ZEMxd1lYSjBibVZ5TG0xaGJtRm5aVzFsYm5RdVlYcDFjbVV1WTI5dE1JSUJJakFOCkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQTBSYjdJcHpxMmR4emhhbVpyS1ZDakMzeTQyYlYKUnNIY2pCUTFuSDBHZ1puUDhXeDZDSE1mWThybkVJQzRLeVRRYkJXVzhnNXlmc3NSQ0ZXbFpxYjR6SkRXS0pmTgpGSmNMUm9LNnhwTktZYVZVTkVlT25IdUxHYTM0ZlA0VjBFRjZybzdvbkRLME5zanhjY1dZVzRNVXVzc0xrQS94CkUrM2RwU1REdk1KcjJoWUpsVnFDcVR6blQvbmZaVUZzQUVEQnp5MUpOOHZiZDlIR2czc2Myd0x4dk95cFJOc0gKT1V3V2pmN2xzWWZleEVlcWkzY29EeHc2alpLVWEyVkdsUnBpTkowMjhBQitYSi9TU1FVNVBsd0JBbU9TT3ovRApGY0NKdGpPZlBqU1NKckFIQVV3SHU3RzlSV05JTFBwYU9zQ1J5eitETE5zNGpvNlEvUUg4d1lManJRSURBUUFCCm80SUNtakNDQXBZd0N3WURWUjBQQkFRREFnU3dNQjBHQTFVZEpRUVdNQlFHQ0NzR0FRVUZCd01DQmdnckJnRUYKQlFjREFUQWRCZ05WSFE0RUZnUVVlbEdkVVJrZzJoSFFOWEQ4WUc4L3drdjJVT0F3SHdZRFZSMGpCQmd3Rm9BVQplbnVNd2Mvbm9Nb2MxR3Y2KytFend3OGFvcDB3Z2F3R0ExVWRId1NCcERDQm9UQ0JucUNCbTZDQm1JWkxhSFIwCmNEb3ZMMjF6WTNKc0xtMXBZM0p2YzI5bWRDNWpiMjB2Y0d0cEwyMXpZMjl5Y0M5amNtd3ZUV2xqY205emIyWjAKSlRJd1NWUWxNakJVVEZNbE1qQkRRU1V5TURRdVkzSnNoa2xvZEhSd09pOHZZM0pzTG0xcFkzSnZjMjltZEM1agpiMjB2Y0d0cEwyMXpZMjl5Y0M5amNtd3ZUV2xqY205emIyWjBKVEl3U1ZRbE1qQlVURk1sTWpCRFFTVXlNRFF1ClkzSnNNSUdGQmdnckJnRUZCUWNCQVFSNU1IY3dVUVlJS3dZQkJRVUhNQUtHUldoMGRIQTZMeTkzZDNjdWJXbGoKY205emIyWjBMbU52YlM5d2Eya3ZiWE5qYjNKd0wwMXBZM0p2YzI5bWRDVXlNRWxVSlRJd1ZFeFRKVEl3UTBFbApNakEwTG1OeWREQWlCZ2dyQmdFRkJRY3dBWVlXYUhSMGNEb3ZMMjlqYzNBdWJYTnZZM053TG1OdmJUQStCZ2tyCkJnRUVBWUkzRlFjRU1UQXZCaWNyQmdFRUFZSTNGUWlIMm9aMWcrN1pBWUxKaFJ1QnRaNWhoZlRyWUlGZGhOTGYKUW9Mbmszb0NBV1FDQVIwd1RRWURWUjBnQkVZd1JEQkNCZ2tyQmdFRUFZSTNLZ0V3TlRBekJnZ3JCZ0VGQlFjQwpBUlluYUhSMGNEb3ZMM2QzZHk1dGFXTnliM052Wm5RdVkyOXRMM0JyYVM5dGMyTnZjbkF2WTNCek1DY0dDU3NHCkFRUUJnamNWQ2dRYU1CZ3dDZ1lJS3dZQkJRVUhBd0l3Q2dZSUt3WUJCUVVIQXdFd09RWURWUjBSQkRJd01JSXUKYzJWeWRtbGpaV05zYVdWdWRHTmxjblF0Y0dGeWRHNWxjaTV0WVc1aFoyVnRaVzUwTG1GNmRYSmxMbU52YlRBTgpCZ2txaGtpRzl3MEJBUXNGQUFPQ0FnRUFIVXIzbk1vdUI5WWdDUlRWYndUTllIS2RkWGJkSW1GUXNDYys4T1g1CjE5c0N6dFFSR05iSXEwVW1Ba01MbFVvWTIxckh4ZXdxU2hWczFhL2RwaFh5Tk1pcUdaU2QzU1BtYzZscitqUFQKNXVEREs0MUlWeXN0K2VUNlpyazFvcCtMVmdkeS9EU2lyNzVqcWZFY016bS82bU8rNnFNeWRLTWtVYmM5K3JHVwphUkpUcjRWUUdIRmEwNEIwZVZpNUd4MG9pL2RpZDNSaXg2aXJMMjFJSGEwYjN6c1hzZHpHU0R2K3hqL2Q2S0l4Ckdrd2FhYmZvU1NoQnFqaFNlQ0VyZXFlb1RpYjljdGw0MGRVdUp3THl4bjhHS2N6K3AvMEJUOEIxU3lYK01OQ2wKY0pkMjVtMjhLajY2TGUxOEVyeFlJYXZJVGVGa3Y2eGZjdkEvcHladDdPaU41QTlGQk1IUmpQK1kyZ2tvdjMrcQpISFRUZG4xNnlRajduNit3YlFHNGVleXc0YisyQkRLcUxNVFU2ZmlSQ3ZPM2FPZVBLSFVNN3R4b1FidWl6Z3NzCkNiMzl3QnJOTEZsMkJLQ1RkSCtkSU9oZVJiSkZvbmlwOGRPOUVFZWdSSG9lQW54ZUlYTFBrdXMzTzEvZjRhNkIKWHQ3RG5BUm8xSzJmeEp3VXRaU2MvR3dFSjU5NzlnRXlEa3pDZEVsLzdpWE9QZXVjTXhlM2xVM2pweUtsNERUaApjSkJqQytqNGpLWTFrK1U4b040aGdqYnJISUx6Vnd2eU15OU5KS290U3BMSjQxeHdPOHlGangxalFTT3Bxc0N1ClFhUFUvTjhSZ0hxWjBGTkFzS3dNUmZ6WmdXanRCNzRzYUVEdk5jVmNuNFhCQnFNSG0ydHo2Uzk3d3kxZGt0cTgKSE5BPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg=="), - }}, - }, - ScopeMapID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myScopeMap"), - Status: to.Ptr(armcontainerregistry.TokenStatusDisabled), - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/TokenDelete.json -func ExampleTokensClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTokensClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myRegistry", - "myToken", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/TokenUpdate.json -func ExampleTokensClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewTokensClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "myResourceGroup", - "myRegistry", - "myToken", - armcontainerregistry.TokenUpdateParameters{ - Properties: &armcontainerregistry.TokenUpdateProperties{ - Credentials: &armcontainerregistry.TokenCredentialsProperties{ - Certificates: []*armcontainerregistry.TokenCertificate{ - { - Name: to.Ptr(armcontainerregistry.TokenCertificateNameCertificate1), - EncodedPemCertificate: to.Ptr("LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUc3akNDQk5hZ0F3SUJBZ0lURmdBQlR3UVpyZGdmdmhxdzBnQUFBQUZQQkRBTkJna3Foa2lHOXcwQkFRc0YKQURDQml6RUxNQWtHQTFVRUJoTUNWVk14RXpBUkJnTlZCQWdUQ2xkaGMyaHBibWQwYjI0eEVEQU9CZ05WQkFjVApCMUpsWkcxdmJtUXhIakFjQmdOVkJBb1RGVTFwWTNKdmMyOW1kQ0JEYjNKd2IzSmhkR2x2YmpFVk1CTUdBMVVFCkN4TU1UV2xqY205emIyWjBJRWxVTVI0d0hBWURWUVFERXhWTmFXTnliM052Wm5RZ1NWUWdWRXhUSUVOQklEUXcKSGhjTk1UZ3dOREV5TWpJek1qUTRXaGNOTWpBd05ERXlNakl6TWpRNFdqQTVNVGN3TlFZRFZRUURFeTV6WlhKMgphV05sWTJ4cFpXNTBZMlZ5ZEMxd1lYSjBibVZ5TG0xaGJtRm5aVzFsYm5RdVlYcDFjbVV1WTI5dE1JSUJJakFOCkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQTBSYjdJcHpxMmR4emhhbVpyS1ZDakMzeTQyYlYKUnNIY2pCUTFuSDBHZ1puUDhXeDZDSE1mWThybkVJQzRLeVRRYkJXVzhnNXlmc3NSQ0ZXbFpxYjR6SkRXS0pmTgpGSmNMUm9LNnhwTktZYVZVTkVlT25IdUxHYTM0ZlA0VjBFRjZybzdvbkRLME5zanhjY1dZVzRNVXVzc0xrQS94CkUrM2RwU1REdk1KcjJoWUpsVnFDcVR6blQvbmZaVUZzQUVEQnp5MUpOOHZiZDlIR2czc2Myd0x4dk95cFJOc0gKT1V3V2pmN2xzWWZleEVlcWkzY29EeHc2alpLVWEyVkdsUnBpTkowMjhBQitYSi9TU1FVNVBsd0JBbU9TT3ovRApGY0NKdGpPZlBqU1NKckFIQVV3SHU3RzlSV05JTFBwYU9zQ1J5eitETE5zNGpvNlEvUUg4d1lManJRSURBUUFCCm80SUNtakNDQXBZd0N3WURWUjBQQkFRREFnU3dNQjBHQTFVZEpRUVdNQlFHQ0NzR0FRVUZCd01DQmdnckJnRUYKQlFjREFUQWRCZ05WSFE0RUZnUVVlbEdkVVJrZzJoSFFOWEQ4WUc4L3drdjJVT0F3SHdZRFZSMGpCQmd3Rm9BVQplbnVNd2Mvbm9Nb2MxR3Y2KytFend3OGFvcDB3Z2F3R0ExVWRId1NCcERDQm9UQ0JucUNCbTZDQm1JWkxhSFIwCmNEb3ZMMjF6WTNKc0xtMXBZM0p2YzI5bWRDNWpiMjB2Y0d0cEwyMXpZMjl5Y0M5amNtd3ZUV2xqY205emIyWjAKSlRJd1NWUWxNakJVVEZNbE1qQkRRU1V5TURRdVkzSnNoa2xvZEhSd09pOHZZM0pzTG0xcFkzSnZjMjltZEM1agpiMjB2Y0d0cEwyMXpZMjl5Y0M5amNtd3ZUV2xqY205emIyWjBKVEl3U1ZRbE1qQlVURk1sTWpCRFFTVXlNRFF1ClkzSnNNSUdGQmdnckJnRUZCUWNCQVFSNU1IY3dVUVlJS3dZQkJRVUhNQUtHUldoMGRIQTZMeTkzZDNjdWJXbGoKY205emIyWjBMbU52YlM5d2Eya3ZiWE5qYjNKd0wwMXBZM0p2YzI5bWRDVXlNRWxVSlRJd1ZFeFRKVEl3UTBFbApNakEwTG1OeWREQWlCZ2dyQmdFRkJRY3dBWVlXYUhSMGNEb3ZMMjlqYzNBdWJYTnZZM053TG1OdmJUQStCZ2tyCkJnRUVBWUkzRlFjRU1UQXZCaWNyQmdFRUFZSTNGUWlIMm9aMWcrN1pBWUxKaFJ1QnRaNWhoZlRyWUlGZGhOTGYKUW9Mbmszb0NBV1FDQVIwd1RRWURWUjBnQkVZd1JEQkNCZ2tyQmdFRUFZSTNLZ0V3TlRBekJnZ3JCZ0VGQlFjQwpBUlluYUhSMGNEb3ZMM2QzZHk1dGFXTnliM052Wm5RdVkyOXRMM0JyYVM5dGMyTnZjbkF2WTNCek1DY0dDU3NHCkFRUUJnamNWQ2dRYU1CZ3dDZ1lJS3dZQkJRVUhBd0l3Q2dZSUt3WUJCUVVIQXdFd09RWURWUjBSQkRJd01JSXUKYzJWeWRtbGpaV05zYVdWdWRHTmxjblF0Y0dGeWRHNWxjaTV0WVc1aFoyVnRaVzUwTG1GNmRYSmxMbU52YlRBTgpCZ2txaGtpRzl3MEJBUXNGQUFPQ0FnRUFIVXIzbk1vdUI5WWdDUlRWYndUTllIS2RkWGJkSW1GUXNDYys4T1g1CjE5c0N6dFFSR05iSXEwVW1Ba01MbFVvWTIxckh4ZXdxU2hWczFhL2RwaFh5Tk1pcUdaU2QzU1BtYzZscitqUFQKNXVEREs0MUlWeXN0K2VUNlpyazFvcCtMVmdkeS9EU2lyNzVqcWZFY016bS82bU8rNnFNeWRLTWtVYmM5K3JHVwphUkpUcjRWUUdIRmEwNEIwZVZpNUd4MG9pL2RpZDNSaXg2aXJMMjFJSGEwYjN6c1hzZHpHU0R2K3hqL2Q2S0l4Ckdrd2FhYmZvU1NoQnFqaFNlQ0VyZXFlb1RpYjljdGw0MGRVdUp3THl4bjhHS2N6K3AvMEJUOEIxU3lYK01OQ2wKY0pkMjVtMjhLajY2TGUxOEVyeFlJYXZJVGVGa3Y2eGZjdkEvcHladDdPaU41QTlGQk1IUmpQK1kyZ2tvdjMrcQpISFRUZG4xNnlRajduNit3YlFHNGVleXc0YisyQkRLcUxNVFU2ZmlSQ3ZPM2FPZVBLSFVNN3R4b1FidWl6Z3NzCkNiMzl3QnJOTEZsMkJLQ1RkSCtkSU9oZVJiSkZvbmlwOGRPOUVFZWdSSG9lQW54ZUlYTFBrdXMzTzEvZjRhNkIKWHQ3RG5BUm8xSzJmeEp3VXRaU2MvR3dFSjU5NzlnRXlEa3pDZEVsLzdpWE9QZXVjTXhlM2xVM2pweUtsNERUaApjSkJqQytqNGpLWTFrK1U4b040aGdqYnJISUx6Vnd2eU15OU5KS290U3BMSjQxeHdPOHlGangxalFTT3Bxc0N1ClFhUFUvTjhSZ0hxWjBGTkFzS3dNUmZ6WmdXanRCNzRzYUVEdk5jVmNuNFhCQnFNSG0ydHo2Uzk3d3kxZGt0cTgKSE5BPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg=="), - }}, - }, - ScopeMapID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myNewScopeMap"), - }, - }, - 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/containerregistry/armcontainerregistry/ze_generated_example_webhooks_client_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_webhooks_client_test.go deleted file mode 100644 index e891d32aee84..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/ze_generated_example_webhooks_client_test.go +++ /dev/null @@ -1,250 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/WebhookList.json -func ExampleWebhooksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewWebhooksClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myRegistry", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/WebhookGet.json -func ExampleWebhooksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewWebhooksClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myRegistry", - "myWebhook", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/WebhookCreate.json -func ExampleWebhooksClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewWebhooksClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "myResourceGroup", - "myRegistry", - "myWebhook", - armcontainerregistry.WebhookCreateParameters{ - Location: to.Ptr("westus"), - Properties: &armcontainerregistry.WebhookPropertiesCreateParameters{ - Actions: []*armcontainerregistry.WebhookAction{ - to.Ptr(armcontainerregistry.WebhookActionPush)}, - CustomHeaders: map[string]*string{ - "Authorization": to.Ptr("Basic 000000000000000000000000000000000000000000000000000"), - }, - Scope: to.Ptr("myRepository"), - ServiceURI: to.Ptr("http://myservice.com"), - Status: to.Ptr(armcontainerregistry.WebhookStatusEnabled), - }, - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/WebhookDelete.json -func ExampleWebhooksClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewWebhooksClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myRegistry", - "myWebhook", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/WebhookUpdate.json -func ExampleWebhooksClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewWebhooksClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "myResourceGroup", - "myRegistry", - "myWebhook", - armcontainerregistry.WebhookUpdateParameters{ - Properties: &armcontainerregistry.WebhookPropertiesUpdateParameters{ - Actions: []*armcontainerregistry.WebhookAction{ - to.Ptr(armcontainerregistry.WebhookActionPush)}, - CustomHeaders: map[string]*string{ - "Authorization": to.Ptr("Basic 000000000000000000000000000000000000000000000000000"), - }, - Scope: to.Ptr("myRepository"), - ServiceURI: to.Ptr("http://myservice.com"), - Status: to.Ptr(armcontainerregistry.WebhookStatusEnabled), - }, - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - }, - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/WebhookPing.json -func ExampleWebhooksClient_Ping() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewWebhooksClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Ping(ctx, - "myResourceGroup", - "myRegistry", - "myWebhook", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/WebhookListEvents.json -func ExampleWebhooksClient_NewListEventsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewWebhooksClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListEventsPager("myResourceGroup", - "myRegistry", - "myWebhook", - 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/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2022-02-01-preview/examples/WebhookGetCallbackConfig.json -func ExampleWebhooksClient_GetCallbackConfig() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerregistry.NewWebhooksClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetCallbackConfig(ctx, - "myResourceGroup", - "myRegistry", - "myWebhook", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_models_serde.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_models_serde.go deleted file mode 100644 index f4c23e43d69f..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_models_serde.go +++ /dev/null @@ -1,2136 +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 armcontainerregistry - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AgentPool. -func (a AgentPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AgentPoolUpdateParameters. -func (a AgentPoolUpdateParameters) 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 ConnectedRegistryProperties. -func (c ConnectedRegistryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "activation", c.Activation) - populate(objectMap, "clientTokenIds", c.ClientTokenIDs) - populate(objectMap, "connectionState", c.ConnectionState) - populateTimeRFC3339(objectMap, "lastActivityTime", c.LastActivityTime) - populate(objectMap, "logging", c.Logging) - populate(objectMap, "loginServer", c.LoginServer) - populate(objectMap, "mode", c.Mode) - populate(objectMap, "notificationsList", c.NotificationsList) - populate(objectMap, "parent", c.Parent) - populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "statusDetails", c.StatusDetails) - populate(objectMap, "version", c.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedRegistryProperties. -func (c *ConnectedRegistryProperties) 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 "activation": - err = unpopulate(val, "Activation", &c.Activation) - delete(rawMsg, key) - case "clientTokenIds": - err = unpopulate(val, "ClientTokenIDs", &c.ClientTokenIDs) - delete(rawMsg, key) - case "connectionState": - err = unpopulate(val, "ConnectionState", &c.ConnectionState) - delete(rawMsg, key) - case "lastActivityTime": - err = unpopulateTimeRFC3339(val, "LastActivityTime", &c.LastActivityTime) - delete(rawMsg, key) - case "logging": - err = unpopulate(val, "Logging", &c.Logging) - delete(rawMsg, key) - case "loginServer": - err = unpopulate(val, "LoginServer", &c.LoginServer) - delete(rawMsg, key) - case "mode": - err = unpopulate(val, "Mode", &c.Mode) - delete(rawMsg, key) - case "notificationsList": - err = unpopulate(val, "NotificationsList", &c.NotificationsList) - delete(rawMsg, key) - case "parent": - err = unpopulate(val, "Parent", &c.Parent) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) - delete(rawMsg, key) - case "statusDetails": - err = unpopulate(val, "StatusDetails", &c.StatusDetails) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &c.Version) - 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 ConnectedRegistryUpdateParameters. -func (c ConnectedRegistryUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", c.Properties) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectedRegistryUpdateProperties. -func (c ConnectedRegistryUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "clientTokenIds", c.ClientTokenIDs) - populate(objectMap, "logging", c.Logging) - populate(objectMap, "notificationsList", c.NotificationsList) - populate(objectMap, "syncProperties", c.SyncProperties) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Credentials. -func (c Credentials) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "customRegistries", c.CustomRegistries) - populate(objectMap, "sourceRegistry", c.SourceRegistry) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DockerBuildRequest. -func (d DockerBuildRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "agentConfiguration", d.AgentConfiguration) - populate(objectMap, "agentPoolName", d.AgentPoolName) - populate(objectMap, "arguments", d.Arguments) - populate(objectMap, "credentials", d.Credentials) - populate(objectMap, "dockerFilePath", d.DockerFilePath) - populate(objectMap, "imageNames", d.ImageNames) - populate(objectMap, "isArchiveEnabled", d.IsArchiveEnabled) - populate(objectMap, "isPushEnabled", d.IsPushEnabled) - populate(objectMap, "logTemplate", d.LogTemplate) - populate(objectMap, "noCache", d.NoCache) - populate(objectMap, "platform", d.Platform) - populate(objectMap, "sourceLocation", d.SourceLocation) - populate(objectMap, "target", d.Target) - populate(objectMap, "timeout", d.Timeout) - objectMap["type"] = "DockerBuildRequest" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DockerBuildRequest. -func (d *DockerBuildRequest) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "agentConfiguration": - err = unpopulate(val, "AgentConfiguration", &d.AgentConfiguration) - delete(rawMsg, key) - case "agentPoolName": - err = unpopulate(val, "AgentPoolName", &d.AgentPoolName) - delete(rawMsg, key) - case "arguments": - err = unpopulate(val, "Arguments", &d.Arguments) - delete(rawMsg, key) - case "credentials": - err = unpopulate(val, "Credentials", &d.Credentials) - delete(rawMsg, key) - case "dockerFilePath": - err = unpopulate(val, "DockerFilePath", &d.DockerFilePath) - delete(rawMsg, key) - case "imageNames": - err = unpopulate(val, "ImageNames", &d.ImageNames) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &d.IsArchiveEnabled) - delete(rawMsg, key) - case "isPushEnabled": - err = unpopulate(val, "IsPushEnabled", &d.IsPushEnabled) - delete(rawMsg, key) - case "logTemplate": - err = unpopulate(val, "LogTemplate", &d.LogTemplate) - delete(rawMsg, key) - case "noCache": - err = unpopulate(val, "NoCache", &d.NoCache) - delete(rawMsg, key) - case "platform": - err = unpopulate(val, "Platform", &d.Platform) - delete(rawMsg, key) - case "sourceLocation": - err = unpopulate(val, "SourceLocation", &d.SourceLocation) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &d.Target) - delete(rawMsg, key) - case "timeout": - err = unpopulate(val, "Timeout", &d.Timeout) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DockerBuildStep. -func (d DockerBuildStep) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "arguments", d.Arguments) - populate(objectMap, "baseImageDependencies", d.BaseImageDependencies) - populate(objectMap, "contextAccessToken", d.ContextAccessToken) - populate(objectMap, "contextPath", d.ContextPath) - populate(objectMap, "dockerFilePath", d.DockerFilePath) - populate(objectMap, "imageNames", d.ImageNames) - populate(objectMap, "isPushEnabled", d.IsPushEnabled) - populate(objectMap, "noCache", d.NoCache) - populate(objectMap, "target", d.Target) - objectMap["type"] = StepTypeDocker - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DockerBuildStep. -func (d *DockerBuildStep) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "arguments": - err = unpopulate(val, "Arguments", &d.Arguments) - delete(rawMsg, key) - case "baseImageDependencies": - err = unpopulate(val, "BaseImageDependencies", &d.BaseImageDependencies) - delete(rawMsg, key) - case "contextAccessToken": - err = unpopulate(val, "ContextAccessToken", &d.ContextAccessToken) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &d.ContextPath) - delete(rawMsg, key) - case "dockerFilePath": - err = unpopulate(val, "DockerFilePath", &d.DockerFilePath) - delete(rawMsg, key) - case "imageNames": - err = unpopulate(val, "ImageNames", &d.ImageNames) - delete(rawMsg, key) - case "isPushEnabled": - err = unpopulate(val, "IsPushEnabled", &d.IsPushEnabled) - delete(rawMsg, key) - case "noCache": - err = unpopulate(val, "NoCache", &d.NoCache) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &d.Target) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DockerBuildStepUpdateParameters. -func (d DockerBuildStepUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "arguments", d.Arguments) - populate(objectMap, "contextAccessToken", d.ContextAccessToken) - populate(objectMap, "contextPath", d.ContextPath) - populate(objectMap, "dockerFilePath", d.DockerFilePath) - populate(objectMap, "imageNames", d.ImageNames) - populate(objectMap, "isPushEnabled", d.IsPushEnabled) - populate(objectMap, "noCache", d.NoCache) - populate(objectMap, "target", d.Target) - objectMap["type"] = StepTypeDocker - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DockerBuildStepUpdateParameters. -func (d *DockerBuildStepUpdateParameters) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "arguments": - err = unpopulate(val, "Arguments", &d.Arguments) - delete(rawMsg, key) - case "contextAccessToken": - err = unpopulate(val, "ContextAccessToken", &d.ContextAccessToken) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &d.ContextPath) - delete(rawMsg, key) - case "dockerFilePath": - err = unpopulate(val, "DockerFilePath", &d.DockerFilePath) - delete(rawMsg, key) - case "imageNames": - err = unpopulate(val, "ImageNames", &d.ImageNames) - delete(rawMsg, key) - case "isPushEnabled": - err = unpopulate(val, "IsPushEnabled", &d.IsPushEnabled) - delete(rawMsg, key) - case "noCache": - err = unpopulate(val, "NoCache", &d.NoCache) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &d.Target) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EncodedTaskRunRequest. -func (e EncodedTaskRunRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "agentConfiguration", e.AgentConfiguration) - populate(objectMap, "agentPoolName", e.AgentPoolName) - populate(objectMap, "credentials", e.Credentials) - populate(objectMap, "encodedTaskContent", e.EncodedTaskContent) - populate(objectMap, "encodedValuesContent", e.EncodedValuesContent) - populate(objectMap, "isArchiveEnabled", e.IsArchiveEnabled) - populate(objectMap, "logTemplate", e.LogTemplate) - populate(objectMap, "platform", e.Platform) - populate(objectMap, "sourceLocation", e.SourceLocation) - populate(objectMap, "timeout", e.Timeout) - objectMap["type"] = "EncodedTaskRunRequest" - populate(objectMap, "values", e.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EncodedTaskRunRequest. -func (e *EncodedTaskRunRequest) 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 "agentConfiguration": - err = unpopulate(val, "AgentConfiguration", &e.AgentConfiguration) - delete(rawMsg, key) - case "agentPoolName": - err = unpopulate(val, "AgentPoolName", &e.AgentPoolName) - delete(rawMsg, key) - case "credentials": - err = unpopulate(val, "Credentials", &e.Credentials) - delete(rawMsg, key) - case "encodedTaskContent": - err = unpopulate(val, "EncodedTaskContent", &e.EncodedTaskContent) - delete(rawMsg, key) - case "encodedValuesContent": - err = unpopulate(val, "EncodedValuesContent", &e.EncodedValuesContent) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &e.IsArchiveEnabled) - delete(rawMsg, key) - case "logTemplate": - err = unpopulate(val, "LogTemplate", &e.LogTemplate) - delete(rawMsg, key) - case "platform": - err = unpopulate(val, "Platform", &e.Platform) - delete(rawMsg, key) - case "sourceLocation": - err = unpopulate(val, "SourceLocation", &e.SourceLocation) - delete(rawMsg, key) - case "timeout": - err = unpopulate(val, "Timeout", &e.Timeout) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &e.Values) - 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 EncodedTaskStep. -func (e EncodedTaskStep) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "baseImageDependencies", e.BaseImageDependencies) - populate(objectMap, "contextAccessToken", e.ContextAccessToken) - populate(objectMap, "contextPath", e.ContextPath) - populate(objectMap, "encodedTaskContent", e.EncodedTaskContent) - populate(objectMap, "encodedValuesContent", e.EncodedValuesContent) - objectMap["type"] = StepTypeEncodedTask - populate(objectMap, "values", e.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EncodedTaskStep. -func (e *EncodedTaskStep) 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 "baseImageDependencies": - err = unpopulate(val, "BaseImageDependencies", &e.BaseImageDependencies) - delete(rawMsg, key) - case "contextAccessToken": - err = unpopulate(val, "ContextAccessToken", &e.ContextAccessToken) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &e.ContextPath) - delete(rawMsg, key) - case "encodedTaskContent": - err = unpopulate(val, "EncodedTaskContent", &e.EncodedTaskContent) - delete(rawMsg, key) - case "encodedValuesContent": - err = unpopulate(val, "EncodedValuesContent", &e.EncodedValuesContent) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &e.Values) - 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 EncodedTaskStepUpdateParameters. -func (e EncodedTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "contextAccessToken", e.ContextAccessToken) - populate(objectMap, "contextPath", e.ContextPath) - populate(objectMap, "encodedTaskContent", e.EncodedTaskContent) - populate(objectMap, "encodedValuesContent", e.EncodedValuesContent) - objectMap["type"] = StepTypeEncodedTask - populate(objectMap, "values", e.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EncodedTaskStepUpdateParameters. -func (e *EncodedTaskStepUpdateParameters) 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 "contextAccessToken": - err = unpopulate(val, "ContextAccessToken", &e.ContextAccessToken) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &e.ContextPath) - delete(rawMsg, key) - case "encodedTaskContent": - err = unpopulate(val, "EncodedTaskContent", &e.EncodedTaskContent) - delete(rawMsg, key) - case "encodedValuesContent": - err = unpopulate(val, "EncodedValuesContent", &e.EncodedValuesContent) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &e.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventContent. -func (e *EventContent) 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 "action": - err = unpopulate(val, "Action", &e.Action) - delete(rawMsg, key) - case "actor": - err = unpopulate(val, "Actor", &e.Actor) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "request": - err = unpopulate(val, "Request", &e.Request) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &e.Source) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) - delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &e.Timestamp) - 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 ExportPipelineProperties. -func (e ExportPipelineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "options", e.Options) - populate(objectMap, "provisioningState", e.ProvisioningState) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type FileTaskRunRequest. -func (f FileTaskRunRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "agentConfiguration", f.AgentConfiguration) - populate(objectMap, "agentPoolName", f.AgentPoolName) - populate(objectMap, "credentials", f.Credentials) - populate(objectMap, "isArchiveEnabled", f.IsArchiveEnabled) - populate(objectMap, "logTemplate", f.LogTemplate) - populate(objectMap, "platform", f.Platform) - populate(objectMap, "sourceLocation", f.SourceLocation) - populate(objectMap, "taskFilePath", f.TaskFilePath) - populate(objectMap, "timeout", f.Timeout) - objectMap["type"] = "FileTaskRunRequest" - populate(objectMap, "values", f.Values) - populate(objectMap, "valuesFilePath", f.ValuesFilePath) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FileTaskRunRequest. -func (f *FileTaskRunRequest) 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", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "agentConfiguration": - err = unpopulate(val, "AgentConfiguration", &f.AgentConfiguration) - delete(rawMsg, key) - case "agentPoolName": - err = unpopulate(val, "AgentPoolName", &f.AgentPoolName) - delete(rawMsg, key) - case "credentials": - err = unpopulate(val, "Credentials", &f.Credentials) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &f.IsArchiveEnabled) - delete(rawMsg, key) - case "logTemplate": - err = unpopulate(val, "LogTemplate", &f.LogTemplate) - delete(rawMsg, key) - case "platform": - err = unpopulate(val, "Platform", &f.Platform) - delete(rawMsg, key) - case "sourceLocation": - err = unpopulate(val, "SourceLocation", &f.SourceLocation) - delete(rawMsg, key) - case "taskFilePath": - err = unpopulate(val, "TaskFilePath", &f.TaskFilePath) - delete(rawMsg, key) - case "timeout": - err = unpopulate(val, "Timeout", &f.Timeout) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &f.Type) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &f.Values) - delete(rawMsg, key) - case "valuesFilePath": - err = unpopulate(val, "ValuesFilePath", &f.ValuesFilePath) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FileTaskStep. -func (f FileTaskStep) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "baseImageDependencies", f.BaseImageDependencies) - populate(objectMap, "contextAccessToken", f.ContextAccessToken) - populate(objectMap, "contextPath", f.ContextPath) - populate(objectMap, "taskFilePath", f.TaskFilePath) - objectMap["type"] = StepTypeFileTask - populate(objectMap, "values", f.Values) - populate(objectMap, "valuesFilePath", f.ValuesFilePath) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FileTaskStep. -func (f *FileTaskStep) 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", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "baseImageDependencies": - err = unpopulate(val, "BaseImageDependencies", &f.BaseImageDependencies) - delete(rawMsg, key) - case "contextAccessToken": - err = unpopulate(val, "ContextAccessToken", &f.ContextAccessToken) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &f.ContextPath) - delete(rawMsg, key) - case "taskFilePath": - err = unpopulate(val, "TaskFilePath", &f.TaskFilePath) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &f.Type) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &f.Values) - delete(rawMsg, key) - case "valuesFilePath": - err = unpopulate(val, "ValuesFilePath", &f.ValuesFilePath) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FileTaskStepUpdateParameters. -func (f FileTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "contextAccessToken", f.ContextAccessToken) - populate(objectMap, "contextPath", f.ContextPath) - populate(objectMap, "taskFilePath", f.TaskFilePath) - objectMap["type"] = StepTypeFileTask - populate(objectMap, "values", f.Values) - populate(objectMap, "valuesFilePath", f.ValuesFilePath) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FileTaskStepUpdateParameters. -func (f *FileTaskStepUpdateParameters) 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", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "contextAccessToken": - err = unpopulate(val, "ContextAccessToken", &f.ContextAccessToken) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &f.ContextPath) - delete(rawMsg, key) - case "taskFilePath": - err = unpopulate(val, "TaskFilePath", &f.TaskFilePath) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &f.Type) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &f.Values) - delete(rawMsg, key) - case "valuesFilePath": - err = unpopulate(val, "ValuesFilePath", &f.ValuesFilePath) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GenerateCredentialsParameters. -func (g GenerateCredentialsParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "expiry", g.Expiry) - populate(objectMap, "name", g.Name) - populate(objectMap, "tokenId", g.TokenID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateCredentialsParameters. -func (g *GenerateCredentialsParameters) 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", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "expiry": - err = unpopulateTimeRFC3339(val, "Expiry", &g.Expiry) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) - delete(rawMsg, key) - case "tokenId": - err = unpopulate(val, "TokenID", &g.TokenID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IdentityProperties. -func (i IdentityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - populate(objectMap, "type", i.Type) - populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ImageUpdateTrigger. -func (i ImageUpdateTrigger) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", i.ID) - populate(objectMap, "images", i.Images) - populateTimeRFC3339(objectMap, "timestamp", i.Timestamp) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageUpdateTrigger. -func (i *ImageUpdateTrigger) 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", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "images": - err = unpopulate(val, "Images", &i.Images) - delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &i.Timestamp) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ImportImageParameters. -func (i ImportImageParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "mode", i.Mode) - populate(objectMap, "source", i.Source) - populate(objectMap, "targetTags", i.TargetTags) - populate(objectMap, "untaggedTargetRepositories", i.UntaggedTargetRepositories) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ImportPipelineProperties. -func (i ImportPipelineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "options", i.Options) - populate(objectMap, "provisioningState", i.ProvisioningState) - populate(objectMap, "source", i.Source) - populate(objectMap, "trigger", i.Trigger) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type KeyVaultProperties. -func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", k.Identity) - populate(objectMap, "keyIdentifier", k.KeyIdentifier) - populate(objectMap, "keyRotationEnabled", k.KeyRotationEnabled) - populateTimeRFC3339(objectMap, "lastKeyRotationTimestamp", k.LastKeyRotationTimestamp) - populate(objectMap, "versionedKeyIdentifier", k.VersionedKeyIdentifier) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties. -func (k *KeyVaultProperties) 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", k, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "identity": - err = unpopulate(val, "Identity", &k.Identity) - delete(rawMsg, key) - case "keyIdentifier": - err = unpopulate(val, "KeyIdentifier", &k.KeyIdentifier) - delete(rawMsg, key) - case "keyRotationEnabled": - err = unpopulate(val, "KeyRotationEnabled", &k.KeyRotationEnabled) - delete(rawMsg, key) - case "lastKeyRotationTimestamp": - err = unpopulateTimeRFC3339(val, "LastKeyRotationTimestamp", &k.LastKeyRotationTimestamp) - delete(rawMsg, key) - case "versionedKeyIdentifier": - err = unpopulate(val, "VersionedKeyIdentifier", &k.VersionedKeyIdentifier) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. -func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "defaultAction", n.DefaultAction) - populate(objectMap, "ipRules", n.IPRules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type OverrideTaskStepProperties. -func (o OverrideTaskStepProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "arguments", o.Arguments) - populate(objectMap, "contextPath", o.ContextPath) - populate(objectMap, "file", o.File) - populate(objectMap, "target", o.Target) - populate(objectMap, "updateTriggerToken", o.UpdateTriggerToken) - populate(objectMap, "values", o.Values) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRunRequest. -func (p PipelineRunRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "artifacts", p.Artifacts) - populate(objectMap, "catalogDigest", p.CatalogDigest) - populate(objectMap, "pipelineResourceId", p.PipelineResourceID) - populate(objectMap, "source", p.Source) - populate(objectMap, "target", p.Target) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRunResponse. -func (p PipelineRunResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "catalogDigest", p.CatalogDigest) - populateTimeRFC3339(objectMap, "finishTime", p.FinishTime) - populate(objectMap, "importedArtifacts", p.ImportedArtifacts) - populate(objectMap, "pipelineRunErrorMessage", p.PipelineRunErrorMessage) - populate(objectMap, "progress", p.Progress) - populate(objectMap, "source", p.Source) - populateTimeRFC3339(objectMap, "startTime", p.StartTime) - populate(objectMap, "status", p.Status) - populate(objectMap, "target", p.Target) - populate(objectMap, "trigger", p.Trigger) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunResponse. -func (p *PipelineRunResponse) 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 "catalogDigest": - err = unpopulate(val, "CatalogDigest", &p.CatalogDigest) - delete(rawMsg, key) - case "finishTime": - err = unpopulateTimeRFC3339(val, "FinishTime", &p.FinishTime) - delete(rawMsg, key) - case "importedArtifacts": - err = unpopulate(val, "ImportedArtifacts", &p.ImportedArtifacts) - delete(rawMsg, key) - case "pipelineRunErrorMessage": - err = unpopulate(val, "PipelineRunErrorMessage", &p.PipelineRunErrorMessage) - delete(rawMsg, key) - case "progress": - err = unpopulate(val, "Progress", &p.Progress) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &p.Source) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &p.Target) - delete(rawMsg, key) - case "trigger": - err = unpopulate(val, "Trigger", &p.Trigger) - 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 PipelineSourceTriggerDescriptor. -func (p PipelineSourceTriggerDescriptor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "timestamp", p.Timestamp) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineSourceTriggerDescriptor. -func (p *PipelineSourceTriggerDescriptor) 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 "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &p.Timestamp) - 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 Registry. -func (r Registry) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "identity", r.Identity) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "sku", r.SKU) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RegistryProperties. -func (r RegistryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "adminUserEnabled", r.AdminUserEnabled) - populate(objectMap, "anonymousPullEnabled", r.AnonymousPullEnabled) - populateTimeRFC3339(objectMap, "creationDate", r.CreationDate) - populate(objectMap, "dataEndpointEnabled", r.DataEndpointEnabled) - populate(objectMap, "dataEndpointHostNames", r.DataEndpointHostNames) - populate(objectMap, "encryption", r.Encryption) - populate(objectMap, "loginServer", r.LoginServer) - populate(objectMap, "networkRuleBypassOptions", r.NetworkRuleBypassOptions) - populate(objectMap, "networkRuleSet", r.NetworkRuleSet) - populate(objectMap, "policies", r.Policies) - populate(objectMap, "privateEndpointConnections", r.PrivateEndpointConnections) - populate(objectMap, "provisioningState", r.ProvisioningState) - populate(objectMap, "publicNetworkAccess", r.PublicNetworkAccess) - populate(objectMap, "status", r.Status) - populate(objectMap, "zoneRedundancy", r.ZoneRedundancy) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryProperties. -func (r *RegistryProperties) 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 "adminUserEnabled": - err = unpopulate(val, "AdminUserEnabled", &r.AdminUserEnabled) - delete(rawMsg, key) - case "anonymousPullEnabled": - err = unpopulate(val, "AnonymousPullEnabled", &r.AnonymousPullEnabled) - delete(rawMsg, key) - case "creationDate": - err = unpopulateTimeRFC3339(val, "CreationDate", &r.CreationDate) - delete(rawMsg, key) - case "dataEndpointEnabled": - err = unpopulate(val, "DataEndpointEnabled", &r.DataEndpointEnabled) - delete(rawMsg, key) - case "dataEndpointHostNames": - err = unpopulate(val, "DataEndpointHostNames", &r.DataEndpointHostNames) - delete(rawMsg, key) - case "encryption": - err = unpopulate(val, "Encryption", &r.Encryption) - delete(rawMsg, key) - case "loginServer": - err = unpopulate(val, "LoginServer", &r.LoginServer) - delete(rawMsg, key) - case "networkRuleBypassOptions": - err = unpopulate(val, "NetworkRuleBypassOptions", &r.NetworkRuleBypassOptions) - delete(rawMsg, key) - case "networkRuleSet": - err = unpopulate(val, "NetworkRuleSet", &r.NetworkRuleSet) - delete(rawMsg, key) - case "policies": - err = unpopulate(val, "Policies", &r.Policies) - delete(rawMsg, key) - case "privateEndpointConnections": - err = unpopulate(val, "PrivateEndpointConnections", &r.PrivateEndpointConnections) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &r.PublicNetworkAccess) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "zoneRedundancy": - err = unpopulate(val, "ZoneRedundancy", &r.ZoneRedundancy) - 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 RegistryUpdateParameters. -func (r RegistryUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", r.Identity) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "sku", r.SKU) - populate(objectMap, "tags", r.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Replication. -func (r Replication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ReplicationUpdateParameters. -func (r ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "tags", r.Tags) - return json.Marshal(objectMap) -} - -// 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, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RetentionPolicy. -func (r RetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "days", r.Days) - populateTimeRFC3339(objectMap, "lastUpdatedTime", r.LastUpdatedTime) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RetentionPolicy. -func (r *RetentionPolicy) 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 "days": - err = unpopulate(val, "Days", &r.Days) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &r.LastUpdatedTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RunFilter. -func (r *RunFilter) 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 "agentPoolName": - err = unpopulate(val, "AgentPoolName", &r.AgentPoolName) - delete(rawMsg, key) - case "createTime": - err = unpopulateTimeRFC3339(val, "CreateTime", &r.CreateTime) - delete(rawMsg, key) - case "finishTime": - err = unpopulateTimeRFC3339(val, "FinishTime", &r.FinishTime) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &r.IsArchiveEnabled) - delete(rawMsg, key) - case "outputImageManifests": - err = unpopulate(val, "OutputImageManifests", &r.OutputImageManifests) - delete(rawMsg, key) - case "runId": - err = unpopulate(val, "RunID", &r.RunID) - delete(rawMsg, key) - case "runType": - err = unpopulate(val, "RunType", &r.RunType) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "taskName": - err = unpopulate(val, "TaskName", &r.TaskName) - 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 RunProperties. -func (r RunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "agentConfiguration", r.AgentConfiguration) - populate(objectMap, "agentPoolName", r.AgentPoolName) - populateTimeRFC3339(objectMap, "createTime", r.CreateTime) - populate(objectMap, "customRegistries", r.CustomRegistries) - populateTimeRFC3339(objectMap, "finishTime", r.FinishTime) - populate(objectMap, "imageUpdateTrigger", r.ImageUpdateTrigger) - populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) - populateTimeRFC3339(objectMap, "lastUpdatedTime", r.LastUpdatedTime) - populate(objectMap, "logArtifact", r.LogArtifact) - populate(objectMap, "outputImages", r.OutputImages) - populate(objectMap, "platform", r.Platform) - populate(objectMap, "provisioningState", r.ProvisioningState) - populate(objectMap, "runErrorMessage", r.RunErrorMessage) - populate(objectMap, "runId", r.RunID) - populate(objectMap, "runType", r.RunType) - populate(objectMap, "sourceRegistryAuth", r.SourceRegistryAuth) - populate(objectMap, "sourceTrigger", r.SourceTrigger) - populateTimeRFC3339(objectMap, "startTime", r.StartTime) - populate(objectMap, "status", r.Status) - populate(objectMap, "task", r.Task) - populate(objectMap, "timerTrigger", r.TimerTrigger) - populate(objectMap, "updateTriggerToken", r.UpdateTriggerToken) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RunProperties. -func (r *RunProperties) 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 "agentConfiguration": - err = unpopulate(val, "AgentConfiguration", &r.AgentConfiguration) - delete(rawMsg, key) - case "agentPoolName": - err = unpopulate(val, "AgentPoolName", &r.AgentPoolName) - delete(rawMsg, key) - case "createTime": - err = unpopulateTimeRFC3339(val, "CreateTime", &r.CreateTime) - delete(rawMsg, key) - case "customRegistries": - err = unpopulate(val, "CustomRegistries", &r.CustomRegistries) - delete(rawMsg, key) - case "finishTime": - err = unpopulateTimeRFC3339(val, "FinishTime", &r.FinishTime) - delete(rawMsg, key) - case "imageUpdateTrigger": - err = unpopulate(val, "ImageUpdateTrigger", &r.ImageUpdateTrigger) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &r.IsArchiveEnabled) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &r.LastUpdatedTime) - delete(rawMsg, key) - case "logArtifact": - err = unpopulate(val, "LogArtifact", &r.LogArtifact) - delete(rawMsg, key) - case "outputImages": - err = unpopulate(val, "OutputImages", &r.OutputImages) - delete(rawMsg, key) - case "platform": - err = unpopulate(val, "Platform", &r.Platform) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) - delete(rawMsg, key) - case "runErrorMessage": - err = unpopulate(val, "RunErrorMessage", &r.RunErrorMessage) - delete(rawMsg, key) - case "runId": - err = unpopulate(val, "RunID", &r.RunID) - delete(rawMsg, key) - case "runType": - err = unpopulate(val, "RunType", &r.RunType) - delete(rawMsg, key) - case "sourceRegistryAuth": - err = unpopulate(val, "SourceRegistryAuth", &r.SourceRegistryAuth) - delete(rawMsg, key) - case "sourceTrigger": - err = unpopulate(val, "SourceTrigger", &r.SourceTrigger) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &r.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "task": - err = unpopulate(val, "Task", &r.Task) - delete(rawMsg, key) - case "timerTrigger": - err = unpopulate(val, "TimerTrigger", &r.TimerTrigger) - delete(rawMsg, key) - case "updateTriggerToken": - err = unpopulate(val, "UpdateTriggerToken", &r.UpdateTriggerToken) - 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 RunUpdateParameters. -func (r RunUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ScopeMapProperties. -func (s ScopeMapProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actions", s.Actions) - populateTimeRFC3339(objectMap, "creationDate", s.CreationDate) - populate(objectMap, "description", s.Description) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMapProperties. -func (s *ScopeMapProperties) 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 "actions": - err = unpopulate(val, "Actions", &s.Actions) - delete(rawMsg, key) - case "creationDate": - err = unpopulateTimeRFC3339(val, "CreationDate", &s.CreationDate) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) - 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 ScopeMapPropertiesUpdateParameters. -func (s ScopeMapPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actions", s.Actions) - populate(objectMap, "description", s.Description) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ScopeMapUpdateParameters. -func (s ScopeMapUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", s.Properties) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SoftDeletePolicy. -func (s SoftDeletePolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "lastUpdatedTime", s.LastUpdatedTime) - populate(objectMap, "retentionDays", s.RetentionDays) - populate(objectMap, "status", s.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SoftDeletePolicy. -func (s *SoftDeletePolicy) 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 "lastUpdatedTime": - err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &s.LastUpdatedTime) - delete(rawMsg, key) - case "retentionDays": - err = unpopulate(val, "RetentionDays", &s.RetentionDays) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) - 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 SourceTrigger. -func (s SourceTrigger) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", s.Name) - populate(objectMap, "sourceRepository", s.SourceRepository) - populate(objectMap, "sourceTriggerEvents", s.SourceTriggerEvents) - populate(objectMap, "status", s.Status) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SourceTriggerUpdateParameters. -func (s SourceTriggerUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", s.Name) - populate(objectMap, "sourceRepository", s.SourceRepository) - populate(objectMap, "sourceTriggerEvents", s.SourceTriggerEvents) - populate(objectMap, "status", s.Status) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Status. -func (s Status) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayStatus", s.DisplayStatus) - populate(objectMap, "message", s.Message) - populateTimeRFC3339(objectMap, "timestamp", s.Timestamp) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Status. -func (s *Status) 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 "displayStatus": - err = unpopulate(val, "DisplayStatus", &s.DisplayStatus) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &s.Message) - delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &s.Timestamp) - 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 StatusDetailProperties. -func (s StatusDetailProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", s.Code) - populate(objectMap, "correlationId", s.CorrelationID) - populate(objectMap, "description", s.Description) - populateTimeRFC3339(objectMap, "timestamp", s.Timestamp) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StatusDetailProperties. -func (s *StatusDetailProperties) 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 "code": - err = unpopulate(val, "Code", &s.Code) - delete(rawMsg, key) - case "correlationId": - err = unpopulate(val, "CorrelationID", &s.CorrelationID) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) - delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &s.Timestamp) - 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 SyncProperties. -func (s SyncProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "gatewayEndpoint", s.GatewayEndpoint) - populateTimeRFC3339(objectMap, "lastSyncTime", s.LastSyncTime) - populate(objectMap, "messageTtl", s.MessageTTL) - populate(objectMap, "schedule", s.Schedule) - populate(objectMap, "syncWindow", s.SyncWindow) - populate(objectMap, "tokenId", s.TokenID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncProperties. -func (s *SyncProperties) 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 "gatewayEndpoint": - err = unpopulate(val, "GatewayEndpoint", &s.GatewayEndpoint) - delete(rawMsg, key) - case "lastSyncTime": - err = unpopulateTimeRFC3339(val, "LastSyncTime", &s.LastSyncTime) - delete(rawMsg, key) - case "messageTtl": - err = unpopulate(val, "MessageTTL", &s.MessageTTL) - delete(rawMsg, key) - case "schedule": - err = unpopulate(val, "Schedule", &s.Schedule) - delete(rawMsg, key) - case "syncWindow": - err = unpopulate(val, "SyncWindow", &s.SyncWindow) - delete(rawMsg, key) - case "tokenId": - err = unpopulate(val, "TokenID", &s.TokenID) - 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 Task. -func (t Task) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "identity", t.Identity) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TaskProperties. -func (t TaskProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "agentConfiguration", t.AgentConfiguration) - populate(objectMap, "agentPoolName", t.AgentPoolName) - populateTimeRFC3339(objectMap, "creationDate", t.CreationDate) - populate(objectMap, "credentials", t.Credentials) - populate(objectMap, "isSystemTask", t.IsSystemTask) - populate(objectMap, "logTemplate", t.LogTemplate) - populate(objectMap, "platform", t.Platform) - populate(objectMap, "provisioningState", t.ProvisioningState) - populate(objectMap, "status", t.Status) - populate(objectMap, "step", t.Step) - populate(objectMap, "timeout", t.Timeout) - populate(objectMap, "trigger", t.Trigger) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskProperties. -func (t *TaskProperties) 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 "agentConfiguration": - err = unpopulate(val, "AgentConfiguration", &t.AgentConfiguration) - delete(rawMsg, key) - case "agentPoolName": - err = unpopulate(val, "AgentPoolName", &t.AgentPoolName) - delete(rawMsg, key) - case "creationDate": - err = unpopulateTimeRFC3339(val, "CreationDate", &t.CreationDate) - delete(rawMsg, key) - case "credentials": - err = unpopulate(val, "Credentials", &t.Credentials) - delete(rawMsg, key) - case "isSystemTask": - err = unpopulate(val, "IsSystemTask", &t.IsSystemTask) - delete(rawMsg, key) - case "logTemplate": - err = unpopulate(val, "LogTemplate", &t.LogTemplate) - delete(rawMsg, key) - case "platform": - err = unpopulate(val, "Platform", &t.Platform) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &t.Status) - delete(rawMsg, key) - case "step": - t.Step, err = unmarshalTaskStepPropertiesClassification(val) - delete(rawMsg, key) - case "timeout": - err = unpopulate(val, "Timeout", &t.Timeout) - delete(rawMsg, key) - case "trigger": - err = unpopulate(val, "Trigger", &t.Trigger) - 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 TaskPropertiesUpdateParameters. -func (t TaskPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "agentConfiguration", t.AgentConfiguration) - populate(objectMap, "agentPoolName", t.AgentPoolName) - populate(objectMap, "credentials", t.Credentials) - populate(objectMap, "logTemplate", t.LogTemplate) - populate(objectMap, "platform", t.Platform) - populate(objectMap, "status", t.Status) - populate(objectMap, "step", t.Step) - populate(objectMap, "timeout", t.Timeout) - populate(objectMap, "trigger", t.Trigger) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskPropertiesUpdateParameters. -func (t *TaskPropertiesUpdateParameters) 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 "agentConfiguration": - err = unpopulate(val, "AgentConfiguration", &t.AgentConfiguration) - delete(rawMsg, key) - case "agentPoolName": - err = unpopulate(val, "AgentPoolName", &t.AgentPoolName) - delete(rawMsg, key) - case "credentials": - err = unpopulate(val, "Credentials", &t.Credentials) - delete(rawMsg, key) - case "logTemplate": - err = unpopulate(val, "LogTemplate", &t.LogTemplate) - delete(rawMsg, key) - case "platform": - err = unpopulate(val, "Platform", &t.Platform) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &t.Status) - delete(rawMsg, key) - case "step": - t.Step, err = unmarshalTaskStepUpdateParametersClassification(val) - delete(rawMsg, key) - case "timeout": - err = unpopulate(val, "Timeout", &t.Timeout) - delete(rawMsg, key) - case "trigger": - err = unpopulate(val, "Trigger", &t.Trigger) - 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 TaskRunProperties. -func (t TaskRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "forceUpdateTag", t.ForceUpdateTag) - populate(objectMap, "provisioningState", t.ProvisioningState) - populate(objectMap, "runRequest", t.RunRequest) - populate(objectMap, "runResult", t.RunResult) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunProperties. -func (t *TaskRunProperties) 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 "forceUpdateTag": - err = unpopulate(val, "ForceUpdateTag", &t.ForceUpdateTag) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) - delete(rawMsg, key) - case "runRequest": - t.RunRequest, err = unmarshalRunRequestClassification(val) - delete(rawMsg, key) - case "runResult": - err = unpopulate(val, "RunResult", &t.RunResult) - 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 TaskRunPropertiesUpdateParameters. -func (t TaskRunPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "forceUpdateTag", t.ForceUpdateTag) - populate(objectMap, "runRequest", t.RunRequest) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunPropertiesUpdateParameters. -func (t *TaskRunPropertiesUpdateParameters) 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 "forceUpdateTag": - err = unpopulate(val, "ForceUpdateTag", &t.ForceUpdateTag) - delete(rawMsg, key) - case "runRequest": - t.RunRequest, err = unmarshalRunRequestClassification(val) - 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 TaskRunRequest. -func (t TaskRunRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "agentPoolName", t.AgentPoolName) - populate(objectMap, "isArchiveEnabled", t.IsArchiveEnabled) - populate(objectMap, "logTemplate", t.LogTemplate) - populate(objectMap, "overrideTaskStepProperties", t.OverrideTaskStepProperties) - populate(objectMap, "taskId", t.TaskID) - objectMap["type"] = "TaskRunRequest" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunRequest. -func (t *TaskRunRequest) 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 "agentPoolName": - err = unpopulate(val, "AgentPoolName", &t.AgentPoolName) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &t.IsArchiveEnabled) - delete(rawMsg, key) - case "logTemplate": - err = unpopulate(val, "LogTemplate", &t.LogTemplate) - delete(rawMsg, key) - case "overrideTaskStepProperties": - err = unpopulate(val, "OverrideTaskStepProperties", &t.OverrideTaskStepProperties) - delete(rawMsg, key) - case "taskId": - err = unpopulate(val, "TaskID", &t.TaskID) - 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 TaskRunUpdateParameters. -func (t TaskRunUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", t.Identity) - populate(objectMap, "location", t.Location) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "tags", t.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TaskStepProperties. -func (t TaskStepProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "baseImageDependencies", t.BaseImageDependencies) - populate(objectMap, "contextAccessToken", t.ContextAccessToken) - populate(objectMap, "contextPath", t.ContextPath) - objectMap["type"] = t.Type - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TaskUpdateParameters. -func (t TaskUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", t.Identity) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "tags", t.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TokenCertificate. -func (t TokenCertificate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "encodedPemCertificate", t.EncodedPemCertificate) - populateTimeRFC3339(objectMap, "expiry", t.Expiry) - populate(objectMap, "name", t.Name) - populate(objectMap, "thumbprint", t.Thumbprint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TokenCertificate. -func (t *TokenCertificate) 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 "encodedPemCertificate": - err = unpopulate(val, "EncodedPemCertificate", &t.EncodedPemCertificate) - delete(rawMsg, key) - case "expiry": - err = unpopulateTimeRFC3339(val, "Expiry", &t.Expiry) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "thumbprint": - err = unpopulate(val, "Thumbprint", &t.Thumbprint) - 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 TokenCredentialsProperties. -func (t TokenCredentialsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "certificates", t.Certificates) - populate(objectMap, "passwords", t.Passwords) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TokenPassword. -func (t TokenPassword) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "creationTime", t.CreationTime) - populateTimeRFC3339(objectMap, "expiry", t.Expiry) - populate(objectMap, "name", t.Name) - populate(objectMap, "value", t.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TokenPassword. -func (t *TokenPassword) 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 "creationTime": - err = unpopulateTimeRFC3339(val, "CreationTime", &t.CreationTime) - delete(rawMsg, key) - case "expiry": - err = unpopulateTimeRFC3339(val, "Expiry", &t.Expiry) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &t.Value) - 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 TokenProperties. -func (t TokenProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "creationDate", t.CreationDate) - populate(objectMap, "credentials", t.Credentials) - populate(objectMap, "provisioningState", t.ProvisioningState) - populate(objectMap, "scopeMapId", t.ScopeMapID) - populate(objectMap, "status", t.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TokenProperties. -func (t *TokenProperties) 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 "creationDate": - err = unpopulateTimeRFC3339(val, "CreationDate", &t.CreationDate) - delete(rawMsg, key) - case "credentials": - err = unpopulate(val, "Credentials", &t.Credentials) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) - delete(rawMsg, key) - case "scopeMapId": - err = unpopulate(val, "ScopeMapID", &t.ScopeMapID) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &t.Status) - 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 TokenUpdateParameters. -func (t TokenUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", t.Properties) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TriggerProperties. -func (t TriggerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "baseImageTrigger", t.BaseImageTrigger) - populate(objectMap, "sourceTriggers", t.SourceTriggers) - populate(objectMap, "timerTriggers", t.TimerTriggers) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TriggerUpdateParameters. -func (t TriggerUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "baseImageTrigger", t.BaseImageTrigger) - populate(objectMap, "sourceTriggers", t.SourceTriggers) - populate(objectMap, "timerTriggers", t.TimerTriggers) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Webhook. -func (w Webhook) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", w.ID) - populate(objectMap, "location", w.Location) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "systemData", w.SystemData) - populate(objectMap, "tags", w.Tags) - populate(objectMap, "type", w.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WebhookCreateParameters. -func (w WebhookCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "location", w.Location) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "tags", w.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WebhookProperties. -func (w WebhookProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actions", w.Actions) - populate(objectMap, "provisioningState", w.ProvisioningState) - populate(objectMap, "scope", w.Scope) - populate(objectMap, "status", w.Status) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WebhookPropertiesCreateParameters. -func (w WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actions", w.Actions) - populate(objectMap, "customHeaders", w.CustomHeaders) - populate(objectMap, "scope", w.Scope) - populate(objectMap, "serviceUri", w.ServiceURI) - populate(objectMap, "status", w.Status) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WebhookPropertiesUpdateParameters. -func (w WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actions", w.Actions) - populate(objectMap, "customHeaders", w.CustomHeaders) - populate(objectMap, "scope", w.Scope) - populate(objectMap, "serviceUri", w.ServiceURI) - populate(objectMap, "status", w.Status) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WebhookUpdateParameters. -func (w WebhookUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "tags", w.Tags) - 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 -}