diff --git a/sdk/resourcemanager/batch/armbatch/CHANGELOG.md b/sdk/resourcemanager/batch/armbatch/CHANGELOG.md index f606a840d0da..e294cb5c45d7 100644 --- a/sdk/resourcemanager/batch/armbatch/CHANGELOG.md +++ b/sdk/resourcemanager/batch/armbatch/CHANGELOG.md @@ -1,5 +1,35 @@ # Release History +## 2.0.0 (2022-07-05) +### Breaking Changes + +- Function `*ApplicationPackageClient.Create` parameter(s) have been changed from `(context.Context, string, string, string, string, *ApplicationPackageClientCreateOptions)` to `(context.Context, string, string, string, string, ApplicationPackage, *ApplicationPackageClientCreateOptions)` +- Function `*ApplicationClient.Create` parameter(s) have been changed from `(context.Context, string, string, string, *ApplicationClientCreateOptions)` to `(context.Context, string, string, string, Application, *ApplicationClientCreateOptions)` +- Field `Parameters` of struct `ApplicationClientCreateOptions` has been removed +- Field `Parameters` of struct `ApplicationPackageClientCreateOptions` has been removed + +### Features Added + +- New const `PrivateEndpointConnectionProvisioningStateDeleting` +- New const `PrivateEndpointConnectionProvisioningStateCancelled` +- New const `PrivateEndpointConnectionProvisioningStateCreating` +- New const `EndpointAccessDefaultActionAllow` +- New const `EndpointAccessDefaultActionDeny` +- New function `PossibleEndpointAccessDefaultActionValues() []EndpointAccessDefaultAction` +- New function `*PrivateEndpointConnectionClient.BeginDelete(context.Context, string, string, string, *PrivateEndpointConnectionClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionClientDeleteResponse], error)` +- New struct `EndpointAccessProfile` +- New struct `IPRule` +- New struct `NetworkProfile` +- New struct `PrivateEndpointConnectionClientBeginDeleteOptions` +- New struct `PrivateEndpointConnectionClientDeleteResponse` +- New field `NetworkProfile` in struct `AccountUpdateProperties` +- New field `PublicNetworkAccess` in struct `AccountUpdateProperties` +- New field `GroupIDs` in struct `PrivateEndpointConnectionProperties` +- New field `NodeManagementEndpoint` in struct `AccountProperties` +- New field `NetworkProfile` in struct `AccountProperties` +- New field `NetworkProfile` in struct `AccountCreateProperties` + + ## 1.0.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/batch/armbatch/zz_generated_account_client.go b/sdk/resourcemanager/batch/armbatch/account_client.go similarity index 97% rename from sdk/resourcemanager/batch/armbatch/zz_generated_account_client.go rename to sdk/resourcemanager/batch/armbatch/account_client.go index a431ee5fdeaa..178caed199d3 100644 --- a/sdk/resourcemanager/batch/armbatch/zz_generated_account_client.go +++ b/sdk/resourcemanager/batch/armbatch/account_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 armbatch @@ -57,7 +58,7 @@ func NewAccountClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this // API and should instead be updated with the Update Batch Account API. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - A name for the Batch account which must be unique within the region. Batch account names must be between // 3 and 24 characters in length and must use only numbers and lowercase letters. This name is @@ -82,7 +83,7 @@ func (client *AccountClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and // should instead be updated with the Update Batch Account API. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 func (client *AccountClient) create(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters, options *AccountClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, parameters, options) if err != nil { @@ -118,7 +119,7 @@ func (client *AccountClient) createCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -126,7 +127,7 @@ func (client *AccountClient) createCreateRequest(ctx context.Context, resourceGr // BeginDelete - Deletes the specified Batch account. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // options - AccountClientBeginDeleteOptions contains the optional parameters for the AccountClient.BeginDelete method. @@ -146,7 +147,7 @@ func (client *AccountClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes the specified Batch account. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 func (client *AccountClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *AccountClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { @@ -182,7 +183,7 @@ func (client *AccountClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -190,7 +191,7 @@ func (client *AccountClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Gets information about the specified Batch account. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // options - AccountClientGetOptions contains the optional parameters for the AccountClient.Get method. @@ -229,7 +230,7 @@ func (client *AccountClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -246,7 +247,7 @@ func (client *AccountClient) getHandleResponse(resp *http.Response) (AccountClie // GetDetector - Gets information about the given detector for a given Batch account. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // detectorID - The name of the detector. @@ -290,7 +291,7 @@ func (client *AccountClient) getDetectorCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -310,7 +311,7 @@ func (client *AccountClient) getDetectorHandleResponse(resp *http.Response) (Acc // use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, getting the keys // will fail. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // options - AccountClientGetKeysOptions contains the optional parameters for the AccountClient.GetKeys method. @@ -349,7 +350,7 @@ func (client *AccountClient) getKeysCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -366,7 +367,7 @@ func (client *AccountClient) getKeysHandleResponse(resp *http.Response) (Account // NewListPager - Gets information about the Batch accounts associated with the subscription. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // options - AccountClientListOptions contains the optional parameters for the AccountClient.List method. func (client *AccountClient) NewListPager(options *AccountClientListOptions) *runtime.Pager[AccountClientListResponse] { return runtime.NewPager(runtime.PagingHandler[AccountClientListResponse]{ @@ -408,7 +409,7 @@ func (client *AccountClient) listCreateRequest(ctx context.Context, options *Acc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -425,7 +426,7 @@ func (client *AccountClient) listHandleResponse(resp *http.Response) (AccountCli // NewListByResourceGroupPager - Gets information about the Batch accounts associated with the specified resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // options - AccountClientListByResourceGroupOptions contains the optional parameters for the AccountClient.ListByResourceGroup // method. @@ -473,7 +474,7 @@ func (client *AccountClient) listByResourceGroupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -490,7 +491,7 @@ func (client *AccountClient) listByResourceGroupHandleResponse(resp *http.Respon // NewListDetectorsPager - Gets information about the detectors available for a given Batch account. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // options - AccountClientListDetectorsOptions contains the optional parameters for the AccountClient.ListDetectors method. @@ -542,7 +543,7 @@ func (client *AccountClient) listDetectorsCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -564,7 +565,7 @@ func (client *AccountClient) listDetectorsHandleResponse(resp *http.Response) (A // Batch to mark the affected nodes as unusable. For more information about // creating a pool inside of a virtual network, see https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // options - AccountClientListOutboundNetworkDependenciesEndpointsOptions contains the optional parameters for the AccountClient.ListOutboundNetworkDependenciesEndpoints @@ -617,7 +618,7 @@ func (client *AccountClient) listOutboundNetworkDependenciesEndpointsCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -637,7 +638,7 @@ func (client *AccountClient) listOutboundNetworkDependenciesEndpointsHandleRespo // use shared keys to authenticate, and must use another allowedAuthenticationModes instead. In this case, regenerating the // keys will fail. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // parameters - The type of key to regenerate. @@ -677,7 +678,7 @@ func (client *AccountClient) regenerateKeyCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -695,7 +696,7 @@ func (client *AccountClient) regenerateKeyHandleResponse(resp *http.Response) (A // SynchronizeAutoStorageKeys - Synchronizes access keys for the auto-storage account configured for the specified Batch account, // only if storage key authentication is being used. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // options - AccountClientSynchronizeAutoStorageKeysOptions contains the optional parameters for the AccountClient.SynchronizeAutoStorageKeys @@ -735,7 +736,7 @@ func (client *AccountClient) synchronizeAutoStorageKeysCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -743,7 +744,7 @@ func (client *AccountClient) synchronizeAutoStorageKeysCreateRequest(ctx context // Update - Updates the properties of an existing Batch account. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // parameters - Additional parameters for account update. @@ -783,7 +784,7 @@ func (client *AccountClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/batch/armbatch/zz_generated_application_client.go b/sdk/resourcemanager/batch/armbatch/application_client.go similarity index 95% rename from sdk/resourcemanager/batch/armbatch/zz_generated_application_client.go rename to sdk/resourcemanager/batch/armbatch/application_client.go index ce34766564a6..1b52b90328b8 100644 --- a/sdk/resourcemanager/batch/armbatch/zz_generated_application_client.go +++ b/sdk/resourcemanager/batch/armbatch/application_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 armbatch @@ -57,13 +58,14 @@ func NewApplicationClient(subscriptionID string, credential azcore.TokenCredenti // Create - Adds an application to the specified Batch account. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // applicationName - The name of the application. This must be unique within the account. +// parameters - The parameters for the request. // options - ApplicationClientCreateOptions contains the optional parameters for the ApplicationClient.Create method. -func (client *ApplicationClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, options *ApplicationClientCreateOptions) (ApplicationClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, applicationName, options) +func (client *ApplicationClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters Application, options *ApplicationClientCreateOptions) (ApplicationClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, applicationName, parameters, options) if err != nil { return ApplicationClientCreateResponse{}, err } @@ -78,7 +80,7 @@ func (client *ApplicationClient) Create(ctx context.Context, resourceGroupName s } // createCreateRequest creates the Create request. -func (client *ApplicationClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, applicationName string, options *ApplicationClientCreateOptions) (*policy.Request, error) { +func (client *ApplicationClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters Application, options *ApplicationClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -101,13 +103,10 @@ func (client *ApplicationClient) createCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Parameters != nil { - return req, runtime.MarshalAsJSON(req, *options.Parameters) - } - return req, nil + return req, runtime.MarshalAsJSON(req, parameters) } // createHandleResponse handles the Create response. @@ -121,7 +120,7 @@ func (client *ApplicationClient) createHandleResponse(resp *http.Response) (Appl // Delete - Deletes an application. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // applicationName - The name of the application. This must be unique within the account. @@ -165,7 +164,7 @@ func (client *ApplicationClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -173,7 +172,7 @@ func (client *ApplicationClient) deleteCreateRequest(ctx context.Context, resour // Get - Gets information about the specified application. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // applicationName - The name of the application. This must be unique within the account. @@ -217,7 +216,7 @@ func (client *ApplicationClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -234,7 +233,7 @@ func (client *ApplicationClient) getHandleResponse(resp *http.Response) (Applica // NewListPager - Lists all of the applications in the specified account. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // options - ApplicationClientListOptions contains the optional parameters for the ApplicationClient.List method. @@ -289,7 +288,7 @@ func (client *ApplicationClient) listCreateRequest(ctx context.Context, resource if options != nil && options.Maxresults != nil { reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) } - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -306,7 +305,7 @@ func (client *ApplicationClient) listHandleResponse(resp *http.Response) (Applic // Update - Updates settings for the specified application. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // applicationName - The name of the application. This must be unique within the account. @@ -351,7 +350,7 @@ func (client *ApplicationClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/batch/armbatch/zz_generated_applicationpackage_client.go b/sdk/resourcemanager/batch/armbatch/applicationpackage_client.go similarity index 95% rename from sdk/resourcemanager/batch/armbatch/zz_generated_applicationpackage_client.go rename to sdk/resourcemanager/batch/armbatch/applicationpackage_client.go index 74f68ee3ddcf..294a444782d3 100644 --- a/sdk/resourcemanager/batch/armbatch/zz_generated_applicationpackage_client.go +++ b/sdk/resourcemanager/batch/armbatch/applicationpackage_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 armbatch @@ -59,7 +60,7 @@ func NewApplicationPackageClient(subscriptionID string, credential azcore.TokenC // uploaded. This needs to be done before an ApplicationPackage can be used on Pools or // Tasks. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // applicationName - The name of the application. This must be unique within the account. @@ -110,7 +111,7 @@ func (client *ApplicationPackageClient) activateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -130,15 +131,16 @@ func (client *ApplicationPackageClient) activateHandleResponse(resp *http.Respon // ApplicationPackageActive before it can be used. If the auto storage account was configured to use storage keys, the URL // returned will contain a SAS. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // applicationName - The name of the application. This must be unique within the account. // versionName - The version of the application. +// parameters - The parameters for the request. // options - ApplicationPackageClientCreateOptions contains the optional parameters for the ApplicationPackageClient.Create // method. -func (client *ApplicationPackageClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, options *ApplicationPackageClientCreateOptions) (ApplicationPackageClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, applicationName, versionName, options) +func (client *ApplicationPackageClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters ApplicationPackage, options *ApplicationPackageClientCreateOptions) (ApplicationPackageClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, applicationName, versionName, parameters, options) if err != nil { return ApplicationPackageClientCreateResponse{}, err } @@ -153,7 +155,7 @@ func (client *ApplicationPackageClient) Create(ctx context.Context, resourceGrou } // createCreateRequest creates the Create request. -func (client *ApplicationPackageClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, options *ApplicationPackageClientCreateOptions) (*policy.Request, error) { +func (client *ApplicationPackageClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters ApplicationPackage, options *ApplicationPackageClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -180,13 +182,10 @@ func (client *ApplicationPackageClient) createCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Parameters != nil { - return req, runtime.MarshalAsJSON(req, *options.Parameters) - } - return req, nil + return req, runtime.MarshalAsJSON(req, parameters) } // createHandleResponse handles the Create response. @@ -200,7 +199,7 @@ func (client *ApplicationPackageClient) createHandleResponse(resp *http.Response // Delete - Deletes an application package record and its associated binary file. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // applicationName - The name of the application. This must be unique within the account. @@ -250,7 +249,7 @@ func (client *ApplicationPackageClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -258,7 +257,7 @@ func (client *ApplicationPackageClient) deleteCreateRequest(ctx context.Context, // Get - Gets information about the specified application package. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // applicationName - The name of the application. This must be unique within the account. @@ -307,7 +306,7 @@ func (client *ApplicationPackageClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -324,7 +323,7 @@ func (client *ApplicationPackageClient) getHandleResponse(resp *http.Response) ( // NewListPager - Lists all of the application packages in the specified application. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // applicationName - The name of the application. This must be unique within the account. @@ -384,7 +383,7 @@ func (client *ApplicationPackageClient) listCreateRequest(ctx context.Context, r if options != nil && options.Maxresults != nil { reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) } - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/batch/armbatch/autorest.md b/sdk/resourcemanager/batch/armbatch/autorest.md index d8e36ad19a79..29adbab00945 100644 --- a/sdk/resourcemanager/batch/armbatch/autorest.md +++ b/sdk/resourcemanager/batch/armbatch/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/batch/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/batch/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/batch/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/batch/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/batch/armbatch/zz_generated_certificate_client.go b/sdk/resourcemanager/batch/armbatch/certificate_client.go similarity index 97% rename from sdk/resourcemanager/batch/armbatch/zz_generated_certificate_client.go rename to sdk/resourcemanager/batch/armbatch/certificate_client.go index c07c16388308..c1145670fd6a 100644 --- a/sdk/resourcemanager/batch/armbatch/zz_generated_certificate_client.go +++ b/sdk/resourcemanager/batch/armbatch/certificate_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 armbatch @@ -61,7 +62,7 @@ func NewCertificateClient(subscriptionID string, credential azcore.TokenCredenti // you do not need to run this operation after the deletion failed. You must make // sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // certificateName - The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, @@ -107,7 +108,7 @@ func (client *CertificateClient) cancelDeletionCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -127,7 +128,7 @@ func (client *CertificateClient) cancelDeletionHandleResponse(resp *http.Respons // Create - Creates a new certificate inside the specified account. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // certificateName - The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, @@ -173,7 +174,7 @@ func (client *CertificateClient) createCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -199,7 +200,7 @@ func (client *CertificateClient) createHandleResponse(resp *http.Response) (Cert // BeginDelete - Deletes the specified certificate. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // certificateName - The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, @@ -221,7 +222,7 @@ func (client *CertificateClient) BeginDelete(ctx context.Context, resourceGroupN // Delete - Deletes the specified certificate. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 func (client *CertificateClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, certificateName string, options *CertificateClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, certificateName, options) if err != nil { @@ -261,7 +262,7 @@ func (client *CertificateClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +270,7 @@ func (client *CertificateClient) deleteCreateRequest(ctx context.Context, resour // Get - Gets information about the specified certificate. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // certificateName - The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, @@ -314,7 +315,7 @@ func (client *CertificateClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -334,7 +335,7 @@ func (client *CertificateClient) getHandleResponse(resp *http.Response) (Certifi // NewListByBatchAccountPager - Lists all of the certificates in the specified account. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // options - CertificateClientListByBatchAccountOptions contains the optional parameters for the CertificateClient.ListByBatchAccount @@ -396,7 +397,7 @@ func (client *CertificateClient) listByBatchAccountCreateRequest(ctx context.Con if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -413,7 +414,7 @@ func (client *CertificateClient) listByBatchAccountHandleResponse(resp *http.Res // Update - Updates the properties of an existing certificate. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // certificateName - The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, @@ -459,7 +460,7 @@ func (client *CertificateClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} diff --git a/sdk/resourcemanager/batch/armbatch/zz_generated_constants.go b/sdk/resourcemanager/batch/armbatch/constants.go similarity index 94% rename from sdk/resourcemanager/batch/armbatch/zz_generated_constants.go rename to sdk/resourcemanager/batch/armbatch/constants.go index b077df24deda..229545b93d23 100644 --- a/sdk/resourcemanager/batch/armbatch/zz_generated_constants.go +++ b/sdk/resourcemanager/batch/armbatch/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 armbatch const ( moduleName = "armbatch" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) // AccountKeyType - The type of account key to regenerate. @@ -321,8 +322,8 @@ type DynamicVNetAssignmentScope string const ( // DynamicVNetAssignmentScopeNone - No dynamic VNet assignment is enabled. DynamicVNetAssignmentScopeNone DynamicVNetAssignmentScope = "none" - // DynamicVNetAssignmentScopeJob - Dynamic VNet assignment is done per-job. Don't use this option unless your batch account - // has been approved to use this feature. + // DynamicVNetAssignmentScopeJob - Dynamic VNet assignment is done per-job. If this value is set, the network configuration + // subnet ID must also be set. This feature requires approval before use, please contact support DynamicVNetAssignmentScopeJob DynamicVNetAssignmentScope = "job" ) @@ -352,6 +353,24 @@ func PossibleElevationLevelValues() []ElevationLevel { } } +// EndpointAccessDefaultAction - Default action for endpoint access. It is only applicable when publicNetworkAccess is enabled. +type EndpointAccessDefaultAction string + +const ( + // EndpointAccessDefaultActionAllow - Allow client access. + EndpointAccessDefaultActionAllow EndpointAccessDefaultAction = "Allow" + // EndpointAccessDefaultActionDeny - Deny client access. + EndpointAccessDefaultActionDeny EndpointAccessDefaultAction = "Deny" +) + +// PossibleEndpointAccessDefaultActionValues returns the possible values for the EndpointAccessDefaultAction const type. +func PossibleEndpointAccessDefaultActionValues() []EndpointAccessDefaultAction { + return []EndpointAccessDefaultAction{ + EndpointAccessDefaultActionAllow, + EndpointAccessDefaultActionDeny, + } +} + // IPAddressProvisioningType - The provisioning type for Public IP Addresses for the Batch Pool. type IPAddressProvisioningType string @@ -585,23 +604,32 @@ func PossiblePoolProvisioningStateValues() []PoolProvisioningState { type PrivateEndpointConnectionProvisioningState string const ( - // PrivateEndpointConnectionProvisioningStateSucceeded - The connection status is final and is ready for use if Status is - // Approved. - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" + // PrivateEndpointConnectionProvisioningStateCreating - The connection is creating. + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" // PrivateEndpointConnectionProvisioningStateUpdating - The user has requested that the connection status be updated, but // the update operation has not yet completed. You may not reference the connection when connecting the Batch account. PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" + // PrivateEndpointConnectionProvisioningStateDeleting - The connection is deleting. + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + // PrivateEndpointConnectionProvisioningStateSucceeded - The connection status is final and is ready for use if Status is + // Approved. + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" // PrivateEndpointConnectionProvisioningStateFailed - The user requested that the connection be updated and it failed. You // may retry the update operation. PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateCancelled - The user has cancelled the connection creation. + PrivateEndpointConnectionProvisioningStateCancelled PrivateEndpointConnectionProvisioningState = "Cancelled" ) // PossiblePrivateEndpointConnectionProvisioningStateValues returns the possible values for the PrivateEndpointConnectionProvisioningState const type. func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { return []PrivateEndpointConnectionProvisioningState{ - PrivateEndpointConnectionProvisioningStateSucceeded, + PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateUpdating, + PrivateEndpointConnectionProvisioningStateDeleting, + PrivateEndpointConnectionProvisioningStateSucceeded, PrivateEndpointConnectionProvisioningStateFailed, + PrivateEndpointConnectionProvisioningStateCancelled, } } diff --git a/sdk/resourcemanager/batch/armbatch/go.mod b/sdk/resourcemanager/batch/armbatch/go.mod index d2f7f2460c2e..dca98d7375e6 100644 --- a/sdk/resourcemanager/batch/armbatch/go.mod +++ b/sdk/resourcemanager/batch/armbatch/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/batch/armbatch/go.sum b/sdk/resourcemanager/batch/armbatch/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/batch/armbatch/go.sum +++ b/sdk/resourcemanager/batch/armbatch/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/batch/armbatch/zz_generated_location_client.go b/sdk/resourcemanager/batch/armbatch/location_client.go similarity index 97% rename from sdk/resourcemanager/batch/armbatch/zz_generated_location_client.go rename to sdk/resourcemanager/batch/armbatch/location_client.go index 391f6759cfaf..41591da42cd2 100644 --- a/sdk/resourcemanager/batch/armbatch/zz_generated_location_client.go +++ b/sdk/resourcemanager/batch/armbatch/location_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 armbatch @@ -57,7 +58,7 @@ func NewLocationClient(subscriptionID string, credential azcore.TokenCredential, // CheckNameAvailability - Checks whether the Batch account name is available in the specified region. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // locationName - The desired region for the name check. // parameters - Properties needed to check the availability of a name. // options - LocationClientCheckNameAvailabilityOptions contains the optional parameters for the LocationClient.CheckNameAvailability @@ -93,7 +94,7 @@ func (client *LocationClient) checkNameAvailabilityCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -110,7 +111,7 @@ func (client *LocationClient) checkNameAvailabilityHandleResponse(resp *http.Res // GetQuotas - Gets the Batch service quotas for the specified subscription at the given location. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // locationName - The region for which to retrieve Batch service quotas. // options - LocationClientGetQuotasOptions contains the optional parameters for the LocationClient.GetQuotas method. func (client *LocationClient) GetQuotas(ctx context.Context, locationName string, options *LocationClientGetQuotasOptions) (LocationClientGetQuotasResponse, error) { @@ -144,7 +145,7 @@ func (client *LocationClient) getQuotasCreateRequest(ctx context.Context, locati return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -162,7 +163,7 @@ func (client *LocationClient) getQuotasHandleResponse(resp *http.Response) (Loca // NewListSupportedCloudServiceSKUsPager - Gets the list of Batch supported Cloud Service VM sizes available at the given // location. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // locationName - The region for which to retrieve Batch service supported SKUs. // options - LocationClientListSupportedCloudServiceSKUsOptions contains the optional parameters for the LocationClient.ListSupportedCloudServiceSKUs // method. @@ -216,7 +217,7 @@ func (client *LocationClient) listSupportedCloudServiceSKUsCreateRequest(ctx con if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -234,7 +235,7 @@ func (client *LocationClient) listSupportedCloudServiceSKUsHandleResponse(resp * // NewListSupportedVirtualMachineSKUsPager - Gets the list of Batch supported Virtual Machine VM sizes available at the given // location. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // locationName - The region for which to retrieve Batch service supported SKUs. // options - LocationClientListSupportedVirtualMachineSKUsOptions contains the optional parameters for the LocationClient.ListSupportedVirtualMachineSKUs // method. @@ -288,7 +289,7 @@ func (client *LocationClient) listSupportedVirtualMachineSKUsCreateRequest(ctx c if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/batch/armbatch/zz_generated_models.go b/sdk/resourcemanager/batch/armbatch/models.go similarity index 96% rename from sdk/resourcemanager/batch/armbatch/zz_generated_models.go rename to sdk/resourcemanager/batch/armbatch/models.go index fc5eb316f31b..46b027f418c4 100644 --- a/sdk/resourcemanager/batch/armbatch/zz_generated_models.go +++ b/sdk/resourcemanager/batch/armbatch/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 armbatch @@ -130,6 +131,9 @@ type AccountCreateProperties struct { // A reference to the Azure key vault associated with the Batch account. KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` + // The network profile only takes effect when publicNetworkAccess is enabled. + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // The pool allocation mode also affects how clients may authenticate to the Batch Service API. If the mode is BatchService, // clients may authenticate using access keys or Azure Active Directory. If the // mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService. @@ -179,6 +183,12 @@ type AccountListResult struct { // AccountProperties - Account specific properties. type AccountProperties struct { + // The network profile only takes effect when publicNetworkAccess is enabled. + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + + // If not specified, the default value is 'enabled'. + PublicNetworkAccess *PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` + // READ-ONLY; The account endpoint used to interact with the Batch service. AccountEndpoint *string `json:"accountEndpoint,omitempty" azure:"ro"` @@ -201,12 +211,9 @@ type AccountProperties struct { // not returned. DedicatedCoreQuotaPerVMFamily []*VirtualMachineFamilyCoreQuota `json:"dedicatedCoreQuotaPerVMFamily,omitempty" azure:"ro"` - // READ-ONLY; Batch is transitioning its core quota system for dedicated cores to be enforced per Virtual Machine family. - // During this transitional phase, the dedicated core quota per Virtual Machine family may not - // yet be enforced. If this flag is false, dedicated core quota is enforced via the old dedicatedCoreQuota property on the - // account and does not consider Virtual Machine family. If this flag is true, - // dedicated core quota is enforced via the dedicatedCoreQuotaPerVMFamily property on the account, and the old dedicatedCoreQuota - // does not apply. + // READ-ONLY; If this flag is true, dedicated core quota is enforced via both the dedicatedCoreQuotaPerVMFamily and dedicatedCoreQuota + // properties on the account. If this flag is false, dedicated core quota is + // enforced only via the dedicatedCoreQuota property on the account and does not consider Virtual Machine family. DedicatedCoreQuotaPerVMFamilyEnforced *bool `json:"dedicatedCoreQuotaPerVMFamilyEnforced,omitempty" azure:"ro"` // READ-ONLY; Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using @@ -221,6 +228,9 @@ type AccountProperties struct { // is not returned. LowPriorityCoreQuota *int32 `json:"lowPriorityCoreQuota,omitempty" azure:"ro"` + // READ-ONLY; The endpoint used by compute node to connect to the Batch node management service. + NodeManagementEndpoint *string `json:"nodeManagementEndpoint,omitempty" azure:"ro"` + // READ-ONLY; The allocation mode for creating pools in the Batch account. PoolAllocationMode *PoolAllocationMode `json:"poolAllocationMode,omitempty" azure:"ro"` @@ -232,9 +242,6 @@ type AccountProperties struct { // READ-ONLY; The provisioned state of the resource ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` - - // READ-ONLY; If not specified, the default value is 'enabled'. - PublicNetworkAccess *PublicNetworkAccessType `json:"publicNetworkAccess,omitempty" azure:"ro"` } // AccountRegenerateKeyParameters - Parameters supplied to the RegenerateKey operation. @@ -268,6 +275,12 @@ type AccountUpdateProperties struct { // managed key. For additional control, a customer-managed key can be used // instead. Encryption *EncryptionProperties `json:"encryption,omitempty"` + + // The network profile only takes effect when publicNetworkAccess is enabled. + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + + // If not specified, the default value is 'enabled'. + PublicNetworkAccess *PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` } // ActivateApplicationPackageParameters - Parameters for an activating an application package. @@ -296,8 +309,7 @@ type Application struct { // ApplicationClientCreateOptions contains the optional parameters for the ApplicationClient.Create method. type ApplicationClientCreateOptions struct { - // The parameters for the request. - Parameters *Application + // placeholder for future optional parameters } // ApplicationClientDeleteOptions contains the optional parameters for the ApplicationClient.Delete method. @@ -346,8 +358,7 @@ type ApplicationPackageClientActivateOptions struct { // ApplicationPackageClientCreateOptions contains the optional parameters for the ApplicationPackageClient.Create method. type ApplicationPackageClientCreateOptions struct { - // The parameters for the request. - Parameters *ApplicationPackage + // placeholder for future optional parameters } // ApplicationPackageClientDeleteOptions contains the optional parameters for the ApplicationPackageClient.Delete method. @@ -718,7 +729,8 @@ type CheckNameAvailabilityParameters struct { // REQUIRED; The name to check for availability Name *string `json:"name,omitempty"` - // REQUIRED; The resource type. + // CONSTANT; The resource type. + // Field has constant value "Microsoft.Batch/batchAccounts", any specified value is ignored. Type *string `json:"type,omitempty"` } @@ -779,7 +791,8 @@ type ComputeNodeIdentityReference struct { // ContainerConfiguration - The configuration for container-enabled pools. type ContainerConfiguration struct { - // REQUIRED; The container technology to be used. + // CONSTANT; The container technology to be used. + // Field has constant value "DockerCompatible", any specified value is ignored. Type *string `json:"type,omitempty"` // This is the full image reference, as would be specified to "docker pull". An image will be sourced from the default Docker @@ -915,6 +928,15 @@ type EncryptionProperties struct { KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` } +// EndpointAccessProfile - Network access profile for Batch endpoint. +type EndpointAccessProfile struct { + // REQUIRED; Default action for endpoint access. It is only applicable when publicNetworkAccess is enabled. + DefaultAction *EndpointAccessDefaultAction `json:"defaultAction,omitempty"` + + // Array of IP ranges to filter client IP address. + IPRules []*IPRule `json:"ipRules,omitempty"` +} + // EndpointDependency - A domain name and connection details used to access a dependency. type EndpointDependency struct { // READ-ONLY; Human-readable supplemental information about the dependency and when it is applicable. @@ -959,6 +981,16 @@ type FixedScaleSettings struct { TargetLowPriorityNodes *int32 `json:"targetLowPriorityNodes,omitempty"` } +// IPRule - Rule to filter client IP address. +type IPRule struct { + // CONSTANT; Action when client IP address is matched. + // Field has constant value "Allow", any specified value is ignored. + Action *string `json:"action,omitempty"` + + // REQUIRED; IPv4 address, or IPv4 address range in CIDR format. + Value *string `json:"value,omitempty"` +} + // ImageReference - A reference to an Azure Virtual Machines Marketplace image or the Azure Image resource of a custom Virtual // Machine. To get the list of all imageReferences verified by Azure Batch, see the 'List // supported node agent SKUs' operation. @@ -1204,6 +1236,15 @@ type NetworkConfiguration struct { SubnetID *string `json:"subnetId,omitempty"` } +// NetworkProfile - Network profile for Batch account, which contains network rule settings for each endpoint. +type NetworkProfile struct { + // Network access profile for batchAccount endpoint (Batch account data plane API). + AccountAccess *EndpointAccessProfile `json:"accountAccess,omitempty"` + + // Network access profile for nodeManagement endpoint (Batch service managing compute nodes for Batch pools). + NodeManagementAccess *EndpointAccessProfile `json:"nodeManagementAccess,omitempty"` +} + // NetworkSecurityGroupRule - A network security group rule to apply to an inbound endpoint. type NetworkSecurityGroupRule struct { // REQUIRED; The action that should be taken for a specified IP address, subnet range or tag. @@ -1521,6 +1562,13 @@ type PrivateEndpointConnection struct { Type *string `json:"type,omitempty" azure:"ro"` } +// PrivateEndpointConnectionClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionClient.BeginDelete +// method. +type PrivateEndpointConnectionClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // PrivateEndpointConnectionClientBeginUpdateOptions contains the optional parameters for the PrivateEndpointConnectionClient.BeginUpdate // method. type PrivateEndpointConnectionClientBeginUpdateOptions struct { @@ -1546,12 +1594,15 @@ type PrivateEndpointConnectionClientListByBatchAccountOptions struct { // PrivateEndpointConnectionProperties - Private endpoint connection properties. type PrivateEndpointConnectionProperties struct { - // The private endpoint of the private endpoint connection. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // The private link service connection state of the private endpoint connection PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // READ-ONLY; The value has one and only one group id. + GroupIDs []*string `json:"groupIds,omitempty" azure:"ro"` + + // READ-ONLY; The private endpoint of the private endpoint connection. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty" azure:"ro"` + // READ-ONLY; The provisioning state of the private endpoint connection. ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } @@ -1777,8 +1828,7 @@ type StartTask struct { // retries. The Batch service will try the task once, and may then retry up to this // limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). // If the maximum retry count is 0, the Batch service does not retry the task. If - // the maximum retry count is -1, the Batch service retries the task without limit, however this is not recommended for a - // start task or any task. The default value is 0 (no retries). + // the maximum retry count is -1, the Batch service retries the task without limit. MaxTaskRetryCount *int32 `json:"maxTaskRetryCount,omitempty"` // A list of files that the Batch service will download to the compute node before running the command line. diff --git a/sdk/resourcemanager/batch/armbatch/models_serde.go b/sdk/resourcemanager/batch/armbatch/models_serde.go new file mode 100644 index 000000000000..5b6c31b17be8 --- /dev/null +++ b/sdk/resourcemanager/batch/armbatch/models_serde.go @@ -0,0 +1,4147 @@ +//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 armbatch + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Account. +func (a Account) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Account. +func (a *Account) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &a.Identity) + 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 "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 AccountCreateParameters. +func (a AccountCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "location", a.Location) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountCreateParameters. +func (a *AccountCreateParameters) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, 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 AccountCreateProperties. +func (a AccountCreateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedAuthenticationModes", a.AllowedAuthenticationModes) + populate(objectMap, "autoStorage", a.AutoStorage) + populate(objectMap, "encryption", a.Encryption) + populate(objectMap, "keyVaultReference", a.KeyVaultReference) + populate(objectMap, "networkProfile", a.NetworkProfile) + populate(objectMap, "poolAllocationMode", a.PoolAllocationMode) + populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountCreateProperties. +func (a *AccountCreateProperties) UnmarshalJSON(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 "allowedAuthenticationModes": + err = unpopulate(val, "AllowedAuthenticationModes", &a.AllowedAuthenticationModes) + delete(rawMsg, key) + case "autoStorage": + err = unpopulate(val, "AutoStorage", &a.AutoStorage) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &a.Encryption) + delete(rawMsg, key) + case "keyVaultReference": + err = unpopulate(val, "KeyVaultReference", &a.KeyVaultReference) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &a.NetworkProfile) + delete(rawMsg, key) + case "poolAllocationMode": + err = unpopulate(val, "PoolAllocationMode", &a.PoolAllocationMode) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &a.PublicNetworkAccess) + 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 AccountIdentity. +func (a AccountIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", a.PrincipalID) + populate(objectMap, "tenantId", a.TenantID) + populate(objectMap, "type", a.Type) + populate(objectMap, "userAssignedIdentities", a.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountIdentity. +func (a *AccountIdentity) UnmarshalJSON(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 "principalId": + err = unpopulate(val, "PrincipalID", &a.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &a.UserAssignedIdentities) + 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 AccountKeys. +func (a AccountKeys) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountName", a.AccountName) + populate(objectMap, "primary", a.Primary) + populate(objectMap, "secondary", a.Secondary) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountKeys. +func (a *AccountKeys) UnmarshalJSON(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 "accountName": + err = unpopulate(val, "AccountName", &a.AccountName) + delete(rawMsg, key) + case "primary": + err = unpopulate(val, "Primary", &a.Primary) + delete(rawMsg, key) + case "secondary": + err = unpopulate(val, "Secondary", &a.Secondary) + 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 AccountListResult. +func (a AccountListResult) 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 AccountListResult. +func (a *AccountListResult) UnmarshalJSON(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 AccountProperties. +func (a AccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountEndpoint", a.AccountEndpoint) + populate(objectMap, "activeJobAndJobScheduleQuota", a.ActiveJobAndJobScheduleQuota) + populate(objectMap, "allowedAuthenticationModes", a.AllowedAuthenticationModes) + populate(objectMap, "autoStorage", a.AutoStorage) + populate(objectMap, "dedicatedCoreQuota", a.DedicatedCoreQuota) + populate(objectMap, "dedicatedCoreQuotaPerVMFamily", a.DedicatedCoreQuotaPerVMFamily) + populate(objectMap, "dedicatedCoreQuotaPerVMFamilyEnforced", a.DedicatedCoreQuotaPerVMFamilyEnforced) + populate(objectMap, "encryption", a.Encryption) + populate(objectMap, "keyVaultReference", a.KeyVaultReference) + populate(objectMap, "lowPriorityCoreQuota", a.LowPriorityCoreQuota) + populate(objectMap, "networkProfile", a.NetworkProfile) + populate(objectMap, "nodeManagementEndpoint", a.NodeManagementEndpoint) + populate(objectMap, "poolAllocationMode", a.PoolAllocationMode) + populate(objectMap, "poolQuota", a.PoolQuota) + populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountProperties. +func (a *AccountProperties) UnmarshalJSON(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 "accountEndpoint": + err = unpopulate(val, "AccountEndpoint", &a.AccountEndpoint) + delete(rawMsg, key) + case "activeJobAndJobScheduleQuota": + err = unpopulate(val, "ActiveJobAndJobScheduleQuota", &a.ActiveJobAndJobScheduleQuota) + delete(rawMsg, key) + case "allowedAuthenticationModes": + err = unpopulate(val, "AllowedAuthenticationModes", &a.AllowedAuthenticationModes) + delete(rawMsg, key) + case "autoStorage": + err = unpopulate(val, "AutoStorage", &a.AutoStorage) + delete(rawMsg, key) + case "dedicatedCoreQuota": + err = unpopulate(val, "DedicatedCoreQuota", &a.DedicatedCoreQuota) + delete(rawMsg, key) + case "dedicatedCoreQuotaPerVMFamily": + err = unpopulate(val, "DedicatedCoreQuotaPerVMFamily", &a.DedicatedCoreQuotaPerVMFamily) + delete(rawMsg, key) + case "dedicatedCoreQuotaPerVMFamilyEnforced": + err = unpopulate(val, "DedicatedCoreQuotaPerVMFamilyEnforced", &a.DedicatedCoreQuotaPerVMFamilyEnforced) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &a.Encryption) + delete(rawMsg, key) + case "keyVaultReference": + err = unpopulate(val, "KeyVaultReference", &a.KeyVaultReference) + delete(rawMsg, key) + case "lowPriorityCoreQuota": + err = unpopulate(val, "LowPriorityCoreQuota", &a.LowPriorityCoreQuota) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &a.NetworkProfile) + delete(rawMsg, key) + case "nodeManagementEndpoint": + err = unpopulate(val, "NodeManagementEndpoint", &a.NodeManagementEndpoint) + delete(rawMsg, key) + case "poolAllocationMode": + err = unpopulate(val, "PoolAllocationMode", &a.PoolAllocationMode) + delete(rawMsg, key) + case "poolQuota": + err = unpopulate(val, "PoolQuota", &a.PoolQuota) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &a.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &a.PublicNetworkAccess) + 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 AccountRegenerateKeyParameters. +func (a AccountRegenerateKeyParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyName", a.KeyName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountRegenerateKeyParameters. +func (a *AccountRegenerateKeyParameters) UnmarshalJSON(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 "keyName": + err = unpopulate(val, "KeyName", &a.KeyName) + 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 AccountUpdateParameters. +func (a AccountUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountUpdateParameters. +func (a *AccountUpdateParameters) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, 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 AccountUpdateProperties. +func (a AccountUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedAuthenticationModes", a.AllowedAuthenticationModes) + populate(objectMap, "autoStorage", a.AutoStorage) + populate(objectMap, "encryption", a.Encryption) + populate(objectMap, "networkProfile", a.NetworkProfile) + populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountUpdateProperties. +func (a *AccountUpdateProperties) UnmarshalJSON(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 "allowedAuthenticationModes": + err = unpopulate(val, "AllowedAuthenticationModes", &a.AllowedAuthenticationModes) + delete(rawMsg, key) + case "autoStorage": + err = unpopulate(val, "AutoStorage", &a.AutoStorage) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &a.Encryption) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &a.NetworkProfile) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &a.PublicNetworkAccess) + 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 ActivateApplicationPackageParameters. +func (a ActivateApplicationPackageParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "format", a.Format) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActivateApplicationPackageParameters. +func (a *ActivateApplicationPackageParameters) UnmarshalJSON(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 "format": + err = unpopulate(val, "Format", &a.Format) + 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 Application. +func (a Application) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Application. +func (a *Application) UnmarshalJSON(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 "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "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 ApplicationPackage. +func (a ApplicationPackage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationPackage. +func (a *ApplicationPackage) UnmarshalJSON(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 "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "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 ApplicationPackageProperties. +func (a ApplicationPackageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "format", a.Format) + populateTimeRFC3339(objectMap, "lastActivationTime", a.LastActivationTime) + populate(objectMap, "state", a.State) + populate(objectMap, "storageUrl", a.StorageURL) + populateTimeRFC3339(objectMap, "storageUrlExpiry", a.StorageURLExpiry) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationPackageProperties. +func (a *ApplicationPackageProperties) UnmarshalJSON(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 "format": + err = unpopulate(val, "Format", &a.Format) + delete(rawMsg, key) + case "lastActivationTime": + err = unpopulateTimeRFC3339(val, "LastActivationTime", &a.LastActivationTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &a.State) + delete(rawMsg, key) + case "storageUrl": + err = unpopulate(val, "StorageURL", &a.StorageURL) + delete(rawMsg, key) + case "storageUrlExpiry": + err = unpopulateTimeRFC3339(val, "StorageURLExpiry", &a.StorageURLExpiry) + 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 ApplicationPackageReference. +func (a ApplicationPackageReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "version", a.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationPackageReference. +func (a *ApplicationPackageReference) UnmarshalJSON(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 "version": + err = unpopulate(val, "Version", &a.Version) + 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 ApplicationProperties. +func (a ApplicationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowUpdates", a.AllowUpdates) + populate(objectMap, "defaultVersion", a.DefaultVersion) + populate(objectMap, "displayName", a.DisplayName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationProperties. +func (a *ApplicationProperties) UnmarshalJSON(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 "allowUpdates": + err = unpopulate(val, "AllowUpdates", &a.AllowUpdates) + delete(rawMsg, key) + case "defaultVersion": + err = unpopulate(val, "DefaultVersion", &a.DefaultVersion) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + 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 AutoScaleRun. +func (a AutoScaleRun) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", a.Error) + populateTimeRFC3339(objectMap, "evaluationTime", a.EvaluationTime) + populate(objectMap, "results", a.Results) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoScaleRun. +func (a *AutoScaleRun) UnmarshalJSON(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 "error": + err = unpopulate(val, "Error", &a.Error) + delete(rawMsg, key) + case "evaluationTime": + err = unpopulateTimeRFC3339(val, "EvaluationTime", &a.EvaluationTime) + delete(rawMsg, key) + case "results": + err = unpopulate(val, "Results", &a.Results) + 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 AutoScaleRunError. +func (a AutoScaleRunError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", a.Code) + populate(objectMap, "details", a.Details) + populate(objectMap, "message", a.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoScaleRunError. +func (a *AutoScaleRunError) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &a.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &a.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &a.Message) + 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 AutoScaleSettings. +func (a AutoScaleSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "evaluationInterval", a.EvaluationInterval) + populate(objectMap, "formula", a.Formula) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoScaleSettings. +func (a *AutoScaleSettings) UnmarshalJSON(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 "evaluationInterval": + err = unpopulate(val, "EvaluationInterval", &a.EvaluationInterval) + delete(rawMsg, key) + case "formula": + err = unpopulate(val, "Formula", &a.Formula) + 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 AutoStorageBaseProperties. +func (a AutoStorageBaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationMode", a.AuthenticationMode) + populate(objectMap, "nodeIdentityReference", a.NodeIdentityReference) + populate(objectMap, "storageAccountId", a.StorageAccountID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoStorageBaseProperties. +func (a *AutoStorageBaseProperties) UnmarshalJSON(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 "authenticationMode": + err = unpopulate(val, "AuthenticationMode", &a.AuthenticationMode) + delete(rawMsg, key) + case "nodeIdentityReference": + err = unpopulate(val, "NodeIdentityReference", &a.NodeIdentityReference) + delete(rawMsg, key) + case "storageAccountId": + err = unpopulate(val, "StorageAccountID", &a.StorageAccountID) + 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 AutoStorageProperties. +func (a AutoStorageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationMode", a.AuthenticationMode) + populateTimeRFC3339(objectMap, "lastKeySync", a.LastKeySync) + populate(objectMap, "nodeIdentityReference", a.NodeIdentityReference) + populate(objectMap, "storageAccountId", a.StorageAccountID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoStorageProperties. +func (a *AutoStorageProperties) UnmarshalJSON(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 "authenticationMode": + err = unpopulate(val, "AuthenticationMode", &a.AuthenticationMode) + delete(rawMsg, key) + case "lastKeySync": + err = unpopulateTimeRFC3339(val, "LastKeySync", &a.LastKeySync) + delete(rawMsg, key) + case "nodeIdentityReference": + err = unpopulate(val, "NodeIdentityReference", &a.NodeIdentityReference) + delete(rawMsg, key) + case "storageAccountId": + err = unpopulate(val, "StorageAccountID", &a.StorageAccountID) + 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 AutoUserSpecification. +func (a AutoUserSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "elevationLevel", a.ElevationLevel) + populate(objectMap, "scope", a.Scope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoUserSpecification. +func (a *AutoUserSpecification) UnmarshalJSON(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 "elevationLevel": + err = unpopulate(val, "ElevationLevel", &a.ElevationLevel) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &a.Scope) + 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 AzureBlobFileSystemConfiguration. +func (a AzureBlobFileSystemConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountKey", a.AccountKey) + populate(objectMap, "accountName", a.AccountName) + populate(objectMap, "blobfuseOptions", a.BlobfuseOptions) + populate(objectMap, "containerName", a.ContainerName) + populate(objectMap, "identityReference", a.IdentityReference) + populate(objectMap, "relativeMountPath", a.RelativeMountPath) + populate(objectMap, "sasKey", a.SasKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBlobFileSystemConfiguration. +func (a *AzureBlobFileSystemConfiguration) UnmarshalJSON(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 "accountKey": + err = unpopulate(val, "AccountKey", &a.AccountKey) + delete(rawMsg, key) + case "accountName": + err = unpopulate(val, "AccountName", &a.AccountName) + delete(rawMsg, key) + case "blobfuseOptions": + err = unpopulate(val, "BlobfuseOptions", &a.BlobfuseOptions) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &a.ContainerName) + delete(rawMsg, key) + case "identityReference": + err = unpopulate(val, "IdentityReference", &a.IdentityReference) + delete(rawMsg, key) + case "relativeMountPath": + err = unpopulate(val, "RelativeMountPath", &a.RelativeMountPath) + delete(rawMsg, key) + case "sasKey": + err = unpopulate(val, "SasKey", &a.SasKey) + 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 AzureFileShareConfiguration. +func (a AzureFileShareConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountKey", a.AccountKey) + populate(objectMap, "accountName", a.AccountName) + populate(objectMap, "azureFileUrl", a.AzureFileURL) + populate(objectMap, "mountOptions", a.MountOptions) + populate(objectMap, "relativeMountPath", a.RelativeMountPath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFileShareConfiguration. +func (a *AzureFileShareConfiguration) UnmarshalJSON(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 "accountKey": + err = unpopulate(val, "AccountKey", &a.AccountKey) + delete(rawMsg, key) + case "accountName": + err = unpopulate(val, "AccountName", &a.AccountName) + delete(rawMsg, key) + case "azureFileUrl": + err = unpopulate(val, "AzureFileURL", &a.AzureFileURL) + delete(rawMsg, key) + case "mountOptions": + err = unpopulate(val, "MountOptions", &a.MountOptions) + delete(rawMsg, key) + case "relativeMountPath": + err = unpopulate(val, "RelativeMountPath", &a.RelativeMountPath) + 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 CIFSMountConfiguration. +func (c CIFSMountConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "mountOptions", c.MountOptions) + populate(objectMap, "password", c.Password) + populate(objectMap, "relativeMountPath", c.RelativeMountPath) + populate(objectMap, "source", c.Source) + populate(objectMap, "username", c.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CIFSMountConfiguration. +func (c *CIFSMountConfiguration) UnmarshalJSON(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 "mountOptions": + err = unpopulate(val, "MountOptions", &c.MountOptions) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &c.Password) + delete(rawMsg, key) + case "relativeMountPath": + err = unpopulate(val, "RelativeMountPath", &c.RelativeMountPath) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &c.Source) + 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 Certificate. +func (c Certificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Certificate. +func (c *Certificate) UnmarshalJSON(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 "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, 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 "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 CertificateBaseProperties. +func (c CertificateBaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "format", c.Format) + populate(objectMap, "thumbprint", c.Thumbprint) + populate(objectMap, "thumbprintAlgorithm", c.ThumbprintAlgorithm) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateBaseProperties. +func (c *CertificateBaseProperties) UnmarshalJSON(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 "format": + err = unpopulate(val, "Format", &c.Format) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &c.Thumbprint) + delete(rawMsg, key) + case "thumbprintAlgorithm": + err = unpopulate(val, "ThumbprintAlgorithm", &c.ThumbprintAlgorithm) + 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 CertificateCreateOrUpdateParameters. +func (c CertificateCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateCreateOrUpdateParameters. +func (c *CertificateCreateOrUpdateParameters) UnmarshalJSON(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 "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, 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 "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 CertificateCreateOrUpdateProperties. +func (c CertificateCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "data", c.Data) + populate(objectMap, "format", c.Format) + populate(objectMap, "password", c.Password) + populate(objectMap, "thumbprint", c.Thumbprint) + populate(objectMap, "thumbprintAlgorithm", c.ThumbprintAlgorithm) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateCreateOrUpdateProperties. +func (c *CertificateCreateOrUpdateProperties) UnmarshalJSON(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 "data": + err = unpopulate(val, "Data", &c.Data) + delete(rawMsg, key) + case "format": + err = unpopulate(val, "Format", &c.Format) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &c.Password) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &c.Thumbprint) + delete(rawMsg, key) + case "thumbprintAlgorithm": + err = unpopulate(val, "ThumbprintAlgorithm", &c.ThumbprintAlgorithm) + 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 CertificateProperties. +func (c CertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deleteCertificateError", c.DeleteCertificateError) + populate(objectMap, "format", c.Format) + populate(objectMap, "previousProvisioningState", c.PreviousProvisioningState) + populateTimeRFC3339(objectMap, "previousProvisioningStateTransitionTime", c.PreviousProvisioningStateTransitionTime) + populate(objectMap, "provisioningState", c.ProvisioningState) + populateTimeRFC3339(objectMap, "provisioningStateTransitionTime", c.ProvisioningStateTransitionTime) + populate(objectMap, "publicData", c.PublicData) + populate(objectMap, "thumbprint", c.Thumbprint) + populate(objectMap, "thumbprintAlgorithm", c.ThumbprintAlgorithm) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateProperties. +func (c *CertificateProperties) UnmarshalJSON(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 "deleteCertificateError": + err = unpopulate(val, "DeleteCertificateError", &c.DeleteCertificateError) + delete(rawMsg, key) + case "format": + err = unpopulate(val, "Format", &c.Format) + delete(rawMsg, key) + case "previousProvisioningState": + err = unpopulate(val, "PreviousProvisioningState", &c.PreviousProvisioningState) + delete(rawMsg, key) + case "previousProvisioningStateTransitionTime": + err = unpopulateTimeRFC3339(val, "PreviousProvisioningStateTransitionTime", &c.PreviousProvisioningStateTransitionTime) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "provisioningStateTransitionTime": + err = unpopulateTimeRFC3339(val, "ProvisioningStateTransitionTime", &c.ProvisioningStateTransitionTime) + delete(rawMsg, key) + case "publicData": + err = unpopulate(val, "PublicData", &c.PublicData) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &c.Thumbprint) + delete(rawMsg, key) + case "thumbprintAlgorithm": + err = unpopulate(val, "ThumbprintAlgorithm", &c.ThumbprintAlgorithm) + 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 CertificateReference. +func (c CertificateReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "storeLocation", c.StoreLocation) + populate(objectMap, "storeName", c.StoreName) + populate(objectMap, "visibility", c.Visibility) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateReference. +func (c *CertificateReference) UnmarshalJSON(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 "storeLocation": + err = unpopulate(val, "StoreLocation", &c.StoreLocation) + delete(rawMsg, key) + case "storeName": + err = unpopulate(val, "StoreName", &c.StoreName) + delete(rawMsg, key) + case "visibility": + err = unpopulate(val, "Visibility", &c.Visibility) + 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 CheckNameAvailabilityParameters. +func (c CheckNameAvailabilityParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + objectMap["type"] = "Microsoft.Batch/batchAccounts" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityParameters. +func (c *CheckNameAvailabilityParameters) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &c.Name) + 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 CheckNameAvailabilityResult. +func (c CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResult. +func (c *CheckNameAvailabilityResult) UnmarshalJSON(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 "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + 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 CloudError. +func (c CloudError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", c.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudError. +func (c *CloudError) UnmarshalJSON(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 "error": + err = unpopulate(val, "Error", &c.Error) + 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 CloudErrorBody. +func (c CloudErrorBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", c.Code) + populate(objectMap, "details", c.Details) + populate(objectMap, "message", c.Message) + populate(objectMap, "target", c.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudErrorBody. +func (c *CloudErrorBody) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &c.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &c.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &c.Target) + 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 CloudServiceConfiguration. +func (c CloudServiceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "osFamily", c.OSFamily) + populate(objectMap, "osVersion", c.OSVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceConfiguration. +func (c *CloudServiceConfiguration) UnmarshalJSON(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 "osFamily": + err = unpopulate(val, "OSFamily", &c.OSFamily) + delete(rawMsg, key) + case "osVersion": + err = unpopulate(val, "OSVersion", &c.OSVersion) + 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 ComputeNodeIdentityReference. +func (c ComputeNodeIdentityReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "resourceId", c.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComputeNodeIdentityReference. +func (c *ComputeNodeIdentityReference) UnmarshalJSON(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 "resourceId": + err = unpopulate(val, "ResourceID", &c.ResourceID) + 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 ContainerConfiguration. +func (c ContainerConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "containerImageNames", c.ContainerImageNames) + populate(objectMap, "containerRegistries", c.ContainerRegistries) + objectMap["type"] = "DockerCompatible" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerConfiguration. +func (c *ContainerConfiguration) UnmarshalJSON(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 "containerImageNames": + err = unpopulate(val, "ContainerImageNames", &c.ContainerImageNames) + delete(rawMsg, key) + case "containerRegistries": + err = unpopulate(val, "ContainerRegistries", &c.ContainerRegistries) + 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 ContainerRegistry. +func (c ContainerRegistry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identityReference", c.IdentityReference) + populate(objectMap, "password", c.Password) + populate(objectMap, "registryServer", c.RegistryServer) + populate(objectMap, "username", c.UserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerRegistry. +func (c *ContainerRegistry) UnmarshalJSON(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 "identityReference": + err = unpopulate(val, "IdentityReference", &c.IdentityReference) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &c.Password) + delete(rawMsg, key) + case "registryServer": + err = unpopulate(val, "RegistryServer", &c.RegistryServer) + 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 DataDisk. +func (d DataDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "caching", d.Caching) + populate(objectMap, "diskSizeGB", d.DiskSizeGB) + populate(objectMap, "lun", d.Lun) + populate(objectMap, "storageAccountType", d.StorageAccountType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataDisk. +func (d *DataDisk) UnmarshalJSON(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 "caching": + err = unpopulate(val, "Caching", &d.Caching) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &d.DiskSizeGB) + delete(rawMsg, key) + case "lun": + err = unpopulate(val, "Lun", &d.Lun) + delete(rawMsg, key) + case "storageAccountType": + err = unpopulate(val, "StorageAccountType", &d.StorageAccountType) + 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 DeleteCertificateError. +func (d DeleteCertificateError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", d.Code) + populate(objectMap, "details", d.Details) + populate(objectMap, "message", d.Message) + populate(objectMap, "target", d.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeleteCertificateError. +func (d *DeleteCertificateError) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &d.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &d.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &d.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &d.Target) + 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 DeploymentConfiguration. +func (d DeploymentConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cloudServiceConfiguration", d.CloudServiceConfiguration) + populate(objectMap, "virtualMachineConfiguration", d.VirtualMachineConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentConfiguration. +func (d *DeploymentConfiguration) UnmarshalJSON(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 "cloudServiceConfiguration": + err = unpopulate(val, "CloudServiceConfiguration", &d.CloudServiceConfiguration) + delete(rawMsg, key) + case "virtualMachineConfiguration": + err = unpopulate(val, "VirtualMachineConfiguration", &d.VirtualMachineConfiguration) + 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 DetectorListResult. +func (d DetectorListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DetectorListResult. +func (d *DetectorListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + 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 DetectorResponse. +func (d DetectorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DetectorResponse. +func (d *DetectorResponse) UnmarshalJSON(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 "etag": + err = unpopulate(val, "Etag", &d.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + 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 DetectorResponseProperties. +func (d DetectorResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DetectorResponseProperties. +func (d *DetectorResponseProperties) UnmarshalJSON(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 "value": + err = unpopulate(val, "Value", &d.Value) + 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 DiffDiskSettings. +func (d DiffDiskSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["placement"] = "CacheDisk" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiffDiskSettings. +func (d *DiffDiskSettings) UnmarshalJSON(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 "placement": + err = unpopulate(val, "Placement", &d.Placement) + 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 DiskEncryptionConfiguration. +func (d DiskEncryptionConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "targets", d.Targets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskEncryptionConfiguration. +func (d *DiskEncryptionConfiguration) UnmarshalJSON(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 "targets": + err = unpopulate(val, "Targets", &d.Targets) + 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 EncryptionProperties. +func (e EncryptionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keySource", e.KeySource) + populate(objectMap, "keyVaultProperties", e.KeyVaultProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionProperties. +func (e *EncryptionProperties) UnmarshalJSON(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 "keySource": + err = unpopulate(val, "KeySource", &e.KeySource) + delete(rawMsg, key) + case "keyVaultProperties": + err = unpopulate(val, "KeyVaultProperties", &e.KeyVaultProperties) + 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 EndpointAccessProfile. +func (e EndpointAccessProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultAction", e.DefaultAction) + populate(objectMap, "ipRules", e.IPRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointAccessProfile. +func (e *EndpointAccessProfile) UnmarshalJSON(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 "defaultAction": + err = unpopulate(val, "DefaultAction", &e.DefaultAction) + delete(rawMsg, key) + case "ipRules": + err = unpopulate(val, "IPRules", &e.IPRules) + 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 EndpointDependency. +func (e EndpointDependency) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", e.Description) + populate(objectMap, "domainName", e.DomainName) + populate(objectMap, "endpointDetails", e.EndpointDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDependency. +func (e *EndpointDependency) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &e.Description) + delete(rawMsg, key) + case "domainName": + err = unpopulate(val, "DomainName", &e.DomainName) + delete(rawMsg, key) + case "endpointDetails": + err = unpopulate(val, "EndpointDetails", &e.EndpointDetails) + 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 EndpointDetail. +func (e EndpointDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "port", e.Port) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDetail. +func (e *EndpointDetail) UnmarshalJSON(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 "port": + err = unpopulate(val, "Port", &e.Port) + 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 EnvironmentSetting. +func (e EnvironmentSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", e.Name) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnvironmentSetting. +func (e *EnvironmentSetting) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &e.Name) + 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 FixedScaleSettings. +func (f FixedScaleSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nodeDeallocationOption", f.NodeDeallocationOption) + populate(objectMap, "resizeTimeout", f.ResizeTimeout) + populate(objectMap, "targetDedicatedNodes", f.TargetDedicatedNodes) + populate(objectMap, "targetLowPriorityNodes", f.TargetLowPriorityNodes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FixedScaleSettings. +func (f *FixedScaleSettings) UnmarshalJSON(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 "nodeDeallocationOption": + err = unpopulate(val, "NodeDeallocationOption", &f.NodeDeallocationOption) + delete(rawMsg, key) + case "resizeTimeout": + err = unpopulate(val, "ResizeTimeout", &f.ResizeTimeout) + delete(rawMsg, key) + case "targetDedicatedNodes": + err = unpopulate(val, "TargetDedicatedNodes", &f.TargetDedicatedNodes) + delete(rawMsg, key) + case "targetLowPriorityNodes": + err = unpopulate(val, "TargetLowPriorityNodes", &f.TargetLowPriorityNodes) + 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 IPRule. +func (i IPRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["action"] = "Allow" + populate(objectMap, "value", i.Value) + 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, "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 ImageReference. +func (i ImageReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + populate(objectMap, "offer", i.Offer) + populate(objectMap, "publisher", i.Publisher) + populate(objectMap, "sku", i.SKU) + populate(objectMap, "version", i.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageReference. +func (i *ImageReference) UnmarshalJSON(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 "offer": + err = unpopulate(val, "Offer", &i.Offer) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &i.Publisher) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &i.SKU) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &i.Version) + 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 InboundNatPool. +func (i InboundNatPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendPort", i.BackendPort) + populate(objectMap, "frontendPortRangeEnd", i.FrontendPortRangeEnd) + populate(objectMap, "frontendPortRangeStart", i.FrontendPortRangeStart) + populate(objectMap, "name", i.Name) + populate(objectMap, "networkSecurityGroupRules", i.NetworkSecurityGroupRules) + populate(objectMap, "protocol", i.Protocol) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InboundNatPool. +func (i *InboundNatPool) UnmarshalJSON(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 "backendPort": + err = unpopulate(val, "BackendPort", &i.BackendPort) + delete(rawMsg, key) + case "frontendPortRangeEnd": + err = unpopulate(val, "FrontendPortRangeEnd", &i.FrontendPortRangeEnd) + delete(rawMsg, key) + case "frontendPortRangeStart": + err = unpopulate(val, "FrontendPortRangeStart", &i.FrontendPortRangeStart) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "networkSecurityGroupRules": + err = unpopulate(val, "NetworkSecurityGroupRules", &i.NetworkSecurityGroupRules) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &i.Protocol) + 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, "keyIdentifier", k.KeyIdentifier) + 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 "keyIdentifier": + err = unpopulate(val, "KeyIdentifier", &k.KeyIdentifier) + 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 KeyVaultReference. +func (k KeyVaultReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", k.ID) + populate(objectMap, "url", k.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultReference. +func (k *KeyVaultReference) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &k.ID) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &k.URL) + 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 LinuxUserConfiguration. +func (l LinuxUserConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "gid", l.Gid) + populate(objectMap, "sshPrivateKey", l.SSHPrivateKey) + populate(objectMap, "uid", l.UID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinuxUserConfiguration. +func (l *LinuxUserConfiguration) UnmarshalJSON(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 "gid": + err = unpopulate(val, "Gid", &l.Gid) + delete(rawMsg, key) + case "sshPrivateKey": + err = unpopulate(val, "SSHPrivateKey", &l.SSHPrivateKey) + delete(rawMsg, key) + case "uid": + err = unpopulate(val, "UID", &l.UID) + 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 ListApplicationPackagesResult. +func (l ListApplicationPackagesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListApplicationPackagesResult. +func (l *ListApplicationPackagesResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + 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 ListApplicationsResult. +func (l ListApplicationsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListApplicationsResult. +func (l *ListApplicationsResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + 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 ListCertificatesResult. +func (l ListCertificatesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListCertificatesResult. +func (l *ListCertificatesResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + 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 ListPoolsResult. +func (l ListPoolsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListPoolsResult. +func (l *ListPoolsResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + 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 ListPrivateEndpointConnectionsResult. +func (l ListPrivateEndpointConnectionsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListPrivateEndpointConnectionsResult. +func (l *ListPrivateEndpointConnectionsResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + 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 ListPrivateLinkResourcesResult. +func (l ListPrivateLinkResourcesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListPrivateLinkResourcesResult. +func (l *ListPrivateLinkResourcesResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + 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 LocationQuota. +func (l LocationQuota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountQuota", l.AccountQuota) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocationQuota. +func (l *LocationQuota) UnmarshalJSON(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 "accountQuota": + err = unpopulate(val, "AccountQuota", &l.AccountQuota) + 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 MetadataItem. +func (m MetadataItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", m.Name) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataItem. +func (m *MetadataItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MountConfiguration. +func (m MountConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureBlobFileSystemConfiguration", m.AzureBlobFileSystemConfiguration) + populate(objectMap, "azureFileShareConfiguration", m.AzureFileShareConfiguration) + populate(objectMap, "cifsMountConfiguration", m.CifsMountConfiguration) + populate(objectMap, "nfsMountConfiguration", m.NfsMountConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MountConfiguration. +func (m *MountConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureBlobFileSystemConfiguration": + err = unpopulate(val, "AzureBlobFileSystemConfiguration", &m.AzureBlobFileSystemConfiguration) + delete(rawMsg, key) + case "azureFileShareConfiguration": + err = unpopulate(val, "AzureFileShareConfiguration", &m.AzureFileShareConfiguration) + delete(rawMsg, key) + case "cifsMountConfiguration": + err = unpopulate(val, "CifsMountConfiguration", &m.CifsMountConfiguration) + delete(rawMsg, key) + case "nfsMountConfiguration": + err = unpopulate(val, "NfsMountConfiguration", &m.NfsMountConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NFSMountConfiguration. +func (n NFSMountConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "mountOptions", n.MountOptions) + populate(objectMap, "relativeMountPath", n.RelativeMountPath) + populate(objectMap, "source", n.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NFSMountConfiguration. +func (n *NFSMountConfiguration) UnmarshalJSON(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 "mountOptions": + err = unpopulate(val, "MountOptions", &n.MountOptions) + delete(rawMsg, key) + case "relativeMountPath": + err = unpopulate(val, "RelativeMountPath", &n.RelativeMountPath) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &n.Source) + 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 NetworkConfiguration. +func (n NetworkConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dynamicVNetAssignmentScope", n.DynamicVNetAssignmentScope) + populate(objectMap, "endpointConfiguration", n.EndpointConfiguration) + populate(objectMap, "publicIPAddressConfiguration", n.PublicIPAddressConfiguration) + populate(objectMap, "subnetId", n.SubnetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkConfiguration. +func (n *NetworkConfiguration) UnmarshalJSON(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 "dynamicVNetAssignmentScope": + err = unpopulate(val, "DynamicVNetAssignmentScope", &n.DynamicVNetAssignmentScope) + delete(rawMsg, key) + case "endpointConfiguration": + err = unpopulate(val, "EndpointConfiguration", &n.EndpointConfiguration) + delete(rawMsg, key) + case "publicIPAddressConfiguration": + err = unpopulate(val, "PublicIPAddressConfiguration", &n.PublicIPAddressConfiguration) + delete(rawMsg, key) + case "subnetId": + err = unpopulate(val, "SubnetID", &n.SubnetID) + 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 NetworkProfile. +func (n NetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountAccess", n.AccountAccess) + populate(objectMap, "nodeManagementAccess", n.NodeManagementAccess) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfile. +func (n *NetworkProfile) UnmarshalJSON(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 "accountAccess": + err = unpopulate(val, "AccountAccess", &n.AccountAccess) + delete(rawMsg, key) + case "nodeManagementAccess": + err = unpopulate(val, "NodeManagementAccess", &n.NodeManagementAccess) + 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 NetworkSecurityGroupRule. +func (n NetworkSecurityGroupRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "access", n.Access) + populate(objectMap, "priority", n.Priority) + populate(objectMap, "sourceAddressPrefix", n.SourceAddressPrefix) + populate(objectMap, "sourcePortRanges", n.SourcePortRanges) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityGroupRule. +func (n *NetworkSecurityGroupRule) UnmarshalJSON(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 "access": + err = unpopulate(val, "Access", &n.Access) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &n.Priority) + delete(rawMsg, key) + case "sourceAddressPrefix": + err = unpopulate(val, "SourceAddressPrefix", &n.SourceAddressPrefix) + delete(rawMsg, key) + case "sourcePortRanges": + err = unpopulate(val, "SourcePortRanges", &n.SourcePortRanges) + 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 NodePlacementConfiguration. +func (n NodePlacementConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "policy", n.Policy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NodePlacementConfiguration. +func (n *NodePlacementConfiguration) UnmarshalJSON(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 "policy": + err = unpopulate(val, "Policy", &n.Policy) + 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 OSDisk. +func (o OSDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ephemeralOSDiskSettings", o.EphemeralOSDiskSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSDisk. +func (o *OSDisk) UnmarshalJSON(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 "ephemeralOSDiskSettings": + err = unpopulate(val, "EphemeralOSDiskSettings", &o.EphemeralOSDiskSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "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 Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "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 OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpoint. +func (o OutboundEnvironmentEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "category", o.Category) + populate(objectMap, "endpoints", o.Endpoints) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpoint. +func (o *OutboundEnvironmentEndpoint) UnmarshalJSON(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 "category": + err = unpopulate(val, "Category", &o.Category) + delete(rawMsg, key) + case "endpoints": + err = unpopulate(val, "Endpoints", &o.Endpoints) + 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 OutboundEnvironmentEndpointCollection. +func (o OutboundEnvironmentEndpointCollection) 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 OutboundEnvironmentEndpointCollection. +func (o *OutboundEnvironmentEndpointCollection) UnmarshalJSON(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 Pool. +func (p Pool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "identity", p.Identity) + 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 Pool. +func (p *Pool) UnmarshalJSON(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 "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &p.Identity) + 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 PoolEndpointConfiguration. +func (p PoolEndpointConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "inboundNatPools", p.InboundNatPools) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PoolEndpointConfiguration. +func (p *PoolEndpointConfiguration) UnmarshalJSON(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 "inboundNatPools": + err = unpopulate(val, "InboundNatPools", &p.InboundNatPools) + 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 PoolIdentity. +func (p PoolIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", p.Type) + populate(objectMap, "userAssignedIdentities", p.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PoolIdentity. +func (p *PoolIdentity) UnmarshalJSON(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 "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &p.UserAssignedIdentities) + 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 PoolProperties. +func (p PoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allocationState", p.AllocationState) + populateTimeRFC3339(objectMap, "allocationStateTransitionTime", p.AllocationStateTransitionTime) + populate(objectMap, "applicationLicenses", p.ApplicationLicenses) + populate(objectMap, "applicationPackages", p.ApplicationPackages) + populate(objectMap, "autoScaleRun", p.AutoScaleRun) + populate(objectMap, "certificates", p.Certificates) + populateTimeRFC3339(objectMap, "creationTime", p.CreationTime) + populate(objectMap, "currentDedicatedNodes", p.CurrentDedicatedNodes) + populate(objectMap, "currentLowPriorityNodes", p.CurrentLowPriorityNodes) + populate(objectMap, "deploymentConfiguration", p.DeploymentConfiguration) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "interNodeCommunication", p.InterNodeCommunication) + populateTimeRFC3339(objectMap, "lastModified", p.LastModified) + populate(objectMap, "metadata", p.Metadata) + populate(objectMap, "mountConfiguration", p.MountConfiguration) + populate(objectMap, "networkConfiguration", p.NetworkConfiguration) + populate(objectMap, "provisioningState", p.ProvisioningState) + populateTimeRFC3339(objectMap, "provisioningStateTransitionTime", p.ProvisioningStateTransitionTime) + populate(objectMap, "resizeOperationStatus", p.ResizeOperationStatus) + populate(objectMap, "scaleSettings", p.ScaleSettings) + populate(objectMap, "startTask", p.StartTask) + populate(objectMap, "taskSchedulingPolicy", p.TaskSchedulingPolicy) + populate(objectMap, "taskSlotsPerNode", p.TaskSlotsPerNode) + populate(objectMap, "userAccounts", p.UserAccounts) + populate(objectMap, "vmSize", p.VMSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PoolProperties. +func (p *PoolProperties) UnmarshalJSON(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 "allocationState": + err = unpopulate(val, "AllocationState", &p.AllocationState) + delete(rawMsg, key) + case "allocationStateTransitionTime": + err = unpopulateTimeRFC3339(val, "AllocationStateTransitionTime", &p.AllocationStateTransitionTime) + delete(rawMsg, key) + case "applicationLicenses": + err = unpopulate(val, "ApplicationLicenses", &p.ApplicationLicenses) + delete(rawMsg, key) + case "applicationPackages": + err = unpopulate(val, "ApplicationPackages", &p.ApplicationPackages) + delete(rawMsg, key) + case "autoScaleRun": + err = unpopulate(val, "AutoScaleRun", &p.AutoScaleRun) + delete(rawMsg, key) + case "certificates": + err = unpopulate(val, "Certificates", &p.Certificates) + delete(rawMsg, key) + case "creationTime": + err = unpopulateTimeRFC3339(val, "CreationTime", &p.CreationTime) + delete(rawMsg, key) + case "currentDedicatedNodes": + err = unpopulate(val, "CurrentDedicatedNodes", &p.CurrentDedicatedNodes) + delete(rawMsg, key) + case "currentLowPriorityNodes": + err = unpopulate(val, "CurrentLowPriorityNodes", &p.CurrentLowPriorityNodes) + delete(rawMsg, key) + case "deploymentConfiguration": + err = unpopulate(val, "DeploymentConfiguration", &p.DeploymentConfiguration) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "interNodeCommunication": + err = unpopulate(val, "InterNodeCommunication", &p.InterNodeCommunication) + delete(rawMsg, key) + case "lastModified": + err = unpopulateTimeRFC3339(val, "LastModified", &p.LastModified) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &p.Metadata) + delete(rawMsg, key) + case "mountConfiguration": + err = unpopulate(val, "MountConfiguration", &p.MountConfiguration) + delete(rawMsg, key) + case "networkConfiguration": + err = unpopulate(val, "NetworkConfiguration", &p.NetworkConfiguration) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "provisioningStateTransitionTime": + err = unpopulateTimeRFC3339(val, "ProvisioningStateTransitionTime", &p.ProvisioningStateTransitionTime) + delete(rawMsg, key) + case "resizeOperationStatus": + err = unpopulate(val, "ResizeOperationStatus", &p.ResizeOperationStatus) + delete(rawMsg, key) + case "scaleSettings": + err = unpopulate(val, "ScaleSettings", &p.ScaleSettings) + delete(rawMsg, key) + case "startTask": + err = unpopulate(val, "StartTask", &p.StartTask) + delete(rawMsg, key) + case "taskSchedulingPolicy": + err = unpopulate(val, "TaskSchedulingPolicy", &p.TaskSchedulingPolicy) + delete(rawMsg, key) + case "taskSlotsPerNode": + err = unpopulate(val, "TaskSlotsPerNode", &p.TaskSlotsPerNode) + delete(rawMsg, key) + case "userAccounts": + err = unpopulate(val, "UserAccounts", &p.UserAccounts) + delete(rawMsg, key) + case "vmSize": + err = unpopulate(val, "VMSize", &p.VMSize) + 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, "etag", p.Etag) + 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 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 "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, 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 PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupIds", p.GroupIDs) + 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 "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, 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, "etag", p.Etag) + 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 "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, 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 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, "actionRequired", p.ActionRequired) + 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 "actionRequired": + err = unpopulate(val, "ActionRequired", &p.ActionRequired) + 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 ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + 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 "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, 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 PublicIPAddressConfiguration. +func (p PublicIPAddressConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ipAddressIds", p.IPAddressIDs) + populate(objectMap, "provision", p.Provision) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicIPAddressConfiguration. +func (p *PublicIPAddressConfiguration) UnmarshalJSON(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 "ipAddressIds": + err = unpopulate(val, "IPAddressIDs", &p.IPAddressIDs) + delete(rawMsg, key) + case "provision": + err = unpopulate(val, "Provision", &p.Provision) + 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 ResizeError. +func (r ResizeError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", r.Code) + populate(objectMap, "details", r.Details) + populate(objectMap, "message", r.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResizeError. +func (r *ResizeError) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &r.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &r.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &r.Message) + 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 ResizeOperationStatus. +func (r ResizeOperationStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errors", r.Errors) + populate(objectMap, "nodeDeallocationOption", r.NodeDeallocationOption) + populate(objectMap, "resizeTimeout", r.ResizeTimeout) + populateTimeRFC3339(objectMap, "startTime", r.StartTime) + populate(objectMap, "targetDedicatedNodes", r.TargetDedicatedNodes) + populate(objectMap, "targetLowPriorityNodes", r.TargetLowPriorityNodes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResizeOperationStatus. +func (r *ResizeOperationStatus) UnmarshalJSON(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 "errors": + err = unpopulate(val, "Errors", &r.Errors) + delete(rawMsg, key) + case "nodeDeallocationOption": + err = unpopulate(val, "NodeDeallocationOption", &r.NodeDeallocationOption) + delete(rawMsg, key) + case "resizeTimeout": + err = unpopulate(val, "ResizeTimeout", &r.ResizeTimeout) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &r.StartTime) + delete(rawMsg, key) + case "targetDedicatedNodes": + err = unpopulate(val, "TargetDedicatedNodes", &r.TargetDedicatedNodes) + delete(rawMsg, key) + case "targetLowPriorityNodes": + err = unpopulate(val, "TargetLowPriorityNodes", &r.TargetLowPriorityNodes) + 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, "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 "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 ResourceFile. +func (r ResourceFile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoStorageContainerName", r.AutoStorageContainerName) + populate(objectMap, "blobPrefix", r.BlobPrefix) + populate(objectMap, "fileMode", r.FileMode) + populate(objectMap, "filePath", r.FilePath) + populate(objectMap, "httpUrl", r.HTTPURL) + populate(objectMap, "identityReference", r.IdentityReference) + populate(objectMap, "storageContainerUrl", r.StorageContainerURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceFile. +func (r *ResourceFile) UnmarshalJSON(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 "autoStorageContainerName": + err = unpopulate(val, "AutoStorageContainerName", &r.AutoStorageContainerName) + delete(rawMsg, key) + case "blobPrefix": + err = unpopulate(val, "BlobPrefix", &r.BlobPrefix) + delete(rawMsg, key) + case "fileMode": + err = unpopulate(val, "FileMode", &r.FileMode) + delete(rawMsg, key) + case "filePath": + err = unpopulate(val, "FilePath", &r.FilePath) + delete(rawMsg, key) + case "httpUrl": + err = unpopulate(val, "HTTPURL", &r.HTTPURL) + delete(rawMsg, key) + case "identityReference": + err = unpopulate(val, "IdentityReference", &r.IdentityReference) + delete(rawMsg, key) + case "storageContainerUrl": + err = unpopulate(val, "StorageContainerURL", &r.StorageContainerURL) + 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 SKUCapability. +func (s SKUCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUCapability. +func (s *SKUCapability) UnmarshalJSON(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 "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 ScaleSettings. +func (s ScaleSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoScale", s.AutoScale) + populate(objectMap, "fixedScale", s.FixedScale) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleSettings. +func (s *ScaleSettings) UnmarshalJSON(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 "autoScale": + err = unpopulate(val, "AutoScale", &s.AutoScale) + delete(rawMsg, key) + case "fixedScale": + err = unpopulate(val, "FixedScale", &s.FixedScale) + 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 StartTask. +func (s StartTask) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "commandLine", s.CommandLine) + populate(objectMap, "containerSettings", s.ContainerSettings) + populate(objectMap, "environmentSettings", s.EnvironmentSettings) + populate(objectMap, "maxTaskRetryCount", s.MaxTaskRetryCount) + populate(objectMap, "resourceFiles", s.ResourceFiles) + populate(objectMap, "userIdentity", s.UserIdentity) + populate(objectMap, "waitForSuccess", s.WaitForSuccess) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StartTask. +func (s *StartTask) UnmarshalJSON(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 "commandLine": + err = unpopulate(val, "CommandLine", &s.CommandLine) + delete(rawMsg, key) + case "containerSettings": + err = unpopulate(val, "ContainerSettings", &s.ContainerSettings) + delete(rawMsg, key) + case "environmentSettings": + err = unpopulate(val, "EnvironmentSettings", &s.EnvironmentSettings) + delete(rawMsg, key) + case "maxTaskRetryCount": + err = unpopulate(val, "MaxTaskRetryCount", &s.MaxTaskRetryCount) + delete(rawMsg, key) + case "resourceFiles": + err = unpopulate(val, "ResourceFiles", &s.ResourceFiles) + delete(rawMsg, key) + case "userIdentity": + err = unpopulate(val, "UserIdentity", &s.UserIdentity) + delete(rawMsg, key) + case "waitForSuccess": + err = unpopulate(val, "WaitForSuccess", &s.WaitForSuccess) + 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 SupportedSKU. +func (s SupportedSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capabilities", s.Capabilities) + populate(objectMap, "familyName", s.FamilyName) + populate(objectMap, "name", s.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SupportedSKU. +func (s *SupportedSKU) UnmarshalJSON(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 "capabilities": + err = unpopulate(val, "Capabilities", &s.Capabilities) + delete(rawMsg, key) + case "familyName": + err = unpopulate(val, "FamilyName", &s.FamilyName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + 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 SupportedSKUsResult. +func (s SupportedSKUsResult) 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 SupportedSKUsResult. +func (s *SupportedSKUsResult) UnmarshalJSON(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 TaskContainerSettings. +func (t TaskContainerSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "containerRunOptions", t.ContainerRunOptions) + populate(objectMap, "imageName", t.ImageName) + populate(objectMap, "registry", t.Registry) + populate(objectMap, "workingDirectory", t.WorkingDirectory) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskContainerSettings. +func (t *TaskContainerSettings) UnmarshalJSON(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 "containerRunOptions": + err = unpopulate(val, "ContainerRunOptions", &t.ContainerRunOptions) + delete(rawMsg, key) + case "imageName": + err = unpopulate(val, "ImageName", &t.ImageName) + delete(rawMsg, key) + case "registry": + err = unpopulate(val, "Registry", &t.Registry) + delete(rawMsg, key) + case "workingDirectory": + err = unpopulate(val, "WorkingDirectory", &t.WorkingDirectory) + 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 TaskSchedulingPolicy. +func (t TaskSchedulingPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nodeFillType", t.NodeFillType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskSchedulingPolicy. +func (t *TaskSchedulingPolicy) UnmarshalJSON(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 "nodeFillType": + err = unpopulate(val, "NodeFillType", &t.NodeFillType) + 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 UserAccount. +func (u UserAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "elevationLevel", u.ElevationLevel) + populate(objectMap, "linuxUserConfiguration", u.LinuxUserConfiguration) + populate(objectMap, "name", u.Name) + populate(objectMap, "password", u.Password) + populate(objectMap, "windowsUserConfiguration", u.WindowsUserConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAccount. +func (u *UserAccount) UnmarshalJSON(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 "elevationLevel": + err = unpopulate(val, "ElevationLevel", &u.ElevationLevel) + delete(rawMsg, key) + case "linuxUserConfiguration": + err = unpopulate(val, "LinuxUserConfiguration", &u.LinuxUserConfiguration) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &u.Password) + delete(rawMsg, key) + case "windowsUserConfiguration": + err = unpopulate(val, "WindowsUserConfiguration", &u.WindowsUserConfiguration) + 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 UserAssignedIdentities. +func (u UserAssignedIdentities) 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 UserAssignedIdentities. +func (u *UserAssignedIdentities) UnmarshalJSON(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 UserIdentity. +func (u UserIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoUser", u.AutoUser) + populate(objectMap, "userName", u.UserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserIdentity. +func (u *UserIdentity) UnmarshalJSON(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 "autoUser": + err = unpopulate(val, "AutoUser", &u.AutoUser) + delete(rawMsg, key) + case "userName": + err = unpopulate(val, "UserName", &u.UserName) + 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 VMExtension. +func (v VMExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoUpgradeMinorVersion", v.AutoUpgradeMinorVersion) + populate(objectMap, "name", v.Name) + populate(objectMap, "protectedSettings", &v.ProtectedSettings) + populate(objectMap, "provisionAfterExtensions", v.ProvisionAfterExtensions) + populate(objectMap, "publisher", v.Publisher) + populate(objectMap, "settings", &v.Settings) + populate(objectMap, "type", v.Type) + populate(objectMap, "typeHandlerVersion", v.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMExtension. +func (v *VMExtension) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoUpgradeMinorVersion": + err = unpopulate(val, "AutoUpgradeMinorVersion", &v.AutoUpgradeMinorVersion) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "protectedSettings": + err = unpopulate(val, "ProtectedSettings", &v.ProtectedSettings) + delete(rawMsg, key) + case "provisionAfterExtensions": + err = unpopulate(val, "ProvisionAfterExtensions", &v.ProvisionAfterExtensions) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &v.Publisher) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &v.Settings) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &v.TypeHandlerVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineConfiguration. +func (v VirtualMachineConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "containerConfiguration", v.ContainerConfiguration) + populate(objectMap, "dataDisks", v.DataDisks) + populate(objectMap, "diskEncryptionConfiguration", v.DiskEncryptionConfiguration) + populate(objectMap, "extensions", v.Extensions) + populate(objectMap, "imageReference", v.ImageReference) + populate(objectMap, "licenseType", v.LicenseType) + populate(objectMap, "nodeAgentSkuId", v.NodeAgentSKUID) + populate(objectMap, "nodePlacementConfiguration", v.NodePlacementConfiguration) + populate(objectMap, "osDisk", v.OSDisk) + populate(objectMap, "windowsConfiguration", v.WindowsConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineConfiguration. +func (v *VirtualMachineConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "containerConfiguration": + err = unpopulate(val, "ContainerConfiguration", &v.ContainerConfiguration) + delete(rawMsg, key) + case "dataDisks": + err = unpopulate(val, "DataDisks", &v.DataDisks) + delete(rawMsg, key) + case "diskEncryptionConfiguration": + err = unpopulate(val, "DiskEncryptionConfiguration", &v.DiskEncryptionConfiguration) + delete(rawMsg, key) + case "extensions": + err = unpopulate(val, "Extensions", &v.Extensions) + delete(rawMsg, key) + case "imageReference": + err = unpopulate(val, "ImageReference", &v.ImageReference) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, "LicenseType", &v.LicenseType) + delete(rawMsg, key) + case "nodeAgentSkuId": + err = unpopulate(val, "NodeAgentSKUID", &v.NodeAgentSKUID) + delete(rawMsg, key) + case "nodePlacementConfiguration": + err = unpopulate(val, "NodePlacementConfiguration", &v.NodePlacementConfiguration) + delete(rawMsg, key) + case "osDisk": + err = unpopulate(val, "OSDisk", &v.OSDisk) + delete(rawMsg, key) + case "windowsConfiguration": + err = unpopulate(val, "WindowsConfiguration", &v.WindowsConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineFamilyCoreQuota. +func (v VirtualMachineFamilyCoreQuota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "coreQuota", v.CoreQuota) + populate(objectMap, "name", v.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineFamilyCoreQuota. +func (v *VirtualMachineFamilyCoreQuota) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "coreQuota": + err = unpopulate(val, "CoreQuota", &v.CoreQuota) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WindowsConfiguration. +func (w WindowsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enableAutomaticUpdates", w.EnableAutomaticUpdates) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsConfiguration. +func (w *WindowsConfiguration) UnmarshalJSON(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 "enableAutomaticUpdates": + err = unpopulate(val, "EnableAutomaticUpdates", &w.EnableAutomaticUpdates) + 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 WindowsUserConfiguration. +func (w WindowsUserConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "loginMode", w.LoginMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsUserConfiguration. +func (w *WindowsUserConfiguration) UnmarshalJSON(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 "loginMode": + err = unpopulate(val, "LoginMode", &w.LoginMode) + 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/batch/armbatch/zz_generated_operations_client.go b/sdk/resourcemanager/batch/armbatch/operations_client.go similarity index 97% rename from sdk/resourcemanager/batch/armbatch/zz_generated_operations_client.go rename to sdk/resourcemanager/batch/armbatch/operations_client.go index fa6b4865ee0e..5f13f8bdaffe 100644 --- a/sdk/resourcemanager/batch/armbatch/zz_generated_operations_client.go +++ b/sdk/resourcemanager/batch/armbatch/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 armbatch @@ -50,7 +51,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists available operations for the Microsoft.Batch provider // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // 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 +89,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/batch/armbatch/zz_generated_pool_client.go b/sdk/resourcemanager/batch/armbatch/pool_client.go similarity index 97% rename from sdk/resourcemanager/batch/armbatch/zz_generated_pool_client.go rename to sdk/resourcemanager/batch/armbatch/pool_client.go index 13fb12645b74..06c46654182e 100644 --- a/sdk/resourcemanager/batch/armbatch/zz_generated_pool_client.go +++ b/sdk/resourcemanager/batch/armbatch/pool_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 armbatch @@ -57,7 +58,7 @@ func NewPoolClient(subscriptionID string, credential azcore.TokenCredential, opt // Create - Creates a new pool inside the specified account. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // poolName - The pool name. This must be unique within the account. @@ -102,7 +103,7 @@ func (client *PoolClient) createCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -128,7 +129,7 @@ func (client *PoolClient) createHandleResponse(resp *http.Response) (PoolClientC // BeginDelete - Deletes the specified pool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // poolName - The pool name. This must be unique within the account. @@ -149,7 +150,7 @@ func (client *PoolClient) BeginDelete(ctx context.Context, resourceGroupName str // Delete - Deletes the specified pool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 func (client *PoolClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, options *PoolClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, poolName, options) if err != nil { @@ -189,7 +190,7 @@ func (client *PoolClient) deleteCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -197,7 +198,7 @@ func (client *PoolClient) deleteCreateRequest(ctx context.Context, resourceGroup // DisableAutoScale - Disables automatic scaling for a pool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // poolName - The pool name. This must be unique within the account. @@ -241,7 +242,7 @@ func (client *PoolClient) disableAutoScaleCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,7 +262,7 @@ func (client *PoolClient) disableAutoScaleHandleResponse(resp *http.Response) (P // Get - Gets information about the specified pool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // poolName - The pool name. This must be unique within the account. @@ -305,7 +306,7 @@ func (client *PoolClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -325,7 +326,7 @@ func (client *PoolClient) getHandleResponse(resp *http.Response) (PoolClientGetR // NewListByBatchAccountPager - Lists all of the pools in the specified account. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // options - PoolClientListByBatchAccountOptions contains the optional parameters for the PoolClient.ListByBatchAccount method. @@ -386,7 +387,7 @@ func (client *PoolClient) listByBatchAccountCreateRequest(ctx context.Context, r if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -407,7 +408,7 @@ func (client *PoolClient) listByBatchAccountHandleResponse(resp *http.Response) // state changes first to stopping and then to steady. A resize operation need // not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // poolName - The pool name. This must be unique within the account. @@ -451,7 +452,7 @@ func (client *PoolClient) stopResizeCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -471,7 +472,7 @@ func (client *PoolClient) stopResizeHandleResponse(resp *http.Response) (PoolCli // Update - Updates the properties of an existing pool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // poolName - The pool name. This must be unique within the account. @@ -517,7 +518,7 @@ func (client *PoolClient) updateCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} diff --git a/sdk/resourcemanager/batch/armbatch/zz_generated_privateendpointconnection_client.go b/sdk/resourcemanager/batch/armbatch/privateendpointconnection_client.go similarity index 76% rename from sdk/resourcemanager/batch/armbatch/zz_generated_privateendpointconnection_client.go rename to sdk/resourcemanager/batch/armbatch/privateendpointconnection_client.go index b6d8be8830a5..10d014253e4b 100644 --- a/sdk/resourcemanager/batch/armbatch/zz_generated_privateendpointconnection_client.go +++ b/sdk/resourcemanager/batch/armbatch/privateendpointconnection_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 armbatch @@ -55,9 +56,79 @@ func NewPrivateEndpointConnectionClient(subscriptionID string, credential azcore return client, nil } +// BeginDelete - Deletes the specified private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01 +// resourceGroupName - The name of the resource group that contains the Batch account. +// accountName - The name of the Batch account. +// privateEndpointConnectionName - The private endpoint connection name. This must be unique within the account. +// options - PrivateEndpointConnectionClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionClient.BeginDelete +// method. +func (client *PrivateEndpointConnectionClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateEndpointConnectionClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-06-01 +func (client *PrivateEndpointConnectionClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + 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", "2022-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // Get - Gets information about the specified private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // privateEndpointConnectionName - The private endpoint connection name. This must be unique within the account. @@ -102,7 +173,7 @@ func (client *PrivateEndpointConnectionClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,7 +190,7 @@ func (client *PrivateEndpointConnectionClient) getHandleResponse(resp *http.Resp // NewListByBatchAccountPager - Lists all of the private endpoint connections in the specified account. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // options - PrivateEndpointConnectionClientListByBatchAccountOptions contains the optional parameters for the PrivateEndpointConnectionClient.ListByBatchAccount @@ -172,7 +243,7 @@ func (client *PrivateEndpointConnectionClient) listByBatchAccountCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") if options != nil && options.Maxresults != nil { reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) } @@ -192,7 +263,7 @@ func (client *PrivateEndpointConnectionClient) listByBatchAccountHandleResponse( // BeginUpdate - Updates the properties of an existing private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // privateEndpointConnectionName - The private endpoint connection name. This must be unique within the account. @@ -216,7 +287,7 @@ func (client *PrivateEndpointConnectionClient) BeginUpdate(ctx context.Context, // Update - Updates the properties of an existing private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 func (client *PrivateEndpointConnectionClient) update(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, parameters, options) if err != nil { @@ -256,7 +327,7 @@ func (client *PrivateEndpointConnectionClient) updateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} diff --git a/sdk/resourcemanager/batch/armbatch/zz_generated_privatelinkresource_client.go b/sdk/resourcemanager/batch/armbatch/privatelinkresource_client.go similarity index 98% rename from sdk/resourcemanager/batch/armbatch/zz_generated_privatelinkresource_client.go rename to sdk/resourcemanager/batch/armbatch/privatelinkresource_client.go index 5f56860df3d9..c935794354f1 100644 --- a/sdk/resourcemanager/batch/armbatch/zz_generated_privatelinkresource_client.go +++ b/sdk/resourcemanager/batch/armbatch/privatelinkresource_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 armbatch @@ -57,7 +58,7 @@ func NewPrivateLinkResourceClient(subscriptionID string, credential azcore.Token // Get - Gets information about the specified private link resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // privateLinkResourceName - The private link resource name. This must be unique within the account. @@ -101,7 +102,7 @@ func (client *PrivateLinkResourceClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -118,7 +119,7 @@ func (client *PrivateLinkResourceClient) getHandleResponse(resp *http.Response) // NewListByBatchAccountPager - Lists all of the private link resources in the specified account. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-01 +// Generated from API version 2022-06-01 // resourceGroupName - The name of the resource group that contains the Batch account. // accountName - The name of the Batch account. // options - PrivateLinkResourceClientListByBatchAccountOptions contains the optional parameters for the PrivateLinkResourceClient.ListByBatchAccount @@ -171,7 +172,7 @@ func (client *PrivateLinkResourceClient) listByBatchAccountCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2022-06-01") if options != nil && options.Maxresults != nil { reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) } diff --git a/sdk/resourcemanager/batch/armbatch/zz_generated_response_types.go b/sdk/resourcemanager/batch/armbatch/response_types.go similarity index 97% rename from sdk/resourcemanager/batch/armbatch/zz_generated_response_types.go rename to sdk/resourcemanager/batch/armbatch/response_types.go index d7355c820f62..d57ea4ada05b 100644 --- a/sdk/resourcemanager/batch/armbatch/zz_generated_response_types.go +++ b/sdk/resourcemanager/batch/armbatch/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 armbatch @@ -226,6 +227,11 @@ type PoolClientUpdateResponse struct { ETag *string } +// PrivateEndpointConnectionClientDeleteResponse contains the response from method PrivateEndpointConnectionClient.Delete. +type PrivateEndpointConnectionClientDeleteResponse struct { + // placeholder for future response values +} + // PrivateEndpointConnectionClientGetResponse contains the response from method PrivateEndpointConnectionClient.Get. type PrivateEndpointConnectionClientGetResponse struct { PrivateEndpointConnection diff --git a/sdk/resourcemanager/batch/armbatch/zz_generated_time_rfc3339.go b/sdk/resourcemanager/batch/armbatch/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/batch/armbatch/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/batch/armbatch/time_rfc3339.go index 4b2c51f1cf35..d79887cd5fae 100644 --- a/sdk/resourcemanager/batch/armbatch/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/batch/armbatch/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 armbatch diff --git a/sdk/resourcemanager/batch/armbatch/ze_generated_example_application_client_test.go b/sdk/resourcemanager/batch/armbatch/ze_generated_example_application_client_test.go deleted file mode 100644 index cf3d7e55df8a..000000000000 --- a/sdk/resourcemanager/batch/armbatch/ze_generated_example_application_client_test.go +++ /dev/null @@ -1,147 +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 armbatch_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/batch/armbatch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationCreate.json -func ExampleApplicationClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewApplicationClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "app1", - &armbatch.ApplicationClientCreateOptions{Parameters: &armbatch.Application{ - Properties: &armbatch.ApplicationProperties{ - AllowUpdates: to.Ptr(false), - DisplayName: to.Ptr("myAppName"), - }, - }, - }) - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationDelete.json -func ExampleApplicationClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewApplicationClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "app1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationGet.json -func ExampleApplicationClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewApplicationClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "app1", - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationUpdate.json -func ExampleApplicationClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewApplicationClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "app1", - armbatch.Application{ - Properties: &armbatch.ApplicationProperties{ - AllowUpdates: to.Ptr(true), - DefaultVersion: to.Ptr("2"), - DisplayName: to.Ptr("myAppName"), - }, - }, - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationList.json -func ExampleApplicationClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewApplicationClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("default-azurebatch-japaneast", - "sampleacct", - &armbatch.ApplicationClientListOptions{Maxresults: 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/batch/armbatch/ze_generated_example_applicationpackage_client_test.go b/sdk/resourcemanager/batch/armbatch/ze_generated_example_applicationpackage_client_test.go deleted file mode 100644 index e951e71161b7..000000000000 --- a/sdk/resourcemanager/batch/armbatch/ze_generated_example_applicationpackage_client_test.go +++ /dev/null @@ -1,142 +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 armbatch_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/batch/armbatch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageActivate.json -func ExampleApplicationPackageClient_Activate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewApplicationPackageClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Activate(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "app1", - "1", - armbatch.ActivateApplicationPackageParameters{ - Format: to.Ptr("zip"), - }, - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageCreate.json -func ExampleApplicationPackageClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewApplicationPackageClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "app1", - "1", - &armbatch.ApplicationPackageClientCreateOptions{Parameters: 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageDelete.json -func ExampleApplicationPackageClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewApplicationPackageClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "app1", - "1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageGet.json -func ExampleApplicationPackageClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewApplicationPackageClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "app1", - "1", - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/ApplicationPackageList.json -func ExampleApplicationPackageClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewApplicationPackageClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("default-azurebatch-japaneast", - "sampleacct", - "app1", - &armbatch.ApplicationPackageClientListOptions{Maxresults: 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/batch/armbatch/ze_generated_example_batchaccount_client_test.go b/sdk/resourcemanager/batch/armbatch/ze_generated_example_batchaccount_client_test.go deleted file mode 100644 index 47e6c10ce46c..000000000000 --- a/sdk/resourcemanager/batch/armbatch/ze_generated_example_batchaccount_client_test.go +++ /dev/null @@ -1,323 +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 armbatch_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/batch/armbatch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountCreate_BYOS.json -func ExampleAccountClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewAccountClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "default-azurebatch-japaneast", - "sampleacct", - armbatch.AccountCreateParameters{ - Location: to.Ptr("japaneast"), - Properties: &armbatch.AccountCreateProperties{ - AutoStorage: &armbatch.AutoStorageBaseProperties{ - StorageAccountID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"), - }, - KeyVaultReference: &armbatch.KeyVaultReference{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample"), - URL: to.Ptr("http://sample.vault.azure.net/"), - }, - PoolAllocationMode: to.Ptr(armbatch.PoolAllocationModeUserSubscription), - }, - }, - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountUpdate.json -func ExampleAccountClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewAccountClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "default-azurebatch-japaneast", - "sampleacct", - armbatch.AccountUpdateParameters{ - Properties: &armbatch.AccountUpdateProperties{ - AutoStorage: &armbatch.AutoStorageBaseProperties{ - StorageAccountID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"), - }, - }, - }, - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountDelete.json -func ExampleAccountClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewAccountClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "default-azurebatch-japaneast", - "sampleacct", - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountGet.json -func ExampleAccountClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewAccountClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "default-azurebatch-japaneast", - "sampleacct", - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountList.json -func ExampleAccountClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewAccountClient("subid", 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountListByResourceGroup.json -func ExampleAccountClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewAccountClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("default-azurebatch-japaneast", - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountSynchronizeAutoStorageKeys.json -func ExampleAccountClient_SynchronizeAutoStorageKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewAccountClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.SynchronizeAutoStorageKeys(ctx, - "default-azurebatch-japaneast", - "sampleacct", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountRegenerateKey.json -func ExampleAccountClient_RegenerateKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewAccountClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.RegenerateKey(ctx, - "default-azurebatch-japaneast", - "sampleacct", - armbatch.AccountRegenerateKeyParameters{ - KeyName: to.Ptr(armbatch.AccountKeyTypePrimary), - }, - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountGetKeys.json -func ExampleAccountClient_GetKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewAccountClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetKeys(ctx, - "default-azurebatch-japaneast", - "sampleacct", - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/DetectorList.json -func ExampleAccountClient_NewListDetectorsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewAccountClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListDetectorsPager("default-azurebatch-japaneast", - "sampleacct", - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/DetectorGet.json -func ExampleAccountClient_GetDetector() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewAccountClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetDetector(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "poolsAndNodes", - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/BatchAccountListOutboundNetworkDependenciesEndpoints.json -func ExampleAccountClient_NewListOutboundNetworkDependenciesEndpointsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewAccountClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListOutboundNetworkDependenciesEndpointsPager("default-azurebatch-japaneast", - "sampleacct", - 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/batch/armbatch/ze_generated_example_certificate_client_test.go b/sdk/resourcemanager/batch/armbatch/ze_generated_example_certificate_client_test.go deleted file mode 100644 index 7fe0cd55b6e6..000000000000 --- a/sdk/resourcemanager/batch/armbatch/ze_generated_example_certificate_client_test.go +++ /dev/null @@ -1,181 +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 armbatch_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/batch/armbatch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateList.json -func ExampleCertificateClient_NewListByBatchAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewCertificateClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBatchAccountPager("default-azurebatch-japaneast", - "sampleacct", - &armbatch.CertificateClientListByBatchAccountOptions{Maxresults: nil, - Select: nil, - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCreate_Full.json -func ExampleCertificateClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewCertificateClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e", - armbatch.CertificateCreateOrUpdateParameters{ - Properties: &armbatch.CertificateCreateOrUpdateProperties{ - Format: to.Ptr(armbatch.CertificateFormatPfx), - Thumbprint: to.Ptr("0a0e4f50d51beadeac1d35afc5116098e7902e6e"), - ThumbprintAlgorithm: to.Ptr("sha1"), - Data: to.Ptr("MIIJsgIBAzCCCW4GCSqGSIb3DQE..."), - Password: to.Ptr(""), - }, - }, - &armbatch.CertificateClientCreateOptions{IfMatch: nil, - IfNoneMatch: 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateUpdate.json -func ExampleCertificateClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewCertificateClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e", - armbatch.CertificateCreateOrUpdateParameters{ - Properties: &armbatch.CertificateCreateOrUpdateProperties{ - Data: to.Ptr("MIIJsgIBAzCCCW4GCSqGSIb3DQE..."), - Password: to.Ptr(""), - }, - }, - &armbatch.CertificateClientUpdateOptions{IfMatch: 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateDelete.json -func ExampleCertificateClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewCertificateClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e", - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateGet.json -func ExampleCertificateClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewCertificateClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e", - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/CertificateCancelDeletion.json -func ExampleCertificateClient_CancelDeletion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewCertificateClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CancelDeletion(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "sha1-0a0e4f50d51beadeac1d35afc5116098e7902e6e", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/batch/armbatch/ze_generated_example_location_client_test.go b/sdk/resourcemanager/batch/armbatch/ze_generated_example_location_client_test.go deleted file mode 100644 index a56c34ca9f4b..000000000000 --- a/sdk/resourcemanager/batch/armbatch/ze_generated_example_location_client_test.go +++ /dev/null @@ -1,64 +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 armbatch_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/batch/armbatch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationGetQuotas.json -func ExampleLocationClient_GetQuotas() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewLocationClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetQuotas(ctx, - "japaneast", - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/LocationCheckNameAvailability_AlreadyExists.json -func ExampleLocationClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewLocationClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, - "japaneast", - armbatch.CheckNameAvailabilityParameters{ - Name: to.Ptr("existingaccountname"), - Type: to.Ptr("Microsoft.Batch/batchAccounts"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/batch/armbatch/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/batch/armbatch/ze_generated_example_operations_client_test.go deleted file mode 100644 index 78fd5cbbef08..000000000000 --- a/sdk/resourcemanager/batch/armbatch/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 armbatch_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/OperationsList.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 := armbatch.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/batch/armbatch/ze_generated_example_pool_client_test.go b/sdk/resourcemanager/batch/armbatch/ze_generated_example_pool_client_test.go deleted file mode 100644 index db029a1496bd..000000000000 --- a/sdk/resourcemanager/batch/armbatch/ze_generated_example_pool_client_test.go +++ /dev/null @@ -1,211 +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 armbatch_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/batch/armbatch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolList.json -func ExamplePoolClient_NewListByBatchAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewPoolClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBatchAccountPager("default-azurebatch-japaneast", - "sampleacct", - &armbatch.PoolClientListByBatchAccountOptions{Maxresults: nil, - Select: nil, - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolCreate_SharedImageGallery.json -func ExamplePoolClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewPoolClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "testpool", - armbatch.Pool{ - Properties: &armbatch.PoolProperties{ - DeploymentConfiguration: &armbatch.DeploymentConfiguration{ - VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{ - ImageReference: &armbatch.ImageReference{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"), - }, - NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"), - }, - }, - VMSize: to.Ptr("STANDARD_D4"), - }, - }, - &armbatch.PoolClientCreateOptions{IfMatch: nil, - IfNoneMatch: 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolUpdate_EnableAutoScale.json -func ExamplePoolClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewPoolClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "testpool", - armbatch.Pool{ - Properties: &armbatch.PoolProperties{ - ScaleSettings: &armbatch.ScaleSettings{ - AutoScale: &armbatch.AutoScaleSettings{ - Formula: to.Ptr("$TargetDedicatedNodes=34"), - }, - }, - }, - }, - &armbatch.PoolClientUpdateOptions{IfMatch: 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolDelete.json -func ExamplePoolClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewPoolClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "testpool", - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolGet.json -func ExamplePoolClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewPoolClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "testpool", - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolDisableAutoScale.json -func ExamplePoolClient_DisableAutoScale() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewPoolClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.DisableAutoScale(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "testpool", - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PoolStopResize.json -func ExamplePoolClient_StopResize() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewPoolClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.StopResize(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "testpool", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/batch/armbatch/ze_generated_example_privateendpointconnection_client_test.go b/sdk/resourcemanager/batch/armbatch/ze_generated_example_privateendpointconnection_client_test.go deleted file mode 100644 index 8d47d8e27656..000000000000 --- a/sdk/resourcemanager/batch/armbatch/ze_generated_example_privateendpointconnection_client_test.go +++ /dev/null @@ -1,102 +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 armbatch_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/batch/armbatch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionsList.json -func ExamplePrivateEndpointConnectionClient_NewListByBatchAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewPrivateEndpointConnectionClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBatchAccountPager("default-azurebatch-japaneast", - "sampleacct", - &armbatch.PrivateEndpointConnectionClientListByBatchAccountOptions{Maxresults: 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionGet.json -func ExamplePrivateEndpointConnectionClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewPrivateEndpointConnectionClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "testprivateEndpointConnection5testprivateEndpointConnection5.24d6b4b5-e65c-4330-bbe9-3a290d62f8e0", - 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateEndpointConnectionUpdate.json -func ExamplePrivateEndpointConnectionClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewPrivateEndpointConnectionClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "testprivateEndpointConnection5.24d6b4b5-e65c-4330-bbe9-3a290d62f8e0", - armbatch.PrivateEndpointConnection{ - Properties: &armbatch.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armbatch.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Approved by xyz.abc@company.com"), - Status: to.Ptr(armbatch.PrivateLinkServiceConnectionStatusApproved), - }, - }, - }, - &armbatch.PrivateEndpointConnectionClientBeginUpdateOptions{IfMatch: 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/batch/armbatch/ze_generated_example_privatelinkresource_client_test.go b/sdk/resourcemanager/batch/armbatch/ze_generated_example_privatelinkresource_client_test.go deleted file mode 100644 index 6b2e16942a8d..000000000000 --- a/sdk/resourcemanager/batch/armbatch/ze_generated_example_privatelinkresource_client_test.go +++ /dev/null @@ -1,66 +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 armbatch_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateLinkResourcesList.json -func ExamplePrivateLinkResourceClient_NewListByBatchAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewPrivateLinkResourceClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBatchAccountPager("default-azurebatch-japaneast", - "sampleacct", - &armbatch.PrivateLinkResourceClientListByBatchAccountOptions{Maxresults: 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/batch/resource-manager/Microsoft.Batch/stable/2022-01-01/examples/PrivateLinkResourceGet.json -func ExamplePrivateLinkResourceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbatch.NewPrivateLinkResourceClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "default-azurebatch-japaneast", - "sampleacct", - "sampleacct", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/batch/armbatch/zz_generated_models_serde.go b/sdk/resourcemanager/batch/armbatch/zz_generated_models_serde.go deleted file mode 100644 index e83e9d447943..000000000000 --- a/sdk/resourcemanager/batch/armbatch/zz_generated_models_serde.go +++ /dev/null @@ -1,628 +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 armbatch - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AccountCreateParameters. -func (a AccountCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", a.Identity) - populate(objectMap, "location", a.Location) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AccountCreateProperties. -func (a AccountCreateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowedAuthenticationModes", a.AllowedAuthenticationModes) - populate(objectMap, "autoStorage", a.AutoStorage) - populate(objectMap, "encryption", a.Encryption) - populate(objectMap, "keyVaultReference", a.KeyVaultReference) - populate(objectMap, "poolAllocationMode", a.PoolAllocationMode) - populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AccountIdentity. -func (a AccountIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", a.PrincipalID) - populate(objectMap, "tenantId", a.TenantID) - populate(objectMap, "type", a.Type) - populate(objectMap, "userAssignedIdentities", a.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AccountUpdateParameters. -func (a AccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", a.Identity) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AccountUpdateProperties. -func (a AccountUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowedAuthenticationModes", a.AllowedAuthenticationModes) - populate(objectMap, "autoStorage", a.AutoStorage) - populate(objectMap, "encryption", a.Encryption) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Application. -func (a Application) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", a.Etag) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ApplicationPackageProperties. -func (a ApplicationPackageProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "format", a.Format) - populateTimeRFC3339(objectMap, "lastActivationTime", a.LastActivationTime) - populate(objectMap, "state", a.State) - populate(objectMap, "storageUrl", a.StorageURL) - populateTimeRFC3339(objectMap, "storageUrlExpiry", a.StorageURLExpiry) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationPackageProperties. -func (a *ApplicationPackageProperties) UnmarshalJSON(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 "format": - err = unpopulate(val, "Format", &a.Format) - delete(rawMsg, key) - case "lastActivationTime": - err = unpopulateTimeRFC3339(val, "LastActivationTime", &a.LastActivationTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &a.State) - delete(rawMsg, key) - case "storageUrl": - err = unpopulate(val, "StorageURL", &a.StorageURL) - delete(rawMsg, key) - case "storageUrlExpiry": - err = unpopulateTimeRFC3339(val, "StorageURLExpiry", &a.StorageURLExpiry) - 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 AutoScaleRun. -func (a AutoScaleRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "error", a.Error) - populateTimeRFC3339(objectMap, "evaluationTime", a.EvaluationTime) - populate(objectMap, "results", a.Results) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoScaleRun. -func (a *AutoScaleRun) UnmarshalJSON(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 "error": - err = unpopulate(val, "Error", &a.Error) - delete(rawMsg, key) - case "evaluationTime": - err = unpopulateTimeRFC3339(val, "EvaluationTime", &a.EvaluationTime) - delete(rawMsg, key) - case "results": - err = unpopulate(val, "Results", &a.Results) - 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 AutoScaleRunError. -func (a AutoScaleRunError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", a.Code) - populate(objectMap, "details", a.Details) - populate(objectMap, "message", a.Message) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AutoStorageProperties. -func (a AutoStorageProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authenticationMode", a.AuthenticationMode) - populateTimeRFC3339(objectMap, "lastKeySync", a.LastKeySync) - populate(objectMap, "nodeIdentityReference", a.NodeIdentityReference) - populate(objectMap, "storageAccountId", a.StorageAccountID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoStorageProperties. -func (a *AutoStorageProperties) UnmarshalJSON(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 "authenticationMode": - err = unpopulate(val, "AuthenticationMode", &a.AuthenticationMode) - delete(rawMsg, key) - case "lastKeySync": - err = unpopulateTimeRFC3339(val, "LastKeySync", &a.LastKeySync) - delete(rawMsg, key) - case "nodeIdentityReference": - err = unpopulate(val, "NodeIdentityReference", &a.NodeIdentityReference) - delete(rawMsg, key) - case "storageAccountId": - err = unpopulate(val, "StorageAccountID", &a.StorageAccountID) - 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 CertificateCreateOrUpdateParameters. -func (c CertificateCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", c.Etag) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CertificateProperties. -func (c CertificateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "deleteCertificateError", c.DeleteCertificateError) - populate(objectMap, "format", c.Format) - populate(objectMap, "previousProvisioningState", c.PreviousProvisioningState) - populateTimeRFC3339(objectMap, "previousProvisioningStateTransitionTime", c.PreviousProvisioningStateTransitionTime) - populate(objectMap, "provisioningState", c.ProvisioningState) - populateTimeRFC3339(objectMap, "provisioningStateTransitionTime", c.ProvisioningStateTransitionTime) - populate(objectMap, "publicData", c.PublicData) - populate(objectMap, "thumbprint", c.Thumbprint) - populate(objectMap, "thumbprintAlgorithm", c.ThumbprintAlgorithm) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateProperties. -func (c *CertificateProperties) UnmarshalJSON(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 "deleteCertificateError": - err = unpopulate(val, "DeleteCertificateError", &c.DeleteCertificateError) - delete(rawMsg, key) - case "format": - err = unpopulate(val, "Format", &c.Format) - delete(rawMsg, key) - case "previousProvisioningState": - err = unpopulate(val, "PreviousProvisioningState", &c.PreviousProvisioningState) - delete(rawMsg, key) - case "previousProvisioningStateTransitionTime": - err = unpopulateTimeRFC3339(val, "PreviousProvisioningStateTransitionTime", &c.PreviousProvisioningStateTransitionTime) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) - delete(rawMsg, key) - case "provisioningStateTransitionTime": - err = unpopulateTimeRFC3339(val, "ProvisioningStateTransitionTime", &c.ProvisioningStateTransitionTime) - delete(rawMsg, key) - case "publicData": - err = unpopulate(val, "PublicData", &c.PublicData) - delete(rawMsg, key) - case "thumbprint": - err = unpopulate(val, "Thumbprint", &c.Thumbprint) - delete(rawMsg, key) - case "thumbprintAlgorithm": - err = unpopulate(val, "ThumbprintAlgorithm", &c.ThumbprintAlgorithm) - 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 CertificateReference. -func (c CertificateReference) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - populate(objectMap, "storeLocation", c.StoreLocation) - populate(objectMap, "storeName", c.StoreName) - populate(objectMap, "visibility", c.Visibility) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ContainerConfiguration. -func (c ContainerConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "containerImageNames", c.ContainerImageNames) - populate(objectMap, "containerRegistries", c.ContainerRegistries) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DeleteCertificateError. -func (d DeleteCertificateError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", d.Code) - populate(objectMap, "details", d.Details) - populate(objectMap, "message", d.Message) - populate(objectMap, "target", d.Target) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DiskEncryptionConfiguration. -func (d DiskEncryptionConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "targets", d.Targets) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type InboundNatPool. -func (i InboundNatPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "backendPort", i.BackendPort) - populate(objectMap, "frontendPortRangeEnd", i.FrontendPortRangeEnd) - populate(objectMap, "frontendPortRangeStart", i.FrontendPortRangeStart) - populate(objectMap, "name", i.Name) - populate(objectMap, "networkSecurityGroupRules", i.NetworkSecurityGroupRules) - populate(objectMap, "protocol", i.Protocol) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityGroupRule. -func (n NetworkSecurityGroupRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "access", n.Access) - populate(objectMap, "priority", n.Priority) - populate(objectMap, "sourceAddressPrefix", n.SourceAddressPrefix) - populate(objectMap, "sourcePortRanges", n.SourcePortRanges) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Pool. -func (p Pool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", p.Etag) - populate(objectMap, "id", p.ID) - populate(objectMap, "identity", p.Identity) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PoolEndpointConfiguration. -func (p PoolEndpointConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "inboundNatPools", p.InboundNatPools) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PoolIdentity. -func (p PoolIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "type", p.Type) - populate(objectMap, "userAssignedIdentities", p.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PoolProperties. -func (p PoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allocationState", p.AllocationState) - populateTimeRFC3339(objectMap, "allocationStateTransitionTime", p.AllocationStateTransitionTime) - populate(objectMap, "applicationLicenses", p.ApplicationLicenses) - populate(objectMap, "applicationPackages", p.ApplicationPackages) - populate(objectMap, "autoScaleRun", p.AutoScaleRun) - populate(objectMap, "certificates", p.Certificates) - populateTimeRFC3339(objectMap, "creationTime", p.CreationTime) - populate(objectMap, "currentDedicatedNodes", p.CurrentDedicatedNodes) - populate(objectMap, "currentLowPriorityNodes", p.CurrentLowPriorityNodes) - populate(objectMap, "deploymentConfiguration", p.DeploymentConfiguration) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "interNodeCommunication", p.InterNodeCommunication) - populateTimeRFC3339(objectMap, "lastModified", p.LastModified) - populate(objectMap, "metadata", p.Metadata) - populate(objectMap, "mountConfiguration", p.MountConfiguration) - populate(objectMap, "networkConfiguration", p.NetworkConfiguration) - populate(objectMap, "provisioningState", p.ProvisioningState) - populateTimeRFC3339(objectMap, "provisioningStateTransitionTime", p.ProvisioningStateTransitionTime) - populate(objectMap, "resizeOperationStatus", p.ResizeOperationStatus) - populate(objectMap, "scaleSettings", p.ScaleSettings) - populate(objectMap, "startTask", p.StartTask) - populate(objectMap, "taskSchedulingPolicy", p.TaskSchedulingPolicy) - populate(objectMap, "taskSlotsPerNode", p.TaskSlotsPerNode) - populate(objectMap, "userAccounts", p.UserAccounts) - populate(objectMap, "vmSize", p.VMSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PoolProperties. -func (p *PoolProperties) UnmarshalJSON(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 "allocationState": - err = unpopulate(val, "AllocationState", &p.AllocationState) - delete(rawMsg, key) - case "allocationStateTransitionTime": - err = unpopulateTimeRFC3339(val, "AllocationStateTransitionTime", &p.AllocationStateTransitionTime) - delete(rawMsg, key) - case "applicationLicenses": - err = unpopulate(val, "ApplicationLicenses", &p.ApplicationLicenses) - delete(rawMsg, key) - case "applicationPackages": - err = unpopulate(val, "ApplicationPackages", &p.ApplicationPackages) - delete(rawMsg, key) - case "autoScaleRun": - err = unpopulate(val, "AutoScaleRun", &p.AutoScaleRun) - delete(rawMsg, key) - case "certificates": - err = unpopulate(val, "Certificates", &p.Certificates) - delete(rawMsg, key) - case "creationTime": - err = unpopulateTimeRFC3339(val, "CreationTime", &p.CreationTime) - delete(rawMsg, key) - case "currentDedicatedNodes": - err = unpopulate(val, "CurrentDedicatedNodes", &p.CurrentDedicatedNodes) - delete(rawMsg, key) - case "currentLowPriorityNodes": - err = unpopulate(val, "CurrentLowPriorityNodes", &p.CurrentLowPriorityNodes) - delete(rawMsg, key) - case "deploymentConfiguration": - err = unpopulate(val, "DeploymentConfiguration", &p.DeploymentConfiguration) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "interNodeCommunication": - err = unpopulate(val, "InterNodeCommunication", &p.InterNodeCommunication) - delete(rawMsg, key) - case "lastModified": - err = unpopulateTimeRFC3339(val, "LastModified", &p.LastModified) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &p.Metadata) - delete(rawMsg, key) - case "mountConfiguration": - err = unpopulate(val, "MountConfiguration", &p.MountConfiguration) - delete(rawMsg, key) - case "networkConfiguration": - err = unpopulate(val, "NetworkConfiguration", &p.NetworkConfiguration) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) - delete(rawMsg, key) - case "provisioningStateTransitionTime": - err = unpopulateTimeRFC3339(val, "ProvisioningStateTransitionTime", &p.ProvisioningStateTransitionTime) - delete(rawMsg, key) - case "resizeOperationStatus": - err = unpopulate(val, "ResizeOperationStatus", &p.ResizeOperationStatus) - delete(rawMsg, key) - case "scaleSettings": - err = unpopulate(val, "ScaleSettings", &p.ScaleSettings) - delete(rawMsg, key) - case "startTask": - err = unpopulate(val, "StartTask", &p.StartTask) - delete(rawMsg, key) - case "taskSchedulingPolicy": - err = unpopulate(val, "TaskSchedulingPolicy", &p.TaskSchedulingPolicy) - delete(rawMsg, key) - case "taskSlotsPerNode": - err = unpopulate(val, "TaskSlotsPerNode", &p.TaskSlotsPerNode) - delete(rawMsg, key) - case "userAccounts": - err = unpopulate(val, "UserAccounts", &p.UserAccounts) - delete(rawMsg, key) - case "vmSize": - err = unpopulate(val, "VMSize", &p.VMSize) - 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, "etag", p.Etag) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// 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) -} - -// MarshalJSON implements the json.Marshaller interface for type PublicIPAddressConfiguration. -func (p PublicIPAddressConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "ipAddressIds", p.IPAddressIDs) - populate(objectMap, "provision", p.Provision) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ResizeError. -func (r ResizeError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", r.Code) - populate(objectMap, "details", r.Details) - populate(objectMap, "message", r.Message) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ResizeOperationStatus. -func (r ResizeOperationStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "errors", r.Errors) - populate(objectMap, "nodeDeallocationOption", r.NodeDeallocationOption) - populate(objectMap, "resizeTimeout", r.ResizeTimeout) - populateTimeRFC3339(objectMap, "startTime", r.StartTime) - populate(objectMap, "targetDedicatedNodes", r.TargetDedicatedNodes) - populate(objectMap, "targetLowPriorityNodes", r.TargetLowPriorityNodes) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResizeOperationStatus. -func (r *ResizeOperationStatus) UnmarshalJSON(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 "errors": - err = unpopulate(val, "Errors", &r.Errors) - delete(rawMsg, key) - case "nodeDeallocationOption": - err = unpopulate(val, "NodeDeallocationOption", &r.NodeDeallocationOption) - delete(rawMsg, key) - case "resizeTimeout": - err = unpopulate(val, "ResizeTimeout", &r.ResizeTimeout) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &r.StartTime) - delete(rawMsg, key) - case "targetDedicatedNodes": - err = unpopulate(val, "TargetDedicatedNodes", &r.TargetDedicatedNodes) - delete(rawMsg, key) - case "targetLowPriorityNodes": - err = unpopulate(val, "TargetLowPriorityNodes", &r.TargetLowPriorityNodes) - 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 StartTask. -func (s StartTask) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "commandLine", s.CommandLine) - populate(objectMap, "containerSettings", s.ContainerSettings) - populate(objectMap, "environmentSettings", s.EnvironmentSettings) - populate(objectMap, "maxTaskRetryCount", s.MaxTaskRetryCount) - populate(objectMap, "resourceFiles", s.ResourceFiles) - populate(objectMap, "userIdentity", s.UserIdentity) - populate(objectMap, "waitForSuccess", s.WaitForSuccess) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type VMExtension. -func (v VMExtension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "autoUpgradeMinorVersion", v.AutoUpgradeMinorVersion) - populate(objectMap, "name", v.Name) - populate(objectMap, "protectedSettings", &v.ProtectedSettings) - populate(objectMap, "provisionAfterExtensions", v.ProvisionAfterExtensions) - populate(objectMap, "publisher", v.Publisher) - populate(objectMap, "settings", &v.Settings) - populate(objectMap, "type", v.Type) - populate(objectMap, "typeHandlerVersion", v.TypeHandlerVersion) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type VirtualMachineConfiguration. -func (v VirtualMachineConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "containerConfiguration", v.ContainerConfiguration) - populate(objectMap, "dataDisks", v.DataDisks) - populate(objectMap, "diskEncryptionConfiguration", v.DiskEncryptionConfiguration) - populate(objectMap, "extensions", v.Extensions) - populate(objectMap, "imageReference", v.ImageReference) - populate(objectMap, "licenseType", v.LicenseType) - populate(objectMap, "nodeAgentSkuId", v.NodeAgentSKUID) - populate(objectMap, "nodePlacementConfiguration", v.NodePlacementConfiguration) - populate(objectMap, "osDisk", v.OSDisk) - populate(objectMap, "windowsConfiguration", v.WindowsConfiguration) - 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 -}