diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/CHANGELOG.md b/sdk/resourcemanager/frontdoor/armfrontdoor/CHANGELOG.md index e13b1c9f70d8..80f897a8c560 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/CHANGELOG.md +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.1.0 (2023-01-03) +### Features Added + +- New value `ActionTypeAnomalyScoring` added to type alias `ActionType` +- New value `FrontDoorResourceStateMigrated`, `FrontDoorResourceStateMigrating` added to type alias `FrontDoorResourceState` +- New function `*PoliciesClient.BeginUpdate(context.Context, string, string, TagsObject, *PoliciesClientBeginUpdateOptions) (*runtime.Poller[PoliciesClientUpdateResponse], error)` +- New struct `PoliciesClientUpdateResponse` +- New field `ExtendedProperties` in struct `Properties` + + ## 1.0.0 (2022-05-18) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/frontdoor/armfrontdoor` 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/frontdoor/armfrontdoor/autorest.md b/sdk/resourcemanager/frontdoor/armfrontdoor/autorest.md index 3bce7b5adbc6..3847750764b5 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/autorest.md +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/frontdoor/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/frontdoor/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/frontdoor/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/frontdoor/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 1.1.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_constants.go b/sdk/resourcemanager/frontdoor/armfrontdoor/constants.go similarity index 98% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_constants.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/constants.go index 9f6f3aed1329..2729e85d6da0 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_constants.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/constants.go @@ -5,28 +5,31 @@ // 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 armfrontdoor const ( moduleName = "armfrontdoor" - moduleVersion = "v1.0.0" + moduleVersion = "v1.1.0" ) // ActionType - Defines the action to take on rule match. type ActionType string const ( - ActionTypeAllow ActionType = "Allow" - ActionTypeBlock ActionType = "Block" - ActionTypeLog ActionType = "Log" - ActionTypeRedirect ActionType = "Redirect" + ActionTypeAllow ActionType = "Allow" + ActionTypeAnomalyScoring ActionType = "AnomalyScoring" + ActionTypeBlock ActionType = "Block" + ActionTypeLog ActionType = "Log" + ActionTypeRedirect ActionType = "Redirect" ) // PossibleActionTypeValues returns the possible values for the ActionType const type. func PossibleActionTypeValues() []ActionType { return []ActionType{ ActionTypeAllow, + ActionTypeAnomalyScoring, ActionTypeBlock, ActionTypeLog, ActionTypeRedirect, @@ -369,6 +372,8 @@ const ( FrontDoorResourceStateDisabling FrontDoorResourceState = "Disabling" FrontDoorResourceStateEnabled FrontDoorResourceState = "Enabled" FrontDoorResourceStateEnabling FrontDoorResourceState = "Enabling" + FrontDoorResourceStateMigrated FrontDoorResourceState = "Migrated" + FrontDoorResourceStateMigrating FrontDoorResourceState = "Migrating" ) // PossibleFrontDoorResourceStateValues returns the possible values for the FrontDoorResourceState const type. @@ -380,6 +385,8 @@ func PossibleFrontDoorResourceStateValues() []FrontDoorResourceState { FrontDoorResourceStateDisabling, FrontDoorResourceStateEnabled, FrontDoorResourceStateEnabling, + FrontDoorResourceStateMigrated, + FrontDoorResourceStateMigrating, } } diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_endpoints_client.go b/sdk/resourcemanager/frontdoor/armfrontdoor/endpoints_client.go similarity index 97% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_endpoints_client.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/endpoints_client.go index 85f6e3655e1b..6827f2c303ad 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_endpoints_client.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/endpoints_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 armfrontdoor @@ -57,7 +58,7 @@ func NewEndpointsClient(subscriptionID string, credential azcore.TokenCredential // BeginPurgeContent - Removes a content from Front Door. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // frontDoorName - Name of the Front Door which is globally unique. // contentFilePaths - The path to the content to be purged. Path can be a full URL, e.g. '/pictures/city.png' which removes @@ -81,7 +82,7 @@ func (client *EndpointsClient) BeginPurgeContent(ctx context.Context, resourceGr // PurgeContent - Removes a content from Front Door. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 func (client *EndpointsClient) purgeContent(ctx context.Context, resourceGroupName string, frontDoorName string, contentFilePaths PurgeParameters, options *EndpointsClientBeginPurgeContentOptions) (*http.Response, error) { req, err := client.purgeContentCreateRequest(ctx, resourceGroupName, frontDoorName, contentFilePaths, options) if err != nil { @@ -117,7 +118,7 @@ func (client *EndpointsClient) purgeContentCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, contentFilePaths) diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_experiments_client.go b/sdk/resourcemanager/frontdoor/armfrontdoor/experiments_client.go similarity index 99% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_experiments_client.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/experiments_client.go index a18c5192e3f3..d80b67d40a94 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_experiments_client.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/experiments_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 armfrontdoor @@ -253,7 +254,6 @@ func (client *ExperimentsClient) getHandleResponse(resp *http.Response) (Experim } // NewListByProfilePager - Gets a list of Experiments -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-11-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // profileName - The Profile identifier associated with the Tenant and Partner diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_frontdoors_client.go b/sdk/resourcemanager/frontdoor/armfrontdoor/frontdoors_client.go similarity index 96% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_frontdoors_client.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/frontdoors_client.go index 4c66ac09bebe..2de16a71d66c 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_frontdoors_client.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/frontdoors_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 armfrontdoor @@ -57,7 +58,7 @@ func NewFrontDoorsClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreateOrUpdate - Creates a new Front Door with a Front Door name under the specified subscription and resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // frontDoorName - Name of the Front Door which is globally unique. // frontDoorParameters - Front Door properties needed to create a new Front Door. @@ -79,7 +80,7 @@ func (client *FrontDoorsClient) BeginCreateOrUpdate(ctx context.Context, resourc // CreateOrUpdate - Creates a new Front Door with a Front Door name under the specified subscription and resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 func (client *FrontDoorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, frontDoorName string, frontDoorParameters FrontDoor, options *FrontDoorsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, frontDoorName, frontDoorParameters, options) if err != nil { @@ -115,7 +116,7 @@ func (client *FrontDoorsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, frontDoorParameters) @@ -123,7 +124,7 @@ func (client *FrontDoorsClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Deletes an existing Front Door with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // frontDoorName - Name of the Front Door which is globally unique. // options - FrontDoorsClientBeginDeleteOptions contains the optional parameters for the FrontDoorsClient.BeginDelete method. @@ -143,7 +144,7 @@ func (client *FrontDoorsClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes an existing Front Door with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 func (client *FrontDoorsClient) deleteOperation(ctx context.Context, resourceGroupName string, frontDoorName string, options *FrontDoorsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, frontDoorName, options) if err != nil { @@ -179,7 +180,7 @@ func (client *FrontDoorsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -187,7 +188,7 @@ func (client *FrontDoorsClient) deleteCreateRequest(ctx context.Context, resourc // Get - Gets a Front Door with the specified Front Door name under the specified subscription and resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // frontDoorName - Name of the Front Door which is globally unique. // options - FrontDoorsClientGetOptions contains the optional parameters for the FrontDoorsClient.Get method. @@ -226,7 +227,7 @@ func (client *FrontDoorsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,8 +243,7 @@ func (client *FrontDoorsClient) getHandleResponse(resp *http.Response) (FrontDoo } // NewListPager - Lists all of the Front Doors within an Azure subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // options - FrontDoorsClientListOptions contains the optional parameters for the FrontDoorsClient.List method. func (client *FrontDoorsClient) NewListPager(options *FrontDoorsClientListOptions) *runtime.Pager[FrontDoorsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[FrontDoorsClientListResponse]{ @@ -285,7 +285,7 @@ func (client *FrontDoorsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -301,8 +301,7 @@ func (client *FrontDoorsClient) listHandleResponse(resp *http.Response) (FrontDo } // NewListByResourceGroupPager - Lists all of the Front Doors within a resource group under a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // options - FrontDoorsClientListByResourceGroupOptions contains the optional parameters for the FrontDoorsClient.ListByResourceGroup // method. @@ -350,7 +349,7 @@ func (client *FrontDoorsClient) listByResourceGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -367,7 +366,7 @@ func (client *FrontDoorsClient) listByResourceGroupHandleResponse(resp *http.Res // ValidateCustomDomain - Validates the custom domain mapping to ensure it maps to the correct Front Door endpoint in DNS. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // frontDoorName - Name of the Front Door which is globally unique. // customDomainProperties - Custom domain to be validated. @@ -408,7 +407,7 @@ func (client *FrontDoorsClient) validateCustomDomainCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, customDomainProperties) diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_frontendendpoints_client.go b/sdk/resourcemanager/frontdoor/armfrontdoor/frontendendpoints_client.go similarity index 97% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_frontendendpoints_client.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/frontendendpoints_client.go index c53e0c27d1bd..c285baa835e1 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_frontendendpoints_client.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/frontendendpoints_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 armfrontdoor @@ -57,7 +58,7 @@ func NewFrontendEndpointsClient(subscriptionID string, credential azcore.TokenCr // BeginDisableHTTPS - Disables a frontendEndpoint for HTTPS traffic // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // frontDoorName - Name of the Front Door which is globally unique. // frontendEndpointName - Name of the Frontend endpoint which is unique within the Front Door. @@ -79,7 +80,7 @@ func (client *FrontendEndpointsClient) BeginDisableHTTPS(ctx context.Context, re // DisableHTTPS - Disables a frontendEndpoint for HTTPS traffic // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 func (client *FrontendEndpointsClient) disableHTTPS(ctx context.Context, resourceGroupName string, frontDoorName string, frontendEndpointName string, options *FrontendEndpointsClientBeginDisableHTTPSOptions) (*http.Response, error) { req, err := client.disableHTTPSCreateRequest(ctx, resourceGroupName, frontDoorName, frontendEndpointName, options) if err != nil { @@ -119,7 +120,7 @@ func (client *FrontendEndpointsClient) disableHTTPSCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -127,7 +128,7 @@ func (client *FrontendEndpointsClient) disableHTTPSCreateRequest(ctx context.Con // BeginEnableHTTPS - Enables a frontendEndpoint for HTTPS traffic // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // frontDoorName - Name of the Front Door which is globally unique. // frontendEndpointName - Name of the Frontend endpoint which is unique within the Front Door. @@ -150,7 +151,7 @@ func (client *FrontendEndpointsClient) BeginEnableHTTPS(ctx context.Context, res // EnableHTTPS - Enables a frontendEndpoint for HTTPS traffic // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 func (client *FrontendEndpointsClient) enableHTTPS(ctx context.Context, resourceGroupName string, frontDoorName string, frontendEndpointName string, customHTTPSConfiguration CustomHTTPSConfiguration, options *FrontendEndpointsClientBeginEnableHTTPSOptions) (*http.Response, error) { req, err := client.enableHTTPSCreateRequest(ctx, resourceGroupName, frontDoorName, frontendEndpointName, customHTTPSConfiguration, options) if err != nil { @@ -190,7 +191,7 @@ func (client *FrontendEndpointsClient) enableHTTPSCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, customHTTPSConfiguration) @@ -198,7 +199,7 @@ func (client *FrontendEndpointsClient) enableHTTPSCreateRequest(ctx context.Cont // Get - Gets a Frontend endpoint with the specified name within the specified Front Door. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // frontDoorName - Name of the Front Door which is globally unique. // frontendEndpointName - Name of the Frontend endpoint which is unique within the Front Door. @@ -242,7 +243,7 @@ func (client *FrontendEndpointsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -258,8 +259,7 @@ func (client *FrontendEndpointsClient) getHandleResponse(resp *http.Response) (F } // NewListByFrontDoorPager - Lists all of the frontend endpoints within a Front Door. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // frontDoorName - Name of the Front Door which is globally unique. // options - FrontendEndpointsClientListByFrontDoorOptions contains the optional parameters for the FrontendEndpointsClient.ListByFrontDoor @@ -312,7 +312,7 @@ func (client *FrontendEndpointsClient) listByFrontDoorCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/go.mod b/sdk/resourcemanager/frontdoor/armfrontdoor/go.mod index 747848d3efa1..89db61aaf1a1 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/go.mod +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/frontdoor/armfrontd 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/frontdoor/armfrontdoor/go.sum b/sdk/resourcemanager/frontdoor/armfrontdoor/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/go.sum +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/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/frontdoor/armfrontdoor/zz_generated_managedrulesets_client.go b/sdk/resourcemanager/frontdoor/armfrontdoor/managedrulesets_client.go similarity index 96% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_managedrulesets_client.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/managedrulesets_client.go index 7b9b5027515d..a1539dcbb9d6 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_managedrulesets_client.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/managedrulesets_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 armfrontdoor @@ -56,8 +57,7 @@ func NewManagedRuleSetsClient(subscriptionID string, credential azcore.TokenCred } // NewListPager - Lists all available managed rule sets. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-11-01 +// Generated from API version 2022-05-01 // options - ManagedRuleSetsClientListOptions contains the optional parameters for the ManagedRuleSetsClient.List method. func (client *ManagedRuleSetsClient) NewListPager(options *ManagedRuleSetsClientListOptions) *runtime.Pager[ManagedRuleSetsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ManagedRuleSetsClientListResponse]{ @@ -99,7 +99,7 @@ func (client *ManagedRuleSetsClient) listCreateRequest(ctx context.Context, opti return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_models.go b/sdk/resourcemanager/frontdoor/armfrontdoor/models.go similarity index 99% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_models.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/models.go index 381541c3a8da..5f82ab1443ce 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_models.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/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 armfrontdoor @@ -870,7 +871,7 @@ type ManagedRuleSet struct { // Defines the rule group overrides to apply to the rule set. RuleGroupOverrides []*ManagedRuleGroupOverride `json:"ruleGroupOverrides,omitempty"` - // Defines the action to take when a managed rule set score threshold is met. + // Defines the rule set action. RuleSetAction *ManagedRuleSetActionType `json:"ruleSetAction,omitempty"` } @@ -1016,6 +1017,12 @@ type PoliciesClientBeginDeleteOptions struct { ResumeToken string } +// PoliciesClientBeginUpdateOptions contains the optional parameters for the PoliciesClient.BeginUpdate method. +type PoliciesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // PoliciesClientGetOptions contains the optional parameters for the PoliciesClient.Get method. type PoliciesClientGetOptions struct { // placeholder for future optional parameters @@ -1183,6 +1190,9 @@ type Properties struct { // READ-ONLY; The host that each frontendEndpoint must CNAME to. Cname *string `json:"cname,omitempty" azure:"ro"` + // READ-ONLY; Key-Value pair representing additional properties for frontdoor. + ExtendedProperties map[string]*string `json:"extendedProperties,omitempty" azure:"ro"` + // READ-ONLY; The Id of the frontdoor. FrontdoorID *string `json:"frontdoorId,omitempty" azure:"ro"` diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/models_serde.go b/sdk/resourcemanager/frontdoor/armfrontdoor/models_serde.go new file mode 100644 index 000000000000..5780b173e250 --- /dev/null +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/models_serde.go @@ -0,0 +1,3772 @@ +//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 armfrontdoor + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AzureAsyncOperationResult. +func (a AzureAsyncOperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", a.Error) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureAsyncOperationResult. +func (a *AzureAsyncOperationResult) UnmarshalJSON(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 "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Backend. +func (b Backend) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "address", b.Address) + populate(objectMap, "backendHostHeader", b.BackendHostHeader) + populate(objectMap, "enabledState", b.EnabledState) + populate(objectMap, "httpPort", b.HTTPPort) + populate(objectMap, "httpsPort", b.HTTPSPort) + populate(objectMap, "priority", b.Priority) + populate(objectMap, "privateEndpointStatus", b.PrivateEndpointStatus) + populate(objectMap, "privateLinkAlias", b.PrivateLinkAlias) + populate(objectMap, "privateLinkApprovalMessage", b.PrivateLinkApprovalMessage) + populate(objectMap, "privateLinkLocation", b.PrivateLinkLocation) + populate(objectMap, "privateLinkResourceId", b.PrivateLinkResourceID) + populate(objectMap, "weight", b.Weight) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Backend. +func (b *Backend) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "address": + err = unpopulate(val, "Address", &b.Address) + delete(rawMsg, key) + case "backendHostHeader": + err = unpopulate(val, "BackendHostHeader", &b.BackendHostHeader) + delete(rawMsg, key) + case "enabledState": + err = unpopulate(val, "EnabledState", &b.EnabledState) + delete(rawMsg, key) + case "httpPort": + err = unpopulate(val, "HTTPPort", &b.HTTPPort) + delete(rawMsg, key) + case "httpsPort": + err = unpopulate(val, "HTTPSPort", &b.HTTPSPort) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &b.Priority) + delete(rawMsg, key) + case "privateEndpointStatus": + err = unpopulate(val, "PrivateEndpointStatus", &b.PrivateEndpointStatus) + delete(rawMsg, key) + case "privateLinkAlias": + err = unpopulate(val, "PrivateLinkAlias", &b.PrivateLinkAlias) + delete(rawMsg, key) + case "privateLinkApprovalMessage": + err = unpopulate(val, "PrivateLinkApprovalMessage", &b.PrivateLinkApprovalMessage) + delete(rawMsg, key) + case "privateLinkLocation": + err = unpopulate(val, "PrivateLinkLocation", &b.PrivateLinkLocation) + delete(rawMsg, key) + case "privateLinkResourceId": + err = unpopulate(val, "PrivateLinkResourceID", &b.PrivateLinkResourceID) + delete(rawMsg, key) + case "weight": + err = unpopulate(val, "Weight", &b.Weight) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendPool. +func (b BackendPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendPool. +func (b *BackendPool) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendPoolListResult. +func (b BackendPoolListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendPoolListResult. +func (b *BackendPoolListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendPoolProperties. +func (b BackendPoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backends", b.Backends) + populate(objectMap, "healthProbeSettings", b.HealthProbeSettings) + populate(objectMap, "loadBalancingSettings", b.LoadBalancingSettings) + populate(objectMap, "resourceState", b.ResourceState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendPoolProperties. +func (b *BackendPoolProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backends": + err = unpopulate(val, "Backends", &b.Backends) + delete(rawMsg, key) + case "healthProbeSettings": + err = unpopulate(val, "HealthProbeSettings", &b.HealthProbeSettings) + delete(rawMsg, key) + case "loadBalancingSettings": + err = unpopulate(val, "LoadBalancingSettings", &b.LoadBalancingSettings) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, "ResourceState", &b.ResourceState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendPoolUpdateParameters. +func (b BackendPoolUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backends", b.Backends) + populate(objectMap, "healthProbeSettings", b.HealthProbeSettings) + populate(objectMap, "loadBalancingSettings", b.LoadBalancingSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendPoolUpdateParameters. +func (b *BackendPoolUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backends": + err = unpopulate(val, "Backends", &b.Backends) + delete(rawMsg, key) + case "healthProbeSettings": + err = unpopulate(val, "HealthProbeSettings", &b.HealthProbeSettings) + delete(rawMsg, key) + case "loadBalancingSettings": + err = unpopulate(val, "LoadBalancingSettings", &b.LoadBalancingSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendPoolsSettings. +func (b BackendPoolsSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enforceCertificateNameCheck", b.EnforceCertificateNameCheck) + populate(objectMap, "sendRecvTimeoutSeconds", b.SendRecvTimeoutSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendPoolsSettings. +func (b *BackendPoolsSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enforceCertificateNameCheck": + err = unpopulate(val, "EnforceCertificateNameCheck", &b.EnforceCertificateNameCheck) + delete(rawMsg, key) + case "sendRecvTimeoutSeconds": + err = unpopulate(val, "SendRecvTimeoutSeconds", &b.SendRecvTimeoutSeconds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CacheConfiguration. +func (c CacheConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cacheDuration", c.CacheDuration) + populate(objectMap, "dynamicCompression", c.DynamicCompression) + populate(objectMap, "queryParameterStripDirective", c.QueryParameterStripDirective) + populate(objectMap, "queryParameters", c.QueryParameters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheConfiguration. +func (c *CacheConfiguration) UnmarshalJSON(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 "cacheDuration": + err = unpopulate(val, "CacheDuration", &c.CacheDuration) + delete(rawMsg, key) + case "dynamicCompression": + err = unpopulate(val, "DynamicCompression", &c.DynamicCompression) + delete(rawMsg, key) + case "queryParameterStripDirective": + err = unpopulate(val, "QueryParameterStripDirective", &c.QueryParameterStripDirective) + delete(rawMsg, key) + case "queryParameters": + err = unpopulate(val, "QueryParameters", &c.QueryParameters) + 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 CertificateSourceParameters. +func (c CertificateSourceParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "certificateType", c.CertificateType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateSourceParameters. +func (c *CertificateSourceParameters) UnmarshalJSON(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 "certificateType": + err = unpopulate(val, "CertificateType", &c.CertificateType) + 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 CheckNameAvailabilityInput. +func (c CheckNameAvailabilityInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityInput. +func (c *CheckNameAvailabilityInput) UnmarshalJSON(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 CheckNameAvailabilityOutput. +func (c CheckNameAvailabilityOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailability", c.NameAvailability) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityOutput. +func (c *CheckNameAvailabilityOutput) UnmarshalJSON(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 "nameAvailability": + err = unpopulate(val, "NameAvailability", &c.NameAvailability) + 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 CustomHTTPSConfiguration. +func (c CustomHTTPSConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "certificateSource", c.CertificateSource) + populate(objectMap, "frontDoorCertificateSourceParameters", c.FrontDoorCertificateSourceParameters) + populate(objectMap, "keyVaultCertificateSourceParameters", c.KeyVaultCertificateSourceParameters) + populate(objectMap, "minimumTlsVersion", c.MinimumTLSVersion) + populate(objectMap, "protocolType", c.ProtocolType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomHTTPSConfiguration. +func (c *CustomHTTPSConfiguration) UnmarshalJSON(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 "certificateSource": + err = unpopulate(val, "CertificateSource", &c.CertificateSource) + delete(rawMsg, key) + case "frontDoorCertificateSourceParameters": + err = unpopulate(val, "FrontDoorCertificateSourceParameters", &c.FrontDoorCertificateSourceParameters) + delete(rawMsg, key) + case "keyVaultCertificateSourceParameters": + err = unpopulate(val, "KeyVaultCertificateSourceParameters", &c.KeyVaultCertificateSourceParameters) + delete(rawMsg, key) + case "minimumTlsVersion": + err = unpopulate(val, "MinimumTLSVersion", &c.MinimumTLSVersion) + delete(rawMsg, key) + case "protocolType": + err = unpopulate(val, "ProtocolType", &c.ProtocolType) + 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 CustomRule. +func (c CustomRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", c.Action) + populate(objectMap, "enabledState", c.EnabledState) + populate(objectMap, "matchConditions", c.MatchConditions) + populate(objectMap, "name", c.Name) + populate(objectMap, "priority", c.Priority) + populate(objectMap, "rateLimitDurationInMinutes", c.RateLimitDurationInMinutes) + populate(objectMap, "rateLimitThreshold", c.RateLimitThreshold) + populate(objectMap, "ruleType", c.RuleType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomRule. +func (c *CustomRule) UnmarshalJSON(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 "action": + err = unpopulate(val, "Action", &c.Action) + delete(rawMsg, key) + case "enabledState": + err = unpopulate(val, "EnabledState", &c.EnabledState) + delete(rawMsg, key) + case "matchConditions": + err = unpopulate(val, "MatchConditions", &c.MatchConditions) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &c.Priority) + delete(rawMsg, key) + case "rateLimitDurationInMinutes": + err = unpopulate(val, "RateLimitDurationInMinutes", &c.RateLimitDurationInMinutes) + delete(rawMsg, key) + case "rateLimitThreshold": + err = unpopulate(val, "RateLimitThreshold", &c.RateLimitThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &c.RuleType) + 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 CustomRuleList. +func (c CustomRuleList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "rules", c.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomRuleList. +func (c *CustomRuleList) UnmarshalJSON(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 "rules": + err = unpopulate(val, "Rules", &c.Rules) + 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 Endpoint. +func (e Endpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endpoint", e.Endpoint) + populate(objectMap, "name", e.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Endpoint. +func (e *Endpoint) UnmarshalJSON(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 "endpoint": + err = unpopulate(val, "Endpoint", &e.Endpoint) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + 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 Error. +func (e Error) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "innerError", e.InnerError) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Error. +func (e *Error) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "innerError": + err = unpopulate(val, "InnerError", &e.InnerError) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetails. +func (e ErrorDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetails. +func (e *ErrorDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + 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 Experiment. +func (e Experiment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Experiment. +func (e *Experiment) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExperimentList. +func (e ExperimentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentList. +func (e *ExperimentList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExperimentProperties. +func (e ExperimentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", e.Description) + populate(objectMap, "enabledState", e.EnabledState) + populate(objectMap, "endpointA", e.EndpointA) + populate(objectMap, "endpointB", e.EndpointB) + populate(objectMap, "resourceState", e.ResourceState) + populate(objectMap, "scriptFileUri", e.ScriptFileURI) + populate(objectMap, "status", e.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentProperties. +func (e *ExperimentProperties) UnmarshalJSON(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 "enabledState": + err = unpopulate(val, "EnabledState", &e.EnabledState) + delete(rawMsg, key) + case "endpointA": + err = unpopulate(val, "EndpointA", &e.EndpointA) + delete(rawMsg, key) + case "endpointB": + err = unpopulate(val, "EndpointB", &e.EndpointB) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, "ResourceState", &e.ResourceState) + delete(rawMsg, key) + case "scriptFileUri": + err = unpopulate(val, "ScriptFileURI", &e.ScriptFileURI) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &e.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExperimentUpdateModel. +func (e ExperimentUpdateModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "tags", e.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentUpdateModel. +func (e *ExperimentUpdateModel) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + 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 ExperimentUpdateProperties. +func (e ExperimentUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", e.Description) + populate(objectMap, "enabledState", e.EnabledState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentUpdateProperties. +func (e *ExperimentUpdateProperties) UnmarshalJSON(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 "enabledState": + err = unpopulate(val, "EnabledState", &e.EnabledState) + 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 ForwardingConfiguration. +func (f ForwardingConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendPool", f.BackendPool) + populate(objectMap, "cacheConfiguration", f.CacheConfiguration) + populate(objectMap, "customForwardingPath", f.CustomForwardingPath) + populate(objectMap, "forwardingProtocol", f.ForwardingProtocol) + objectMap["@odata.type"] = "#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForwardingConfiguration. +func (f *ForwardingConfiguration) UnmarshalJSON(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 "backendPool": + err = unpopulate(val, "BackendPool", &f.BackendPool) + delete(rawMsg, key) + case "cacheConfiguration": + err = unpopulate(val, "CacheConfiguration", &f.CacheConfiguration) + delete(rawMsg, key) + case "customForwardingPath": + err = unpopulate(val, "CustomForwardingPath", &f.CustomForwardingPath) + delete(rawMsg, key) + case "forwardingProtocol": + err = unpopulate(val, "ForwardingProtocol", &f.ForwardingProtocol) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, "ODataType", &f.ODataType) + 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 FrontDoor. +func (f FrontDoor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", f.ID) + populate(objectMap, "location", f.Location) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "tags", f.Tags) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FrontDoor. +func (f *FrontDoor) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &f.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + 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 FrontendEndpoint. +func (f FrontendEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FrontendEndpoint. +func (f *FrontendEndpoint) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + 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 FrontendEndpointLink. +func (f FrontendEndpointLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", f.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FrontendEndpointLink. +func (f *FrontendEndpointLink) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &f.ID) + 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 FrontendEndpointProperties. +func (f FrontendEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customHttpsConfiguration", f.CustomHTTPSConfiguration) + populate(objectMap, "customHttpsProvisioningState", f.CustomHTTPSProvisioningState) + populate(objectMap, "customHttpsProvisioningSubstate", f.CustomHTTPSProvisioningSubstate) + populate(objectMap, "hostName", f.HostName) + populate(objectMap, "resourceState", f.ResourceState) + populate(objectMap, "sessionAffinityEnabledState", f.SessionAffinityEnabledState) + populate(objectMap, "sessionAffinityTtlSeconds", f.SessionAffinityTTLSeconds) + populate(objectMap, "webApplicationFirewallPolicyLink", f.WebApplicationFirewallPolicyLink) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FrontendEndpointProperties. +func (f *FrontendEndpointProperties) UnmarshalJSON(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 "customHttpsConfiguration": + err = unpopulate(val, "CustomHTTPSConfiguration", &f.CustomHTTPSConfiguration) + delete(rawMsg, key) + case "customHttpsProvisioningState": + err = unpopulate(val, "CustomHTTPSProvisioningState", &f.CustomHTTPSProvisioningState) + delete(rawMsg, key) + case "customHttpsProvisioningSubstate": + err = unpopulate(val, "CustomHTTPSProvisioningSubstate", &f.CustomHTTPSProvisioningSubstate) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &f.HostName) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, "ResourceState", &f.ResourceState) + delete(rawMsg, key) + case "sessionAffinityEnabledState": + err = unpopulate(val, "SessionAffinityEnabledState", &f.SessionAffinityEnabledState) + delete(rawMsg, key) + case "sessionAffinityTtlSeconds": + err = unpopulate(val, "SessionAffinityTTLSeconds", &f.SessionAffinityTTLSeconds) + delete(rawMsg, key) + case "webApplicationFirewallPolicyLink": + err = unpopulate(val, "WebApplicationFirewallPolicyLink", &f.WebApplicationFirewallPolicyLink) + 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 FrontendEndpointUpdateParameters. +func (f FrontendEndpointUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hostName", f.HostName) + populate(objectMap, "sessionAffinityEnabledState", f.SessionAffinityEnabledState) + populate(objectMap, "sessionAffinityTtlSeconds", f.SessionAffinityTTLSeconds) + populate(objectMap, "webApplicationFirewallPolicyLink", f.WebApplicationFirewallPolicyLink) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FrontendEndpointUpdateParameters. +func (f *FrontendEndpointUpdateParameters) UnmarshalJSON(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 "hostName": + err = unpopulate(val, "HostName", &f.HostName) + delete(rawMsg, key) + case "sessionAffinityEnabledState": + err = unpopulate(val, "SessionAffinityEnabledState", &f.SessionAffinityEnabledState) + delete(rawMsg, key) + case "sessionAffinityTtlSeconds": + err = unpopulate(val, "SessionAffinityTTLSeconds", &f.SessionAffinityTTLSeconds) + delete(rawMsg, key) + case "webApplicationFirewallPolicyLink": + err = unpopulate(val, "WebApplicationFirewallPolicyLink", &f.WebApplicationFirewallPolicyLink) + 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 FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink. +func (f FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", f.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink. +func (f *FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &f.ID) + 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 FrontendEndpointsListResult. +func (f FrontendEndpointsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FrontendEndpointsListResult. +func (f *FrontendEndpointsListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + 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 HeaderAction. +func (h HeaderAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "headerActionType", h.HeaderActionType) + populate(objectMap, "headerName", h.HeaderName) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HeaderAction. +func (h *HeaderAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "headerActionType": + err = unpopulate(val, "HeaderActionType", &h.HeaderActionType) + delete(rawMsg, key) + case "headerName": + err = unpopulate(val, "HeaderName", &h.HeaderName) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HealthProbeSettingsListResult. +func (h HealthProbeSettingsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HealthProbeSettingsListResult. +func (h *HealthProbeSettingsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HealthProbeSettingsModel. +func (h HealthProbeSettingsModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HealthProbeSettingsModel. +func (h *HealthProbeSettingsModel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HealthProbeSettingsProperties. +func (h HealthProbeSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabledState", h.EnabledState) + populate(objectMap, "healthProbeMethod", h.HealthProbeMethod) + populate(objectMap, "intervalInSeconds", h.IntervalInSeconds) + populate(objectMap, "path", h.Path) + populate(objectMap, "protocol", h.Protocol) + populate(objectMap, "resourceState", h.ResourceState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HealthProbeSettingsProperties. +func (h *HealthProbeSettingsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabledState": + err = unpopulate(val, "EnabledState", &h.EnabledState) + delete(rawMsg, key) + case "healthProbeMethod": + err = unpopulate(val, "HealthProbeMethod", &h.HealthProbeMethod) + delete(rawMsg, key) + case "intervalInSeconds": + err = unpopulate(val, "IntervalInSeconds", &h.IntervalInSeconds) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &h.Path) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &h.Protocol) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, "ResourceState", &h.ResourceState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HealthProbeSettingsUpdateParameters. +func (h HealthProbeSettingsUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabledState", h.EnabledState) + populate(objectMap, "healthProbeMethod", h.HealthProbeMethod) + populate(objectMap, "intervalInSeconds", h.IntervalInSeconds) + populate(objectMap, "path", h.Path) + populate(objectMap, "protocol", h.Protocol) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HealthProbeSettingsUpdateParameters. +func (h *HealthProbeSettingsUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabledState": + err = unpopulate(val, "EnabledState", &h.EnabledState) + delete(rawMsg, key) + case "healthProbeMethod": + err = unpopulate(val, "HealthProbeMethod", &h.HealthProbeMethod) + delete(rawMsg, key) + case "intervalInSeconds": + err = unpopulate(val, "IntervalInSeconds", &h.IntervalInSeconds) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &h.Path) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &h.Protocol) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultCertificateSourceParameters. +func (k KeyVaultCertificateSourceParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "secretName", k.SecretName) + populate(objectMap, "secretVersion", k.SecretVersion) + populate(objectMap, "vault", k.Vault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultCertificateSourceParameters. +func (k *KeyVaultCertificateSourceParameters) UnmarshalJSON(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 "secretName": + err = unpopulate(val, "SecretName", &k.SecretName) + delete(rawMsg, key) + case "secretVersion": + err = unpopulate(val, "SecretVersion", &k.SecretVersion) + delete(rawMsg, key) + case "vault": + err = unpopulate(val, "Vault", &k.Vault) + 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 KeyVaultCertificateSourceParametersVault. +func (k KeyVaultCertificateSourceParametersVault) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", k.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultCertificateSourceParametersVault. +func (k *KeyVaultCertificateSourceParametersVault) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LatencyMetric. +func (l LatencyMetric) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aCLower95CI", l.ACLower95CI) + populate(objectMap, "aHUpper95CI", l.AHUpper95CI) + populate(objectMap, "aValue", l.AValue) + populate(objectMap, "bCLower95CI", l.BCLower95CI) + populate(objectMap, "bUpper95CI", l.BUpper95CI) + populate(objectMap, "bValue", l.BValue) + populate(objectMap, "delta", l.Delta) + populate(objectMap, "deltaPercent", l.DeltaPercent) + populate(objectMap, "endDateTimeUTC", l.EndDateTimeUTC) + populate(objectMap, "name", l.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LatencyMetric. +func (l *LatencyMetric) UnmarshalJSON(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 "aCLower95CI": + err = unpopulate(val, "ACLower95CI", &l.ACLower95CI) + delete(rawMsg, key) + case "aHUpper95CI": + err = unpopulate(val, "AHUpper95CI", &l.AHUpper95CI) + delete(rawMsg, key) + case "aValue": + err = unpopulate(val, "AValue", &l.AValue) + delete(rawMsg, key) + case "bCLower95CI": + err = unpopulate(val, "BCLower95CI", &l.BCLower95CI) + delete(rawMsg, key) + case "bUpper95CI": + err = unpopulate(val, "BUpper95CI", &l.BUpper95CI) + delete(rawMsg, key) + case "bValue": + err = unpopulate(val, "BValue", &l.BValue) + delete(rawMsg, key) + case "delta": + err = unpopulate(val, "Delta", &l.Delta) + delete(rawMsg, key) + case "deltaPercent": + err = unpopulate(val, "DeltaPercent", &l.DeltaPercent) + delete(rawMsg, key) + case "endDateTimeUTC": + err = unpopulate(val, "EndDateTimeUTC", &l.EndDateTimeUTC) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + 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 LatencyScorecard. +func (l LatencyScorecard) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", l.ID) + populate(objectMap, "location", l.Location) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "tags", l.Tags) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LatencyScorecard. +func (l *LatencyScorecard) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &l.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + 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 LatencyScorecardProperties. +func (l LatencyScorecardProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "country", l.Country) + populate(objectMap, "description", l.Description) + populateTimeRFC3339(objectMap, "endDateTimeUTC", l.EndDateTimeUTC) + populate(objectMap, "endpointA", l.EndpointA) + populate(objectMap, "endpointB", l.EndpointB) + populate(objectMap, "id", l.ID) + populate(objectMap, "latencyMetrics", l.LatencyMetrics) + populate(objectMap, "name", l.Name) + populateTimeRFC3339(objectMap, "startDateTimeUTC", l.StartDateTimeUTC) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LatencyScorecardProperties. +func (l *LatencyScorecardProperties) UnmarshalJSON(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 "country": + err = unpopulate(val, "Country", &l.Country) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &l.Description) + delete(rawMsg, key) + case "endDateTimeUTC": + err = unpopulateTimeRFC3339(val, "EndDateTimeUTC", &l.EndDateTimeUTC) + delete(rawMsg, key) + case "endpointA": + err = unpopulate(val, "EndpointA", &l.EndpointA) + delete(rawMsg, key) + case "endpointB": + err = unpopulate(val, "EndpointB", &l.EndpointB) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "latencyMetrics": + err = unpopulate(val, "LatencyMetrics", &l.LatencyMetrics) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "startDateTimeUTC": + err = unpopulateTimeRFC3339(val, "StartDateTimeUTC", &l.StartDateTimeUTC) + 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 ListResult. +func (l ListResult) 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 ListResult. +func (l *ListResult) UnmarshalJSON(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 LoadBalancingSettingsListResult. +func (l LoadBalancingSettingsListResult) 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 LoadBalancingSettingsListResult. +func (l *LoadBalancingSettingsListResult) UnmarshalJSON(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 LoadBalancingSettingsModel. +func (l LoadBalancingSettingsModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancingSettingsModel. +func (l *LoadBalancingSettingsModel) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + 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 LoadBalancingSettingsProperties. +func (l LoadBalancingSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalLatencyMilliseconds", l.AdditionalLatencyMilliseconds) + populate(objectMap, "resourceState", l.ResourceState) + populate(objectMap, "sampleSize", l.SampleSize) + populate(objectMap, "successfulSamplesRequired", l.SuccessfulSamplesRequired) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancingSettingsProperties. +func (l *LoadBalancingSettingsProperties) UnmarshalJSON(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 "additionalLatencyMilliseconds": + err = unpopulate(val, "AdditionalLatencyMilliseconds", &l.AdditionalLatencyMilliseconds) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, "ResourceState", &l.ResourceState) + delete(rawMsg, key) + case "sampleSize": + err = unpopulate(val, "SampleSize", &l.SampleSize) + delete(rawMsg, key) + case "successfulSamplesRequired": + err = unpopulate(val, "SuccessfulSamplesRequired", &l.SuccessfulSamplesRequired) + 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 LoadBalancingSettingsUpdateParameters. +func (l LoadBalancingSettingsUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalLatencyMilliseconds", l.AdditionalLatencyMilliseconds) + populate(objectMap, "sampleSize", l.SampleSize) + populate(objectMap, "successfulSamplesRequired", l.SuccessfulSamplesRequired) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancingSettingsUpdateParameters. +func (l *LoadBalancingSettingsUpdateParameters) UnmarshalJSON(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 "additionalLatencyMilliseconds": + err = unpopulate(val, "AdditionalLatencyMilliseconds", &l.AdditionalLatencyMilliseconds) + delete(rawMsg, key) + case "sampleSize": + err = unpopulate(val, "SampleSize", &l.SampleSize) + delete(rawMsg, key) + case "successfulSamplesRequired": + err = unpopulate(val, "SuccessfulSamplesRequired", &l.SuccessfulSamplesRequired) + 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 ManagedRuleDefinition. +func (m ManagedRuleDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultAction", m.DefaultAction) + populate(objectMap, "defaultState", m.DefaultState) + populate(objectMap, "description", m.Description) + populate(objectMap, "ruleId", m.RuleID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedRuleDefinition. +func (m *ManagedRuleDefinition) UnmarshalJSON(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 "defaultAction": + err = unpopulate(val, "DefaultAction", &m.DefaultAction) + delete(rawMsg, key) + case "defaultState": + err = unpopulate(val, "DefaultState", &m.DefaultState) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "ruleId": + err = unpopulate(val, "RuleID", &m.RuleID) + 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 ManagedRuleExclusion. +func (m ManagedRuleExclusion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "matchVariable", m.MatchVariable) + populate(objectMap, "selector", m.Selector) + populate(objectMap, "selectorMatchOperator", m.SelectorMatchOperator) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedRuleExclusion. +func (m *ManagedRuleExclusion) UnmarshalJSON(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 "matchVariable": + err = unpopulate(val, "MatchVariable", &m.MatchVariable) + delete(rawMsg, key) + case "selector": + err = unpopulate(val, "Selector", &m.Selector) + delete(rawMsg, key) + case "selectorMatchOperator": + err = unpopulate(val, "SelectorMatchOperator", &m.SelectorMatchOperator) + 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 ManagedRuleGroupDefinition. +func (m ManagedRuleGroupDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", m.Description) + populate(objectMap, "ruleGroupName", m.RuleGroupName) + populate(objectMap, "rules", m.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedRuleGroupDefinition. +func (m *ManagedRuleGroupDefinition) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "ruleGroupName": + err = unpopulate(val, "RuleGroupName", &m.RuleGroupName) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &m.Rules) + 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 ManagedRuleGroupOverride. +func (m ManagedRuleGroupOverride) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "exclusions", m.Exclusions) + populate(objectMap, "ruleGroupName", m.RuleGroupName) + populate(objectMap, "rules", m.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedRuleGroupOverride. +func (m *ManagedRuleGroupOverride) UnmarshalJSON(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 "exclusions": + err = unpopulate(val, "Exclusions", &m.Exclusions) + delete(rawMsg, key) + case "ruleGroupName": + err = unpopulate(val, "RuleGroupName", &m.RuleGroupName) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &m.Rules) + 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 ManagedRuleOverride. +func (m ManagedRuleOverride) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", m.Action) + populate(objectMap, "enabledState", m.EnabledState) + populate(objectMap, "exclusions", m.Exclusions) + populate(objectMap, "ruleId", m.RuleID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedRuleOverride. +func (m *ManagedRuleOverride) UnmarshalJSON(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 "action": + err = unpopulate(val, "Action", &m.Action) + delete(rawMsg, key) + case "enabledState": + err = unpopulate(val, "EnabledState", &m.EnabledState) + delete(rawMsg, key) + case "exclusions": + err = unpopulate(val, "Exclusions", &m.Exclusions) + delete(rawMsg, key) + case "ruleId": + err = unpopulate(val, "RuleID", &m.RuleID) + 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 ManagedRuleSet. +func (m ManagedRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "exclusions", m.Exclusions) + populate(objectMap, "ruleGroupOverrides", m.RuleGroupOverrides) + populate(objectMap, "ruleSetAction", m.RuleSetAction) + populate(objectMap, "ruleSetType", m.RuleSetType) + populate(objectMap, "ruleSetVersion", m.RuleSetVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedRuleSet. +func (m *ManagedRuleSet) UnmarshalJSON(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 "exclusions": + err = unpopulate(val, "Exclusions", &m.Exclusions) + delete(rawMsg, key) + case "ruleGroupOverrides": + err = unpopulate(val, "RuleGroupOverrides", &m.RuleGroupOverrides) + delete(rawMsg, key) + case "ruleSetAction": + err = unpopulate(val, "RuleSetAction", &m.RuleSetAction) + delete(rawMsg, key) + case "ruleSetType": + err = unpopulate(val, "RuleSetType", &m.RuleSetType) + delete(rawMsg, key) + case "ruleSetVersion": + err = unpopulate(val, "RuleSetVersion", &m.RuleSetVersion) + 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 ManagedRuleSetDefinition. +func (m ManagedRuleSetDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedRuleSetDefinition. +func (m *ManagedRuleSetDefinition) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + 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 ManagedRuleSetDefinitionList. +func (m ManagedRuleSetDefinitionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedRuleSetDefinitionList. +func (m *ManagedRuleSetDefinitionList) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + 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 ManagedRuleSetDefinitionProperties. +func (m ManagedRuleSetDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "ruleGroups", m.RuleGroups) + populate(objectMap, "ruleSetId", m.RuleSetID) + populate(objectMap, "ruleSetType", m.RuleSetType) + populate(objectMap, "ruleSetVersion", m.RuleSetVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedRuleSetDefinitionProperties. +func (m *ManagedRuleSetDefinitionProperties) UnmarshalJSON(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 "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "ruleGroups": + err = unpopulate(val, "RuleGroups", &m.RuleGroups) + delete(rawMsg, key) + case "ruleSetId": + err = unpopulate(val, "RuleSetID", &m.RuleSetID) + delete(rawMsg, key) + case "ruleSetType": + err = unpopulate(val, "RuleSetType", &m.RuleSetType) + delete(rawMsg, key) + case "ruleSetVersion": + err = unpopulate(val, "RuleSetVersion", &m.RuleSetVersion) + 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 ManagedRuleSetList. +func (m ManagedRuleSetList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "managedRuleSets", m.ManagedRuleSets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedRuleSetList. +func (m *ManagedRuleSetList) UnmarshalJSON(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 "managedRuleSets": + err = unpopulate(val, "ManagedRuleSets", &m.ManagedRuleSets) + 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 MatchCondition. +func (m MatchCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "matchValue", m.MatchValue) + populate(objectMap, "matchVariable", m.MatchVariable) + populate(objectMap, "negateCondition", m.NegateCondition) + populate(objectMap, "operator", m.Operator) + populate(objectMap, "selector", m.Selector) + populate(objectMap, "transforms", m.Transforms) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MatchCondition. +func (m *MatchCondition) UnmarshalJSON(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 "matchValue": + err = unpopulate(val, "MatchValue", &m.MatchValue) + delete(rawMsg, key) + case "matchVariable": + err = unpopulate(val, "MatchVariable", &m.MatchVariable) + delete(rawMsg, key) + case "negateCondition": + err = unpopulate(val, "NegateCondition", &m.NegateCondition) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &m.Operator) + delete(rawMsg, key) + case "selector": + err = unpopulate(val, "Selector", &m.Selector) + delete(rawMsg, key) + case "transforms": + err = unpopulate(val, "Transforms", &m.Transforms) + 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 PolicySettings. +func (p PolicySettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customBlockResponseBody", p.CustomBlockResponseBody) + populate(objectMap, "customBlockResponseStatusCode", p.CustomBlockResponseStatusCode) + populate(objectMap, "enabledState", p.EnabledState) + populate(objectMap, "mode", p.Mode) + populate(objectMap, "redirectUrl", p.RedirectURL) + populate(objectMap, "requestBodyCheck", p.RequestBodyCheck) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicySettings. +func (p *PolicySettings) UnmarshalJSON(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 "customBlockResponseBody": + err = unpopulate(val, "CustomBlockResponseBody", &p.CustomBlockResponseBody) + delete(rawMsg, key) + case "customBlockResponseStatusCode": + err = unpopulate(val, "CustomBlockResponseStatusCode", &p.CustomBlockResponseStatusCode) + delete(rawMsg, key) + case "enabledState": + err = unpopulate(val, "EnabledState", &p.EnabledState) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &p.Mode) + delete(rawMsg, key) + case "redirectUrl": + err = unpopulate(val, "RedirectURL", &p.RedirectURL) + delete(rawMsg, key) + case "requestBodyCheck": + err = unpopulate(val, "RequestBodyCheck", &p.RequestBodyCheck) + 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 PreconfiguredEndpoint. +func (p PreconfiguredEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PreconfiguredEndpoint. +func (p *PreconfiguredEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + 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 "tags": + err = unpopulate(val, "Tags", &p.Tags) + 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 PreconfiguredEndpointList. +func (p PreconfiguredEndpointList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PreconfiguredEndpointList. +func (p *PreconfiguredEndpointList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PreconfiguredEndpointProperties. +func (p PreconfiguredEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backend", p.Backend) + populate(objectMap, "description", p.Description) + populate(objectMap, "endpoint", p.Endpoint) + populate(objectMap, "endpointType", p.EndpointType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PreconfiguredEndpointProperties. +func (p *PreconfiguredEndpointProperties) UnmarshalJSON(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 "backend": + err = unpopulate(val, "Backend", &p.Backend) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "endpoint": + err = unpopulate(val, "Endpoint", &p.Endpoint) + delete(rawMsg, key) + case "endpointType": + err = unpopulate(val, "EndpointType", &p.EndpointType) + 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 Profile. +func (p Profile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Profile. +func (p *Profile) UnmarshalJSON(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 "location": + err = unpopulate(val, "Location", &p.Location) + 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 "tags": + err = unpopulate(val, "Tags", &p.Tags) + 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 ProfileList. +func (p ProfileList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProfileList. +func (p *ProfileList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProfileProperties. +func (p ProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabledState", p.EnabledState) + populate(objectMap, "resourceState", p.ResourceState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProfileProperties. +func (p *ProfileProperties) UnmarshalJSON(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 "enabledState": + err = unpopulate(val, "EnabledState", &p.EnabledState) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, "ResourceState", &p.ResourceState) + 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 ProfileUpdateModel. +func (p ProfileUpdateModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProfileUpdateModel. +func (p *ProfileUpdateModel) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + 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 ProfileUpdateProperties. +func (p ProfileUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabledState", p.EnabledState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProfileUpdateProperties. +func (p *ProfileUpdateProperties) UnmarshalJSON(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 "enabledState": + err = unpopulate(val, "EnabledState", &p.EnabledState) + 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 Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendPools", p.BackendPools) + populate(objectMap, "backendPoolsSettings", p.BackendPoolsSettings) + populate(objectMap, "cname", p.Cname) + populate(objectMap, "enabledState", p.EnabledState) + populate(objectMap, "extendedProperties", p.ExtendedProperties) + populate(objectMap, "friendlyName", p.FriendlyName) + populate(objectMap, "frontdoorId", p.FrontdoorID) + populate(objectMap, "frontendEndpoints", p.FrontendEndpoints) + populate(objectMap, "healthProbeSettings", p.HealthProbeSettings) + populate(objectMap, "loadBalancingSettings", p.LoadBalancingSettings) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "resourceState", p.ResourceState) + populate(objectMap, "routingRules", p.RoutingRules) + populate(objectMap, "rulesEngines", p.RulesEngines) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Properties. +func (p *Properties) UnmarshalJSON(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 "backendPools": + err = unpopulate(val, "BackendPools", &p.BackendPools) + delete(rawMsg, key) + case "backendPoolsSettings": + err = unpopulate(val, "BackendPoolsSettings", &p.BackendPoolsSettings) + delete(rawMsg, key) + case "cname": + err = unpopulate(val, "Cname", &p.Cname) + delete(rawMsg, key) + case "enabledState": + err = unpopulate(val, "EnabledState", &p.EnabledState) + delete(rawMsg, key) + case "extendedProperties": + err = unpopulate(val, "ExtendedProperties", &p.ExtendedProperties) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &p.FriendlyName) + delete(rawMsg, key) + case "frontdoorId": + err = unpopulate(val, "FrontdoorID", &p.FrontdoorID) + delete(rawMsg, key) + case "frontendEndpoints": + err = unpopulate(val, "FrontendEndpoints", &p.FrontendEndpoints) + delete(rawMsg, key) + case "healthProbeSettings": + err = unpopulate(val, "HealthProbeSettings", &p.HealthProbeSettings) + delete(rawMsg, key) + case "loadBalancingSettings": + err = unpopulate(val, "LoadBalancingSettings", &p.LoadBalancingSettings) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, "ResourceState", &p.ResourceState) + delete(rawMsg, key) + case "routingRules": + err = unpopulate(val, "RoutingRules", &p.RoutingRules) + delete(rawMsg, key) + case "rulesEngines": + err = unpopulate(val, "RulesEngines", &p.RulesEngines) + 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 PurgeParameters. +func (p PurgeParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contentPaths", p.ContentPaths) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PurgeParameters. +func (p *PurgeParameters) UnmarshalJSON(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 "contentPaths": + err = unpopulate(val, "ContentPaths", &p.ContentPaths) + 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 RedirectConfiguration. +func (r RedirectConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customFragment", r.CustomFragment) + populate(objectMap, "customHost", r.CustomHost) + populate(objectMap, "customPath", r.CustomPath) + populate(objectMap, "customQueryString", r.CustomQueryString) + objectMap["@odata.type"] = "#Microsoft.Azure.FrontDoor.Models.FrontdoorRedirectConfiguration" + populate(objectMap, "redirectProtocol", r.RedirectProtocol) + populate(objectMap, "redirectType", r.RedirectType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RedirectConfiguration. +func (r *RedirectConfiguration) UnmarshalJSON(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 "customFragment": + err = unpopulate(val, "CustomFragment", &r.CustomFragment) + delete(rawMsg, key) + case "customHost": + err = unpopulate(val, "CustomHost", &r.CustomHost) + delete(rawMsg, key) + case "customPath": + err = unpopulate(val, "CustomPath", &r.CustomPath) + delete(rawMsg, key) + case "customQueryString": + err = unpopulate(val, "CustomQueryString", &r.CustomQueryString) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, "ODataType", &r.ODataType) + delete(rawMsg, key) + case "redirectProtocol": + err = unpopulate(val, "RedirectProtocol", &r.RedirectProtocol) + delete(rawMsg, key) + case "redirectType": + err = unpopulate(val, "RedirectType", &r.RedirectType) + 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 RouteConfiguration. +func (r RouteConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["@odata.type"] = r.ODataType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteConfiguration. +func (r *RouteConfiguration) UnmarshalJSON(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 "@odata.type": + err = unpopulate(val, "ODataType", &r.ODataType) + 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 RoutingRule. +func (r RoutingRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingRule. +func (r *RoutingRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "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 RoutingRuleLink. +func (r RoutingRuleLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingRuleLink. +func (r *RoutingRuleLink) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingRuleListResult. +func (r RoutingRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingRuleListResult. +func (r *RoutingRuleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingRuleProperties. +func (r RoutingRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "acceptedProtocols", r.AcceptedProtocols) + populate(objectMap, "enabledState", r.EnabledState) + populate(objectMap, "frontendEndpoints", r.FrontendEndpoints) + populate(objectMap, "patternsToMatch", r.PatternsToMatch) + populate(objectMap, "resourceState", r.ResourceState) + populate(objectMap, "routeConfiguration", r.RouteConfiguration) + populate(objectMap, "rulesEngine", r.RulesEngine) + populate(objectMap, "webApplicationFirewallPolicyLink", r.WebApplicationFirewallPolicyLink) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingRuleProperties. +func (r *RoutingRuleProperties) UnmarshalJSON(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 "acceptedProtocols": + err = unpopulate(val, "AcceptedProtocols", &r.AcceptedProtocols) + delete(rawMsg, key) + case "enabledState": + err = unpopulate(val, "EnabledState", &r.EnabledState) + delete(rawMsg, key) + case "frontendEndpoints": + err = unpopulate(val, "FrontendEndpoints", &r.FrontendEndpoints) + delete(rawMsg, key) + case "patternsToMatch": + err = unpopulate(val, "PatternsToMatch", &r.PatternsToMatch) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, "ResourceState", &r.ResourceState) + delete(rawMsg, key) + case "routeConfiguration": + r.RouteConfiguration, err = unmarshalRouteConfigurationClassification(val) + delete(rawMsg, key) + case "rulesEngine": + err = unpopulate(val, "RulesEngine", &r.RulesEngine) + delete(rawMsg, key) + case "webApplicationFirewallPolicyLink": + err = unpopulate(val, "WebApplicationFirewallPolicyLink", &r.WebApplicationFirewallPolicyLink) + 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 RoutingRuleUpdateParameters. +func (r RoutingRuleUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "acceptedProtocols", r.AcceptedProtocols) + populate(objectMap, "enabledState", r.EnabledState) + populate(objectMap, "frontendEndpoints", r.FrontendEndpoints) + populate(objectMap, "patternsToMatch", r.PatternsToMatch) + populate(objectMap, "routeConfiguration", r.RouteConfiguration) + populate(objectMap, "rulesEngine", r.RulesEngine) + populate(objectMap, "webApplicationFirewallPolicyLink", r.WebApplicationFirewallPolicyLink) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingRuleUpdateParameters. +func (r *RoutingRuleUpdateParameters) UnmarshalJSON(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 "acceptedProtocols": + err = unpopulate(val, "AcceptedProtocols", &r.AcceptedProtocols) + delete(rawMsg, key) + case "enabledState": + err = unpopulate(val, "EnabledState", &r.EnabledState) + delete(rawMsg, key) + case "frontendEndpoints": + err = unpopulate(val, "FrontendEndpoints", &r.FrontendEndpoints) + delete(rawMsg, key) + case "patternsToMatch": + err = unpopulate(val, "PatternsToMatch", &r.PatternsToMatch) + delete(rawMsg, key) + case "routeConfiguration": + r.RouteConfiguration, err = unmarshalRouteConfigurationClassification(val) + delete(rawMsg, key) + case "rulesEngine": + err = unpopulate(val, "RulesEngine", &r.RulesEngine) + delete(rawMsg, key) + case "webApplicationFirewallPolicyLink": + err = unpopulate(val, "WebApplicationFirewallPolicyLink", &r.WebApplicationFirewallPolicyLink) + 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 RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink. +func (r RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink. +func (r *RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RulesEngine. +func (r RulesEngine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RulesEngine. +func (r *RulesEngine) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "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 RulesEngineAction. +func (r RulesEngineAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "requestHeaderActions", r.RequestHeaderActions) + populate(objectMap, "responseHeaderActions", r.ResponseHeaderActions) + populate(objectMap, "routeConfigurationOverride", r.RouteConfigurationOverride) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RulesEngineAction. +func (r *RulesEngineAction) UnmarshalJSON(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 "requestHeaderActions": + err = unpopulate(val, "RequestHeaderActions", &r.RequestHeaderActions) + delete(rawMsg, key) + case "responseHeaderActions": + err = unpopulate(val, "ResponseHeaderActions", &r.ResponseHeaderActions) + delete(rawMsg, key) + case "routeConfigurationOverride": + r.RouteConfigurationOverride, err = unmarshalRouteConfigurationClassification(val) + 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 RulesEngineListResult. +func (r RulesEngineListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RulesEngineListResult. +func (r *RulesEngineListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RulesEngineMatchCondition. +func (r RulesEngineMatchCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "negateCondition", r.NegateCondition) + populate(objectMap, "rulesEngineMatchValue", r.RulesEngineMatchValue) + populate(objectMap, "rulesEngineMatchVariable", r.RulesEngineMatchVariable) + populate(objectMap, "rulesEngineOperator", r.RulesEngineOperator) + populate(objectMap, "selector", r.Selector) + populate(objectMap, "transforms", r.Transforms) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RulesEngineMatchCondition. +func (r *RulesEngineMatchCondition) UnmarshalJSON(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 "negateCondition": + err = unpopulate(val, "NegateCondition", &r.NegateCondition) + delete(rawMsg, key) + case "rulesEngineMatchValue": + err = unpopulate(val, "RulesEngineMatchValue", &r.RulesEngineMatchValue) + delete(rawMsg, key) + case "rulesEngineMatchVariable": + err = unpopulate(val, "RulesEngineMatchVariable", &r.RulesEngineMatchVariable) + delete(rawMsg, key) + case "rulesEngineOperator": + err = unpopulate(val, "RulesEngineOperator", &r.RulesEngineOperator) + delete(rawMsg, key) + case "selector": + err = unpopulate(val, "Selector", &r.Selector) + delete(rawMsg, key) + case "transforms": + err = unpopulate(val, "Transforms", &r.Transforms) + 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 RulesEngineProperties. +func (r RulesEngineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "resourceState", r.ResourceState) + populate(objectMap, "rules", r.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RulesEngineProperties. +func (r *RulesEngineProperties) UnmarshalJSON(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 "resourceState": + err = unpopulate(val, "ResourceState", &r.ResourceState) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &r.Rules) + 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 RulesEngineRule. +func (r RulesEngineRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", r.Action) + populate(objectMap, "matchConditions", r.MatchConditions) + populate(objectMap, "matchProcessingBehavior", r.MatchProcessingBehavior) + populate(objectMap, "name", r.Name) + populate(objectMap, "priority", r.Priority) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RulesEngineRule. +func (r *RulesEngineRule) UnmarshalJSON(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 "action": + err = unpopulate(val, "Action", &r.Action) + delete(rawMsg, key) + case "matchConditions": + err = unpopulate(val, "MatchConditions", &r.MatchConditions) + delete(rawMsg, key) + case "matchProcessingBehavior": + err = unpopulate(val, "MatchProcessingBehavior", &r.MatchProcessingBehavior) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &r.Priority) + 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 RulesEngineUpdateParameters. +func (r RulesEngineUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "rules", r.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RulesEngineUpdateParameters. +func (r *RulesEngineUpdateParameters) UnmarshalJSON(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 "rules": + err = unpopulate(val, "Rules", &r.Rules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKU. +func (s SKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. +func (s *SKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityPolicyLink. +func (s SecurityPolicyLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityPolicyLink. +func (s *SecurityPolicyLink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubResource. +func (s SubResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubResource. +func (s *SubResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TagsObject. +func (t TagsObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagsObject. +func (t *TagsObject) UnmarshalJSON(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 "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Timeseries. +func (t Timeseries) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Timeseries. +func (t *Timeseries) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TimeseriesDataPoint. +func (t TimeseriesDataPoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dateTimeUTC", t.DateTimeUTC) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimeseriesDataPoint. +func (t *TimeseriesDataPoint) UnmarshalJSON(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 "dateTimeUTC": + err = unpopulate(val, "DateTimeUTC", &t.DateTimeUTC) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TimeseriesProperties. +func (t TimeseriesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationInterval", t.AggregationInterval) + populate(objectMap, "country", t.Country) + populate(objectMap, "endDateTimeUTC", t.EndDateTimeUTC) + populate(objectMap, "endpoint", t.Endpoint) + populate(objectMap, "startDateTimeUTC", t.StartDateTimeUTC) + populate(objectMap, "timeseriesData", t.TimeseriesData) + populate(objectMap, "timeseriesType", t.TimeseriesType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimeseriesProperties. +func (t *TimeseriesProperties) UnmarshalJSON(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 "aggregationInterval": + err = unpopulate(val, "AggregationInterval", &t.AggregationInterval) + delete(rawMsg, key) + case "country": + err = unpopulate(val, "Country", &t.Country) + delete(rawMsg, key) + case "endDateTimeUTC": + err = unpopulate(val, "EndDateTimeUTC", &t.EndDateTimeUTC) + delete(rawMsg, key) + case "endpoint": + err = unpopulate(val, "Endpoint", &t.Endpoint) + delete(rawMsg, key) + case "startDateTimeUTC": + err = unpopulate(val, "StartDateTimeUTC", &t.StartDateTimeUTC) + delete(rawMsg, key) + case "timeseriesData": + err = unpopulate(val, "TimeseriesData", &t.TimeseriesData) + delete(rawMsg, key) + case "timeseriesType": + err = unpopulate(val, "TimeseriesType", &t.TimeseriesType) + 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 UpdateParameters. +func (u UpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendPools", u.BackendPools) + populate(objectMap, "backendPoolsSettings", u.BackendPoolsSettings) + populate(objectMap, "enabledState", u.EnabledState) + populate(objectMap, "friendlyName", u.FriendlyName) + populate(objectMap, "frontendEndpoints", u.FrontendEndpoints) + populate(objectMap, "healthProbeSettings", u.HealthProbeSettings) + populate(objectMap, "loadBalancingSettings", u.LoadBalancingSettings) + populate(objectMap, "routingRules", u.RoutingRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateParameters. +func (u *UpdateParameters) UnmarshalJSON(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 "backendPools": + err = unpopulate(val, "BackendPools", &u.BackendPools) + delete(rawMsg, key) + case "backendPoolsSettings": + err = unpopulate(val, "BackendPoolsSettings", &u.BackendPoolsSettings) + delete(rawMsg, key) + case "enabledState": + err = unpopulate(val, "EnabledState", &u.EnabledState) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &u.FriendlyName) + delete(rawMsg, key) + case "frontendEndpoints": + err = unpopulate(val, "FrontendEndpoints", &u.FrontendEndpoints) + delete(rawMsg, key) + case "healthProbeSettings": + err = unpopulate(val, "HealthProbeSettings", &u.HealthProbeSettings) + delete(rawMsg, key) + case "loadBalancingSettings": + err = unpopulate(val, "LoadBalancingSettings", &u.LoadBalancingSettings) + delete(rawMsg, key) + case "routingRules": + err = unpopulate(val, "RoutingRules", &u.RoutingRules) + 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 ValidateCustomDomainInput. +func (v ValidateCustomDomainInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hostName", v.HostName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateCustomDomainInput. +func (v *ValidateCustomDomainInput) UnmarshalJSON(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 "hostName": + err = unpopulate(val, "HostName", &v.HostName) + 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 ValidateCustomDomainOutput. +func (v ValidateCustomDomainOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customDomainValidated", v.CustomDomainValidated) + populate(objectMap, "message", v.Message) + populate(objectMap, "reason", v.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateCustomDomainOutput. +func (v *ValidateCustomDomainOutput) UnmarshalJSON(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 "customDomainValidated": + err = unpopulate(val, "CustomDomainValidated", &v.CustomDomainValidated) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &v.Message) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &v.Reason) + 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 WebApplicationFirewallPolicy. +func (w WebApplicationFirewallPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", w.Etag) + populate(objectMap, "id", w.ID) + populate(objectMap, "location", w.Location) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "sku", w.SKU) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationFirewallPolicy. +func (w *WebApplicationFirewallPolicy) UnmarshalJSON(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 "etag": + err = unpopulate(val, "Etag", &w.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &w.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebApplicationFirewallPolicyList. +func (w WebApplicationFirewallPolicyList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationFirewallPolicyList. +func (w *WebApplicationFirewallPolicyList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebApplicationFirewallPolicyProperties. +func (w WebApplicationFirewallPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customRules", w.CustomRules) + populate(objectMap, "frontendEndpointLinks", w.FrontendEndpointLinks) + populate(objectMap, "managedRules", w.ManagedRules) + populate(objectMap, "policySettings", w.PolicySettings) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "resourceState", w.ResourceState) + populate(objectMap, "routingRuleLinks", w.RoutingRuleLinks) + populate(objectMap, "securityPolicyLinks", w.SecurityPolicyLinks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationFirewallPolicyProperties. +func (w *WebApplicationFirewallPolicyProperties) UnmarshalJSON(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 "customRules": + err = unpopulate(val, "CustomRules", &w.CustomRules) + delete(rawMsg, key) + case "frontendEndpointLinks": + err = unpopulate(val, "FrontendEndpointLinks", &w.FrontendEndpointLinks) + delete(rawMsg, key) + case "managedRules": + err = unpopulate(val, "ManagedRules", &w.ManagedRules) + delete(rawMsg, key) + case "policySettings": + err = unpopulate(val, "PolicySettings", &w.PolicySettings) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, "ResourceState", &w.ResourceState) + delete(rawMsg, key) + case "routingRuleLinks": + err = unpopulate(val, "RoutingRuleLinks", &w.RoutingRuleLinks) + delete(rawMsg, key) + case "securityPolicyLinks": + err = unpopulate(val, "SecurityPolicyLinks", &w.SecurityPolicyLinks) + 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/frontdoor/armfrontdoor/zz_generated_nameavailability_client.go b/sdk/resourcemanager/frontdoor/armfrontdoor/nameavailability_client.go similarity index 97% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_nameavailability_client.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/nameavailability_client.go index accbfc78fbc2..4d3057587056 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_nameavailability_client.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/nameavailability_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 armfrontdoor @@ -50,7 +51,7 @@ func NewNameAvailabilityClient(credential azcore.TokenCredential, options *arm.C // Check - Check the availability of a Front Door resource name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // checkFrontDoorNameAvailabilityInput - Input to check. // options - NameAvailabilityClientCheckOptions contains the optional parameters for the NameAvailabilityClient.Check method. func (client *NameAvailabilityClient) Check(ctx context.Context, checkFrontDoorNameAvailabilityInput CheckNameAvailabilityInput, options *NameAvailabilityClientCheckOptions) (NameAvailabilityClientCheckResponse, error) { @@ -76,7 +77,7 @@ func (client *NameAvailabilityClient) checkCreateRequest(ctx context.Context, ch return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, checkFrontDoorNameAvailabilityInput) diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_nameavailabilitywithsubscription_client.go b/sdk/resourcemanager/frontdoor/armfrontdoor/nameavailabilitywithsubscription_client.go similarity index 98% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_nameavailabilitywithsubscription_client.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/nameavailabilitywithsubscription_client.go index 6b19fdbd6826..a6801d6c3596 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_nameavailabilitywithsubscription_client.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/nameavailabilitywithsubscription_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 armfrontdoor @@ -57,7 +58,7 @@ func NewNameAvailabilityWithSubscriptionClient(subscriptionID string, credential // Check - Check the availability of a Front Door subdomain. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // checkFrontDoorNameAvailabilityInput - Input to check. // options - NameAvailabilityWithSubscriptionClientCheckOptions contains the optional parameters for the NameAvailabilityWithSubscriptionClient.Check // method. @@ -88,7 +89,7 @@ func (client *NameAvailabilityWithSubscriptionClient) checkCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, checkFrontDoorNameAvailabilityInput) diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_networkexperimentprofiles_client.go b/sdk/resourcemanager/frontdoor/armfrontdoor/networkexperimentprofiles_client.go similarity index 99% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_networkexperimentprofiles_client.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/networkexperimentprofiles_client.go index 2a781b1cb1c5..4dd7ea6c83df 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_networkexperimentprofiles_client.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/networkexperimentprofiles_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 armfrontdoor @@ -240,7 +241,6 @@ func (client *NetworkExperimentProfilesClient) getHandleResponse(resp *http.Resp } // NewListPager - Gets a list of Network Experiment Profiles under a subscription -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-11-01 // options - NetworkExperimentProfilesClientListOptions contains the optional parameters for the NetworkExperimentProfilesClient.List // method. @@ -300,7 +300,6 @@ func (client *NetworkExperimentProfilesClient) listHandleResponse(resp *http.Res } // NewListByResourceGroupPager - Gets a list of Network Experiment Profiles within a resource group under a subscription -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-11-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // options - NetworkExperimentProfilesClientListByResourceGroupOptions contains the optional parameters for the NetworkExperimentProfilesClient.ListByResourceGroup diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_policies_client.go b/sdk/resourcemanager/frontdoor/armfrontdoor/policies_client.go similarity index 78% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_policies_client.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/policies_client.go index 72b97c7c9b92..22ba8329349d 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_policies_client.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/policies_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 armfrontdoor @@ -57,7 +58,7 @@ func NewPoliciesClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreateOrUpdate - Create or update policy with specified rule set name within a resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-11-01 +// Generated from API version 2022-05-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // policyName - The name of the Web Application Firewall Policy. // parameters - Policy to be created. @@ -77,7 +78,7 @@ func (client *PoliciesClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create or update policy with specified rule set name within a resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-11-01 +// Generated from API version 2022-05-01 func (client *PoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, policyName string, parameters WebApplicationFirewallPolicy, options *PoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, policyName, parameters, options) if err != nil { @@ -113,7 +114,7 @@ func (client *PoliciesClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -121,7 +122,7 @@ func (client *PoliciesClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Deletes Policy // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-11-01 +// Generated from API version 2022-05-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // policyName - The name of the Web Application Firewall Policy. // options - PoliciesClientBeginDeleteOptions contains the optional parameters for the PoliciesClient.BeginDelete method. @@ -139,7 +140,7 @@ func (client *PoliciesClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes Policy // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-11-01 +// Generated from API version 2022-05-01 func (client *PoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, policyName string, options *PoliciesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, policyName, options) if err != nil { @@ -175,14 +176,14 @@ func (client *PoliciesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Retrieve protection policy with specified name within a resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-11-01 +// Generated from API version 2022-05-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // policyName - The name of the Web Application Firewall Policy. // options - PoliciesClientGetOptions contains the optional parameters for the PoliciesClient.Get method. @@ -221,7 +222,7 @@ func (client *PoliciesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -237,8 +238,7 @@ func (client *PoliciesClient) getHandleResponse(resp *http.Response) (PoliciesCl } // NewListPager - Lists all of the protection policies within a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-11-01 +// Generated from API version 2022-05-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // options - PoliciesClientListOptions contains the optional parameters for the PoliciesClient.List method. func (client *PoliciesClient) NewListPager(resourceGroupName string, options *PoliciesClientListOptions) *runtime.Pager[PoliciesClientListResponse] { @@ -285,7 +285,7 @@ func (client *PoliciesClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -299,3 +299,68 @@ func (client *PoliciesClient) listHandleResponse(resp *http.Response) (PoliciesC } return result, nil } + +// BeginUpdate - Patch a specific frontdoor webApplicationFirewall policy for tags update under the specified subscription +// and resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - Name of the Resource group within the Azure subscription. +// policyName - The name of the Web Application Firewall Policy. +// parameters - FrontdoorWebApplicationFirewallPolicy parameters to be patched. +// options - PoliciesClientBeginUpdateOptions contains the optional parameters for the PoliciesClient.BeginUpdate method. +func (client *PoliciesClient) BeginUpdate(ctx context.Context, resourceGroupName string, policyName string, parameters TagsObject, options *PoliciesClientBeginUpdateOptions) (*runtime.Poller[PoliciesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, policyName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[PoliciesClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[PoliciesClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Patch a specific frontdoor webApplicationFirewall policy for tags update under the specified subscription and +// resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PoliciesClient) update(ctx context.Context, resourceGroupName string, policyName string, parameters TagsObject, options *PoliciesClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, policyName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *PoliciesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, policyName string, parameters TagsObject, options *PoliciesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if policyName == "" { + return nil, errors.New("parameter policyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-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/frontdoor/armfrontdoor/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/frontdoor/armfrontdoor/polymorphic_helpers.go similarity index 98% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_polymorphic_helpers.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/polymorphic_helpers.go index 9f0ca53b7682..754be7a642ce 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/polymorphic_helpers.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armfrontdoor diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_preconfiguredendpoints_client.go b/sdk/resourcemanager/frontdoor/armfrontdoor/preconfiguredendpoints_client.go similarity index 98% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_preconfiguredendpoints_client.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/preconfiguredendpoints_client.go index a0515a114559..a6e31b64bd3f 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_preconfiguredendpoints_client.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/preconfiguredendpoints_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 armfrontdoor @@ -56,7 +57,6 @@ func NewPreconfiguredEndpointsClient(subscriptionID string, credential azcore.To } // NewListPager - Gets a list of Preconfigured Endpoints -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-11-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // profileName - The Profile identifier associated with the Tenant and Partner diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_reports_client.go b/sdk/resourcemanager/frontdoor/armfrontdoor/reports_client.go similarity index 99% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_reports_client.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/reports_client.go index 2e73d5df63dc..5e858a5222cc 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_reports_client.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/reports_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 armfrontdoor diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_response_types.go b/sdk/resourcemanager/frontdoor/armfrontdoor/response_types.go similarity index 97% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_response_types.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/response_types.go index f30fac794500..fec662a419aa 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_response_types.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/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 armfrontdoor @@ -153,6 +154,11 @@ type PoliciesClientListResponse struct { WebApplicationFirewallPolicyList } +// PoliciesClientUpdateResponse contains the response from method PoliciesClient.Update. +type PoliciesClientUpdateResponse struct { + WebApplicationFirewallPolicy +} + // PreconfiguredEndpointsClientListResponse contains the response from method PreconfiguredEndpointsClient.List. type PreconfiguredEndpointsClientListResponse struct { PreconfiguredEndpointList diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_rulesengines_client.go b/sdk/resourcemanager/frontdoor/armfrontdoor/rulesengines_client.go similarity index 97% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_rulesengines_client.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/rulesengines_client.go index 98b366377355..0fbc7e3d7570 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_rulesengines_client.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/rulesengines_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 armfrontdoor @@ -57,7 +58,7 @@ func NewRulesEnginesClient(subscriptionID string, credential azcore.TokenCredent // BeginCreateOrUpdate - Creates a new Rules Engine Configuration with the specified name within the specified Front Door. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // frontDoorName - Name of the Front Door which is globally unique. // rulesEngineName - Name of the Rules Engine which is unique within the Front Door. @@ -80,7 +81,7 @@ func (client *RulesEnginesClient) BeginCreateOrUpdate(ctx context.Context, resou // CreateOrUpdate - Creates a new Rules Engine Configuration with the specified name within the specified Front Door. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 func (client *RulesEnginesClient) createOrUpdate(ctx context.Context, resourceGroupName string, frontDoorName string, rulesEngineName string, rulesEngineParameters RulesEngine, options *RulesEnginesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, frontDoorName, rulesEngineName, rulesEngineParameters, options) if err != nil { @@ -120,7 +121,7 @@ func (client *RulesEnginesClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, rulesEngineParameters) @@ -128,7 +129,7 @@ func (client *RulesEnginesClient) createOrUpdateCreateRequest(ctx context.Contex // BeginDelete - Deletes an existing Rules Engine Configuration with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // frontDoorName - Name of the Front Door which is globally unique. // rulesEngineName - Name of the Rules Engine which is unique within the Front Door. @@ -150,7 +151,7 @@ func (client *RulesEnginesClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Deletes an existing Rules Engine Configuration with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 func (client *RulesEnginesClient) deleteOperation(ctx context.Context, resourceGroupName string, frontDoorName string, rulesEngineName string, options *RulesEnginesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, frontDoorName, rulesEngineName, options) if err != nil { @@ -190,7 +191,7 @@ func (client *RulesEnginesClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -198,7 +199,7 @@ func (client *RulesEnginesClient) deleteCreateRequest(ctx context.Context, resou // Get - Gets a Rules Engine Configuration with the specified name within the specified Front Door. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // frontDoorName - Name of the Front Door which is globally unique. // rulesEngineName - Name of the Rules Engine which is unique within the Front Door. @@ -242,7 +243,7 @@ func (client *RulesEnginesClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -258,8 +259,7 @@ func (client *RulesEnginesClient) getHandleResponse(resp *http.Response) (RulesE } // NewListByFrontDoorPager - Lists all of the Rules Engine Configurations within a Front Door. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-05-01 +// Generated from API version 2021-06-01 // resourceGroupName - Name of the Resource group within the Azure subscription. // frontDoorName - Name of the Front Door which is globally unique. // options - RulesEnginesClientListByFrontDoorOptions contains the optional parameters for the RulesEnginesClient.ListByFrontDoor @@ -312,7 +312,7 @@ func (client *RulesEnginesClient) listByFrontDoorCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-05-01") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_time_rfc3339.go b/sdk/resourcemanager/frontdoor/armfrontdoor/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/frontdoor/armfrontdoor/time_rfc3339.go index 81fe39d11bd4..ebd4caac51c4 100644 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/frontdoor/armfrontdoor/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 armfrontdoor diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_endpoints_client_test.go b/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_endpoints_client_test.go deleted file mode 100644 index 8022dc8b52fb..000000000000 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_endpoints_client_test.go +++ /dev/null @@ -1,47 +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 armfrontdoor_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/frontdoor/armfrontdoor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/FrontdoorPurgeContent.json -func ExampleEndpointsClient_BeginPurgeContent() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewEndpointsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPurgeContent(ctx, - "rg1", - "frontDoor1", - armfrontdoor.PurgeParameters{ - ContentPaths: []*string{ - to.Ptr("/pictures.aspx"), - to.Ptr("/pictures/*")}, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_experiments_client_test.go b/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_experiments_client_test.go deleted file mode 100644 index da336f85fcff..000000000000 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_experiments_client_test.go +++ /dev/null @@ -1,166 +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 armfrontdoor_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/frontdoor/armfrontdoor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentListExperiments.json -func ExampleExperimentsClient_NewListByProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewExperimentsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByProfilePager("MyResourceGroup", - "MyProfile", - 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/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentGetExperiment.json -func ExampleExperimentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewExperimentsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "MyResourceGroup", - "MyProfile", - "MyExperiment", - 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/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentCreateExperiment.json -func ExampleExperimentsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewExperimentsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "MyResourceGroup", - "MyProfile", - "MyExperiment", - armfrontdoor.Experiment{ - Properties: &armfrontdoor.ExperimentProperties{ - Description: to.Ptr("this is my first experiment!"), - EnabledState: to.Ptr(armfrontdoor.StateEnabled), - EndpointA: &armfrontdoor.Endpoint{ - Name: to.Ptr("endpoint A"), - Endpoint: to.Ptr("endpointA.net"), - }, - EndpointB: &armfrontdoor.Endpoint{ - Name: to.Ptr("endpoint B"), - Endpoint: to.Ptr("endpointB.net"), - }, - }, - }, - 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/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentUpdateExperiment.json -func ExampleExperimentsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewExperimentsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "MyResourceGroup", - "MyProfile", - "MyExperiment", - armfrontdoor.ExperimentUpdateModel{ - Properties: &armfrontdoor.ExperimentUpdateProperties{ - Description: to.Ptr("string"), - EnabledState: to.Ptr(armfrontdoor.StateEnabled), - }, - }, - 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/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentDeleteExperiment.json -func ExampleExperimentsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewExperimentsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "MyResourceGroup", - "MyProfile", - "MyExperiment", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_frontdoornameavailability_client_test.go b/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_frontdoornameavailability_client_test.go deleted file mode 100644 index 407a1354ebc0..000000000000 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_frontdoornameavailability_client_test.go +++ /dev/null @@ -1,42 +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 armfrontdoor_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/frontdoor/armfrontdoor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/CheckFrontdoorNameAvailability.json -func ExampleNameAvailabilityClient_Check() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewNameAvailabilityClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Check(ctx, - armfrontdoor.CheckNameAvailabilityInput{ - Name: to.Ptr("sampleName"), - Type: to.Ptr(armfrontdoor.ResourceTypeMicrosoftNetworkFrontDoors), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_frontdoornameavailabilitywithsubscription_client_test.go b/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_frontdoornameavailabilitywithsubscription_client_test.go deleted file mode 100644 index 7f644a9cd05f..000000000000 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_frontdoornameavailabilitywithsubscription_client_test.go +++ /dev/null @@ -1,42 +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 armfrontdoor_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/frontdoor/armfrontdoor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/CheckFrontdoorNameAvailabilityWithSubscription.json -func ExampleNameAvailabilityWithSubscriptionClient_Check() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewNameAvailabilityWithSubscriptionClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Check(ctx, - armfrontdoor.CheckNameAvailabilityInput{ - Name: to.Ptr("sampleName"), - Type: to.Ptr(armfrontdoor.ResourceTypeMicrosoftNetworkFrontDoorsFrontendEndpoints), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_frontdoors_client_test.go b/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_frontdoors_client_test.go deleted file mode 100644 index c2e581a74f9c..000000000000 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_frontdoors_client_test.go +++ /dev/null @@ -1,284 +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 armfrontdoor_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/frontdoor/armfrontdoor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/FrontdoorListAll.json -func ExampleFrontDoorsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewFrontDoorsClient("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/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/FrontdoorList.json -func ExampleFrontDoorsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewFrontDoorsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("rg1", - 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/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/FrontdoorGet.json -func ExampleFrontDoorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewFrontDoorsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "frontDoor1", - 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/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/FrontdoorCreate.json -func ExampleFrontDoorsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewFrontDoorsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "rg1", - "frontDoor1", - armfrontdoor.FrontDoor{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - Properties: &armfrontdoor.Properties{ - BackendPools: []*armfrontdoor.BackendPool{ - { - Name: to.Ptr("backendPool1"), - Properties: &armfrontdoor.BackendPoolProperties{ - Backends: []*armfrontdoor.Backend{ - { - Address: to.Ptr("w3.contoso.com"), - HTTPPort: to.Ptr[int32](80), - HTTPSPort: to.Ptr[int32](443), - Priority: to.Ptr[int32](2), - Weight: to.Ptr[int32](1), - }, - { - Address: to.Ptr("contoso.com.website-us-west-2.othercloud.net"), - HTTPPort: to.Ptr[int32](80), - HTTPSPort: to.Ptr[int32](443), - Priority: to.Ptr[int32](1), - PrivateLinkApprovalMessage: to.Ptr("Please approve the connection request for this Private Link"), - PrivateLinkLocation: to.Ptr("eastus"), - PrivateLinkResourceID: to.Ptr("/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Network/privateLinkServices/pls1"), - Weight: to.Ptr[int32](2), - }, - { - Address: to.Ptr("10.0.1.5"), - HTTPPort: to.Ptr[int32](80), - HTTPSPort: to.Ptr[int32](443), - Priority: to.Ptr[int32](1), - PrivateLinkAlias: to.Ptr("APPSERVER.d84e61f0-0870-4d24-9746-7438fa0019d1.westus2.azure.privatelinkservice"), - PrivateLinkApprovalMessage: to.Ptr("Please approve this request to connect to the Private Link"), - Weight: to.Ptr[int32](1), - }}, - HealthProbeSettings: &armfrontdoor.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoors/frontDoor1/healthProbeSettings/healthProbeSettings1"), - }, - LoadBalancingSettings: &armfrontdoor.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoors/frontDoor1/loadBalancingSettings/loadBalancingSettings1"), - }, - }, - }}, - BackendPoolsSettings: &armfrontdoor.BackendPoolsSettings{ - EnforceCertificateNameCheck: to.Ptr(armfrontdoor.EnforceCertificateNameCheckEnabledStateEnabled), - SendRecvTimeoutSeconds: to.Ptr[int32](60), - }, - EnabledState: to.Ptr(armfrontdoor.FrontDoorEnabledStateEnabled), - FrontendEndpoints: []*armfrontdoor.FrontendEndpoint{ - { - Name: to.Ptr("frontendEndpoint1"), - Properties: &armfrontdoor.FrontendEndpointProperties{ - HostName: to.Ptr("www.contoso.com"), - SessionAffinityEnabledState: to.Ptr(armfrontdoor.SessionAffinityEnabledStateEnabled), - SessionAffinityTTLSeconds: to.Ptr[int32](60), - WebApplicationFirewallPolicyLink: &armfrontdoor.FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/policy1"), - }, - }, - }, - { - Name: to.Ptr("default"), - Properties: &armfrontdoor.FrontendEndpointProperties{ - HostName: to.Ptr("frontDoor1.azurefd.net"), - }, - }}, - HealthProbeSettings: []*armfrontdoor.HealthProbeSettingsModel{ - { - Name: to.Ptr("healthProbeSettings1"), - Properties: &armfrontdoor.HealthProbeSettingsProperties{ - Path: to.Ptr("/"), - EnabledState: to.Ptr(armfrontdoor.HealthProbeEnabledEnabled), - HealthProbeMethod: to.Ptr(armfrontdoor.FrontDoorHealthProbeMethodHEAD), - IntervalInSeconds: to.Ptr[int32](120), - Protocol: to.Ptr(armfrontdoor.FrontDoorProtocolHTTP), - }, - }}, - LoadBalancingSettings: []*armfrontdoor.LoadBalancingSettingsModel{ - { - Name: to.Ptr("loadBalancingSettings1"), - Properties: &armfrontdoor.LoadBalancingSettingsProperties{ - SampleSize: to.Ptr[int32](4), - SuccessfulSamplesRequired: to.Ptr[int32](2), - }, - }}, - RoutingRules: []*armfrontdoor.RoutingRule{ - { - Name: to.Ptr("routingRule1"), - Properties: &armfrontdoor.RoutingRuleProperties{ - AcceptedProtocols: []*armfrontdoor.FrontDoorProtocol{ - to.Ptr(armfrontdoor.FrontDoorProtocolHTTP)}, - EnabledState: to.Ptr(armfrontdoor.RoutingRuleEnabledStateEnabled), - FrontendEndpoints: []*armfrontdoor.SubResource{ - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoors/frontDoor1/frontendEndpoints/frontendEndpoint1"), - }, - { - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoors/frontDoor1/frontendEndpoints/default"), - }}, - PatternsToMatch: []*string{ - to.Ptr("/*")}, - RouteConfiguration: &armfrontdoor.ForwardingConfiguration{ - ODataType: to.Ptr("#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration"), - BackendPool: &armfrontdoor.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoors/frontDoor1/backendPools/backendPool1"), - }, - }, - RulesEngine: &armfrontdoor.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoors/frontDoor1/rulesEngines/rulesEngine1"), - }, - WebApplicationFirewallPolicyLink: &armfrontdoor.RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/policy1"), - }, - }, - }}, - }, - }, - 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/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/FrontdoorDelete.json -func ExampleFrontDoorsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewFrontDoorsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "rg1", - "frontDoor1", - 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/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/FrontdoorValidateCustomDomain.json -func ExampleFrontDoorsClient_ValidateCustomDomain() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewFrontDoorsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ValidateCustomDomain(ctx, - "rg1", - "frontDoor1", - armfrontdoor.ValidateCustomDomainInput{ - HostName: to.Ptr("www.someDomain.com"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_frontendendpoints_client_test.go b/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_frontendendpoints_client_test.go deleted file mode 100644 index 3e31f7772743..000000000000 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_frontendendpoints_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 armfrontdoor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/frontdoor/armfrontdoor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/FrontdoorFrontendEndpointList.json -func ExampleFrontendEndpointsClient_NewListByFrontDoorPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewFrontendEndpointsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByFrontDoorPager("rg1", - "frontDoor1", - 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/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/FrontdoorFrontendEndpointGet.json -func ExampleFrontendEndpointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewFrontendEndpointsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "frontDoor1", - "frontendEndpoint1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_managedrulesets_client_test.go b/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_managedrulesets_client_test.go deleted file mode 100644 index 9a475aee5682..000000000000 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_managedrulesets_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 armfrontdoor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/frontdoor/armfrontdoor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/frontdoor/resource-manager/Microsoft.Network/stable/2020-11-01/examples/WafListManagedRuleSets.json -func ExampleManagedRuleSetsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewManagedRuleSetsClient("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 - } - } -} diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_networkexperimentprofiles_client_test.go b/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_networkexperimentprofiles_client_test.go deleted file mode 100644 index e0347e141bb9..000000000000 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_networkexperimentprofiles_client_test.go +++ /dev/null @@ -1,180 +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 armfrontdoor_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/frontdoor/armfrontdoor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentListProfiles.json -func ExampleNetworkExperimentProfilesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewNetworkExperimentProfilesClient("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/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentListProfiles.json -func ExampleNetworkExperimentProfilesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewNetworkExperimentProfilesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("MyResourceGroup", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentGetProfile.json -func ExampleNetworkExperimentProfilesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewNetworkExperimentProfilesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "MyResourceGroup", - "MyProfile", - 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/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentCreateProfile.json -func ExampleNetworkExperimentProfilesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewNetworkExperimentProfilesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "MyProfile", - "MyResourceGroup", - armfrontdoor.Profile{ - Location: to.Ptr("WestUs"), - Properties: &armfrontdoor.ProfileProperties{ - EnabledState: to.Ptr(armfrontdoor.StateEnabled), - }, - }, - 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/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentUpdateProfile.json -func ExampleNetworkExperimentProfilesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewNetworkExperimentProfilesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "MyResourceGroup", - "MyProfile", - armfrontdoor.ProfileUpdateModel{ - Properties: &armfrontdoor.ProfileUpdateProperties{ - EnabledState: to.Ptr(armfrontdoor.StateEnabled), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, - 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/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentDeleteProfile.json -func ExampleNetworkExperimentProfilesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewNetworkExperimentProfilesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "MyResourceGroup", - "MyProfile", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_policies_client_test.go b/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_policies_client_test.go deleted file mode 100644 index 28ea0b80f644..000000000000 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_policies_client_test.go +++ /dev/null @@ -1,210 +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 armfrontdoor_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/frontdoor/armfrontdoor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/frontdoor/resource-manager/Microsoft.Network/stable/2020-11-01/examples/WafListPolicies.json -func ExamplePoliciesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewPoliciesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rg1", - 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/frontdoor/resource-manager/Microsoft.Network/stable/2020-11-01/examples/WafPolicyGet.json -func ExamplePoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewPoliciesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "Policy1", - 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/frontdoor/resource-manager/Microsoft.Network/stable/2020-11-01/examples/WafPolicyCreateOrUpdate.json -func ExamplePoliciesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewPoliciesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "rg1", - "Policy1", - armfrontdoor.WebApplicationFirewallPolicy{ - Properties: &armfrontdoor.WebApplicationFirewallPolicyProperties{ - CustomRules: &armfrontdoor.CustomRuleList{ - Rules: []*armfrontdoor.CustomRule{ - { - Name: to.Ptr("Rule1"), - Action: to.Ptr(armfrontdoor.ActionTypeBlock), - MatchConditions: []*armfrontdoor.MatchCondition{ - { - MatchValue: []*string{ - to.Ptr("192.168.1.0/24"), - to.Ptr("10.0.0.0/24")}, - MatchVariable: to.Ptr(armfrontdoor.MatchVariableRemoteAddr), - Operator: to.Ptr(armfrontdoor.OperatorIPMatch), - }}, - Priority: to.Ptr[int32](1), - RateLimitThreshold: to.Ptr[int32](1000), - RuleType: to.Ptr(armfrontdoor.RuleTypeRateLimitRule), - }, - { - Name: to.Ptr("Rule2"), - Action: to.Ptr(armfrontdoor.ActionTypeBlock), - MatchConditions: []*armfrontdoor.MatchCondition{ - { - MatchValue: []*string{ - to.Ptr("CH")}, - MatchVariable: to.Ptr(armfrontdoor.MatchVariableRemoteAddr), - Operator: to.Ptr(armfrontdoor.OperatorGeoMatch), - }, - { - MatchValue: []*string{ - to.Ptr("windows")}, - MatchVariable: to.Ptr(armfrontdoor.MatchVariableRequestHeader), - Operator: to.Ptr(armfrontdoor.OperatorContains), - Selector: to.Ptr("UserAgent"), - Transforms: []*armfrontdoor.TransformType{ - to.Ptr(armfrontdoor.TransformTypeLowercase)}, - }}, - Priority: to.Ptr[int32](2), - RuleType: to.Ptr(armfrontdoor.RuleTypeMatchRule), - }}, - }, - ManagedRules: &armfrontdoor.ManagedRuleSetList{ - ManagedRuleSets: []*armfrontdoor.ManagedRuleSet{ - { - Exclusions: []*armfrontdoor.ManagedRuleExclusion{ - { - MatchVariable: to.Ptr(armfrontdoor.ManagedRuleExclusionMatchVariableRequestHeaderNames), - Selector: to.Ptr("User-Agent"), - SelectorMatchOperator: to.Ptr(armfrontdoor.ManagedRuleExclusionSelectorMatchOperatorEquals), - }}, - RuleGroupOverrides: []*armfrontdoor.ManagedRuleGroupOverride{ - { - Exclusions: []*armfrontdoor.ManagedRuleExclusion{ - { - MatchVariable: to.Ptr(armfrontdoor.ManagedRuleExclusionMatchVariableRequestCookieNames), - Selector: to.Ptr("token"), - SelectorMatchOperator: to.Ptr(armfrontdoor.ManagedRuleExclusionSelectorMatchOperatorStartsWith), - }}, - RuleGroupName: to.Ptr("SQLI"), - Rules: []*armfrontdoor.ManagedRuleOverride{ - { - Action: to.Ptr(armfrontdoor.ActionTypeRedirect), - EnabledState: to.Ptr(armfrontdoor.ManagedRuleEnabledStateEnabled), - Exclusions: []*armfrontdoor.ManagedRuleExclusion{ - { - MatchVariable: to.Ptr(armfrontdoor.ManagedRuleExclusionMatchVariableQueryStringArgNames), - Selector: to.Ptr("query"), - SelectorMatchOperator: to.Ptr(armfrontdoor.ManagedRuleExclusionSelectorMatchOperatorEquals), - }}, - RuleID: to.Ptr("942100"), - }, - { - EnabledState: to.Ptr(armfrontdoor.ManagedRuleEnabledStateDisabled), - RuleID: to.Ptr("942110"), - }}, - }}, - RuleSetAction: to.Ptr(armfrontdoor.ManagedRuleSetActionTypeBlock), - RuleSetType: to.Ptr("DefaultRuleSet"), - RuleSetVersion: to.Ptr("1.0"), - }}, - }, - PolicySettings: &armfrontdoor.PolicySettings{ - CustomBlockResponseBody: to.Ptr("PGh0bWw+CjxoZWFkZXI+PHRpdGxlPkhlbGxvPC90aXRsZT48L2hlYWRlcj4KPGJvZHk+CkhlbGxvIHdvcmxkCjwvYm9keT4KPC9odG1sPg=="), - CustomBlockResponseStatusCode: to.Ptr[int32](499), - EnabledState: to.Ptr(armfrontdoor.PolicyEnabledStateEnabled), - Mode: to.Ptr(armfrontdoor.PolicyModePrevention), - RedirectURL: to.Ptr("http://www.bing.com"), - RequestBodyCheck: to.Ptr(armfrontdoor.PolicyRequestBodyCheckDisabled), - }, - }, - SKU: &armfrontdoor.SKU{ - Name: to.Ptr(armfrontdoor.SKUNameClassicAzureFrontDoor), - }, - }, - 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/frontdoor/resource-manager/Microsoft.Network/stable/2020-11-01/examples/WafPolicyDelete.json -func ExamplePoliciesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewPoliciesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "rg1", - "Policy1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_preconfiguredendpoints_client_test.go b/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_preconfiguredendpoints_client_test.go deleted file mode 100644 index 5b9785fd29c9..000000000000 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_preconfiguredendpoints_client_test.go +++ /dev/null @@ -1,43 +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 armfrontdoor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/frontdoor/armfrontdoor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentGetPreconfiguredEndpoints.json -func ExamplePreconfiguredEndpointsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewPreconfiguredEndpointsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("MyResourceGroup", - "MyProfile", - 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/frontdoor/armfrontdoor/ze_generated_example_reports_client_test.go b/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_reports_client_test.go deleted file mode 100644 index 10c1642fa538..000000000000 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_reports_client_test.go +++ /dev/null @@ -1,74 +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 armfrontdoor_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/frontdoor/armfrontdoor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentGetLatencyScorecard.json -func ExampleReportsClient_GetLatencyScorecards() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewReportsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetLatencyScorecards(ctx, - "MyResourceGroup", - "MyProfile", - "MyExperiment", - armfrontdoor.LatencyScorecardAggregationIntervalDaily, - &armfrontdoor.ReportsClientGetLatencyScorecardsOptions{EndDateTimeUTC: nil, - Country: 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/frontdoor/resource-manager/Microsoft.Network/stable/2019-11-01/examples/NetworkExperimentGetTimeseries.json -func ExampleReportsClient_GetTimeseries() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewReportsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetTimeseries(ctx, - "MyResourceGroup", - "MyProfile", - "MyExperiment", - func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-21T17:32:28Z"); return t }(), - func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-21T17:32:28Z"); return t }(), - armfrontdoor.TimeseriesAggregationIntervalHourly, - armfrontdoor.TimeseriesTypeMeasurementCounts, - &armfrontdoor.ReportsClientGetTimeseriesOptions{Endpoint: nil, - Country: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_rulesengines_client_test.go b/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_rulesengines_client_test.go deleted file mode 100644 index 2e9dc90bc477..000000000000 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/ze_generated_example_rulesengines_client_test.go +++ /dev/null @@ -1,198 +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 armfrontdoor_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/frontdoor/armfrontdoor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/FrontdoorRulesEngineList.json -func ExampleRulesEnginesClient_NewListByFrontDoorPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewRulesEnginesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByFrontDoorPager("rg1", - "frontDoor1", - 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/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/FrontdoorRulesEngineGet.json -func ExampleRulesEnginesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewRulesEnginesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "frontDoor1", - "rulesEngine1", - 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/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/FrontdoorRulesEngineCreate.json -func ExampleRulesEnginesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewRulesEnginesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "rg1", - "frontDoor1", - "rulesEngine1", - armfrontdoor.RulesEngine{ - Properties: &armfrontdoor.RulesEngineProperties{ - Rules: []*armfrontdoor.RulesEngineRule{ - { - Name: to.Ptr("Rule1"), - Action: &armfrontdoor.RulesEngineAction{ - RouteConfigurationOverride: &armfrontdoor.RedirectConfiguration{ - ODataType: to.Ptr("#Microsoft.Azure.FrontDoor.Models.FrontdoorRedirectConfiguration"), - CustomFragment: to.Ptr("fragment"), - CustomHost: to.Ptr("www.bing.com"), - CustomPath: to.Ptr("/api"), - CustomQueryString: to.Ptr("a=b"), - RedirectProtocol: to.Ptr(armfrontdoor.FrontDoorRedirectProtocolHTTPSOnly), - RedirectType: to.Ptr(armfrontdoor.FrontDoorRedirectTypeMoved), - }, - }, - MatchConditions: []*armfrontdoor.RulesEngineMatchCondition{ - { - RulesEngineMatchValue: []*string{ - to.Ptr("CH")}, - RulesEngineMatchVariable: to.Ptr(armfrontdoor.RulesEngineMatchVariableRemoteAddr), - RulesEngineOperator: to.Ptr(armfrontdoor.RulesEngineOperatorGeoMatch), - }}, - MatchProcessingBehavior: to.Ptr(armfrontdoor.MatchProcessingBehaviorStop), - Priority: to.Ptr[int32](1), - }, - { - Name: to.Ptr("Rule2"), - Action: &armfrontdoor.RulesEngineAction{ - ResponseHeaderActions: []*armfrontdoor.HeaderAction{ - { - HeaderActionType: to.Ptr(armfrontdoor.HeaderActionTypeOverwrite), - HeaderName: to.Ptr("Cache-Control"), - Value: to.Ptr("public, max-age=31536000"), - }}, - }, - MatchConditions: []*armfrontdoor.RulesEngineMatchCondition{ - { - RulesEngineMatchValue: []*string{ - to.Ptr("jpg")}, - RulesEngineMatchVariable: to.Ptr(armfrontdoor.RulesEngineMatchVariableRequestFilenameExtension), - RulesEngineOperator: to.Ptr(armfrontdoor.RulesEngineOperatorEqual), - Transforms: []*armfrontdoor.Transform{ - to.Ptr(armfrontdoor.TransformLowercase)}, - }}, - Priority: to.Ptr[int32](2), - }, - { - Name: to.Ptr("Rule3"), - Action: &armfrontdoor.RulesEngineAction{ - RouteConfigurationOverride: &armfrontdoor.ForwardingConfiguration{ - ODataType: to.Ptr("#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration"), - BackendPool: &armfrontdoor.SubResource{ - ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoors/frontDoor1/backendPools/backendPool1"), - }, - CacheConfiguration: &armfrontdoor.CacheConfiguration{ - CacheDuration: to.Ptr("P1DT12H20M30S"), - DynamicCompression: to.Ptr(armfrontdoor.DynamicCompressionEnabledDisabled), - QueryParameterStripDirective: to.Ptr(armfrontdoor.FrontDoorQueryStripOnly), - QueryParameters: to.Ptr("a=b,p=q"), - }, - ForwardingProtocol: to.Ptr(armfrontdoor.FrontDoorForwardingProtocolHTTPSOnly), - }, - }, - MatchConditions: []*armfrontdoor.RulesEngineMatchCondition{ - { - NegateCondition: to.Ptr(false), - RulesEngineMatchValue: []*string{ - to.Ptr("allowoverride")}, - RulesEngineMatchVariable: to.Ptr(armfrontdoor.RulesEngineMatchVariableRequestHeader), - RulesEngineOperator: to.Ptr(armfrontdoor.RulesEngineOperatorEqual), - Selector: to.Ptr("Rules-Engine-Route-Forward"), - Transforms: []*armfrontdoor.Transform{ - to.Ptr(armfrontdoor.TransformLowercase)}, - }}, - Priority: to.Ptr[int32](3), - }}, - }, - }, - 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/frontdoor/resource-manager/Microsoft.Network/stable/2020-05-01/examples/FrontdoorRulesEngineDelete.json -func ExampleRulesEnginesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armfrontdoor.NewRulesEnginesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "rg1", - "frontDoor1", - "rulesEngine1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_models_serde.go b/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_models_serde.go deleted file mode 100644 index 1c2413bd7124..000000000000 --- a/sdk/resourcemanager/frontdoor/armfrontdoor/zz_generated_models_serde.go +++ /dev/null @@ -1,670 +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 armfrontdoor - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type BackendPoolProperties. -func (b BackendPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "backends", b.Backends) - populate(objectMap, "healthProbeSettings", b.HealthProbeSettings) - populate(objectMap, "loadBalancingSettings", b.LoadBalancingSettings) - populate(objectMap, "resourceState", b.ResourceState) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type BackendPoolUpdateParameters. -func (b BackendPoolUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "backends", b.Backends) - populate(objectMap, "healthProbeSettings", b.HealthProbeSettings) - populate(objectMap, "loadBalancingSettings", b.LoadBalancingSettings) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CustomRule. -func (c CustomRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "action", c.Action) - populate(objectMap, "enabledState", c.EnabledState) - populate(objectMap, "matchConditions", c.MatchConditions) - populate(objectMap, "name", c.Name) - populate(objectMap, "priority", c.Priority) - populate(objectMap, "rateLimitDurationInMinutes", c.RateLimitDurationInMinutes) - populate(objectMap, "rateLimitThreshold", c.RateLimitThreshold) - populate(objectMap, "ruleType", c.RuleType) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CustomRuleList. -func (c CustomRuleList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "rules", c.Rules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Experiment. -func (e Experiment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", e.ID) - populate(objectMap, "location", e.Location) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "tags", e.Tags) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ExperimentUpdateModel. -func (e ExperimentUpdateModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "tags", e.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ForwardingConfiguration. -func (f ForwardingConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "backendPool", f.BackendPool) - populate(objectMap, "cacheConfiguration", f.CacheConfiguration) - populate(objectMap, "customForwardingPath", f.CustomForwardingPath) - populate(objectMap, "forwardingProtocol", f.ForwardingProtocol) - objectMap["@odata.type"] = "#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ForwardingConfiguration. -func (f *ForwardingConfiguration) UnmarshalJSON(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 "backendPool": - err = unpopulate(val, "BackendPool", &f.BackendPool) - delete(rawMsg, key) - case "cacheConfiguration": - err = unpopulate(val, "CacheConfiguration", &f.CacheConfiguration) - delete(rawMsg, key) - case "customForwardingPath": - err = unpopulate(val, "CustomForwardingPath", &f.CustomForwardingPath) - delete(rawMsg, key) - case "forwardingProtocol": - err = unpopulate(val, "ForwardingProtocol", &f.ForwardingProtocol) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, "ODataType", &f.ODataType) - 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 FrontDoor. -func (f FrontDoor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", f.ID) - populate(objectMap, "location", f.Location) - populate(objectMap, "name", f.Name) - populate(objectMap, "properties", f.Properties) - populate(objectMap, "tags", f.Tags) - populate(objectMap, "type", f.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type LatencyScorecard. -func (l LatencyScorecard) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", l.ID) - populate(objectMap, "location", l.Location) - populate(objectMap, "name", l.Name) - populate(objectMap, "properties", l.Properties) - populate(objectMap, "tags", l.Tags) - populate(objectMap, "type", l.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type LatencyScorecardProperties. -func (l LatencyScorecardProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "country", l.Country) - populate(objectMap, "description", l.Description) - populateTimeRFC3339(objectMap, "endDateTimeUTC", l.EndDateTimeUTC) - populate(objectMap, "endpointA", l.EndpointA) - populate(objectMap, "endpointB", l.EndpointB) - populate(objectMap, "id", l.ID) - populate(objectMap, "latencyMetrics", l.LatencyMetrics) - populate(objectMap, "name", l.Name) - populateTimeRFC3339(objectMap, "startDateTimeUTC", l.StartDateTimeUTC) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LatencyScorecardProperties. -func (l *LatencyScorecardProperties) UnmarshalJSON(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 "country": - err = unpopulate(val, "Country", &l.Country) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &l.Description) - delete(rawMsg, key) - case "endDateTimeUTC": - err = unpopulateTimeRFC3339(val, "EndDateTimeUTC", &l.EndDateTimeUTC) - delete(rawMsg, key) - case "endpointA": - err = unpopulate(val, "EndpointA", &l.EndpointA) - delete(rawMsg, key) - case "endpointB": - err = unpopulate(val, "EndpointB", &l.EndpointB) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &l.ID) - delete(rawMsg, key) - case "latencyMetrics": - err = unpopulate(val, "LatencyMetrics", &l.LatencyMetrics) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &l.Name) - delete(rawMsg, key) - case "startDateTimeUTC": - err = unpopulateTimeRFC3339(val, "StartDateTimeUTC", &l.StartDateTimeUTC) - 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 ManagedRuleGroupDefinition. -func (m ManagedRuleGroupDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", m.Description) - populate(objectMap, "ruleGroupName", m.RuleGroupName) - populate(objectMap, "rules", m.Rules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ManagedRuleGroupOverride. -func (m ManagedRuleGroupOverride) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "exclusions", m.Exclusions) - populate(objectMap, "ruleGroupName", m.RuleGroupName) - populate(objectMap, "rules", m.Rules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ManagedRuleOverride. -func (m ManagedRuleOverride) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "action", m.Action) - populate(objectMap, "enabledState", m.EnabledState) - populate(objectMap, "exclusions", m.Exclusions) - populate(objectMap, "ruleId", m.RuleID) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ManagedRuleSet. -func (m ManagedRuleSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "exclusions", m.Exclusions) - populate(objectMap, "ruleGroupOverrides", m.RuleGroupOverrides) - populate(objectMap, "ruleSetAction", m.RuleSetAction) - populate(objectMap, "ruleSetType", m.RuleSetType) - populate(objectMap, "ruleSetVersion", m.RuleSetVersion) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ManagedRuleSetDefinition. -func (m ManagedRuleSetDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ManagedRuleSetDefinitionProperties. -func (m ManagedRuleSetDefinitionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "provisioningState", m.ProvisioningState) - populate(objectMap, "ruleGroups", m.RuleGroups) - populate(objectMap, "ruleSetId", m.RuleSetID) - populate(objectMap, "ruleSetType", m.RuleSetType) - populate(objectMap, "ruleSetVersion", m.RuleSetVersion) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ManagedRuleSetList. -func (m ManagedRuleSetList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "managedRuleSets", m.ManagedRuleSets) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MatchCondition. -func (m MatchCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "matchValue", m.MatchValue) - populate(objectMap, "matchVariable", m.MatchVariable) - populate(objectMap, "negateCondition", m.NegateCondition) - populate(objectMap, "operator", m.Operator) - populate(objectMap, "selector", m.Selector) - populate(objectMap, "transforms", m.Transforms) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PreconfiguredEndpoint. -func (p PreconfiguredEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Profile. -func (p Profile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", p.Etag) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ProfileUpdateModel. -func (p ProfileUpdateModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Properties. -func (p Properties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "backendPools", p.BackendPools) - populate(objectMap, "backendPoolsSettings", p.BackendPoolsSettings) - populate(objectMap, "cname", p.Cname) - populate(objectMap, "enabledState", p.EnabledState) - populate(objectMap, "friendlyName", p.FriendlyName) - populate(objectMap, "frontdoorId", p.FrontdoorID) - populate(objectMap, "frontendEndpoints", p.FrontendEndpoints) - populate(objectMap, "healthProbeSettings", p.HealthProbeSettings) - populate(objectMap, "loadBalancingSettings", p.LoadBalancingSettings) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "resourceState", p.ResourceState) - populate(objectMap, "routingRules", p.RoutingRules) - populate(objectMap, "rulesEngines", p.RulesEngines) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PurgeParameters. -func (p PurgeParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "contentPaths", p.ContentPaths) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RedirectConfiguration. -func (r RedirectConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "customFragment", r.CustomFragment) - populate(objectMap, "customHost", r.CustomHost) - populate(objectMap, "customPath", r.CustomPath) - populate(objectMap, "customQueryString", r.CustomQueryString) - objectMap["@odata.type"] = "#Microsoft.Azure.FrontDoor.Models.FrontdoorRedirectConfiguration" - populate(objectMap, "redirectProtocol", r.RedirectProtocol) - populate(objectMap, "redirectType", r.RedirectType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RedirectConfiguration. -func (r *RedirectConfiguration) UnmarshalJSON(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 "customFragment": - err = unpopulate(val, "CustomFragment", &r.CustomFragment) - delete(rawMsg, key) - case "customHost": - err = unpopulate(val, "CustomHost", &r.CustomHost) - delete(rawMsg, key) - case "customPath": - err = unpopulate(val, "CustomPath", &r.CustomPath) - delete(rawMsg, key) - case "customQueryString": - err = unpopulate(val, "CustomQueryString", &r.CustomQueryString) - delete(rawMsg, key) - case "@odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - case "redirectProtocol": - err = unpopulate(val, "RedirectProtocol", &r.RedirectProtocol) - delete(rawMsg, key) - case "redirectType": - err = unpopulate(val, "RedirectType", &r.RedirectType) - 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) -} - -// MarshalJSON implements the json.Marshaller interface for type RoutingRuleProperties. -func (r RoutingRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "acceptedProtocols", r.AcceptedProtocols) - populate(objectMap, "enabledState", r.EnabledState) - populate(objectMap, "frontendEndpoints", r.FrontendEndpoints) - populate(objectMap, "patternsToMatch", r.PatternsToMatch) - populate(objectMap, "resourceState", r.ResourceState) - populate(objectMap, "routeConfiguration", r.RouteConfiguration) - populate(objectMap, "rulesEngine", r.RulesEngine) - populate(objectMap, "webApplicationFirewallPolicyLink", r.WebApplicationFirewallPolicyLink) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingRuleProperties. -func (r *RoutingRuleProperties) UnmarshalJSON(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 "acceptedProtocols": - err = unpopulate(val, "AcceptedProtocols", &r.AcceptedProtocols) - delete(rawMsg, key) - case "enabledState": - err = unpopulate(val, "EnabledState", &r.EnabledState) - delete(rawMsg, key) - case "frontendEndpoints": - err = unpopulate(val, "FrontendEndpoints", &r.FrontendEndpoints) - delete(rawMsg, key) - case "patternsToMatch": - err = unpopulate(val, "PatternsToMatch", &r.PatternsToMatch) - delete(rawMsg, key) - case "resourceState": - err = unpopulate(val, "ResourceState", &r.ResourceState) - delete(rawMsg, key) - case "routeConfiguration": - r.RouteConfiguration, err = unmarshalRouteConfigurationClassification(val) - delete(rawMsg, key) - case "rulesEngine": - err = unpopulate(val, "RulesEngine", &r.RulesEngine) - delete(rawMsg, key) - case "webApplicationFirewallPolicyLink": - err = unpopulate(val, "WebApplicationFirewallPolicyLink", &r.WebApplicationFirewallPolicyLink) - 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 RoutingRuleUpdateParameters. -func (r RoutingRuleUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "acceptedProtocols", r.AcceptedProtocols) - populate(objectMap, "enabledState", r.EnabledState) - populate(objectMap, "frontendEndpoints", r.FrontendEndpoints) - populate(objectMap, "patternsToMatch", r.PatternsToMatch) - populate(objectMap, "routeConfiguration", r.RouteConfiguration) - populate(objectMap, "rulesEngine", r.RulesEngine) - populate(objectMap, "webApplicationFirewallPolicyLink", r.WebApplicationFirewallPolicyLink) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingRuleUpdateParameters. -func (r *RoutingRuleUpdateParameters) UnmarshalJSON(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 "acceptedProtocols": - err = unpopulate(val, "AcceptedProtocols", &r.AcceptedProtocols) - delete(rawMsg, key) - case "enabledState": - err = unpopulate(val, "EnabledState", &r.EnabledState) - delete(rawMsg, key) - case "frontendEndpoints": - err = unpopulate(val, "FrontendEndpoints", &r.FrontendEndpoints) - delete(rawMsg, key) - case "patternsToMatch": - err = unpopulate(val, "PatternsToMatch", &r.PatternsToMatch) - delete(rawMsg, key) - case "routeConfiguration": - r.RouteConfiguration, err = unmarshalRouteConfigurationClassification(val) - delete(rawMsg, key) - case "rulesEngine": - err = unpopulate(val, "RulesEngine", &r.RulesEngine) - delete(rawMsg, key) - case "webApplicationFirewallPolicyLink": - err = unpopulate(val, "WebApplicationFirewallPolicyLink", &r.WebApplicationFirewallPolicyLink) - 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 RulesEngineAction. -func (r RulesEngineAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "requestHeaderActions", r.RequestHeaderActions) - populate(objectMap, "responseHeaderActions", r.ResponseHeaderActions) - populate(objectMap, "routeConfigurationOverride", r.RouteConfigurationOverride) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RulesEngineAction. -func (r *RulesEngineAction) UnmarshalJSON(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 "requestHeaderActions": - err = unpopulate(val, "RequestHeaderActions", &r.RequestHeaderActions) - delete(rawMsg, key) - case "responseHeaderActions": - err = unpopulate(val, "ResponseHeaderActions", &r.ResponseHeaderActions) - delete(rawMsg, key) - case "routeConfigurationOverride": - r.RouteConfigurationOverride, err = unmarshalRouteConfigurationClassification(val) - 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 RulesEngineMatchCondition. -func (r RulesEngineMatchCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "negateCondition", r.NegateCondition) - populate(objectMap, "rulesEngineMatchValue", r.RulesEngineMatchValue) - populate(objectMap, "rulesEngineMatchVariable", r.RulesEngineMatchVariable) - populate(objectMap, "rulesEngineOperator", r.RulesEngineOperator) - populate(objectMap, "selector", r.Selector) - populate(objectMap, "transforms", r.Transforms) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RulesEngineProperties. -func (r RulesEngineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "resourceState", r.ResourceState) - populate(objectMap, "rules", r.Rules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RulesEngineRule. -func (r RulesEngineRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "action", r.Action) - populate(objectMap, "matchConditions", r.MatchConditions) - populate(objectMap, "matchProcessingBehavior", r.MatchProcessingBehavior) - populate(objectMap, "name", r.Name) - populate(objectMap, "priority", r.Priority) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RulesEngineUpdateParameters. -func (r RulesEngineUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "rules", r.Rules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Timeseries. -func (t Timeseries) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TimeseriesProperties. -func (t TimeseriesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aggregationInterval", t.AggregationInterval) - populate(objectMap, "country", t.Country) - populate(objectMap, "endDateTimeUTC", t.EndDateTimeUTC) - populate(objectMap, "endpoint", t.Endpoint) - populate(objectMap, "startDateTimeUTC", t.StartDateTimeUTC) - populate(objectMap, "timeseriesData", t.TimeseriesData) - populate(objectMap, "timeseriesType", t.TimeseriesType) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type UpdateParameters. -func (u UpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "backendPools", u.BackendPools) - populate(objectMap, "backendPoolsSettings", u.BackendPoolsSettings) - populate(objectMap, "enabledState", u.EnabledState) - populate(objectMap, "friendlyName", u.FriendlyName) - populate(objectMap, "frontendEndpoints", u.FrontendEndpoints) - populate(objectMap, "healthProbeSettings", u.HealthProbeSettings) - populate(objectMap, "loadBalancingSettings", u.LoadBalancingSettings) - populate(objectMap, "routingRules", u.RoutingRules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WebApplicationFirewallPolicy. -func (w WebApplicationFirewallPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", w.Etag) - populate(objectMap, "id", w.ID) - populate(objectMap, "location", w.Location) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "sku", w.SKU) - populate(objectMap, "tags", w.Tags) - populate(objectMap, "type", w.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WebApplicationFirewallPolicyProperties. -func (w WebApplicationFirewallPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "customRules", w.CustomRules) - populate(objectMap, "frontendEndpointLinks", w.FrontendEndpointLinks) - populate(objectMap, "managedRules", w.ManagedRules) - populate(objectMap, "policySettings", w.PolicySettings) - populate(objectMap, "provisioningState", w.ProvisioningState) - populate(objectMap, "resourceState", w.ResourceState) - populate(objectMap, "routingRuleLinks", w.RoutingRuleLinks) - populate(objectMap, "securityPolicyLinks", w.SecurityPolicyLinks) - 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 -}