From b7876cff95bb1170c9fc5e7265259d258c33f669 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Wed, 1 Jun 2022 17:49:03 +0200 Subject: [PATCH 1/7] cdn: adding the clients for CDN Frontdoor --- .../cdn/azuresdkhacks/cdn_frontdoor_route.go | 169 ++++++++++++++++++ internal/services/cdn/client/client.go | 77 ++++++-- 2 files changed, 236 insertions(+), 10 deletions(-) create mode 100644 internal/services/cdn/azuresdkhacks/cdn_frontdoor_route.go diff --git a/internal/services/cdn/azuresdkhacks/cdn_frontdoor_route.go b/internal/services/cdn/azuresdkhacks/cdn_frontdoor_route.go new file mode 100644 index 000000000000..ac5d2779cf20 --- /dev/null +++ b/internal/services/cdn/azuresdkhacks/cdn_frontdoor_route.go @@ -0,0 +1,169 @@ +package azuresdkhacks + +import ( + "context" + "encoding/json" + "net/http" + + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" + "github.com/Azure/go-autorest/autorest" +) + +// NOTE: this workaround client exists to allow the removal of `cacheConfiguration` items during update + +type CdnFrontDoorRoutesWorkaroundClient struct { + sdkClient *cdn.RoutesClient +} + +func NewCdnFrontDoorRoutesWorkaroundClient(client *cdn.RoutesClient) CdnFrontDoorRoutesWorkaroundClient { + return CdnFrontDoorRoutesWorkaroundClient{ + sdkClient: client, + } +} + +func (c *CdnFrontDoorRoutesWorkaroundClient) Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string, routeUpdateProperties RouteUpdateParameters) (result cdn.RoutesUpdateFuture, err error) { + req, err := c.UpdatePreparer(ctx, resourceGroupName, profileName, endpointName, routeName, routeUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.sdkClient.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client CdnFrontDoorRoutesWorkaroundClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string, routeUpdateProperties RouteUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.sdkClient.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.sdkClient.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}", pathParameters), + autorest.WithJSON(routeUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RouteUpdateParameters the domain JSON object required for domain creation or update. +type RouteUpdateParameters struct { + *RouteUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteUpdateParameters. +func (rup RouteUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rup.RouteUpdatePropertiesParameters != nil { + objectMap["properties"] = rup.RouteUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RouteUpdateParameters struct. +func (rup *RouteUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { // nolint gocritic + case "properties": + if v != nil { + var routeUpdatePropertiesParameters RouteUpdatePropertiesParameters + err = json.Unmarshal(*v, &routeUpdatePropertiesParameters) + if err != nil { + return err + } + + rup.RouteUpdatePropertiesParameters = &routeUpdatePropertiesParameters + } + } + } + + return nil +} + +// RouteUpdatePropertiesParameters the JSON object that contains the properties of the domain to create. +type RouteUpdatePropertiesParameters struct { + // EndpointName - READ-ONLY; The name of the endpoint which holds the route. + EndpointName *string `json:"endpointName,omitempty"` + // CustomDomains - Domains referenced by this endpoint. + CustomDomains *[]cdn.ActivatedResourceReference `json:"customDomains,omitempty"` + // OriginGroup - A reference to the origin group. + OriginGroup *cdn.ResourceReference `json:"originGroup,omitempty"` + // OriginPath - A directory path on the origin that AzureFrontDoor can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. + OriginPath *string `json:"originPath,omitempty"` + // RuleSets - rule sets referenced by this endpoint. + RuleSets *[]cdn.ResourceReference `json:"ruleSets,omitempty"` + // SupportedProtocols - List of supported protocols for this route. + SupportedProtocols *[]cdn.AFDEndpointProtocols `json:"supportedProtocols,omitempty"` + // PatternsToMatch - The route patterns of the rule. + PatternsToMatch *[]string `json:"patternsToMatch,omitempty"` + // CacheConfiguration - The caching configuration for this route. To disable caching, do not provide a cacheConfiguration object. + CacheConfiguration *cdn.AfdRouteCacheConfiguration `json:"cacheConfiguration,omitempty"` + // ForwardingProtocol - Protocol this rule will use when forwarding traffic to backends. Possible values include: 'ForwardingProtocolHTTPOnly', 'ForwardingProtocolHTTPSOnly', 'ForwardingProtocolMatchRequest' + ForwardingProtocol cdn.ForwardingProtocol `json:"forwardingProtocol,omitempty"` + // LinkToDefaultDomain - whether this route will be linked to the default endpoint domain. Possible values include: 'LinkToDefaultDomainEnabled', 'LinkToDefaultDomainDisabled' + LinkToDefaultDomain cdn.LinkToDefaultDomain `json:"linkToDefaultDomain,omitempty"` + // HTTPSRedirect - Whether to automatically redirect HTTP traffic to HTTPS traffic. Note that this is a easy way to set up this rule and it will be the first rule that gets executed. Possible values include: 'HTTPSRedirectEnabled', 'HTTPSRedirectDisabled' + HTTPSRedirect cdn.HTTPSRedirect `json:"httpsRedirect,omitempty"` + // EnabledState - Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + EnabledState cdn.EnabledState `json:"enabledState,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteUpdatePropertiesParameters. +func (rupp RouteUpdatePropertiesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + + objectMap["customDomains"] = rupp.CustomDomains + + if rupp.OriginGroup != nil { + objectMap["originGroup"] = rupp.OriginGroup + } + if rupp.OriginPath != nil { + objectMap["originPath"] = rupp.OriginPath + } + if rupp.RuleSets != nil { + objectMap["ruleSets"] = rupp.RuleSets + } + if rupp.SupportedProtocols != nil { + objectMap["supportedProtocols"] = rupp.SupportedProtocols + } + if rupp.PatternsToMatch != nil { + objectMap["patternsToMatch"] = rupp.PatternsToMatch + } + + objectMap["cacheConfiguration"] = rupp.CacheConfiguration + + if rupp.ForwardingProtocol != "" { + objectMap["forwardingProtocol"] = rupp.ForwardingProtocol + } + if rupp.LinkToDefaultDomain != "" { + objectMap["linkToDefaultDomain"] = rupp.LinkToDefaultDomain + } + if rupp.HTTPSRedirect != "" { + objectMap["httpsRedirect"] = rupp.HTTPSRedirect + } + if rupp.EnabledState != "" { + objectMap["enabledState"] = rupp.EnabledState + } + return json.Marshal(objectMap) +} diff --git a/internal/services/cdn/client/client.go b/internal/services/cdn/client/client.go index 3e2f590c2689..f805f89c9e1d 100644 --- a/internal/services/cdn/client/client.go +++ b/internal/services/cdn/client/client.go @@ -1,29 +1,86 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" + cdnSdk "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" + cdnFrontDoorSdk "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" + "github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - CustomDomainsClient *cdn.CustomDomainsClient - EndpointsClient *cdn.EndpointsClient - ProfilesClient *cdn.ProfilesClient + FrontDoorEndpointsClient *cdnFrontDoorSdk.AFDEndpointsClient + FrontDoorOriginGroupsClient *cdnFrontDoorSdk.AFDOriginGroupsClient + FrontDoorOriginsClient *cdnFrontDoorSdk.AFDOriginsClient + FrontDoorCustomDomainsClient *cdnFrontDoorSdk.AFDCustomDomainsClient + FrontDoorSecurityPoliciesClient *cdnFrontDoorSdk.SecurityPoliciesClient + FrontDoorRoutesClient *cdnFrontDoorSdk.RoutesClient + FrontDoorRulesClient *cdnFrontDoorSdk.RulesClient + FrontDoorProfileClient *cdnFrontDoorSdk.ProfilesClient + FrontDoorSecretsClient *cdnFrontDoorSdk.SecretsClient + FrontDoorRuleSetsClient *cdnFrontDoorSdk.RuleSetsClient + FrontDoorLegacyPoliciesClient *frontdoor.PoliciesClient + CustomDomainsClient *cdnSdk.CustomDomainsClient + EndpointsClient *cdnSdk.EndpointsClient + ProfilesClient *cdnSdk.ProfilesClient } func NewClient(o *common.ClientOptions) *Client { - customDomainsClient := cdn.NewCustomDomainsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + frontDoorEndpointsClient := cdnFrontDoorSdk.NewAFDEndpointsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&frontDoorEndpointsClient.Client, o.ResourceManagerAuthorizer) + + frontDoorOriginGroupsClient := cdnFrontDoorSdk.NewAFDOriginGroupsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&frontDoorOriginGroupsClient.Client, o.ResourceManagerAuthorizer) + + frontDoorOriginsClient := cdnFrontDoorSdk.NewAFDOriginsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&frontDoorOriginsClient.Client, o.ResourceManagerAuthorizer) + + frontDoorCustomDomainsClient := cdnFrontDoorSdk.NewAFDCustomDomainsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&frontDoorCustomDomainsClient.Client, o.ResourceManagerAuthorizer) + + frontDoorPolicySecurityPoliciesClient := cdnFrontDoorSdk.NewSecurityPoliciesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&frontDoorPolicySecurityPoliciesClient.Client, o.ResourceManagerAuthorizer) + + frontDoorLegacyPoliciesClient := frontdoor.NewPoliciesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&frontDoorLegacyPoliciesClient.Client, o.ResourceManagerAuthorizer) + + frontDoorRoutesClient := cdnFrontDoorSdk.NewRoutesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&frontDoorRoutesClient.Client, o.ResourceManagerAuthorizer) + + frontDoorRulesClient := cdnFrontDoorSdk.NewRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&frontDoorRulesClient.Client, o.ResourceManagerAuthorizer) + + frontDoorProfilesClient := cdnFrontDoorSdk.NewProfilesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&frontDoorProfilesClient.Client, o.ResourceManagerAuthorizer) + + frontDoorPolicySecretsClient := cdnFrontDoorSdk.NewSecretsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&frontDoorPolicySecretsClient.Client, o.ResourceManagerAuthorizer) + + frontDoorRuleSetsClient := cdnFrontDoorSdk.NewRuleSetsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&frontDoorRuleSetsClient.Client, o.ResourceManagerAuthorizer) + + customDomainsClient := cdnSdk.NewCustomDomainsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&customDomainsClient.Client, o.ResourceManagerAuthorizer) - endpointsClient := cdn.NewEndpointsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + endpointsClient := cdnSdk.NewEndpointsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&endpointsClient.Client, o.ResourceManagerAuthorizer) - profilesClient := cdn.NewProfilesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + profilesClient := cdnSdk.NewProfilesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&profilesClient.Client, o.ResourceManagerAuthorizer) return &Client{ - CustomDomainsClient: &customDomainsClient, - EndpointsClient: &endpointsClient, - ProfilesClient: &profilesClient, + FrontDoorEndpointsClient: &frontDoorEndpointsClient, + FrontDoorOriginGroupsClient: &frontDoorOriginGroupsClient, + FrontDoorOriginsClient: &frontDoorOriginsClient, + FrontDoorCustomDomainsClient: &frontDoorCustomDomainsClient, + FrontDoorSecurityPoliciesClient: &frontDoorPolicySecurityPoliciesClient, + FrontDoorRoutesClient: &frontDoorRoutesClient, + FrontDoorRulesClient: &frontDoorRulesClient, + FrontDoorProfileClient: &frontDoorProfilesClient, + FrontDoorSecretsClient: &frontDoorPolicySecretsClient, + FrontDoorRuleSetsClient: &frontDoorRuleSetsClient, + FrontDoorLegacyPoliciesClient: &frontDoorLegacyPoliciesClient, + CustomDomainsClient: &customDomainsClient, + EndpointsClient: &endpointsClient, + ProfilesClient: &profilesClient, } } From bba55067796d07da65f3b8e88cfd94b3ecb3e9e1 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Wed, 1 Jun 2022 17:49:23 +0200 Subject: [PATCH 2/7] go mod vendor --- .../cdn/mgmt/2021-06-01/cdn/CHANGELOG.md | 2 + .../cdn/mgmt/2021-06-01/cdn/_meta.json | 11 + .../mgmt/2021-06-01/cdn/afdcustomdomains.go | 616 + .../cdn/mgmt/2021-06-01/cdn/afdendpoints.go | 844 + .../mgmt/2021-06-01/cdn/afdorigingroups.go | 663 + .../cdn/mgmt/2021-06-01/cdn/afdorigins.go | 551 + .../cdn/mgmt/2021-06-01/cdn/afdprofiles.go | 249 + .../cdn/mgmt/2021-06-01/cdn/client.go | 377 + .../cdn/mgmt/2021-06-01/cdn/customdomains.go | 620 + .../cdn/mgmt/2021-06-01/cdn/edgenodes.go | 140 + .../cdn/mgmt/2021-06-01/cdn/endpoints.go | 1111 ++ .../services/cdn/mgmt/2021-06-01/cdn/enums.go | 1923 ++ .../cdn/mgmt/2021-06-01/cdn/loganalytics.go | 608 + .../mgmt/2021-06-01/cdn/managedrulesets.go | 144 + .../cdn/mgmt/2021-06-01/cdn/models.go | 14642 ++++++++++++++++ .../cdn/mgmt/2021-06-01/cdn/operations.go | 140 + .../cdn/mgmt/2021-06-01/cdn/origingroups.go | 526 + .../cdn/mgmt/2021-06-01/cdn/origins.go | 526 + .../cdn/mgmt/2021-06-01/cdn/policies.go | 520 + .../cdn/mgmt/2021-06-01/cdn/profiles.go | 938 + .../cdn/mgmt/2021-06-01/cdn/resourceusage.go | 144 + .../cdn/mgmt/2021-06-01/cdn/routes.go | 538 + .../services/cdn/mgmt/2021-06-01/cdn/rules.go | 536 + .../cdn/mgmt/2021-06-01/cdn/rulesets.go | 553 + .../cdn/mgmt/2021-06-01/cdn/secrets.go | 428 + .../mgmt/2021-06-01/cdn/securitypolicies.go | 522 + .../cdn/mgmt/2021-06-01/cdn/validate.go | 113 + .../cdn/mgmt/2021-06-01/cdn/version.go | 19 + .../mgmt/2020-11-01/frontdoor/CHANGELOG.md | 2 + .../mgmt/2020-11-01/frontdoor/_meta.json | 11 + .../mgmt/2020-11-01/frontdoor/client.go | 41 + .../mgmt/2020-11-01/frontdoor/endpoints.go | 129 + .../mgmt/2020-11-01/frontdoor/enums.go | 960 + .../mgmt/2020-11-01/frontdoor/experiments.go | 534 + .../mgmt/2020-11-01/frontdoor/frontdoors.go | 635 + .../2020-11-01/frontdoor/frontendendpoints.go | 454 + .../2020-11-01/frontdoor/managedrulesets.go | 144 + .../mgmt/2020-11-01/frontdoor/models.go | 4945 ++++++ .../2020-11-01/frontdoor/nameavailability.go | 110 + .../nameavailabilitywithsubscription.go | 114 + .../frontdoor/networkexperimentprofiles.go | 628 + .../mgmt/2020-11-01/frontdoor/policies.go | 429 + .../frontdoor/preconfiguredendpoints.go | 161 + .../mgmt/2020-11-01/frontdoor/reports.go | 241 + .../mgmt/2020-11-01/frontdoor/rulesengines.go | 456 + .../mgmt/2020-11-01/frontdoor/version.go | 19 + vendor/modules.txt | 2 + 47 files changed, 38019 insertions(+) create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/CHANGELOG.md create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/_meta.json create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdcustomdomains.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdendpoints.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdorigingroups.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdorigins.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdprofiles.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/customdomains.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/edgenodes.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/endpoints.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/enums.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/loganalytics.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/managedrulesets.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/operations.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/origingroups.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/origins.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/policies.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/profiles.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/resourceusage.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/routes.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/rules.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/rulesets.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/secrets.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/securitypolicies.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/validate.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/version.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/CHANGELOG.md create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/_meta.json create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/endpoints.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/enums.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/experiments.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontdoors.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontendendpoints.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/managedrulesets.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailability.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailabilitywithsubscription.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/networkexperimentprofiles.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/policies.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/preconfiguredendpoints.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/reports.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/rulesengines.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/version.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/_meta.json new file mode 100644 index 000000000000..32850ce6dba4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "162460648e39b3cd20ef3d302008add138e90223", + "readme": "/_/azure-rest-api-specs/specification/cdn/resource-manager/readme.md", + "tag": "package-2021-06", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-06 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/cdn/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdcustomdomains.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdcustomdomains.go new file mode 100644 index 000000000000..55532707b5f3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdcustomdomains.go @@ -0,0 +1,616 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AFDCustomDomainsClient is the cdn Management Client +type AFDCustomDomainsClient struct { + BaseClient +} + +// NewAFDCustomDomainsClient creates an instance of the AFDCustomDomainsClient client. +func NewAFDCustomDomainsClient(subscriptionID string) AFDCustomDomainsClient { + return NewAFDCustomDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAFDCustomDomainsClientWithBaseURI creates an instance of the AFDCustomDomainsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewAFDCustomDomainsClientWithBaseURI(baseURI string, subscriptionID string) AFDCustomDomainsClient { + return AFDCustomDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new domain within the specified profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// customDomainName - name of the domain under the profile which is unique globally +// customDomain - domain properties +func (client AFDCustomDomainsClient) Create(ctx context.Context, resourceGroupName string, profileName string, customDomainName string, customDomain AFDDomain) (result AFDCustomDomainsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDCustomDomainsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: customDomain, + Constraints: []validation.Constraint{{Target: "customDomain.AFDDomainProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "customDomain.AFDDomainProperties.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("cdn.AFDCustomDomainsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, customDomainName, customDomain) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AFDCustomDomainsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, customDomainName string, customDomain AFDDomain) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}", pathParameters), + autorest.WithJSON(customDomain), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AFDCustomDomainsClient) CreateSender(req *http.Request) (future AFDCustomDomainsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AFDCustomDomainsClient) CreateResponder(resp *http.Response) (result AFDDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing AzureFrontDoor domain with the specified domain name under the specified subscription, +// resource group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// customDomainName - name of the domain under the profile which is unique globally. +func (client AFDCustomDomainsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, customDomainName string) (result AFDCustomDomainsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDCustomDomainsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDCustomDomainsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, customDomainName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AFDCustomDomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AFDCustomDomainsClient) DeleteSender(req *http.Request) (future AFDCustomDomainsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AFDCustomDomainsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing AzureFrontDoor domain with the specified domain name under the specified subscription, resource +// group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// customDomainName - name of the domain under the profile which is unique globally. +func (client AFDCustomDomainsClient) Get(ctx context.Context, resourceGroupName string, profileName string, customDomainName string) (result AFDDomain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDCustomDomainsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDCustomDomainsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, customDomainName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AFDCustomDomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AFDCustomDomainsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AFDCustomDomainsClient) GetResponder(resp *http.Response) (result AFDDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile lists existing AzureFrontDoor domains. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile or CDN profile which +// is unique within the resource group. +func (client AFDCustomDomainsClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result AFDDomainListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDCustomDomainsClient.ListByProfile") + defer func() { + sc := -1 + if result.adlr.Response.Response != nil { + sc = result.adlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDCustomDomainsClient", "ListByProfile", err.Error()) + } + + result.fn = client.listByProfileNextResults + req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.adlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "ListByProfile", resp, "Failure sending request") + return + } + + result.adlr, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "ListByProfile", resp, "Failure responding to request") + return + } + if result.adlr.hasNextLink() && result.adlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client AFDCustomDomainsClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client AFDCustomDomainsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client AFDCustomDomainsClient) ListByProfileResponder(resp *http.Response) (result AFDDomainListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByProfileNextResults retrieves the next set of results, if any. +func (client AFDCustomDomainsClient) listByProfileNextResults(ctx context.Context, lastResults AFDDomainListResult) (result AFDDomainListResult, err error) { + req, err := lastResults.aFDDomainListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "listByProfileNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "listByProfileNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "listByProfileNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. +func (client AFDCustomDomainsClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result AFDDomainListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDCustomDomainsClient.ListByProfile") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) + return +} + +// RefreshValidationToken updates the domain validation token. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// customDomainName - name of the domain under the profile which is unique globally. +func (client AFDCustomDomainsClient) RefreshValidationToken(ctx context.Context, resourceGroupName string, profileName string, customDomainName string) (result AFDCustomDomainsRefreshValidationTokenFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDCustomDomainsClient.RefreshValidationToken") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDCustomDomainsClient", "RefreshValidationToken", err.Error()) + } + + req, err := client.RefreshValidationTokenPreparer(ctx, resourceGroupName, profileName, customDomainName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "RefreshValidationToken", nil, "Failure preparing request") + return + } + + result, err = client.RefreshValidationTokenSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "RefreshValidationToken", result.Response(), "Failure sending request") + return + } + + return +} + +// RefreshValidationTokenPreparer prepares the RefreshValidationToken request. +func (client AFDCustomDomainsClient) RefreshValidationTokenPreparer(ctx context.Context, resourceGroupName string, profileName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}/refreshValidationToken", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RefreshValidationTokenSender sends the RefreshValidationToken request. The method will close the +// http.Response Body if it receives an error. +func (client AFDCustomDomainsClient) RefreshValidationTokenSender(req *http.Request) (future AFDCustomDomainsRefreshValidationTokenFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RefreshValidationTokenResponder handles the response to the RefreshValidationToken request. The method always +// closes the http.Response Body. +func (client AFDCustomDomainsClient) RefreshValidationTokenResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates an existing domain within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// customDomainName - name of the domain under the profile which is unique globally +// customDomainUpdateProperties - domain properties +func (client AFDCustomDomainsClient) Update(ctx context.Context, resourceGroupName string, profileName string, customDomainName string, customDomainUpdateProperties AFDDomainUpdateParameters) (result AFDCustomDomainsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDCustomDomainsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDCustomDomainsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, customDomainName, customDomainUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AFDCustomDomainsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, customDomainName string, customDomainUpdateProperties AFDDomainUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}", pathParameters), + autorest.WithJSON(customDomainUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AFDCustomDomainsClient) UpdateSender(req *http.Request) (future AFDCustomDomainsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AFDCustomDomainsClient) UpdateResponder(resp *http.Response) (result AFDDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdendpoints.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdendpoints.go new file mode 100644 index 000000000000..eee6e78a71e7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdendpoints.go @@ -0,0 +1,844 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AFDEndpointsClient is the cdn Management Client +type AFDEndpointsClient struct { + BaseClient +} + +// NewAFDEndpointsClient creates an instance of the AFDEndpointsClient client. +func NewAFDEndpointsClient(subscriptionID string) AFDEndpointsClient { + return NewAFDEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAFDEndpointsClientWithBaseURI creates an instance of the AFDEndpointsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAFDEndpointsClientWithBaseURI(baseURI string, subscriptionID string) AFDEndpointsClient { + return AFDEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new AzureFrontDoor endpoint with the specified endpoint name under the specified subscription, +// resource group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// endpoint - endpoint properties +func (client AFDEndpointsClient) Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpoint AFDEndpoint) (result AFDEndpointsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, endpointName, endpoint) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AFDEndpointsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpoint AFDEndpoint) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}", pathParameters), + autorest.WithJSON(endpoint), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) CreateSender(req *http.Request) (future AFDEndpointsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) CreateResponder(resp *http.Response) (result AFDEndpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing AzureFrontDoor endpoint with the specified endpoint name under the specified +// subscription, resource group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client AFDEndpointsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result AFDEndpointsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AFDEndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) DeleteSender(req *http.Request) (future AFDEndpointsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing AzureFrontDoor endpoint with the specified endpoint name under the specified subscription, +// resource group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client AFDEndpointsClient) Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result AFDEndpoint, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AFDEndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) GetResponder(resp *http.Response) (result AFDEndpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile lists existing AzureFrontDoor endpoints. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +func (client AFDEndpointsClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result AFDEndpointListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.ListByProfile") + defer func() { + sc := -1 + if result.aelr.Response.Response != nil { + sc = result.aelr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "ListByProfile", err.Error()) + } + + result.fn = client.listByProfileNextResults + req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.aelr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ListByProfile", resp, "Failure sending request") + return + } + + result.aelr, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ListByProfile", resp, "Failure responding to request") + return + } + if result.aelr.hasNextLink() && result.aelr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client AFDEndpointsClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) ListByProfileResponder(resp *http.Response) (result AFDEndpointListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByProfileNextResults retrieves the next set of results, if any. +func (client AFDEndpointsClient) listByProfileNextResults(ctx context.Context, lastResults AFDEndpointListResult) (result AFDEndpointListResult, err error) { + req, err := lastResults.aFDEndpointListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "listByProfileNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "listByProfileNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "listByProfileNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. +func (client AFDEndpointsClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result AFDEndpointListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.ListByProfile") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) + return +} + +// ListResourceUsage checks the quota and actual usage of endpoints under the given CDN profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client AFDEndpointsClient) ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result UsagesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.ulr.Response.Response != nil { + sc = result.ulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "ListResourceUsage", err.Error()) + } + + result.fn = client.listResourceUsageNextResults + req, err := client.ListResourceUsagePreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ListResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.ulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ListResourceUsage", resp, "Failure sending request") + return + } + + result.ulr, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ListResourceUsage", resp, "Failure responding to request") + return + } + if result.ulr.hasNextLink() && result.ulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client AFDEndpointsClient) ListResourceUsagePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) ListResourceUsageResponder(resp *http.Response) (result UsagesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listResourceUsageNextResults retrieves the next set of results, if any. +func (client AFDEndpointsClient) listResourceUsageNextResults(ctx context.Context, lastResults UsagesListResult) (result UsagesListResult, err error) { + req, err := lastResults.usagesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "listResourceUsageNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "listResourceUsageNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "listResourceUsageNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListResourceUsageComplete enumerates all values, automatically crossing page boundaries as required. +func (client AFDEndpointsClient) ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result UsagesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListResourceUsage(ctx, resourceGroupName, profileName, endpointName) + return +} + +// PurgeContent removes a content from AzureFrontDoor. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// contents - the list of paths to the content and the list of linked domains to be purged. Path can be a full +// URL, e.g. '/pictures/city.png' which removes a single file, or a directory with a wildcard, e.g. +// '/pictures/*' which removes all folders and files in the directory. +func (client AFDEndpointsClient) PurgeContent(ctx context.Context, resourceGroupName string, profileName string, endpointName string, contents AfdPurgeParameters) (result AFDEndpointsPurgeContentFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.PurgeContent") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: contents, + Constraints: []validation.Constraint{{Target: "contents.ContentPaths", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "PurgeContent", err.Error()) + } + + req, err := client.PurgeContentPreparer(ctx, resourceGroupName, profileName, endpointName, contents) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "PurgeContent", nil, "Failure preparing request") + return + } + + result, err = client.PurgeContentSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "PurgeContent", result.Response(), "Failure sending request") + return + } + + return +} + +// PurgeContentPreparer prepares the PurgeContent request. +func (client AFDEndpointsClient) PurgeContentPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, contents AfdPurgeParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/purge", pathParameters), + autorest.WithJSON(contents), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PurgeContentSender sends the PurgeContent request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) PurgeContentSender(req *http.Request) (future AFDEndpointsPurgeContentFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PurgeContentResponder handles the response to the PurgeContent request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) PurgeContentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates an existing AzureFrontDoor endpoint with the specified endpoint name under the specified +// subscription, resource group and profile. Only tags can be updated after creating an endpoint. To update origins, +// use the Update Origin operation. To update origin groups, use the Update Origin group operation. To update domains, +// use the Update Custom Domain operation. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// endpointUpdateProperties - endpoint update properties +func (client AFDEndpointsClient) Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties AFDEndpointUpdateParameters) (result AFDEndpointsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, endpointName, endpointUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AFDEndpointsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties AFDEndpointUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}", pathParameters), + autorest.WithJSON(endpointUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) UpdateSender(req *http.Request) (future AFDEndpointsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) UpdateResponder(resp *http.Response) (result AFDEndpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateCustomDomain validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// customDomainProperties - custom domain to be validated. +func (client AFDEndpointsClient) ValidateCustomDomain(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainProperties ValidateCustomDomainInput) (result ValidateCustomDomainOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointsClient.ValidateCustomDomain") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: customDomainProperties, + Constraints: []validation.Constraint{{Target: "customDomainProperties.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDEndpointsClient", "ValidateCustomDomain", err.Error()) + } + + req, err := client.ValidateCustomDomainPreparer(ctx, resourceGroupName, profileName, endpointName, customDomainProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ValidateCustomDomain", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateCustomDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ValidateCustomDomain", resp, "Failure sending request") + return + } + + result, err = client.ValidateCustomDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsClient", "ValidateCustomDomain", resp, "Failure responding to request") + return + } + + return +} + +// ValidateCustomDomainPreparer prepares the ValidateCustomDomain request. +func (client AFDEndpointsClient) ValidateCustomDomainPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainProperties ValidateCustomDomainInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/validateCustomDomain", pathParameters), + autorest.WithJSON(customDomainProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateCustomDomainSender sends the ValidateCustomDomain request. The method will close the +// http.Response Body if it receives an error. +func (client AFDEndpointsClient) ValidateCustomDomainSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateCustomDomainResponder handles the response to the ValidateCustomDomain request. The method always +// closes the http.Response Body. +func (client AFDEndpointsClient) ValidateCustomDomainResponder(resp *http.Response) (result ValidateCustomDomainOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdorigingroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdorigingroups.go new file mode 100644 index 000000000000..486e003e6d86 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdorigingroups.go @@ -0,0 +1,663 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AFDOriginGroupsClient is the cdn Management Client +type AFDOriginGroupsClient struct { + BaseClient +} + +// NewAFDOriginGroupsClient creates an instance of the AFDOriginGroupsClient client. +func NewAFDOriginGroupsClient(subscriptionID string) AFDOriginGroupsClient { + return NewAFDOriginGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAFDOriginGroupsClientWithBaseURI creates an instance of the AFDOriginGroupsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAFDOriginGroupsClientWithBaseURI(baseURI string, subscriptionID string) AFDOriginGroupsClient { + return AFDOriginGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new origin group within the specified profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the endpoint. +// originGroup - origin group properties +func (client AFDOriginGroupsClient) Create(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originGroup AFDOriginGroup) (result AFDOriginGroupsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: originGroup, + Constraints: []validation.Constraint{{Target: "originGroup.AFDOriginGroupProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "originGroup.AFDOriginGroupProperties.HealthProbeSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "originGroup.AFDOriginGroupProperties.HealthProbeSettings.ProbeIntervalInSeconds", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "originGroup.AFDOriginGroupProperties.HealthProbeSettings.ProbeIntervalInSeconds", Name: validation.InclusiveMaximum, Rule: int64(255), Chain: nil}, + {Target: "originGroup.AFDOriginGroupProperties.HealthProbeSettings.ProbeIntervalInSeconds", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + }}, + {Target: "originGroup.AFDOriginGroupProperties.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "originGroup.AFDOriginGroupProperties.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes", Name: validation.InclusiveMaximum, Rule: int64(50), Chain: nil}, + {Target: "originGroup.AFDOriginGroupProperties.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginGroupsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, originGroupName, originGroup) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AFDOriginGroupsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originGroup AFDOriginGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}", pathParameters), + autorest.WithJSON(originGroup), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginGroupsClient) CreateSender(req *http.Request) (future AFDOriginGroupsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AFDOriginGroupsClient) CreateResponder(resp *http.Response) (result AFDOriginGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing origin group within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the profile. +func (client AFDOriginGroupsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result AFDOriginGroupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginGroupsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, originGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AFDOriginGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginGroupsClient) DeleteSender(req *http.Request) (future AFDOriginGroupsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AFDOriginGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing origin group within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the endpoint. +func (client AFDOriginGroupsClient) Get(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result AFDOriginGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginGroupsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, originGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AFDOriginGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AFDOriginGroupsClient) GetResponder(resp *http.Response) (result AFDOriginGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile lists all of the existing origin groups within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +func (client AFDOriginGroupsClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result AFDOriginGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.ListByProfile") + defer func() { + sc := -1 + if result.aoglr.Response.Response != nil { + sc = result.aoglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginGroupsClient", "ListByProfile", err.Error()) + } + + result.fn = client.listByProfileNextResults + req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.aoglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "ListByProfile", resp, "Failure sending request") + return + } + + result.aoglr, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "ListByProfile", resp, "Failure responding to request") + return + } + if result.aoglr.hasNextLink() && result.aoglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client AFDOriginGroupsClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginGroupsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client AFDOriginGroupsClient) ListByProfileResponder(resp *http.Response) (result AFDOriginGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByProfileNextResults retrieves the next set of results, if any. +func (client AFDOriginGroupsClient) listByProfileNextResults(ctx context.Context, lastResults AFDOriginGroupListResult) (result AFDOriginGroupListResult, err error) { + req, err := lastResults.aFDOriginGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "listByProfileNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "listByProfileNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "listByProfileNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. +func (client AFDOriginGroupsClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result AFDOriginGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.ListByProfile") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) + return +} + +// ListResourceUsage checks the quota and actual usage of endpoints under the given CDN profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the endpoint. +func (client AFDOriginGroupsClient) ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result UsagesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.ulr.Response.Response != nil { + sc = result.ulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginGroupsClient", "ListResourceUsage", err.Error()) + } + + result.fn = client.listResourceUsageNextResults + req, err := client.ListResourceUsagePreparer(ctx, resourceGroupName, profileName, originGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "ListResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.ulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "ListResourceUsage", resp, "Failure sending request") + return + } + + result.ulr, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "ListResourceUsage", resp, "Failure responding to request") + return + } + if result.ulr.hasNextLink() && result.ulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client AFDOriginGroupsClient) ListResourceUsagePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginGroupsClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always +// closes the http.Response Body. +func (client AFDOriginGroupsClient) ListResourceUsageResponder(resp *http.Response) (result UsagesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listResourceUsageNextResults retrieves the next set of results, if any. +func (client AFDOriginGroupsClient) listResourceUsageNextResults(ctx context.Context, lastResults UsagesListResult) (result UsagesListResult, err error) { + req, err := lastResults.usagesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "listResourceUsageNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "listResourceUsageNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "listResourceUsageNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListResourceUsageComplete enumerates all values, automatically crossing page boundaries as required. +func (client AFDOriginGroupsClient) ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result UsagesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListResourceUsage(ctx, resourceGroupName, profileName, originGroupName) + return +} + +// Update updates an existing origin group within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the profile. +// originGroupUpdateProperties - origin group properties +func (client AFDOriginGroupsClient) Update(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originGroupUpdateProperties AFDOriginGroupUpdateParameters) (result AFDOriginGroupsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginGroupsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, originGroupName, originGroupUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AFDOriginGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originGroupUpdateProperties AFDOriginGroupUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}", pathParameters), + autorest.WithJSON(originGroupUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginGroupsClient) UpdateSender(req *http.Request) (future AFDOriginGroupsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AFDOriginGroupsClient) UpdateResponder(resp *http.Response) (result AFDOriginGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdorigins.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdorigins.go new file mode 100644 index 000000000000..06702c2b3806 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdorigins.go @@ -0,0 +1,551 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AFDOriginsClient is the cdn Management Client +type AFDOriginsClient struct { + BaseClient +} + +// NewAFDOriginsClient creates an instance of the AFDOriginsClient client. +func NewAFDOriginsClient(subscriptionID string) AFDOriginsClient { + return NewAFDOriginsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAFDOriginsClientWithBaseURI creates an instance of the AFDOriginsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAFDOriginsClientWithBaseURI(baseURI string, subscriptionID string) AFDOriginsClient { + return AFDOriginsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new origin within the specified origin group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the profile. +// originName - name of the origin that is unique within the profile. +// origin - origin properties +func (client AFDOriginsClient) Create(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, origin AFDOrigin) (result AFDOriginsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: origin, + Constraints: []validation.Constraint{{Target: "origin.AFDOriginProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "origin.AFDOriginProperties.HostName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "origin.AFDOriginProperties.HTTPPort", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "origin.AFDOriginProperties.HTTPPort", Name: validation.InclusiveMaximum, Rule: int64(65535), Chain: nil}, + {Target: "origin.AFDOriginProperties.HTTPPort", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + {Target: "origin.AFDOriginProperties.HTTPSPort", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "origin.AFDOriginProperties.HTTPSPort", Name: validation.InclusiveMaximum, Rule: int64(65535), Chain: nil}, + {Target: "origin.AFDOriginProperties.HTTPSPort", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + {Target: "origin.AFDOriginProperties.Priority", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "origin.AFDOriginProperties.Priority", Name: validation.InclusiveMaximum, Rule: int64(5), Chain: nil}, + {Target: "origin.AFDOriginProperties.Priority", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + {Target: "origin.AFDOriginProperties.Weight", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "origin.AFDOriginProperties.Weight", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "origin.AFDOriginProperties.Weight", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, originGroupName, originName, origin) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AFDOriginsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, origin AFDOrigin) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", pathParameters), + autorest.WithJSON(origin), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginsClient) CreateSender(req *http.Request) (future AFDOriginsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AFDOriginsClient) CreateResponder(resp *http.Response) (result AFDOrigin, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing origin within an origin group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the profile. +// originName - name of the origin which is unique within the profile. +func (client AFDOriginsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string) (result AFDOriginsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, originGroupName, originName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AFDOriginsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginsClient) DeleteSender(req *http.Request) (future AFDOriginsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AFDOriginsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing origin within an origin group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the profile. +// originName - name of the origin which is unique within the profile. +func (client AFDOriginsClient) Get(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string) (result AFDOrigin, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, originGroupName, originName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AFDOriginsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AFDOriginsClient) GetResponder(resp *http.Response) (result AFDOrigin, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByOriginGroup lists all of the existing origins within an origin group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the profile. +func (client AFDOriginsClient) ListByOriginGroup(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result AFDOriginListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.ListByOriginGroup") + defer func() { + sc := -1 + if result.aolr.Response.Response != nil { + sc = result.aolr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginsClient", "ListByOriginGroup", err.Error()) + } + + result.fn = client.listByOriginGroupNextResults + req, err := client.ListByOriginGroupPreparer(ctx, resourceGroupName, profileName, originGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "ListByOriginGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByOriginGroupSender(req) + if err != nil { + result.aolr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "ListByOriginGroup", resp, "Failure sending request") + return + } + + result.aolr, err = client.ListByOriginGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "ListByOriginGroup", resp, "Failure responding to request") + return + } + if result.aolr.hasNextLink() && result.aolr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByOriginGroupPreparer prepares the ListByOriginGroup request. +func (client AFDOriginsClient) ListByOriginGroupPreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByOriginGroupSender sends the ListByOriginGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginsClient) ListByOriginGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByOriginGroupResponder handles the response to the ListByOriginGroup request. The method always +// closes the http.Response Body. +func (client AFDOriginsClient) ListByOriginGroupResponder(resp *http.Response) (result AFDOriginListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByOriginGroupNextResults retrieves the next set of results, if any. +func (client AFDOriginsClient) listByOriginGroupNextResults(ctx context.Context, lastResults AFDOriginListResult) (result AFDOriginListResult, err error) { + req, err := lastResults.aFDOriginListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "listByOriginGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByOriginGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "listByOriginGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByOriginGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "listByOriginGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByOriginGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AFDOriginsClient) ListByOriginGroupComplete(ctx context.Context, resourceGroupName string, profileName string, originGroupName string) (result AFDOriginListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.ListByOriginGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByOriginGroup(ctx, resourceGroupName, profileName, originGroupName) + return +} + +// Update updates an existing origin within an origin group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// originGroupName - name of the origin group which is unique within the profile. +// originName - name of the origin which is unique within the profile. +// originUpdateProperties - origin properties +func (client AFDOriginsClient) Update(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, originUpdateProperties AFDOriginUpdateParameters) (result AFDOriginsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDOriginsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, originGroupName, originName, originUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AFDOriginsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, originName string, originUpdateProperties AFDOriginUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", pathParameters), + autorest.WithJSON(originUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AFDOriginsClient) UpdateSender(req *http.Request) (future AFDOriginsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AFDOriginsClient) UpdateResponder(resp *http.Response) (result AFDOrigin, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdprofiles.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdprofiles.go new file mode 100644 index 000000000000..25f3434c4600 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/afdprofiles.go @@ -0,0 +1,249 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AFDProfilesClient is the cdn Management Client +type AFDProfilesClient struct { + BaseClient +} + +// NewAFDProfilesClient creates an instance of the AFDProfilesClient client. +func NewAFDProfilesClient(subscriptionID string) AFDProfilesClient { + return NewAFDProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAFDProfilesClientWithBaseURI creates an instance of the AFDProfilesClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAFDProfilesClientWithBaseURI(baseURI string, subscriptionID string) AFDProfilesClient { + return AFDProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckHostNameAvailability validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +// checkHostNameAvailabilityInput - custom domain to be validated. +func (client AFDProfilesClient) CheckHostNameAvailability(ctx context.Context, resourceGroupName string, profileName string, checkHostNameAvailabilityInput CheckHostNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDProfilesClient.CheckHostNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: checkHostNameAvailabilityInput, + Constraints: []validation.Constraint{{Target: "checkHostNameAvailabilityInput.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDProfilesClient", "CheckHostNameAvailability", err.Error()) + } + + req, err := client.CheckHostNameAvailabilityPreparer(ctx, resourceGroupName, profileName, checkHostNameAvailabilityInput) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "CheckHostNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckHostNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "CheckHostNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckHostNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "CheckHostNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckHostNameAvailabilityPreparer prepares the CheckHostNameAvailability request. +func (client AFDProfilesClient) CheckHostNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, profileName string, checkHostNameAvailabilityInput CheckHostNameAvailabilityInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkHostNameAvailability", pathParameters), + autorest.WithJSON(checkHostNameAvailabilityInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckHostNameAvailabilitySender sends the CheckHostNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client AFDProfilesClient) CheckHostNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckHostNameAvailabilityResponder handles the response to the CheckHostNameAvailability request. The method always +// closes the http.Response Body. +func (client AFDProfilesClient) CheckHostNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListResourceUsage checks the quota and actual usage of endpoints under the given CDN profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +func (client AFDProfilesClient) ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string) (result UsagesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDProfilesClient.ListResourceUsage") + defer func() { + sc := -1 + if result.ulr.Response.Response != nil { + sc = result.ulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.AFDProfilesClient", "ListResourceUsage", err.Error()) + } + + result.fn = client.listResourceUsageNextResults + req, err := client.ListResourceUsagePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "ListResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.ulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "ListResourceUsage", resp, "Failure sending request") + return + } + + result.ulr, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "ListResourceUsage", resp, "Failure responding to request") + return + } + if result.ulr.hasNextLink() && result.ulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client AFDProfilesClient) ListResourceUsagePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client AFDProfilesClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always +// closes the http.Response Body. +func (client AFDProfilesClient) ListResourceUsageResponder(resp *http.Response) (result UsagesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listResourceUsageNextResults retrieves the next set of results, if any. +func (client AFDProfilesClient) listResourceUsageNextResults(ctx context.Context, lastResults UsagesListResult) (result UsagesListResult, err error) { + req, err := lastResults.usagesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "listResourceUsageNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "listResourceUsageNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDProfilesClient", "listResourceUsageNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListResourceUsageComplete enumerates all values, automatically crossing page boundaries as required. +func (client AFDProfilesClient) ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string) (result UsagesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDProfilesClient.ListResourceUsage") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListResourceUsage(ctx, resourceGroupName, profileName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/client.go new file mode 100644 index 000000000000..17884e340869 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/client.go @@ -0,0 +1,377 @@ +// Package cdn implements the Azure ARM Cdn service API version 2021-06-01. +// +// Cdn Management Client +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +const ( + // DefaultBaseURI is the default URI used for the service Cdn + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Cdn. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} + +// CheckEndpointNameAvailability check the availability of a resource name. This is needed for resources where name is +// globally unique, such as a afdx endpoint. +// Parameters: +// checkEndpointNameAvailabilityInput - input to check. +// resourceGroupName - name of the Resource group within the Azure subscription. +func (client BaseClient) CheckEndpointNameAvailability(ctx context.Context, checkEndpointNameAvailabilityInput CheckEndpointNameAvailabilityInput, resourceGroupName string) (result CheckEndpointNameAvailabilityOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckEndpointNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: checkEndpointNameAvailabilityInput, + Constraints: []validation.Constraint{{Target: "checkEndpointNameAvailabilityInput.Name", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.BaseClient", "CheckEndpointNameAvailability", err.Error()) + } + + req, err := client.CheckEndpointNameAvailabilityPreparer(ctx, checkEndpointNameAvailabilityInput, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckEndpointNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckEndpointNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckEndpointNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckEndpointNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckEndpointNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckEndpointNameAvailabilityPreparer prepares the CheckEndpointNameAvailability request. +func (client BaseClient) CheckEndpointNameAvailabilityPreparer(ctx context.Context, checkEndpointNameAvailabilityInput CheckEndpointNameAvailabilityInput, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/checkEndpointNameAvailability", pathParameters), + autorest.WithJSON(checkEndpointNameAvailabilityInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckEndpointNameAvailabilitySender sends the CheckEndpointNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) CheckEndpointNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckEndpointNameAvailabilityResponder handles the response to the CheckEndpointNameAvailability request. The method always +// closes the http.Response Body. +func (client BaseClient) CheckEndpointNameAvailabilityResponder(resp *http.Response) (result CheckEndpointNameAvailabilityOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CheckNameAvailability check the availability of a resource name. This is needed for resources where name is globally +// unique, such as a CDN endpoint. +// Parameters: +// checkNameAvailabilityInput - input to check. +func (client BaseClient) CheckNameAvailability(ctx context.Context, checkNameAvailabilityInput CheckNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: checkNameAvailabilityInput, + Constraints: []validation.Constraint{{Target: "checkNameAvailabilityInput.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.BaseClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, checkNameAvailabilityInput) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client BaseClient) CheckNameAvailabilityPreparer(ctx context.Context, checkNameAvailabilityInput CheckNameAvailabilityInput) (*http.Request, error) { + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Cdn/checkNameAvailability"), + autorest.WithJSON(checkNameAvailabilityInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client BaseClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CheckNameAvailabilityWithSubscription check the availability of a resource name. This is needed for resources where +// name is globally unique, such as a CDN endpoint. +// Parameters: +// checkNameAvailabilityInput - input to check. +func (client BaseClient) CheckNameAvailabilityWithSubscription(ctx context.Context, checkNameAvailabilityInput CheckNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckNameAvailabilityWithSubscription") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: checkNameAvailabilityInput, + Constraints: []validation.Constraint{{Target: "checkNameAvailabilityInput.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.BaseClient", "CheckNameAvailabilityWithSubscription", err.Error()) + } + + req, err := client.CheckNameAvailabilityWithSubscriptionPreparer(ctx, checkNameAvailabilityInput) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckNameAvailabilityWithSubscription", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilityWithSubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckNameAvailabilityWithSubscription", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityWithSubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "CheckNameAvailabilityWithSubscription", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityWithSubscriptionPreparer prepares the CheckNameAvailabilityWithSubscription request. +func (client BaseClient) CheckNameAvailabilityWithSubscriptionPreparer(ctx context.Context, checkNameAvailabilityInput CheckNameAvailabilityInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability", pathParameters), + autorest.WithJSON(checkNameAvailabilityInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilityWithSubscriptionSender sends the CheckNameAvailabilityWithSubscription request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) CheckNameAvailabilityWithSubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityWithSubscriptionResponder handles the response to the CheckNameAvailabilityWithSubscription request. The method always +// closes the http.Response Body. +func (client BaseClient) CheckNameAvailabilityWithSubscriptionResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateProbe check if the probe path is a valid path and the file can be accessed. Probe path is the path to a file +// hosted on the origin server to help accelerate the delivery of dynamic content via the CDN endpoint. This path is +// relative to the origin path specified in the endpoint configuration. +// Parameters: +// validateProbeInput - input to check. +func (client BaseClient) ValidateProbe(ctx context.Context, validateProbeInput ValidateProbeInput) (result ValidateProbeOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ValidateProbe") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: validateProbeInput, + Constraints: []validation.Constraint{{Target: "validateProbeInput.ProbeURL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.BaseClient", "ValidateProbe", err.Error()) + } + + req, err := client.ValidateProbePreparer(ctx, validateProbeInput) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "ValidateProbe", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateProbeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "ValidateProbe", resp, "Failure sending request") + return + } + + result, err = client.ValidateProbeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.BaseClient", "ValidateProbe", resp, "Failure responding to request") + return + } + + return +} + +// ValidateProbePreparer prepares the ValidateProbe request. +func (client BaseClient) ValidateProbePreparer(ctx context.Context, validateProbeInput ValidateProbeInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe", pathParameters), + autorest.WithJSON(validateProbeInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateProbeSender sends the ValidateProbe request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ValidateProbeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateProbeResponder handles the response to the ValidateProbe request. The method always +// closes the http.Response Body. +func (client BaseClient) ValidateProbeResponder(resp *http.Response) (result ValidateProbeOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/customdomains.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/customdomains.go new file mode 100644 index 000000000000..3ebf37f57630 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/customdomains.go @@ -0,0 +1,620 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CustomDomainsClient is the cdn Management Client +type CustomDomainsClient struct { + BaseClient +} + +// NewCustomDomainsClient creates an instance of the CustomDomainsClient client. +func NewCustomDomainsClient(subscriptionID string) CustomDomainsClient { + return NewCustomDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCustomDomainsClientWithBaseURI creates an instance of the CustomDomainsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewCustomDomainsClientWithBaseURI(baseURI string, subscriptionID string) CustomDomainsClient { + return CustomDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new custom domain within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// customDomainName - name of the custom domain within an endpoint. +// customDomainProperties - properties required to create a new custom domain. +func (client CustomDomainsClient) Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainProperties CustomDomainParameters) (result CustomDomainsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: customDomainProperties, + Constraints: []validation.Constraint{{Target: "customDomainProperties.CustomDomainPropertiesParameters", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "customDomainProperties.CustomDomainPropertiesParameters.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("cdn.CustomDomainsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, endpointName, customDomainName, customDomainProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client CustomDomainsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainProperties CustomDomainParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", pathParameters), + autorest.WithJSON(customDomainProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) CreateSender(req *http.Request) (future CustomDomainsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) CreateResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing custom domain within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// customDomainName - name of the custom domain within an endpoint. +func (client CustomDomainsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomainsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.CustomDomainsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, endpointName, customDomainName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CustomDomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) DeleteSender(req *http.Request) (future CustomDomainsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) DeleteResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DisableCustomHTTPS disable https delivery of the custom domain. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// customDomainName - name of the custom domain within an endpoint. +func (client CustomDomainsClient) DisableCustomHTTPS(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.DisableCustomHTTPS") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.CustomDomainsClient", "DisableCustomHTTPS", err.Error()) + } + + req, err := client.DisableCustomHTTPSPreparer(ctx, resourceGroupName, profileName, endpointName, customDomainName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", nil, "Failure preparing request") + return + } + + resp, err := client.DisableCustomHTTPSSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", resp, "Failure sending request") + return + } + + result, err = client.DisableCustomHTTPSResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", resp, "Failure responding to request") + return + } + + return +} + +// DisableCustomHTTPSPreparer prepares the DisableCustomHTTPS request. +func (client CustomDomainsClient) DisableCustomHTTPSPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableCustomHTTPSSender sends the DisableCustomHTTPS request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) DisableCustomHTTPSSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DisableCustomHTTPSResponder handles the response to the DisableCustomHTTPS request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) DisableCustomHTTPSResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// EnableCustomHTTPS enable https delivery of the custom domain. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// customDomainName - name of the custom domain within an endpoint. +// customDomainHTTPSParameters - the configuration specifying how to enable HTTPS for the custom domain - using +// CDN managed certificate or user's own certificate. If not specified, enabling ssl uses CDN managed +// certificate by default. +func (client CustomDomainsClient) EnableCustomHTTPS(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainHTTPSParameters *BasicCustomDomainHTTPSParameters) (result CustomDomain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.EnableCustomHTTPS") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.CustomDomainsClient", "EnableCustomHTTPS", err.Error()) + } + + req, err := client.EnableCustomHTTPSPreparer(ctx, resourceGroupName, profileName, endpointName, customDomainName, customDomainHTTPSParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", nil, "Failure preparing request") + return + } + + resp, err := client.EnableCustomHTTPSSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", resp, "Failure sending request") + return + } + + result, err = client.EnableCustomHTTPSResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", resp, "Failure responding to request") + return + } + + return +} + +// EnableCustomHTTPSPreparer prepares the EnableCustomHTTPS request. +func (client CustomDomainsClient) EnableCustomHTTPSPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainHTTPSParameters *BasicCustomDomainHTTPSParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if customDomainHTTPSParameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(customDomainHTTPSParameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableCustomHTTPSSender sends the EnableCustomHTTPS request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) EnableCustomHTTPSSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// EnableCustomHTTPSResponder handles the response to the EnableCustomHTTPS request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) EnableCustomHTTPSResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets an existing custom domain within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// customDomainName - name of the custom domain within an endpoint. +func (client CustomDomainsClient) Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.CustomDomainsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, endpointName, customDomainName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CustomDomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) GetResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByEndpoint lists all of the existing custom domains within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client CustomDomainsClient) ListByEndpoint(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result CustomDomainListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.ListByEndpoint") + defer func() { + sc := -1 + if result.cdlr.Response.Response != nil { + sc = result.cdlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.CustomDomainsClient", "ListByEndpoint", err.Error()) + } + + result.fn = client.listByEndpointNextResults + req, err := client.ListByEndpointPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.cdlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", resp, "Failure sending request") + return + } + + result.cdlr, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", resp, "Failure responding to request") + return + } + if result.cdlr.hasNextLink() && result.cdlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByEndpointPreparer prepares the ListByEndpoint request. +func (client CustomDomainsClient) ListByEndpointPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByEndpointSender sends the ListByEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) ListByEndpointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByEndpointResponder handles the response to the ListByEndpoint request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) ListByEndpointResponder(resp *http.Response) (result CustomDomainListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByEndpointNextResults retrieves the next set of results, if any. +func (client CustomDomainsClient) listByEndpointNextResults(ctx context.Context, lastResults CustomDomainListResult) (result CustomDomainListResult, err error) { + req, err := lastResults.customDomainListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "listByEndpointNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "listByEndpointNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "listByEndpointNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByEndpointComplete enumerates all values, automatically crossing page boundaries as required. +func (client CustomDomainsClient) ListByEndpointComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result CustomDomainListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.ListByEndpoint") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByEndpoint(ctx, resourceGroupName, profileName, endpointName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/edgenodes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/edgenodes.go new file mode 100644 index 000000000000..a58d06ec279e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/edgenodes.go @@ -0,0 +1,140 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EdgeNodesClient is the cdn Management Client +type EdgeNodesClient struct { + BaseClient +} + +// NewEdgeNodesClient creates an instance of the EdgeNodesClient client. +func NewEdgeNodesClient(subscriptionID string) EdgeNodesClient { + return NewEdgeNodesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEdgeNodesClientWithBaseURI creates an instance of the EdgeNodesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewEdgeNodesClientWithBaseURI(baseURI string, subscriptionID string) EdgeNodesClient { + return EdgeNodesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List edgenodes are the global Point of Presence (POP) locations used to deliver CDN content to end users. +func (client EdgeNodesClient) List(ctx context.Context) (result EdgenodeResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EdgeNodesClient.List") + defer func() { + sc := -1 + if result.er.Response.Response != nil { + sc = result.er.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.er.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure sending request") + return + } + + result.er, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure responding to request") + return + } + if result.er.hasNextLink() && result.er.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client EdgeNodesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Cdn/edgenodes"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EdgeNodesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EdgeNodesClient) ListResponder(resp *http.Response) (result EdgenodeResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client EdgeNodesClient) listNextResults(ctx context.Context, lastResults EdgenodeResult) (result EdgenodeResult, err error) { + req, err := lastResults.edgenodeResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client EdgeNodesClient) ListComplete(ctx context.Context) (result EdgenodeResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EdgeNodesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/endpoints.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/endpoints.go new file mode 100644 index 000000000000..98cee37c72a1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/endpoints.go @@ -0,0 +1,1111 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EndpointsClient is the cdn Management Client +type EndpointsClient struct { + BaseClient +} + +// NewEndpointsClient creates an instance of the EndpointsClient client. +func NewEndpointsClient(subscriptionID string) EndpointsClient { + return NewEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEndpointsClientWithBaseURI creates an instance of the EndpointsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewEndpointsClientWithBaseURI(baseURI string, subscriptionID string) EndpointsClient { + return EndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new CDN endpoint with the specified endpoint name under the specified subscription, resource group +// and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// endpoint - endpoint properties +func (client EndpointsClient) Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpoint Endpoint) (result EndpointsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: endpoint, + Constraints: []validation.Constraint{{Target: "endpoint.EndpointProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "endpoint.EndpointProperties.Origins", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, endpointName, endpoint) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client EndpointsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpoint Endpoint) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), + autorest.WithJSON(endpoint), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) CreateSender(req *http.Request) (future EndpointsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client EndpointsClient) CreateResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing CDN endpoint with the specified endpoint name under the specified subscription, resource +// group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client EndpointsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result EndpointsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) DeleteSender(req *http.Request) (future EndpointsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client EndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing CDN endpoint with the specified endpoint name under the specified subscription, resource group +// and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client EndpointsClient) Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result Endpoint, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client EndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client EndpointsClient) GetResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile lists existing CDN endpoints. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +func (client EndpointsClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result EndpointListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.ListByProfile") + defer func() { + sc := -1 + if result.elr.Response.Response != nil { + sc = result.elr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "ListByProfile", err.Error()) + } + + result.fn = client.listByProfileNextResults + req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.elr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", resp, "Failure sending request") + return + } + + result.elr, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", resp, "Failure responding to request") + return + } + if result.elr.hasNextLink() && result.elr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client EndpointsClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client EndpointsClient) ListByProfileResponder(resp *http.Response) (result EndpointListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByProfileNextResults retrieves the next set of results, if any. +func (client EndpointsClient) listByProfileNextResults(ctx context.Context, lastResults EndpointListResult) (result EndpointListResult, err error) { + req, err := lastResults.endpointListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "listByProfileNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "listByProfileNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "listByProfileNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. +func (client EndpointsClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result EndpointListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.ListByProfile") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) + return +} + +// ListResourceUsage checks the quota and usage of geo filters and custom domains under the given endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client EndpointsClient) ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result ResourceUsageListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.rulr.Response.Response != nil { + sc = result.rulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "ListResourceUsage", err.Error()) + } + + result.fn = client.listResourceUsageNextResults + req, err := client.ListResourceUsagePreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.rulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure sending request") + return + } + + result.rulr, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure responding to request") + return + } + if result.rulr.hasNextLink() && result.rulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client EndpointsClient) ListResourceUsagePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/checkResourceUsage", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always +// closes the http.Response Body. +func (client EndpointsClient) ListResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listResourceUsageNextResults retrieves the next set of results, if any. +func (client EndpointsClient) listResourceUsageNextResults(ctx context.Context, lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) { + req, err := lastResults.resourceUsageListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "listResourceUsageNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "listResourceUsageNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "listResourceUsageNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListResourceUsageComplete enumerates all values, automatically crossing page boundaries as required. +func (client EndpointsClient) ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result ResourceUsageListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListResourceUsage(ctx, resourceGroupName, profileName, endpointName) + return +} + +// LoadContent pre-loads a content to CDN. Available for Verizon Profiles. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// contentFilePaths - the path to the content to be loaded. Path should be a full URL, e.g. +// ‘/pictures/city.png' which loads a single file +func (client EndpointsClient) LoadContent(ctx context.Context, resourceGroupName string, profileName string, endpointName string, contentFilePaths LoadParameters) (result EndpointsLoadContentFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.LoadContent") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: contentFilePaths, + Constraints: []validation.Constraint{{Target: "contentFilePaths.ContentPaths", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "LoadContent", err.Error()) + } + + req, err := client.LoadContentPreparer(ctx, resourceGroupName, profileName, endpointName, contentFilePaths) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", nil, "Failure preparing request") + return + } + + result, err = client.LoadContentSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", result.Response(), "Failure sending request") + return + } + + return +} + +// LoadContentPreparer prepares the LoadContent request. +func (client EndpointsClient) LoadContentPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, contentFilePaths LoadParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load", pathParameters), + autorest.WithJSON(contentFilePaths), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// LoadContentSender sends the LoadContent request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) LoadContentSender(req *http.Request) (future EndpointsLoadContentFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// LoadContentResponder handles the response to the LoadContent request. The method always +// closes the http.Response Body. +func (client EndpointsClient) LoadContentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// PurgeContent removes a content from CDN. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// contentFilePaths - the path to the content to be purged. Path can be a full URL, e.g. '/pictures/city.png' +// which removes a single file, or a directory with a wildcard, e.g. '/pictures/*' which removes all folders +// and files in the directory. +func (client EndpointsClient) PurgeContent(ctx context.Context, resourceGroupName string, profileName string, endpointName string, contentFilePaths PurgeParameters) (result EndpointsPurgeContentFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.PurgeContent") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: contentFilePaths, + Constraints: []validation.Constraint{{Target: "contentFilePaths.ContentPaths", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "PurgeContent", err.Error()) + } + + req, err := client.PurgeContentPreparer(ctx, resourceGroupName, profileName, endpointName, contentFilePaths) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", nil, "Failure preparing request") + return + } + + result, err = client.PurgeContentSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", result.Response(), "Failure sending request") + return + } + + return +} + +// PurgeContentPreparer prepares the PurgeContent request. +func (client EndpointsClient) PurgeContentPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, contentFilePaths PurgeParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge", pathParameters), + autorest.WithJSON(contentFilePaths), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PurgeContentSender sends the PurgeContent request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) PurgeContentSender(req *http.Request) (future EndpointsPurgeContentFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PurgeContentResponder handles the response to the PurgeContent request. The method always +// closes the http.Response Body. +func (client EndpointsClient) PurgeContentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Start starts an existing CDN endpoint that is on a stopped state. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client EndpointsClient) Start(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result EndpointsStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Start") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "Start", err.Error()) + } + + req, err := client.StartPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client EndpointsClient) StartPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) StartSender(req *http.Request) (future EndpointsStartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client EndpointsClient) StartResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Stop stops an existing running CDN endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client EndpointsClient) Stop(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result EndpointsStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Stop") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "Stop", err.Error()) + } + + req, err := client.StopPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client EndpointsClient) StopPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) StopSender(req *http.Request) (future EndpointsStopFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client EndpointsClient) StopResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing CDN endpoint with the specified endpoint name under the specified subscription, resource +// group and profile. Only tags can be updated after creating an endpoint. To update origins, use the Update Origin +// operation. To update origin groups, use the Update Origin group operation. To update custom domains, use the Update +// Custom Domain operation. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// endpointUpdateProperties - endpoint update properties +func (client EndpointsClient) Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties EndpointUpdateParameters) (result EndpointsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, endpointName, endpointUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client EndpointsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties EndpointUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), + autorest.WithJSON(endpointUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) UpdateSender(req *http.Request) (future EndpointsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client EndpointsClient) UpdateResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateCustomDomain validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// customDomainProperties - custom domain to be validated. +func (client EndpointsClient) ValidateCustomDomain(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainProperties ValidateCustomDomainInput) (result ValidateCustomDomainOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.ValidateCustomDomain") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: customDomainProperties, + Constraints: []validation.Constraint{{Target: "customDomainProperties.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.EndpointsClient", "ValidateCustomDomain", err.Error()) + } + + req, err := client.ValidateCustomDomainPreparer(ctx, resourceGroupName, profileName, endpointName, customDomainProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateCustomDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", resp, "Failure sending request") + return + } + + result, err = client.ValidateCustomDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", resp, "Failure responding to request") + return + } + + return +} + +// ValidateCustomDomainPreparer prepares the ValidateCustomDomain request. +func (client EndpointsClient) ValidateCustomDomainPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, customDomainProperties ValidateCustomDomainInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/validateCustomDomain", pathParameters), + autorest.WithJSON(customDomainProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateCustomDomainSender sends the ValidateCustomDomain request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) ValidateCustomDomainSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateCustomDomainResponder handles the response to the ValidateCustomDomain request. The method always +// closes the http.Response Body. +func (client EndpointsClient) ValidateCustomDomainResponder(resp *http.Response) (result ValidateCustomDomainOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/enums.go new file mode 100644 index 000000000000..bbffccad629f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/enums.go @@ -0,0 +1,1923 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // ActionTypeAllow ... + ActionTypeAllow ActionType = "Allow" + // ActionTypeBlock ... + ActionTypeBlock ActionType = "Block" + // ActionTypeLog ... + ActionTypeLog ActionType = "Log" + // ActionTypeRedirect ... + ActionTypeRedirect ActionType = "Redirect" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ActionTypeAllow, ActionTypeBlock, ActionTypeLog, ActionTypeRedirect} +} + +// AfdCertificateType enumerates the values for afd certificate type. +type AfdCertificateType string + +const ( + // AfdCertificateTypeAzureFirstPartyManagedCertificate ... + AfdCertificateTypeAzureFirstPartyManagedCertificate AfdCertificateType = "AzureFirstPartyManagedCertificate" + // AfdCertificateTypeCustomerCertificate ... + AfdCertificateTypeCustomerCertificate AfdCertificateType = "CustomerCertificate" + // AfdCertificateTypeManagedCertificate ... + AfdCertificateTypeManagedCertificate AfdCertificateType = "ManagedCertificate" +) + +// PossibleAfdCertificateTypeValues returns an array of possible values for the AfdCertificateType const type. +func PossibleAfdCertificateTypeValues() []AfdCertificateType { + return []AfdCertificateType{AfdCertificateTypeAzureFirstPartyManagedCertificate, AfdCertificateTypeCustomerCertificate, AfdCertificateTypeManagedCertificate} +} + +// AFDEndpointProtocols enumerates the values for afd endpoint protocols. +type AFDEndpointProtocols string + +const ( + // AFDEndpointProtocolsHTTP ... + AFDEndpointProtocolsHTTP AFDEndpointProtocols = "Http" + // AFDEndpointProtocolsHTTPS ... + AFDEndpointProtocolsHTTPS AFDEndpointProtocols = "Https" +) + +// PossibleAFDEndpointProtocolsValues returns an array of possible values for the AFDEndpointProtocols const type. +func PossibleAFDEndpointProtocolsValues() []AFDEndpointProtocols { + return []AFDEndpointProtocols{AFDEndpointProtocolsHTTP, AFDEndpointProtocolsHTTPS} +} + +// AfdMinimumTLSVersion enumerates the values for afd minimum tls version. +type AfdMinimumTLSVersion string + +const ( + // AfdMinimumTLSVersionTLS10 ... + AfdMinimumTLSVersionTLS10 AfdMinimumTLSVersion = "TLS10" + // AfdMinimumTLSVersionTLS12 ... + AfdMinimumTLSVersionTLS12 AfdMinimumTLSVersion = "TLS12" +) + +// PossibleAfdMinimumTLSVersionValues returns an array of possible values for the AfdMinimumTLSVersion const type. +func PossibleAfdMinimumTLSVersionValues() []AfdMinimumTLSVersion { + return []AfdMinimumTLSVersion{AfdMinimumTLSVersionTLS10, AfdMinimumTLSVersionTLS12} +} + +// AfdProvisioningState enumerates the values for afd provisioning state. +type AfdProvisioningState string + +const ( + // AfdProvisioningStateCreating ... + AfdProvisioningStateCreating AfdProvisioningState = "Creating" + // AfdProvisioningStateDeleting ... + AfdProvisioningStateDeleting AfdProvisioningState = "Deleting" + // AfdProvisioningStateFailed ... + AfdProvisioningStateFailed AfdProvisioningState = "Failed" + // AfdProvisioningStateSucceeded ... + AfdProvisioningStateSucceeded AfdProvisioningState = "Succeeded" + // AfdProvisioningStateUpdating ... + AfdProvisioningStateUpdating AfdProvisioningState = "Updating" +) + +// PossibleAfdProvisioningStateValues returns an array of possible values for the AfdProvisioningState const type. +func PossibleAfdProvisioningStateValues() []AfdProvisioningState { + return []AfdProvisioningState{AfdProvisioningStateCreating, AfdProvisioningStateDeleting, AfdProvisioningStateFailed, AfdProvisioningStateSucceeded, AfdProvisioningStateUpdating} +} + +// AfdQueryStringCachingBehavior enumerates the values for afd query string caching behavior. +type AfdQueryStringCachingBehavior string + +const ( + // AfdQueryStringCachingBehaviorIgnoreQueryString ... + AfdQueryStringCachingBehaviorIgnoreQueryString AfdQueryStringCachingBehavior = "IgnoreQueryString" + // AfdQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings ... + AfdQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings AfdQueryStringCachingBehavior = "IgnoreSpecifiedQueryStrings" + // AfdQueryStringCachingBehaviorIncludeSpecifiedQueryStrings ... + AfdQueryStringCachingBehaviorIncludeSpecifiedQueryStrings AfdQueryStringCachingBehavior = "IncludeSpecifiedQueryStrings" + // AfdQueryStringCachingBehaviorUseQueryString ... + AfdQueryStringCachingBehaviorUseQueryString AfdQueryStringCachingBehavior = "UseQueryString" +) + +// PossibleAfdQueryStringCachingBehaviorValues returns an array of possible values for the AfdQueryStringCachingBehavior const type. +func PossibleAfdQueryStringCachingBehaviorValues() []AfdQueryStringCachingBehavior { + return []AfdQueryStringCachingBehavior{AfdQueryStringCachingBehaviorIgnoreQueryString, AfdQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings, AfdQueryStringCachingBehaviorIncludeSpecifiedQueryStrings, AfdQueryStringCachingBehaviorUseQueryString} +} + +// Algorithm enumerates the values for algorithm. +type Algorithm string + +const ( + // AlgorithmSHA256 ... + AlgorithmSHA256 Algorithm = "SHA256" +) + +// PossibleAlgorithmValues returns an array of possible values for the Algorithm const type. +func PossibleAlgorithmValues() []Algorithm { + return []Algorithm{AlgorithmSHA256} +} + +// AutoGeneratedDomainNameLabelScope enumerates the values for auto generated domain name label scope. +type AutoGeneratedDomainNameLabelScope string + +const ( + // AutoGeneratedDomainNameLabelScopeNoReuse ... + AutoGeneratedDomainNameLabelScopeNoReuse AutoGeneratedDomainNameLabelScope = "NoReuse" + // AutoGeneratedDomainNameLabelScopeResourceGroupReuse ... + AutoGeneratedDomainNameLabelScopeResourceGroupReuse AutoGeneratedDomainNameLabelScope = "ResourceGroupReuse" + // AutoGeneratedDomainNameLabelScopeSubscriptionReuse ... + AutoGeneratedDomainNameLabelScopeSubscriptionReuse AutoGeneratedDomainNameLabelScope = "SubscriptionReuse" + // AutoGeneratedDomainNameLabelScopeTenantReuse ... + AutoGeneratedDomainNameLabelScopeTenantReuse AutoGeneratedDomainNameLabelScope = "TenantReuse" +) + +// PossibleAutoGeneratedDomainNameLabelScopeValues returns an array of possible values for the AutoGeneratedDomainNameLabelScope const type. +func PossibleAutoGeneratedDomainNameLabelScopeValues() []AutoGeneratedDomainNameLabelScope { + return []AutoGeneratedDomainNameLabelScope{AutoGeneratedDomainNameLabelScopeNoReuse, AutoGeneratedDomainNameLabelScopeResourceGroupReuse, AutoGeneratedDomainNameLabelScopeSubscriptionReuse, AutoGeneratedDomainNameLabelScopeTenantReuse} +} + +// CacheBehavior enumerates the values for cache behavior. +type CacheBehavior string + +const ( + // CacheBehaviorBypassCache ... + CacheBehaviorBypassCache CacheBehavior = "BypassCache" + // CacheBehaviorOverride ... + CacheBehaviorOverride CacheBehavior = "Override" + // CacheBehaviorSetIfMissing ... + CacheBehaviorSetIfMissing CacheBehavior = "SetIfMissing" +) + +// PossibleCacheBehaviorValues returns an array of possible values for the CacheBehavior const type. +func PossibleCacheBehaviorValues() []CacheBehavior { + return []CacheBehavior{CacheBehaviorBypassCache, CacheBehaviorOverride, CacheBehaviorSetIfMissing} +} + +// CertificateSource enumerates the values for certificate source. +type CertificateSource string + +const ( + // CertificateSourceAzureKeyVault ... + CertificateSourceAzureKeyVault CertificateSource = "AzureKeyVault" + // CertificateSourceCdn ... + CertificateSourceCdn CertificateSource = "Cdn" + // CertificateSourceCustomDomainHTTPSParameters ... + CertificateSourceCustomDomainHTTPSParameters CertificateSource = "CustomDomainHttpsParameters" +) + +// PossibleCertificateSourceValues returns an array of possible values for the CertificateSource const type. +func PossibleCertificateSourceValues() []CertificateSource { + return []CertificateSource{CertificateSourceAzureKeyVault, CertificateSourceCdn, CertificateSourceCustomDomainHTTPSParameters} +} + +// CertificateType enumerates the values for certificate type. +type CertificateType string + +const ( + // CertificateTypeDedicated ... + CertificateTypeDedicated CertificateType = "Dedicated" + // CertificateTypeShared ... + CertificateTypeShared CertificateType = "Shared" +) + +// PossibleCertificateTypeValues returns an array of possible values for the CertificateType const type. +func PossibleCertificateTypeValues() []CertificateType { + return []CertificateType{CertificateTypeDedicated, CertificateTypeShared} +} + +// ClientPortOperator enumerates the values for client port operator. +type ClientPortOperator string + +const ( + // ClientPortOperatorAny ... + ClientPortOperatorAny ClientPortOperator = "Any" + // ClientPortOperatorBeginsWith ... + ClientPortOperatorBeginsWith ClientPortOperator = "BeginsWith" + // ClientPortOperatorContains ... + ClientPortOperatorContains ClientPortOperator = "Contains" + // ClientPortOperatorEndsWith ... + ClientPortOperatorEndsWith ClientPortOperator = "EndsWith" + // ClientPortOperatorEqual ... + ClientPortOperatorEqual ClientPortOperator = "Equal" + // ClientPortOperatorGreaterThan ... + ClientPortOperatorGreaterThan ClientPortOperator = "GreaterThan" + // ClientPortOperatorGreaterThanOrEqual ... + ClientPortOperatorGreaterThanOrEqual ClientPortOperator = "GreaterThanOrEqual" + // ClientPortOperatorLessThan ... + ClientPortOperatorLessThan ClientPortOperator = "LessThan" + // ClientPortOperatorLessThanOrEqual ... + ClientPortOperatorLessThanOrEqual ClientPortOperator = "LessThanOrEqual" + // ClientPortOperatorRegEx ... + ClientPortOperatorRegEx ClientPortOperator = "RegEx" +) + +// PossibleClientPortOperatorValues returns an array of possible values for the ClientPortOperator const type. +func PossibleClientPortOperatorValues() []ClientPortOperator { + return []ClientPortOperator{ClientPortOperatorAny, ClientPortOperatorBeginsWith, ClientPortOperatorContains, ClientPortOperatorEndsWith, ClientPortOperatorEqual, ClientPortOperatorGreaterThan, ClientPortOperatorGreaterThanOrEqual, ClientPortOperatorLessThan, ClientPortOperatorLessThanOrEqual, ClientPortOperatorRegEx} +} + +// CookiesOperator enumerates the values for cookies operator. +type CookiesOperator string + +const ( + // CookiesOperatorAny ... + CookiesOperatorAny CookiesOperator = "Any" + // CookiesOperatorBeginsWith ... + CookiesOperatorBeginsWith CookiesOperator = "BeginsWith" + // CookiesOperatorContains ... + CookiesOperatorContains CookiesOperator = "Contains" + // CookiesOperatorEndsWith ... + CookiesOperatorEndsWith CookiesOperator = "EndsWith" + // CookiesOperatorEqual ... + CookiesOperatorEqual CookiesOperator = "Equal" + // CookiesOperatorGreaterThan ... + CookiesOperatorGreaterThan CookiesOperator = "GreaterThan" + // CookiesOperatorGreaterThanOrEqual ... + CookiesOperatorGreaterThanOrEqual CookiesOperator = "GreaterThanOrEqual" + // CookiesOperatorLessThan ... + CookiesOperatorLessThan CookiesOperator = "LessThan" + // CookiesOperatorLessThanOrEqual ... + CookiesOperatorLessThanOrEqual CookiesOperator = "LessThanOrEqual" + // CookiesOperatorRegEx ... + CookiesOperatorRegEx CookiesOperator = "RegEx" +) + +// PossibleCookiesOperatorValues returns an array of possible values for the CookiesOperator const type. +func PossibleCookiesOperatorValues() []CookiesOperator { + return []CookiesOperator{CookiesOperatorAny, CookiesOperatorBeginsWith, CookiesOperatorContains, CookiesOperatorEndsWith, CookiesOperatorEqual, CookiesOperatorGreaterThan, CookiesOperatorGreaterThanOrEqual, CookiesOperatorLessThan, CookiesOperatorLessThanOrEqual, CookiesOperatorRegEx} +} + +// CustomDomainResourceState enumerates the values for custom domain resource state. +type CustomDomainResourceState string + +const ( + // CustomDomainResourceStateActive ... + CustomDomainResourceStateActive CustomDomainResourceState = "Active" + // CustomDomainResourceStateCreating ... + CustomDomainResourceStateCreating CustomDomainResourceState = "Creating" + // CustomDomainResourceStateDeleting ... + CustomDomainResourceStateDeleting CustomDomainResourceState = "Deleting" +) + +// PossibleCustomDomainResourceStateValues returns an array of possible values for the CustomDomainResourceState const type. +func PossibleCustomDomainResourceStateValues() []CustomDomainResourceState { + return []CustomDomainResourceState{CustomDomainResourceStateActive, CustomDomainResourceStateCreating, CustomDomainResourceStateDeleting} +} + +// CustomHTTPSProvisioningState enumerates the values for custom https provisioning state. +type CustomHTTPSProvisioningState string + +const ( + // CustomHTTPSProvisioningStateDisabled ... + CustomHTTPSProvisioningStateDisabled CustomHTTPSProvisioningState = "Disabled" + // CustomHTTPSProvisioningStateDisabling ... + CustomHTTPSProvisioningStateDisabling CustomHTTPSProvisioningState = "Disabling" + // CustomHTTPSProvisioningStateEnabled ... + CustomHTTPSProvisioningStateEnabled CustomHTTPSProvisioningState = "Enabled" + // CustomHTTPSProvisioningStateEnabling ... + CustomHTTPSProvisioningStateEnabling CustomHTTPSProvisioningState = "Enabling" + // CustomHTTPSProvisioningStateFailed ... + CustomHTTPSProvisioningStateFailed CustomHTTPSProvisioningState = "Failed" +) + +// PossibleCustomHTTPSProvisioningStateValues returns an array of possible values for the CustomHTTPSProvisioningState const type. +func PossibleCustomHTTPSProvisioningStateValues() []CustomHTTPSProvisioningState { + return []CustomHTTPSProvisioningState{CustomHTTPSProvisioningStateDisabled, CustomHTTPSProvisioningStateDisabling, CustomHTTPSProvisioningStateEnabled, CustomHTTPSProvisioningStateEnabling, CustomHTTPSProvisioningStateFailed} +} + +// CustomHTTPSProvisioningSubstate enumerates the values for custom https provisioning substate. +type CustomHTTPSProvisioningSubstate string + +const ( + // CustomHTTPSProvisioningSubstateCertificateDeleted ... + CustomHTTPSProvisioningSubstateCertificateDeleted CustomHTTPSProvisioningSubstate = "CertificateDeleted" + // CustomHTTPSProvisioningSubstateCertificateDeployed ... + CustomHTTPSProvisioningSubstateCertificateDeployed CustomHTTPSProvisioningSubstate = "CertificateDeployed" + // CustomHTTPSProvisioningSubstateDeletingCertificate ... + CustomHTTPSProvisioningSubstateDeletingCertificate CustomHTTPSProvisioningSubstate = "DeletingCertificate" + // CustomHTTPSProvisioningSubstateDeployingCertificate ... + CustomHTTPSProvisioningSubstateDeployingCertificate CustomHTTPSProvisioningSubstate = "DeployingCertificate" + // CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved ... + CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestApproved" + // CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected ... + CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestRejected" + // CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut ... + CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestTimedOut" + // CustomHTTPSProvisioningSubstateIssuingCertificate ... + CustomHTTPSProvisioningSubstateIssuingCertificate CustomHTTPSProvisioningSubstate = "IssuingCertificate" + // CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval ... + CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval CustomHTTPSProvisioningSubstate = "PendingDomainControlValidationREquestApproval" + // CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest ... + CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest CustomHTTPSProvisioningSubstate = "SubmittingDomainControlValidationRequest" +) + +// PossibleCustomHTTPSProvisioningSubstateValues returns an array of possible values for the CustomHTTPSProvisioningSubstate const type. +func PossibleCustomHTTPSProvisioningSubstateValues() []CustomHTTPSProvisioningSubstate { + return []CustomHTTPSProvisioningSubstate{CustomHTTPSProvisioningSubstateCertificateDeleted, CustomHTTPSProvisioningSubstateCertificateDeployed, CustomHTTPSProvisioningSubstateDeletingCertificate, CustomHTTPSProvisioningSubstateDeployingCertificate, CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved, CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected, CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut, CustomHTTPSProvisioningSubstateIssuingCertificate, CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval, CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest} +} + +// CustomRuleEnabledState enumerates the values for custom rule enabled state. +type CustomRuleEnabledState string + +const ( + // CustomRuleEnabledStateDisabled ... + CustomRuleEnabledStateDisabled CustomRuleEnabledState = "Disabled" + // CustomRuleEnabledStateEnabled ... + CustomRuleEnabledStateEnabled CustomRuleEnabledState = "Enabled" +) + +// PossibleCustomRuleEnabledStateValues returns an array of possible values for the CustomRuleEnabledState const type. +func PossibleCustomRuleEnabledStateValues() []CustomRuleEnabledState { + return []CustomRuleEnabledState{CustomRuleEnabledStateDisabled, CustomRuleEnabledStateEnabled} +} + +// DeploymentStatus enumerates the values for deployment status. +type DeploymentStatus string + +const ( + // DeploymentStatusFailed ... + DeploymentStatusFailed DeploymentStatus = "Failed" + // DeploymentStatusInProgress ... + DeploymentStatusInProgress DeploymentStatus = "InProgress" + // DeploymentStatusNotStarted ... + DeploymentStatusNotStarted DeploymentStatus = "NotStarted" + // DeploymentStatusSucceeded ... + DeploymentStatusSucceeded DeploymentStatus = "Succeeded" +) + +// PossibleDeploymentStatusValues returns an array of possible values for the DeploymentStatus const type. +func PossibleDeploymentStatusValues() []DeploymentStatus { + return []DeploymentStatus{DeploymentStatusFailed, DeploymentStatusInProgress, DeploymentStatusNotStarted, DeploymentStatusSucceeded} +} + +// DestinationProtocol enumerates the values for destination protocol. +type DestinationProtocol string + +const ( + // DestinationProtocolHTTP ... + DestinationProtocolHTTP DestinationProtocol = "Http" + // DestinationProtocolHTTPS ... + DestinationProtocolHTTPS DestinationProtocol = "Https" + // DestinationProtocolMatchRequest ... + DestinationProtocolMatchRequest DestinationProtocol = "MatchRequest" +) + +// PossibleDestinationProtocolValues returns an array of possible values for the DestinationProtocol const type. +func PossibleDestinationProtocolValues() []DestinationProtocol { + return []DestinationProtocol{DestinationProtocolHTTP, DestinationProtocolHTTPS, DestinationProtocolMatchRequest} +} + +// DomainValidationState enumerates the values for domain validation state. +type DomainValidationState string + +const ( + // DomainValidationStateApproved ... + DomainValidationStateApproved DomainValidationState = "Approved" + // DomainValidationStateInternalError ... + DomainValidationStateInternalError DomainValidationState = "InternalError" + // DomainValidationStatePending ... + DomainValidationStatePending DomainValidationState = "Pending" + // DomainValidationStatePendingRevalidation ... + DomainValidationStatePendingRevalidation DomainValidationState = "PendingRevalidation" + // DomainValidationStateRefreshingValidationToken ... + DomainValidationStateRefreshingValidationToken DomainValidationState = "RefreshingValidationToken" + // DomainValidationStateRejected ... + DomainValidationStateRejected DomainValidationState = "Rejected" + // DomainValidationStateSubmitting ... + DomainValidationStateSubmitting DomainValidationState = "Submitting" + // DomainValidationStateTimedOut ... + DomainValidationStateTimedOut DomainValidationState = "TimedOut" + // DomainValidationStateUnknown ... + DomainValidationStateUnknown DomainValidationState = "Unknown" +) + +// PossibleDomainValidationStateValues returns an array of possible values for the DomainValidationState const type. +func PossibleDomainValidationStateValues() []DomainValidationState { + return []DomainValidationState{DomainValidationStateApproved, DomainValidationStateInternalError, DomainValidationStatePending, DomainValidationStatePendingRevalidation, DomainValidationStateRefreshingValidationToken, DomainValidationStateRejected, DomainValidationStateSubmitting, DomainValidationStateTimedOut, DomainValidationStateUnknown} +} + +// EnabledState enumerates the values for enabled state. +type EnabledState string + +const ( + // EnabledStateDisabled ... + EnabledStateDisabled EnabledState = "Disabled" + // EnabledStateEnabled ... + EnabledStateEnabled EnabledState = "Enabled" +) + +// PossibleEnabledStateValues returns an array of possible values for the EnabledState const type. +func PossibleEnabledStateValues() []EnabledState { + return []EnabledState{EnabledStateDisabled, EnabledStateEnabled} +} + +// EndpointResourceState enumerates the values for endpoint resource state. +type EndpointResourceState string + +const ( + // EndpointResourceStateCreating ... + EndpointResourceStateCreating EndpointResourceState = "Creating" + // EndpointResourceStateDeleting ... + EndpointResourceStateDeleting EndpointResourceState = "Deleting" + // EndpointResourceStateRunning ... + EndpointResourceStateRunning EndpointResourceState = "Running" + // EndpointResourceStateStarting ... + EndpointResourceStateStarting EndpointResourceState = "Starting" + // EndpointResourceStateStopped ... + EndpointResourceStateStopped EndpointResourceState = "Stopped" + // EndpointResourceStateStopping ... + EndpointResourceStateStopping EndpointResourceState = "Stopping" +) + +// PossibleEndpointResourceStateValues returns an array of possible values for the EndpointResourceState const type. +func PossibleEndpointResourceStateValues() []EndpointResourceState { + return []EndpointResourceState{EndpointResourceStateCreating, EndpointResourceStateDeleting, EndpointResourceStateRunning, EndpointResourceStateStarting, EndpointResourceStateStopped, EndpointResourceStateStopping} +} + +// ForwardingProtocol enumerates the values for forwarding protocol. +type ForwardingProtocol string + +const ( + // ForwardingProtocolHTTPOnly ... + ForwardingProtocolHTTPOnly ForwardingProtocol = "HttpOnly" + // ForwardingProtocolHTTPSOnly ... + ForwardingProtocolHTTPSOnly ForwardingProtocol = "HttpsOnly" + // ForwardingProtocolMatchRequest ... + ForwardingProtocolMatchRequest ForwardingProtocol = "MatchRequest" +) + +// PossibleForwardingProtocolValues returns an array of possible values for the ForwardingProtocol const type. +func PossibleForwardingProtocolValues() []ForwardingProtocol { + return []ForwardingProtocol{ForwardingProtocolHTTPOnly, ForwardingProtocolHTTPSOnly, ForwardingProtocolMatchRequest} +} + +// GeoFilterActions enumerates the values for geo filter actions. +type GeoFilterActions string + +const ( + // GeoFilterActionsAllow ... + GeoFilterActionsAllow GeoFilterActions = "Allow" + // GeoFilterActionsBlock ... + GeoFilterActionsBlock GeoFilterActions = "Block" +) + +// PossibleGeoFilterActionsValues returns an array of possible values for the GeoFilterActions const type. +func PossibleGeoFilterActionsValues() []GeoFilterActions { + return []GeoFilterActions{GeoFilterActionsAllow, GeoFilterActionsBlock} +} + +// Granularity enumerates the values for granularity. +type Granularity string + +const ( + // GranularityP1D ... + GranularityP1D Granularity = "P1D" + // GranularityPT1H ... + GranularityPT1H Granularity = "PT1H" + // GranularityPT5M ... + GranularityPT5M Granularity = "PT5M" +) + +// PossibleGranularityValues returns an array of possible values for the Granularity const type. +func PossibleGranularityValues() []Granularity { + return []Granularity{GranularityP1D, GranularityPT1H, GranularityPT5M} +} + +// Granularity1 enumerates the values for granularity 1. +type Granularity1 string + +const ( + // Granularity1P1D ... + Granularity1P1D Granularity1 = "P1D" + // Granularity1PT1H ... + Granularity1PT1H Granularity1 = "PT1H" + // Granularity1PT5M ... + Granularity1PT5M Granularity1 = "PT5M" +) + +// PossibleGranularity1Values returns an array of possible values for the Granularity1 const type. +func PossibleGranularity1Values() []Granularity1 { + return []Granularity1{Granularity1P1D, Granularity1PT1H, Granularity1PT5M} +} + +// HeaderAction enumerates the values for header action. +type HeaderAction string + +const ( + // HeaderActionAppend ... + HeaderActionAppend HeaderAction = "Append" + // HeaderActionDelete ... + HeaderActionDelete HeaderAction = "Delete" + // HeaderActionOverwrite ... + HeaderActionOverwrite HeaderAction = "Overwrite" +) + +// PossibleHeaderActionValues returns an array of possible values for the HeaderAction const type. +func PossibleHeaderActionValues() []HeaderAction { + return []HeaderAction{HeaderActionAppend, HeaderActionDelete, HeaderActionOverwrite} +} + +// HealthProbeRequestType enumerates the values for health probe request type. +type HealthProbeRequestType string + +const ( + // HealthProbeRequestTypeGET ... + HealthProbeRequestTypeGET HealthProbeRequestType = "GET" + // HealthProbeRequestTypeHEAD ... + HealthProbeRequestTypeHEAD HealthProbeRequestType = "HEAD" + // HealthProbeRequestTypeNotSet ... + HealthProbeRequestTypeNotSet HealthProbeRequestType = "NotSet" +) + +// PossibleHealthProbeRequestTypeValues returns an array of possible values for the HealthProbeRequestType const type. +func PossibleHealthProbeRequestTypeValues() []HealthProbeRequestType { + return []HealthProbeRequestType{HealthProbeRequestTypeGET, HealthProbeRequestTypeHEAD, HealthProbeRequestTypeNotSet} +} + +// HostNameOperator enumerates the values for host name operator. +type HostNameOperator string + +const ( + // HostNameOperatorAny ... + HostNameOperatorAny HostNameOperator = "Any" + // HostNameOperatorBeginsWith ... + HostNameOperatorBeginsWith HostNameOperator = "BeginsWith" + // HostNameOperatorContains ... + HostNameOperatorContains HostNameOperator = "Contains" + // HostNameOperatorEndsWith ... + HostNameOperatorEndsWith HostNameOperator = "EndsWith" + // HostNameOperatorEqual ... + HostNameOperatorEqual HostNameOperator = "Equal" + // HostNameOperatorGreaterThan ... + HostNameOperatorGreaterThan HostNameOperator = "GreaterThan" + // HostNameOperatorGreaterThanOrEqual ... + HostNameOperatorGreaterThanOrEqual HostNameOperator = "GreaterThanOrEqual" + // HostNameOperatorLessThan ... + HostNameOperatorLessThan HostNameOperator = "LessThan" + // HostNameOperatorLessThanOrEqual ... + HostNameOperatorLessThanOrEqual HostNameOperator = "LessThanOrEqual" + // HostNameOperatorRegEx ... + HostNameOperatorRegEx HostNameOperator = "RegEx" +) + +// PossibleHostNameOperatorValues returns an array of possible values for the HostNameOperator const type. +func PossibleHostNameOperatorValues() []HostNameOperator { + return []HostNameOperator{HostNameOperatorAny, HostNameOperatorBeginsWith, HostNameOperatorContains, HostNameOperatorEndsWith, HostNameOperatorEqual, HostNameOperatorGreaterThan, HostNameOperatorGreaterThanOrEqual, HostNameOperatorLessThan, HostNameOperatorLessThanOrEqual, HostNameOperatorRegEx} +} + +// HTTPSRedirect enumerates the values for https redirect. +type HTTPSRedirect string + +const ( + // HTTPSRedirectDisabled ... + HTTPSRedirectDisabled HTTPSRedirect = "Disabled" + // HTTPSRedirectEnabled ... + HTTPSRedirectEnabled HTTPSRedirect = "Enabled" +) + +// PossibleHTTPSRedirectValues returns an array of possible values for the HTTPSRedirect const type. +func PossibleHTTPSRedirectValues() []HTTPSRedirect { + return []HTTPSRedirect{HTTPSRedirectDisabled, HTTPSRedirectEnabled} +} + +// IdentityType enumerates the values for identity type. +type IdentityType string + +const ( + // IdentityTypeApplication ... + IdentityTypeApplication IdentityType = "application" + // IdentityTypeKey ... + IdentityTypeKey IdentityType = "key" + // IdentityTypeManagedIdentity ... + IdentityTypeManagedIdentity IdentityType = "managedIdentity" + // IdentityTypeUser ... + IdentityTypeUser IdentityType = "user" +) + +// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{IdentityTypeApplication, IdentityTypeKey, IdentityTypeManagedIdentity, IdentityTypeUser} +} + +// LinkToDefaultDomain enumerates the values for link to default domain. +type LinkToDefaultDomain string + +const ( + // LinkToDefaultDomainDisabled ... + LinkToDefaultDomainDisabled LinkToDefaultDomain = "Disabled" + // LinkToDefaultDomainEnabled ... + LinkToDefaultDomainEnabled LinkToDefaultDomain = "Enabled" +) + +// PossibleLinkToDefaultDomainValues returns an array of possible values for the LinkToDefaultDomain const type. +func PossibleLinkToDefaultDomainValues() []LinkToDefaultDomain { + return []LinkToDefaultDomain{LinkToDefaultDomainDisabled, LinkToDefaultDomainEnabled} +} + +// LogMetric enumerates the values for log metric. +type LogMetric string + +const ( + // LogMetricClientRequestBandwidth ... + LogMetricClientRequestBandwidth LogMetric = "clientRequestBandwidth" + // LogMetricClientRequestCount ... + LogMetricClientRequestCount LogMetric = "clientRequestCount" + // LogMetricClientRequestTraffic ... + LogMetricClientRequestTraffic LogMetric = "clientRequestTraffic" + // LogMetricOriginRequestBandwidth ... + LogMetricOriginRequestBandwidth LogMetric = "originRequestBandwidth" + // LogMetricOriginRequestTraffic ... + LogMetricOriginRequestTraffic LogMetric = "originRequestTraffic" + // LogMetricTotalLatency ... + LogMetricTotalLatency LogMetric = "totalLatency" +) + +// PossibleLogMetricValues returns an array of possible values for the LogMetric const type. +func PossibleLogMetricValues() []LogMetric { + return []LogMetric{LogMetricClientRequestBandwidth, LogMetricClientRequestCount, LogMetricClientRequestTraffic, LogMetricOriginRequestBandwidth, LogMetricOriginRequestTraffic, LogMetricTotalLatency} +} + +// LogMetricsGranularity enumerates the values for log metrics granularity. +type LogMetricsGranularity string + +const ( + // LogMetricsGranularityP1D ... + LogMetricsGranularityP1D LogMetricsGranularity = "P1D" + // LogMetricsGranularityPT1H ... + LogMetricsGranularityPT1H LogMetricsGranularity = "PT1H" + // LogMetricsGranularityPT5M ... + LogMetricsGranularityPT5M LogMetricsGranularity = "PT5M" +) + +// PossibleLogMetricsGranularityValues returns an array of possible values for the LogMetricsGranularity const type. +func PossibleLogMetricsGranularityValues() []LogMetricsGranularity { + return []LogMetricsGranularity{LogMetricsGranularityP1D, LogMetricsGranularityPT1H, LogMetricsGranularityPT5M} +} + +// LogMetricsGroupBy enumerates the values for log metrics group by. +type LogMetricsGroupBy string + +const ( + // LogMetricsGroupByCacheStatus ... + LogMetricsGroupByCacheStatus LogMetricsGroupBy = "cacheStatus" + // LogMetricsGroupByCountryOrRegion ... + LogMetricsGroupByCountryOrRegion LogMetricsGroupBy = "countryOrRegion" + // LogMetricsGroupByCustomDomain ... + LogMetricsGroupByCustomDomain LogMetricsGroupBy = "customDomain" + // LogMetricsGroupByHTTPStatusCode ... + LogMetricsGroupByHTTPStatusCode LogMetricsGroupBy = "httpStatusCode" + // LogMetricsGroupByProtocol ... + LogMetricsGroupByProtocol LogMetricsGroupBy = "protocol" +) + +// PossibleLogMetricsGroupByValues returns an array of possible values for the LogMetricsGroupBy const type. +func PossibleLogMetricsGroupByValues() []LogMetricsGroupBy { + return []LogMetricsGroupBy{LogMetricsGroupByCacheStatus, LogMetricsGroupByCountryOrRegion, LogMetricsGroupByCustomDomain, LogMetricsGroupByHTTPStatusCode, LogMetricsGroupByProtocol} +} + +// LogRanking enumerates the values for log ranking. +type LogRanking string + +const ( + // LogRankingBrowser ... + LogRankingBrowser LogRanking = "browser" + // LogRankingCountryOrRegion ... + LogRankingCountryOrRegion LogRanking = "countryOrRegion" + // LogRankingReferrer ... + LogRankingReferrer LogRanking = "referrer" + // LogRankingURL ... + LogRankingURL LogRanking = "url" + // LogRankingUserAgent ... + LogRankingUserAgent LogRanking = "userAgent" +) + +// PossibleLogRankingValues returns an array of possible values for the LogRanking const type. +func PossibleLogRankingValues() []LogRanking { + return []LogRanking{LogRankingBrowser, LogRankingCountryOrRegion, LogRankingReferrer, LogRankingURL, LogRankingUserAgent} +} + +// LogRankingMetric enumerates the values for log ranking metric. +type LogRankingMetric string + +const ( + // LogRankingMetricClientRequestCount ... + LogRankingMetricClientRequestCount LogRankingMetric = "clientRequestCount" + // LogRankingMetricClientRequestTraffic ... + LogRankingMetricClientRequestTraffic LogRankingMetric = "clientRequestTraffic" + // LogRankingMetricErrorCount ... + LogRankingMetricErrorCount LogRankingMetric = "errorCount" + // LogRankingMetricHitCount ... + LogRankingMetricHitCount LogRankingMetric = "hitCount" + // LogRankingMetricMissCount ... + LogRankingMetricMissCount LogRankingMetric = "missCount" + // LogRankingMetricUserErrorCount ... + LogRankingMetricUserErrorCount LogRankingMetric = "userErrorCount" +) + +// PossibleLogRankingMetricValues returns an array of possible values for the LogRankingMetric const type. +func PossibleLogRankingMetricValues() []LogRankingMetric { + return []LogRankingMetric{LogRankingMetricClientRequestCount, LogRankingMetricClientRequestTraffic, LogRankingMetricErrorCount, LogRankingMetricHitCount, LogRankingMetricMissCount, LogRankingMetricUserErrorCount} +} + +// ManagedRuleEnabledState enumerates the values for managed rule enabled state. +type ManagedRuleEnabledState string + +const ( + // ManagedRuleEnabledStateDisabled ... + ManagedRuleEnabledStateDisabled ManagedRuleEnabledState = "Disabled" + // ManagedRuleEnabledStateEnabled ... + ManagedRuleEnabledStateEnabled ManagedRuleEnabledState = "Enabled" +) + +// PossibleManagedRuleEnabledStateValues returns an array of possible values for the ManagedRuleEnabledState const type. +func PossibleManagedRuleEnabledStateValues() []ManagedRuleEnabledState { + return []ManagedRuleEnabledState{ManagedRuleEnabledStateDisabled, ManagedRuleEnabledStateEnabled} +} + +// MatchProcessingBehavior enumerates the values for match processing behavior. +type MatchProcessingBehavior string + +const ( + // MatchProcessingBehaviorContinue ... + MatchProcessingBehaviorContinue MatchProcessingBehavior = "Continue" + // MatchProcessingBehaviorStop ... + MatchProcessingBehaviorStop MatchProcessingBehavior = "Stop" +) + +// PossibleMatchProcessingBehaviorValues returns an array of possible values for the MatchProcessingBehavior const type. +func PossibleMatchProcessingBehaviorValues() []MatchProcessingBehavior { + return []MatchProcessingBehavior{MatchProcessingBehaviorContinue, MatchProcessingBehaviorStop} +} + +// MinimumTLSVersion enumerates the values for minimum tls version. +type MinimumTLSVersion string + +const ( + // MinimumTLSVersionNone ... + MinimumTLSVersionNone MinimumTLSVersion = "None" + // MinimumTLSVersionTLS10 ... + MinimumTLSVersionTLS10 MinimumTLSVersion = "TLS10" + // MinimumTLSVersionTLS12 ... + MinimumTLSVersionTLS12 MinimumTLSVersion = "TLS12" +) + +// PossibleMinimumTLSVersionValues returns an array of possible values for the MinimumTLSVersion const type. +func PossibleMinimumTLSVersionValues() []MinimumTLSVersion { + return []MinimumTLSVersion{MinimumTLSVersionNone, MinimumTLSVersionTLS10, MinimumTLSVersionTLS12} +} + +// Name enumerates the values for name. +type Name string + +const ( + // NameClientPort ... + NameClientPort Name = "ClientPort" + // NameCookies ... + NameCookies Name = "Cookies" + // NameDeliveryRuleCondition ... + NameDeliveryRuleCondition Name = "DeliveryRuleCondition" + // NameHostName ... + NameHostName Name = "HostName" + // NameHTTPVersion ... + NameHTTPVersion Name = "HttpVersion" + // NameIsDevice ... + NameIsDevice Name = "IsDevice" + // NamePostArgs ... + NamePostArgs Name = "PostArgs" + // NameQueryString ... + NameQueryString Name = "QueryString" + // NameRemoteAddress ... + NameRemoteAddress Name = "RemoteAddress" + // NameRequestBody ... + NameRequestBody Name = "RequestBody" + // NameRequestHeader ... + NameRequestHeader Name = "RequestHeader" + // NameRequestMethod ... + NameRequestMethod Name = "RequestMethod" + // NameRequestScheme ... + NameRequestScheme Name = "RequestScheme" + // NameRequestURI ... + NameRequestURI Name = "RequestUri" + // NameServerPort ... + NameServerPort Name = "ServerPort" + // NameSocketAddr ... + NameSocketAddr Name = "SocketAddr" + // NameSslProtocol ... + NameSslProtocol Name = "SslProtocol" + // NameURLFileExtension ... + NameURLFileExtension Name = "UrlFileExtension" + // NameURLFileName ... + NameURLFileName Name = "UrlFileName" + // NameURLPath ... + NameURLPath Name = "UrlPath" +) + +// PossibleNameValues returns an array of possible values for the Name const type. +func PossibleNameValues() []Name { + return []Name{NameClientPort, NameCookies, NameDeliveryRuleCondition, NameHostName, NameHTTPVersion, NameIsDevice, NamePostArgs, NameQueryString, NameRemoteAddress, NameRequestBody, NameRequestHeader, NameRequestMethod, NameRequestScheme, NameRequestURI, NameServerPort, NameSocketAddr, NameSslProtocol, NameURLFileExtension, NameURLFileName, NameURLPath} +} + +// NameBasicDeliveryRuleAction enumerates the values for name basic delivery rule action. +type NameBasicDeliveryRuleAction string + +const ( + // NameBasicDeliveryRuleActionNameCacheExpiration ... + NameBasicDeliveryRuleActionNameCacheExpiration NameBasicDeliveryRuleAction = "CacheExpiration" + // NameBasicDeliveryRuleActionNameCacheKeyQueryString ... + NameBasicDeliveryRuleActionNameCacheKeyQueryString NameBasicDeliveryRuleAction = "CacheKeyQueryString" + // NameBasicDeliveryRuleActionNameDeliveryRuleAction ... + NameBasicDeliveryRuleActionNameDeliveryRuleAction NameBasicDeliveryRuleAction = "DeliveryRuleAction" + // NameBasicDeliveryRuleActionNameModifyRequestHeader ... + NameBasicDeliveryRuleActionNameModifyRequestHeader NameBasicDeliveryRuleAction = "ModifyRequestHeader" + // NameBasicDeliveryRuleActionNameModifyResponseHeader ... + NameBasicDeliveryRuleActionNameModifyResponseHeader NameBasicDeliveryRuleAction = "ModifyResponseHeader" + // NameBasicDeliveryRuleActionNameOriginGroupOverride ... + NameBasicDeliveryRuleActionNameOriginGroupOverride NameBasicDeliveryRuleAction = "OriginGroupOverride" + // NameBasicDeliveryRuleActionNameRouteConfigurationOverride ... + NameBasicDeliveryRuleActionNameRouteConfigurationOverride NameBasicDeliveryRuleAction = "RouteConfigurationOverride" + // NameBasicDeliveryRuleActionNameURLRedirect ... + NameBasicDeliveryRuleActionNameURLRedirect NameBasicDeliveryRuleAction = "UrlRedirect" + // NameBasicDeliveryRuleActionNameURLRewrite ... + NameBasicDeliveryRuleActionNameURLRewrite NameBasicDeliveryRuleAction = "UrlRewrite" + // NameBasicDeliveryRuleActionNameURLSigning ... + NameBasicDeliveryRuleActionNameURLSigning NameBasicDeliveryRuleAction = "UrlSigning" +) + +// PossibleNameBasicDeliveryRuleActionValues returns an array of possible values for the NameBasicDeliveryRuleAction const type. +func PossibleNameBasicDeliveryRuleActionValues() []NameBasicDeliveryRuleAction { + return []NameBasicDeliveryRuleAction{NameBasicDeliveryRuleActionNameCacheExpiration, NameBasicDeliveryRuleActionNameCacheKeyQueryString, NameBasicDeliveryRuleActionNameDeliveryRuleAction, NameBasicDeliveryRuleActionNameModifyRequestHeader, NameBasicDeliveryRuleActionNameModifyResponseHeader, NameBasicDeliveryRuleActionNameOriginGroupOverride, NameBasicDeliveryRuleActionNameRouteConfigurationOverride, NameBasicDeliveryRuleActionNameURLRedirect, NameBasicDeliveryRuleActionNameURLRewrite, NameBasicDeliveryRuleActionNameURLSigning} +} + +// Operator enumerates the values for operator. +type Operator string + +const ( + // OperatorAny ... + OperatorAny Operator = "Any" + // OperatorBeginsWith ... + OperatorBeginsWith Operator = "BeginsWith" + // OperatorContains ... + OperatorContains Operator = "Contains" + // OperatorEndsWith ... + OperatorEndsWith Operator = "EndsWith" + // OperatorEqual ... + OperatorEqual Operator = "Equal" + // OperatorGeoMatch ... + OperatorGeoMatch Operator = "GeoMatch" + // OperatorGreaterThan ... + OperatorGreaterThan Operator = "GreaterThan" + // OperatorGreaterThanOrEqual ... + OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" + // OperatorIPMatch ... + OperatorIPMatch Operator = "IPMatch" + // OperatorLessThan ... + OperatorLessThan Operator = "LessThan" + // OperatorLessThanOrEqual ... + OperatorLessThanOrEqual Operator = "LessThanOrEqual" + // OperatorRegEx ... + OperatorRegEx Operator = "RegEx" +) + +// PossibleOperatorValues returns an array of possible values for the Operator const type. +func PossibleOperatorValues() []Operator { + return []Operator{OperatorAny, OperatorBeginsWith, OperatorContains, OperatorEndsWith, OperatorEqual, OperatorGeoMatch, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorIPMatch, OperatorLessThan, OperatorLessThanOrEqual, OperatorRegEx} +} + +// OptimizationType enumerates the values for optimization type. +type OptimizationType string + +const ( + // OptimizationTypeDynamicSiteAcceleration ... + OptimizationTypeDynamicSiteAcceleration OptimizationType = "DynamicSiteAcceleration" + // OptimizationTypeGeneralMediaStreaming ... + OptimizationTypeGeneralMediaStreaming OptimizationType = "GeneralMediaStreaming" + // OptimizationTypeGeneralWebDelivery ... + OptimizationTypeGeneralWebDelivery OptimizationType = "GeneralWebDelivery" + // OptimizationTypeLargeFileDownload ... + OptimizationTypeLargeFileDownload OptimizationType = "LargeFileDownload" + // OptimizationTypeVideoOnDemandMediaStreaming ... + OptimizationTypeVideoOnDemandMediaStreaming OptimizationType = "VideoOnDemandMediaStreaming" +) + +// PossibleOptimizationTypeValues returns an array of possible values for the OptimizationType const type. +func PossibleOptimizationTypeValues() []OptimizationType { + return []OptimizationType{OptimizationTypeDynamicSiteAcceleration, OptimizationTypeGeneralMediaStreaming, OptimizationTypeGeneralWebDelivery, OptimizationTypeLargeFileDownload, OptimizationTypeVideoOnDemandMediaStreaming} +} + +// OriginGroupResourceState enumerates the values for origin group resource state. +type OriginGroupResourceState string + +const ( + // OriginGroupResourceStateActive ... + OriginGroupResourceStateActive OriginGroupResourceState = "Active" + // OriginGroupResourceStateCreating ... + OriginGroupResourceStateCreating OriginGroupResourceState = "Creating" + // OriginGroupResourceStateDeleting ... + OriginGroupResourceStateDeleting OriginGroupResourceState = "Deleting" +) + +// PossibleOriginGroupResourceStateValues returns an array of possible values for the OriginGroupResourceState const type. +func PossibleOriginGroupResourceStateValues() []OriginGroupResourceState { + return []OriginGroupResourceState{OriginGroupResourceStateActive, OriginGroupResourceStateCreating, OriginGroupResourceStateDeleting} +} + +// OriginResourceState enumerates the values for origin resource state. +type OriginResourceState string + +const ( + // OriginResourceStateActive ... + OriginResourceStateActive OriginResourceState = "Active" + // OriginResourceStateCreating ... + OriginResourceStateCreating OriginResourceState = "Creating" + // OriginResourceStateDeleting ... + OriginResourceStateDeleting OriginResourceState = "Deleting" +) + +// PossibleOriginResourceStateValues returns an array of possible values for the OriginResourceState const type. +func PossibleOriginResourceStateValues() []OriginResourceState { + return []OriginResourceState{OriginResourceStateActive, OriginResourceStateCreating, OriginResourceStateDeleting} +} + +// ParamIndicator enumerates the values for param indicator. +type ParamIndicator string + +const ( + // ParamIndicatorExpires ... + ParamIndicatorExpires ParamIndicator = "Expires" + // ParamIndicatorKeyID ... + ParamIndicatorKeyID ParamIndicator = "KeyId" + // ParamIndicatorSignature ... + ParamIndicatorSignature ParamIndicator = "Signature" +) + +// PossibleParamIndicatorValues returns an array of possible values for the ParamIndicator const type. +func PossibleParamIndicatorValues() []ParamIndicator { + return []ParamIndicator{ParamIndicatorExpires, ParamIndicatorKeyID, ParamIndicatorSignature} +} + +// PolicyEnabledState enumerates the values for policy enabled state. +type PolicyEnabledState string + +const ( + // PolicyEnabledStateDisabled ... + PolicyEnabledStateDisabled PolicyEnabledState = "Disabled" + // PolicyEnabledStateEnabled ... + PolicyEnabledStateEnabled PolicyEnabledState = "Enabled" +) + +// PossiblePolicyEnabledStateValues returns an array of possible values for the PolicyEnabledState const type. +func PossiblePolicyEnabledStateValues() []PolicyEnabledState { + return []PolicyEnabledState{PolicyEnabledStateDisabled, PolicyEnabledStateEnabled} +} + +// PolicyMode enumerates the values for policy mode. +type PolicyMode string + +const ( + // PolicyModeDetection ... + PolicyModeDetection PolicyMode = "Detection" + // PolicyModePrevention ... + PolicyModePrevention PolicyMode = "Prevention" +) + +// PossiblePolicyModeValues returns an array of possible values for the PolicyMode const type. +func PossiblePolicyModeValues() []PolicyMode { + return []PolicyMode{PolicyModeDetection, PolicyModePrevention} +} + +// PolicyResourceState enumerates the values for policy resource state. +type PolicyResourceState string + +const ( + // PolicyResourceStateCreating ... + PolicyResourceStateCreating PolicyResourceState = "Creating" + // PolicyResourceStateDeleting ... + PolicyResourceStateDeleting PolicyResourceState = "Deleting" + // PolicyResourceStateDisabled ... + PolicyResourceStateDisabled PolicyResourceState = "Disabled" + // PolicyResourceStateDisabling ... + PolicyResourceStateDisabling PolicyResourceState = "Disabling" + // PolicyResourceStateEnabled ... + PolicyResourceStateEnabled PolicyResourceState = "Enabled" + // PolicyResourceStateEnabling ... + PolicyResourceStateEnabling PolicyResourceState = "Enabling" +) + +// PossiblePolicyResourceStateValues returns an array of possible values for the PolicyResourceState const type. +func PossiblePolicyResourceStateValues() []PolicyResourceState { + return []PolicyResourceState{PolicyResourceStateCreating, PolicyResourceStateDeleting, PolicyResourceStateDisabled, PolicyResourceStateDisabling, PolicyResourceStateEnabled, PolicyResourceStateEnabling} +} + +// PostArgsOperator enumerates the values for post args operator. +type PostArgsOperator string + +const ( + // PostArgsOperatorAny ... + PostArgsOperatorAny PostArgsOperator = "Any" + // PostArgsOperatorBeginsWith ... + PostArgsOperatorBeginsWith PostArgsOperator = "BeginsWith" + // PostArgsOperatorContains ... + PostArgsOperatorContains PostArgsOperator = "Contains" + // PostArgsOperatorEndsWith ... + PostArgsOperatorEndsWith PostArgsOperator = "EndsWith" + // PostArgsOperatorEqual ... + PostArgsOperatorEqual PostArgsOperator = "Equal" + // PostArgsOperatorGreaterThan ... + PostArgsOperatorGreaterThan PostArgsOperator = "GreaterThan" + // PostArgsOperatorGreaterThanOrEqual ... + PostArgsOperatorGreaterThanOrEqual PostArgsOperator = "GreaterThanOrEqual" + // PostArgsOperatorLessThan ... + PostArgsOperatorLessThan PostArgsOperator = "LessThan" + // PostArgsOperatorLessThanOrEqual ... + PostArgsOperatorLessThanOrEqual PostArgsOperator = "LessThanOrEqual" + // PostArgsOperatorRegEx ... + PostArgsOperatorRegEx PostArgsOperator = "RegEx" +) + +// PossiblePostArgsOperatorValues returns an array of possible values for the PostArgsOperator const type. +func PossiblePostArgsOperatorValues() []PostArgsOperator { + return []PostArgsOperator{PostArgsOperatorAny, PostArgsOperatorBeginsWith, PostArgsOperatorContains, PostArgsOperatorEndsWith, PostArgsOperatorEqual, PostArgsOperatorGreaterThan, PostArgsOperatorGreaterThanOrEqual, PostArgsOperatorLessThan, PostArgsOperatorLessThanOrEqual, PostArgsOperatorRegEx} +} + +// PrivateEndpointStatus enumerates the values for private endpoint status. +type PrivateEndpointStatus string + +const ( + // PrivateEndpointStatusApproved ... + PrivateEndpointStatusApproved PrivateEndpointStatus = "Approved" + // PrivateEndpointStatusDisconnected ... + PrivateEndpointStatusDisconnected PrivateEndpointStatus = "Disconnected" + // PrivateEndpointStatusPending ... + PrivateEndpointStatusPending PrivateEndpointStatus = "Pending" + // PrivateEndpointStatusRejected ... + PrivateEndpointStatusRejected PrivateEndpointStatus = "Rejected" + // PrivateEndpointStatusTimeout ... + PrivateEndpointStatusTimeout PrivateEndpointStatus = "Timeout" +) + +// PossiblePrivateEndpointStatusValues returns an array of possible values for the PrivateEndpointStatus const type. +func PossiblePrivateEndpointStatusValues() []PrivateEndpointStatus { + return []PrivateEndpointStatus{PrivateEndpointStatusApproved, PrivateEndpointStatusDisconnected, PrivateEndpointStatusPending, PrivateEndpointStatusRejected, PrivateEndpointStatusTimeout} +} + +// ProbeProtocol enumerates the values for probe protocol. +type ProbeProtocol string + +const ( + // ProbeProtocolHTTP ... + ProbeProtocolHTTP ProbeProtocol = "Http" + // ProbeProtocolHTTPS ... + ProbeProtocolHTTPS ProbeProtocol = "Https" + // ProbeProtocolNotSet ... + ProbeProtocolNotSet ProbeProtocol = "NotSet" +) + +// PossibleProbeProtocolValues returns an array of possible values for the ProbeProtocol const type. +func PossibleProbeProtocolValues() []ProbeProtocol { + return []ProbeProtocol{ProbeProtocolHTTP, ProbeProtocolHTTPS, ProbeProtocolNotSet} +} + +// ProfileResourceState enumerates the values for profile resource state. +type ProfileResourceState string + +const ( + // ProfileResourceStateActive ... + ProfileResourceStateActive ProfileResourceState = "Active" + // ProfileResourceStateCreating ... + ProfileResourceStateCreating ProfileResourceState = "Creating" + // ProfileResourceStateDeleting ... + ProfileResourceStateDeleting ProfileResourceState = "Deleting" + // ProfileResourceStateDisabled ... + ProfileResourceStateDisabled ProfileResourceState = "Disabled" +) + +// PossibleProfileResourceStateValues returns an array of possible values for the ProfileResourceState const type. +func PossibleProfileResourceStateValues() []ProfileResourceState { + return []ProfileResourceState{ProfileResourceStateActive, ProfileResourceStateCreating, ProfileResourceStateDeleting, ProfileResourceStateDisabled} +} + +// ProtocolType enumerates the values for protocol type. +type ProtocolType string + +const ( + // ProtocolTypeIPBased ... + ProtocolTypeIPBased ProtocolType = "IPBased" + // ProtocolTypeServerNameIndication ... + ProtocolTypeServerNameIndication ProtocolType = "ServerNameIndication" +) + +// PossibleProtocolTypeValues returns an array of possible values for the ProtocolType const type. +func PossibleProtocolTypeValues() []ProtocolType { + return []ProtocolType{ProtocolTypeIPBased, ProtocolTypeServerNameIndication} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateFailed, ProvisioningStateSucceeded} +} + +// QueryStringBehavior enumerates the values for query string behavior. +type QueryStringBehavior string + +const ( + // QueryStringBehaviorExclude ... + QueryStringBehaviorExclude QueryStringBehavior = "Exclude" + // QueryStringBehaviorExcludeAll ... + QueryStringBehaviorExcludeAll QueryStringBehavior = "ExcludeAll" + // QueryStringBehaviorInclude ... + QueryStringBehaviorInclude QueryStringBehavior = "Include" + // QueryStringBehaviorIncludeAll ... + QueryStringBehaviorIncludeAll QueryStringBehavior = "IncludeAll" +) + +// PossibleQueryStringBehaviorValues returns an array of possible values for the QueryStringBehavior const type. +func PossibleQueryStringBehaviorValues() []QueryStringBehavior { + return []QueryStringBehavior{QueryStringBehaviorExclude, QueryStringBehaviorExcludeAll, QueryStringBehaviorInclude, QueryStringBehaviorIncludeAll} +} + +// QueryStringCachingBehavior enumerates the values for query string caching behavior. +type QueryStringCachingBehavior string + +const ( + // QueryStringCachingBehaviorBypassCaching ... + QueryStringCachingBehaviorBypassCaching QueryStringCachingBehavior = "BypassCaching" + // QueryStringCachingBehaviorIgnoreQueryString ... + QueryStringCachingBehaviorIgnoreQueryString QueryStringCachingBehavior = "IgnoreQueryString" + // QueryStringCachingBehaviorNotSet ... + QueryStringCachingBehaviorNotSet QueryStringCachingBehavior = "NotSet" + // QueryStringCachingBehaviorUseQueryString ... + QueryStringCachingBehaviorUseQueryString QueryStringCachingBehavior = "UseQueryString" +) + +// PossibleQueryStringCachingBehaviorValues returns an array of possible values for the QueryStringCachingBehavior const type. +func PossibleQueryStringCachingBehaviorValues() []QueryStringCachingBehavior { + return []QueryStringCachingBehavior{QueryStringCachingBehaviorBypassCaching, QueryStringCachingBehaviorIgnoreQueryString, QueryStringCachingBehaviorNotSet, QueryStringCachingBehaviorUseQueryString} +} + +// QueryStringOperator enumerates the values for query string operator. +type QueryStringOperator string + +const ( + // QueryStringOperatorAny ... + QueryStringOperatorAny QueryStringOperator = "Any" + // QueryStringOperatorBeginsWith ... + QueryStringOperatorBeginsWith QueryStringOperator = "BeginsWith" + // QueryStringOperatorContains ... + QueryStringOperatorContains QueryStringOperator = "Contains" + // QueryStringOperatorEndsWith ... + QueryStringOperatorEndsWith QueryStringOperator = "EndsWith" + // QueryStringOperatorEqual ... + QueryStringOperatorEqual QueryStringOperator = "Equal" + // QueryStringOperatorGreaterThan ... + QueryStringOperatorGreaterThan QueryStringOperator = "GreaterThan" + // QueryStringOperatorGreaterThanOrEqual ... + QueryStringOperatorGreaterThanOrEqual QueryStringOperator = "GreaterThanOrEqual" + // QueryStringOperatorLessThan ... + QueryStringOperatorLessThan QueryStringOperator = "LessThan" + // QueryStringOperatorLessThanOrEqual ... + QueryStringOperatorLessThanOrEqual QueryStringOperator = "LessThanOrEqual" + // QueryStringOperatorRegEx ... + QueryStringOperatorRegEx QueryStringOperator = "RegEx" +) + +// PossibleQueryStringOperatorValues returns an array of possible values for the QueryStringOperator const type. +func PossibleQueryStringOperatorValues() []QueryStringOperator { + return []QueryStringOperator{QueryStringOperatorAny, QueryStringOperatorBeginsWith, QueryStringOperatorContains, QueryStringOperatorEndsWith, QueryStringOperatorEqual, QueryStringOperatorGreaterThan, QueryStringOperatorGreaterThanOrEqual, QueryStringOperatorLessThan, QueryStringOperatorLessThanOrEqual, QueryStringOperatorRegEx} +} + +// RedirectType enumerates the values for redirect type. +type RedirectType string + +const ( + // RedirectTypeFound ... + RedirectTypeFound RedirectType = "Found" + // RedirectTypeMoved ... + RedirectTypeMoved RedirectType = "Moved" + // RedirectTypePermanentRedirect ... + RedirectTypePermanentRedirect RedirectType = "PermanentRedirect" + // RedirectTypeTemporaryRedirect ... + RedirectTypeTemporaryRedirect RedirectType = "TemporaryRedirect" +) + +// PossibleRedirectTypeValues returns an array of possible values for the RedirectType const type. +func PossibleRedirectTypeValues() []RedirectType { + return []RedirectType{RedirectTypeFound, RedirectTypeMoved, RedirectTypePermanentRedirect, RedirectTypeTemporaryRedirect} +} + +// RemoteAddressOperator enumerates the values for remote address operator. +type RemoteAddressOperator string + +const ( + // RemoteAddressOperatorAny ... + RemoteAddressOperatorAny RemoteAddressOperator = "Any" + // RemoteAddressOperatorGeoMatch ... + RemoteAddressOperatorGeoMatch RemoteAddressOperator = "GeoMatch" + // RemoteAddressOperatorIPMatch ... + RemoteAddressOperatorIPMatch RemoteAddressOperator = "IPMatch" +) + +// PossibleRemoteAddressOperatorValues returns an array of possible values for the RemoteAddressOperator const type. +func PossibleRemoteAddressOperatorValues() []RemoteAddressOperator { + return []RemoteAddressOperator{RemoteAddressOperatorAny, RemoteAddressOperatorGeoMatch, RemoteAddressOperatorIPMatch} +} + +// RequestBodyOperator enumerates the values for request body operator. +type RequestBodyOperator string + +const ( + // RequestBodyOperatorAny ... + RequestBodyOperatorAny RequestBodyOperator = "Any" + // RequestBodyOperatorBeginsWith ... + RequestBodyOperatorBeginsWith RequestBodyOperator = "BeginsWith" + // RequestBodyOperatorContains ... + RequestBodyOperatorContains RequestBodyOperator = "Contains" + // RequestBodyOperatorEndsWith ... + RequestBodyOperatorEndsWith RequestBodyOperator = "EndsWith" + // RequestBodyOperatorEqual ... + RequestBodyOperatorEqual RequestBodyOperator = "Equal" + // RequestBodyOperatorGreaterThan ... + RequestBodyOperatorGreaterThan RequestBodyOperator = "GreaterThan" + // RequestBodyOperatorGreaterThanOrEqual ... + RequestBodyOperatorGreaterThanOrEqual RequestBodyOperator = "GreaterThanOrEqual" + // RequestBodyOperatorLessThan ... + RequestBodyOperatorLessThan RequestBodyOperator = "LessThan" + // RequestBodyOperatorLessThanOrEqual ... + RequestBodyOperatorLessThanOrEqual RequestBodyOperator = "LessThanOrEqual" + // RequestBodyOperatorRegEx ... + RequestBodyOperatorRegEx RequestBodyOperator = "RegEx" +) + +// PossibleRequestBodyOperatorValues returns an array of possible values for the RequestBodyOperator const type. +func PossibleRequestBodyOperatorValues() []RequestBodyOperator { + return []RequestBodyOperator{RequestBodyOperatorAny, RequestBodyOperatorBeginsWith, RequestBodyOperatorContains, RequestBodyOperatorEndsWith, RequestBodyOperatorEqual, RequestBodyOperatorGreaterThan, RequestBodyOperatorGreaterThanOrEqual, RequestBodyOperatorLessThan, RequestBodyOperatorLessThanOrEqual, RequestBodyOperatorRegEx} +} + +// RequestHeaderOperator enumerates the values for request header operator. +type RequestHeaderOperator string + +const ( + // RequestHeaderOperatorAny ... + RequestHeaderOperatorAny RequestHeaderOperator = "Any" + // RequestHeaderOperatorBeginsWith ... + RequestHeaderOperatorBeginsWith RequestHeaderOperator = "BeginsWith" + // RequestHeaderOperatorContains ... + RequestHeaderOperatorContains RequestHeaderOperator = "Contains" + // RequestHeaderOperatorEndsWith ... + RequestHeaderOperatorEndsWith RequestHeaderOperator = "EndsWith" + // RequestHeaderOperatorEqual ... + RequestHeaderOperatorEqual RequestHeaderOperator = "Equal" + // RequestHeaderOperatorGreaterThan ... + RequestHeaderOperatorGreaterThan RequestHeaderOperator = "GreaterThan" + // RequestHeaderOperatorGreaterThanOrEqual ... + RequestHeaderOperatorGreaterThanOrEqual RequestHeaderOperator = "GreaterThanOrEqual" + // RequestHeaderOperatorLessThan ... + RequestHeaderOperatorLessThan RequestHeaderOperator = "LessThan" + // RequestHeaderOperatorLessThanOrEqual ... + RequestHeaderOperatorLessThanOrEqual RequestHeaderOperator = "LessThanOrEqual" + // RequestHeaderOperatorRegEx ... + RequestHeaderOperatorRegEx RequestHeaderOperator = "RegEx" +) + +// PossibleRequestHeaderOperatorValues returns an array of possible values for the RequestHeaderOperator const type. +func PossibleRequestHeaderOperatorValues() []RequestHeaderOperator { + return []RequestHeaderOperator{RequestHeaderOperatorAny, RequestHeaderOperatorBeginsWith, RequestHeaderOperatorContains, RequestHeaderOperatorEndsWith, RequestHeaderOperatorEqual, RequestHeaderOperatorGreaterThan, RequestHeaderOperatorGreaterThanOrEqual, RequestHeaderOperatorLessThan, RequestHeaderOperatorLessThanOrEqual, RequestHeaderOperatorRegEx} +} + +// RequestURIOperator enumerates the values for request uri operator. +type RequestURIOperator string + +const ( + // RequestURIOperatorAny ... + RequestURIOperatorAny RequestURIOperator = "Any" + // RequestURIOperatorBeginsWith ... + RequestURIOperatorBeginsWith RequestURIOperator = "BeginsWith" + // RequestURIOperatorContains ... + RequestURIOperatorContains RequestURIOperator = "Contains" + // RequestURIOperatorEndsWith ... + RequestURIOperatorEndsWith RequestURIOperator = "EndsWith" + // RequestURIOperatorEqual ... + RequestURIOperatorEqual RequestURIOperator = "Equal" + // RequestURIOperatorGreaterThan ... + RequestURIOperatorGreaterThan RequestURIOperator = "GreaterThan" + // RequestURIOperatorGreaterThanOrEqual ... + RequestURIOperatorGreaterThanOrEqual RequestURIOperator = "GreaterThanOrEqual" + // RequestURIOperatorLessThan ... + RequestURIOperatorLessThan RequestURIOperator = "LessThan" + // RequestURIOperatorLessThanOrEqual ... + RequestURIOperatorLessThanOrEqual RequestURIOperator = "LessThanOrEqual" + // RequestURIOperatorRegEx ... + RequestURIOperatorRegEx RequestURIOperator = "RegEx" +) + +// PossibleRequestURIOperatorValues returns an array of possible values for the RequestURIOperator const type. +func PossibleRequestURIOperatorValues() []RequestURIOperator { + return []RequestURIOperator{RequestURIOperatorAny, RequestURIOperatorBeginsWith, RequestURIOperatorContains, RequestURIOperatorEndsWith, RequestURIOperatorEqual, RequestURIOperatorGreaterThan, RequestURIOperatorGreaterThanOrEqual, RequestURIOperatorLessThan, RequestURIOperatorLessThanOrEqual, RequestURIOperatorRegEx} +} + +// ResourceType enumerates the values for resource type. +type ResourceType string + +const ( + // ResourceTypeMicrosoftCdnProfilesAfdEndpoints ... + ResourceTypeMicrosoftCdnProfilesAfdEndpoints ResourceType = "Microsoft.Cdn/Profiles/AfdEndpoints" + // ResourceTypeMicrosoftCdnProfilesEndpoints ... + ResourceTypeMicrosoftCdnProfilesEndpoints ResourceType = "Microsoft.Cdn/Profiles/Endpoints" +) + +// PossibleResourceTypeValues returns an array of possible values for the ResourceType const type. +func PossibleResourceTypeValues() []ResourceType { + return []ResourceType{ResourceTypeMicrosoftCdnProfilesAfdEndpoints, ResourceTypeMicrosoftCdnProfilesEndpoints} +} + +// ResponseBasedDetectedErrorTypes enumerates the values for response based detected error types. +type ResponseBasedDetectedErrorTypes string + +const ( + // ResponseBasedDetectedErrorTypesNone ... + ResponseBasedDetectedErrorTypesNone ResponseBasedDetectedErrorTypes = "None" + // ResponseBasedDetectedErrorTypesTCPAndHTTPErrors ... + ResponseBasedDetectedErrorTypesTCPAndHTTPErrors ResponseBasedDetectedErrorTypes = "TcpAndHttpErrors" + // ResponseBasedDetectedErrorTypesTCPErrorsOnly ... + ResponseBasedDetectedErrorTypesTCPErrorsOnly ResponseBasedDetectedErrorTypes = "TcpErrorsOnly" +) + +// PossibleResponseBasedDetectedErrorTypesValues returns an array of possible values for the ResponseBasedDetectedErrorTypes const type. +func PossibleResponseBasedDetectedErrorTypesValues() []ResponseBasedDetectedErrorTypes { + return []ResponseBasedDetectedErrorTypes{ResponseBasedDetectedErrorTypesNone, ResponseBasedDetectedErrorTypesTCPAndHTTPErrors, ResponseBasedDetectedErrorTypesTCPErrorsOnly} +} + +// RuleCacheBehavior enumerates the values for rule cache behavior. +type RuleCacheBehavior string + +const ( + // RuleCacheBehaviorHonorOrigin ... + RuleCacheBehaviorHonorOrigin RuleCacheBehavior = "HonorOrigin" + // RuleCacheBehaviorOverrideAlways ... + RuleCacheBehaviorOverrideAlways RuleCacheBehavior = "OverrideAlways" + // RuleCacheBehaviorOverrideIfOriginMissing ... + RuleCacheBehaviorOverrideIfOriginMissing RuleCacheBehavior = "OverrideIfOriginMissing" +) + +// PossibleRuleCacheBehaviorValues returns an array of possible values for the RuleCacheBehavior const type. +func PossibleRuleCacheBehaviorValues() []RuleCacheBehavior { + return []RuleCacheBehavior{RuleCacheBehaviorHonorOrigin, RuleCacheBehaviorOverrideAlways, RuleCacheBehaviorOverrideIfOriginMissing} +} + +// RuleIsCompressionEnabled enumerates the values for rule is compression enabled. +type RuleIsCompressionEnabled string + +const ( + // RuleIsCompressionEnabledDisabled ... + RuleIsCompressionEnabledDisabled RuleIsCompressionEnabled = "Disabled" + // RuleIsCompressionEnabledEnabled ... + RuleIsCompressionEnabledEnabled RuleIsCompressionEnabled = "Enabled" +) + +// PossibleRuleIsCompressionEnabledValues returns an array of possible values for the RuleIsCompressionEnabled const type. +func PossibleRuleIsCompressionEnabledValues() []RuleIsCompressionEnabled { + return []RuleIsCompressionEnabled{RuleIsCompressionEnabledDisabled, RuleIsCompressionEnabledEnabled} +} + +// RuleQueryStringCachingBehavior enumerates the values for rule query string caching behavior. +type RuleQueryStringCachingBehavior string + +const ( + // RuleQueryStringCachingBehaviorIgnoreQueryString ... + RuleQueryStringCachingBehaviorIgnoreQueryString RuleQueryStringCachingBehavior = "IgnoreQueryString" + // RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings ... + RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings RuleQueryStringCachingBehavior = "IgnoreSpecifiedQueryStrings" + // RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings ... + RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings RuleQueryStringCachingBehavior = "IncludeSpecifiedQueryStrings" + // RuleQueryStringCachingBehaviorUseQueryString ... + RuleQueryStringCachingBehaviorUseQueryString RuleQueryStringCachingBehavior = "UseQueryString" +) + +// PossibleRuleQueryStringCachingBehaviorValues returns an array of possible values for the RuleQueryStringCachingBehavior const type. +func PossibleRuleQueryStringCachingBehaviorValues() []RuleQueryStringCachingBehavior { + return []RuleQueryStringCachingBehavior{RuleQueryStringCachingBehaviorIgnoreQueryString, RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings, RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings, RuleQueryStringCachingBehaviorUseQueryString} +} + +// SecretType enumerates the values for secret type. +type SecretType string + +const ( + // SecretTypeAzureFirstPartyManagedCertificate ... + SecretTypeAzureFirstPartyManagedCertificate SecretType = "AzureFirstPartyManagedCertificate" + // SecretTypeCustomerCertificate ... + SecretTypeCustomerCertificate SecretType = "CustomerCertificate" + // SecretTypeManagedCertificate ... + SecretTypeManagedCertificate SecretType = "ManagedCertificate" + // SecretTypeURLSigningKey ... + SecretTypeURLSigningKey SecretType = "UrlSigningKey" +) + +// PossibleSecretTypeValues returns an array of possible values for the SecretType const type. +func PossibleSecretTypeValues() []SecretType { + return []SecretType{SecretTypeAzureFirstPartyManagedCertificate, SecretTypeCustomerCertificate, SecretTypeManagedCertificate, SecretTypeURLSigningKey} +} + +// ServerPortOperator enumerates the values for server port operator. +type ServerPortOperator string + +const ( + // ServerPortOperatorAny ... + ServerPortOperatorAny ServerPortOperator = "Any" + // ServerPortOperatorBeginsWith ... + ServerPortOperatorBeginsWith ServerPortOperator = "BeginsWith" + // ServerPortOperatorContains ... + ServerPortOperatorContains ServerPortOperator = "Contains" + // ServerPortOperatorEndsWith ... + ServerPortOperatorEndsWith ServerPortOperator = "EndsWith" + // ServerPortOperatorEqual ... + ServerPortOperatorEqual ServerPortOperator = "Equal" + // ServerPortOperatorGreaterThan ... + ServerPortOperatorGreaterThan ServerPortOperator = "GreaterThan" + // ServerPortOperatorGreaterThanOrEqual ... + ServerPortOperatorGreaterThanOrEqual ServerPortOperator = "GreaterThanOrEqual" + // ServerPortOperatorLessThan ... + ServerPortOperatorLessThan ServerPortOperator = "LessThan" + // ServerPortOperatorLessThanOrEqual ... + ServerPortOperatorLessThanOrEqual ServerPortOperator = "LessThanOrEqual" + // ServerPortOperatorRegEx ... + ServerPortOperatorRegEx ServerPortOperator = "RegEx" +) + +// PossibleServerPortOperatorValues returns an array of possible values for the ServerPortOperator const type. +func PossibleServerPortOperatorValues() []ServerPortOperator { + return []ServerPortOperator{ServerPortOperatorAny, ServerPortOperatorBeginsWith, ServerPortOperatorContains, ServerPortOperatorEndsWith, ServerPortOperatorEqual, ServerPortOperatorGreaterThan, ServerPortOperatorGreaterThanOrEqual, ServerPortOperatorLessThan, ServerPortOperatorLessThanOrEqual, ServerPortOperatorRegEx} +} + +// SharedPrivateLinkResourceStatus enumerates the values for shared private link resource status. +type SharedPrivateLinkResourceStatus string + +const ( + // SharedPrivateLinkResourceStatusApproved ... + SharedPrivateLinkResourceStatusApproved SharedPrivateLinkResourceStatus = "Approved" + // SharedPrivateLinkResourceStatusDisconnected ... + SharedPrivateLinkResourceStatusDisconnected SharedPrivateLinkResourceStatus = "Disconnected" + // SharedPrivateLinkResourceStatusPending ... + SharedPrivateLinkResourceStatusPending SharedPrivateLinkResourceStatus = "Pending" + // SharedPrivateLinkResourceStatusRejected ... + SharedPrivateLinkResourceStatusRejected SharedPrivateLinkResourceStatus = "Rejected" + // SharedPrivateLinkResourceStatusTimeout ... + SharedPrivateLinkResourceStatusTimeout SharedPrivateLinkResourceStatus = "Timeout" +) + +// PossibleSharedPrivateLinkResourceStatusValues returns an array of possible values for the SharedPrivateLinkResourceStatus const type. +func PossibleSharedPrivateLinkResourceStatusValues() []SharedPrivateLinkResourceStatus { + return []SharedPrivateLinkResourceStatus{SharedPrivateLinkResourceStatusApproved, SharedPrivateLinkResourceStatusDisconnected, SharedPrivateLinkResourceStatusPending, SharedPrivateLinkResourceStatusRejected, SharedPrivateLinkResourceStatusTimeout} +} + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // SkuNameCustomVerizon ... + SkuNameCustomVerizon SkuName = "Custom_Verizon" + // SkuNamePremiumAzureFrontDoor ... + SkuNamePremiumAzureFrontDoor SkuName = "Premium_AzureFrontDoor" + // SkuNamePremiumVerizon ... + SkuNamePremiumVerizon SkuName = "Premium_Verizon" + // SkuNameStandard955BandWidthChinaCdn ... + SkuNameStandard955BandWidthChinaCdn SkuName = "Standard_955BandWidth_ChinaCdn" + // SkuNameStandardAkamai ... + SkuNameStandardAkamai SkuName = "Standard_Akamai" + // SkuNameStandardAvgBandWidthChinaCdn ... + SkuNameStandardAvgBandWidthChinaCdn SkuName = "Standard_AvgBandWidth_ChinaCdn" + // SkuNameStandardAzureFrontDoor ... + SkuNameStandardAzureFrontDoor SkuName = "Standard_AzureFrontDoor" + // SkuNameStandardChinaCdn ... + SkuNameStandardChinaCdn SkuName = "Standard_ChinaCdn" + // SkuNameStandardMicrosoft ... + SkuNameStandardMicrosoft SkuName = "Standard_Microsoft" + // SkuNameStandardPlus955BandWidthChinaCdn ... + SkuNameStandardPlus955BandWidthChinaCdn SkuName = "StandardPlus_955BandWidth_ChinaCdn" + // SkuNameStandardPlusAvgBandWidthChinaCdn ... + SkuNameStandardPlusAvgBandWidthChinaCdn SkuName = "StandardPlus_AvgBandWidth_ChinaCdn" + // SkuNameStandardPlusChinaCdn ... + SkuNameStandardPlusChinaCdn SkuName = "StandardPlus_ChinaCdn" + // SkuNameStandardVerizon ... + SkuNameStandardVerizon SkuName = "Standard_Verizon" +) + +// PossibleSkuNameValues returns an array of possible values for the SkuName const type. +func PossibleSkuNameValues() []SkuName { + return []SkuName{SkuNameCustomVerizon, SkuNamePremiumAzureFrontDoor, SkuNamePremiumVerizon, SkuNameStandard955BandWidthChinaCdn, SkuNameStandardAkamai, SkuNameStandardAvgBandWidthChinaCdn, SkuNameStandardAzureFrontDoor, SkuNameStandardChinaCdn, SkuNameStandardMicrosoft, SkuNameStandardPlus955BandWidthChinaCdn, SkuNameStandardPlusAvgBandWidthChinaCdn, SkuNameStandardPlusChinaCdn, SkuNameStandardVerizon} +} + +// SocketAddrOperator enumerates the values for socket addr operator. +type SocketAddrOperator string + +const ( + // SocketAddrOperatorAny ... + SocketAddrOperatorAny SocketAddrOperator = "Any" + // SocketAddrOperatorIPMatch ... + SocketAddrOperatorIPMatch SocketAddrOperator = "IPMatch" +) + +// PossibleSocketAddrOperatorValues returns an array of possible values for the SocketAddrOperator const type. +func PossibleSocketAddrOperatorValues() []SocketAddrOperator { + return []SocketAddrOperator{SocketAddrOperatorAny, SocketAddrOperatorIPMatch} +} + +// SslProtocol enumerates the values for ssl protocol. +type SslProtocol string + +const ( + // SslProtocolTLSv1 ... + SslProtocolTLSv1 SslProtocol = "TLSv1" + // SslProtocolTLSv11 ... + SslProtocolTLSv11 SslProtocol = "TLSv1.1" + // SslProtocolTLSv12 ... + SslProtocolTLSv12 SslProtocol = "TLSv1.2" +) + +// PossibleSslProtocolValues returns an array of possible values for the SslProtocol const type. +func PossibleSslProtocolValues() []SslProtocol { + return []SslProtocol{SslProtocolTLSv1, SslProtocolTLSv11, SslProtocolTLSv12} +} + +// Status enumerates the values for status. +type Status string + +const ( + // StatusAccessDenied ... + StatusAccessDenied Status = "AccessDenied" + // StatusCertificateExpired ... + StatusCertificateExpired Status = "CertificateExpired" + // StatusInvalid ... + StatusInvalid Status = "Invalid" + // StatusValid ... + StatusValid Status = "Valid" +) + +// PossibleStatusValues returns an array of possible values for the Status const type. +func PossibleStatusValues() []Status { + return []Status{StatusAccessDenied, StatusCertificateExpired, StatusInvalid, StatusValid} +} + +// Transform enumerates the values for transform. +type Transform string + +const ( + // TransformLowercase ... + TransformLowercase Transform = "Lowercase" + // TransformRemoveNulls ... + TransformRemoveNulls Transform = "RemoveNulls" + // TransformTrim ... + TransformTrim Transform = "Trim" + // TransformUppercase ... + TransformUppercase Transform = "Uppercase" + // TransformURLDecode ... + TransformURLDecode Transform = "UrlDecode" + // TransformURLEncode ... + TransformURLEncode Transform = "UrlEncode" +) + +// PossibleTransformValues returns an array of possible values for the Transform const type. +func PossibleTransformValues() []Transform { + return []Transform{TransformLowercase, TransformRemoveNulls, TransformTrim, TransformUppercase, TransformURLDecode, TransformURLEncode} +} + +// TransformType enumerates the values for transform type. +type TransformType string + +const ( + // TransformTypeLowercase ... + TransformTypeLowercase TransformType = "Lowercase" + // TransformTypeRemoveNulls ... + TransformTypeRemoveNulls TransformType = "RemoveNulls" + // TransformTypeTrim ... + TransformTypeTrim TransformType = "Trim" + // TransformTypeUppercase ... + TransformTypeUppercase TransformType = "Uppercase" + // TransformTypeURLDecode ... + TransformTypeURLDecode TransformType = "UrlDecode" + // TransformTypeURLEncode ... + TransformTypeURLEncode TransformType = "UrlEncode" +) + +// PossibleTransformTypeValues returns an array of possible values for the TransformType const type. +func PossibleTransformTypeValues() []TransformType { + return []TransformType{TransformTypeLowercase, TransformTypeRemoveNulls, TransformTypeTrim, TransformTypeUppercase, TransformTypeURLDecode, TransformTypeURLEncode} +} + +// Type enumerates the values for type. +type Type string + +const ( + // TypeSecurityPolicyPropertiesParameters ... + TypeSecurityPolicyPropertiesParameters Type = "SecurityPolicyPropertiesParameters" + // TypeWebApplicationFirewall ... + TypeWebApplicationFirewall Type = "WebApplicationFirewall" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{TypeSecurityPolicyPropertiesParameters, TypeWebApplicationFirewall} +} + +// TypeBasicSecretParameters enumerates the values for type basic secret parameters. +type TypeBasicSecretParameters string + +const ( + // TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate ... + TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate TypeBasicSecretParameters = "AzureFirstPartyManagedCertificate" + // TypeBasicSecretParametersTypeCustomerCertificate ... + TypeBasicSecretParametersTypeCustomerCertificate TypeBasicSecretParameters = "CustomerCertificate" + // TypeBasicSecretParametersTypeManagedCertificate ... + TypeBasicSecretParametersTypeManagedCertificate TypeBasicSecretParameters = "ManagedCertificate" + // TypeBasicSecretParametersTypeSecretParameters ... + TypeBasicSecretParametersTypeSecretParameters TypeBasicSecretParameters = "SecretParameters" + // TypeBasicSecretParametersTypeURLSigningKey ... + TypeBasicSecretParametersTypeURLSigningKey TypeBasicSecretParameters = "UrlSigningKey" +) + +// PossibleTypeBasicSecretParametersValues returns an array of possible values for the TypeBasicSecretParameters const type. +func PossibleTypeBasicSecretParametersValues() []TypeBasicSecretParameters { + return []TypeBasicSecretParameters{TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate, TypeBasicSecretParametersTypeCustomerCertificate, TypeBasicSecretParametersTypeManagedCertificate, TypeBasicSecretParametersTypeSecretParameters, TypeBasicSecretParametersTypeURLSigningKey} +} + +// Unit enumerates the values for unit. +type Unit string + +const ( + // UnitBitsPerSecond ... + UnitBitsPerSecond Unit = "bitsPerSecond" + // UnitBytes ... + UnitBytes Unit = "bytes" + // UnitCount ... + UnitCount Unit = "count" + // UnitMilliSeconds ... + UnitMilliSeconds Unit = "milliSeconds" +) + +// PossibleUnitValues returns an array of possible values for the Unit const type. +func PossibleUnitValues() []Unit { + return []Unit{UnitBitsPerSecond, UnitBytes, UnitCount, UnitMilliSeconds} +} + +// Unit1 enumerates the values for unit 1. +type Unit1 string + +const ( + // Unit1Count ... + Unit1Count Unit1 = "count" +) + +// PossibleUnit1Values returns an array of possible values for the Unit1 const type. +func PossibleUnit1Values() []Unit1 { + return []Unit1{Unit1Count} +} + +// URLFileExtensionOperator enumerates the values for url file extension operator. +type URLFileExtensionOperator string + +const ( + // URLFileExtensionOperatorAny ... + URLFileExtensionOperatorAny URLFileExtensionOperator = "Any" + // URLFileExtensionOperatorBeginsWith ... + URLFileExtensionOperatorBeginsWith URLFileExtensionOperator = "BeginsWith" + // URLFileExtensionOperatorContains ... + URLFileExtensionOperatorContains URLFileExtensionOperator = "Contains" + // URLFileExtensionOperatorEndsWith ... + URLFileExtensionOperatorEndsWith URLFileExtensionOperator = "EndsWith" + // URLFileExtensionOperatorEqual ... + URLFileExtensionOperatorEqual URLFileExtensionOperator = "Equal" + // URLFileExtensionOperatorGreaterThan ... + URLFileExtensionOperatorGreaterThan URLFileExtensionOperator = "GreaterThan" + // URLFileExtensionOperatorGreaterThanOrEqual ... + URLFileExtensionOperatorGreaterThanOrEqual URLFileExtensionOperator = "GreaterThanOrEqual" + // URLFileExtensionOperatorLessThan ... + URLFileExtensionOperatorLessThan URLFileExtensionOperator = "LessThan" + // URLFileExtensionOperatorLessThanOrEqual ... + URLFileExtensionOperatorLessThanOrEqual URLFileExtensionOperator = "LessThanOrEqual" + // URLFileExtensionOperatorRegEx ... + URLFileExtensionOperatorRegEx URLFileExtensionOperator = "RegEx" +) + +// PossibleURLFileExtensionOperatorValues returns an array of possible values for the URLFileExtensionOperator const type. +func PossibleURLFileExtensionOperatorValues() []URLFileExtensionOperator { + return []URLFileExtensionOperator{URLFileExtensionOperatorAny, URLFileExtensionOperatorBeginsWith, URLFileExtensionOperatorContains, URLFileExtensionOperatorEndsWith, URLFileExtensionOperatorEqual, URLFileExtensionOperatorGreaterThan, URLFileExtensionOperatorGreaterThanOrEqual, URLFileExtensionOperatorLessThan, URLFileExtensionOperatorLessThanOrEqual, URLFileExtensionOperatorRegEx} +} + +// URLFileNameOperator enumerates the values for url file name operator. +type URLFileNameOperator string + +const ( + // URLFileNameOperatorAny ... + URLFileNameOperatorAny URLFileNameOperator = "Any" + // URLFileNameOperatorBeginsWith ... + URLFileNameOperatorBeginsWith URLFileNameOperator = "BeginsWith" + // URLFileNameOperatorContains ... + URLFileNameOperatorContains URLFileNameOperator = "Contains" + // URLFileNameOperatorEndsWith ... + URLFileNameOperatorEndsWith URLFileNameOperator = "EndsWith" + // URLFileNameOperatorEqual ... + URLFileNameOperatorEqual URLFileNameOperator = "Equal" + // URLFileNameOperatorGreaterThan ... + URLFileNameOperatorGreaterThan URLFileNameOperator = "GreaterThan" + // URLFileNameOperatorGreaterThanOrEqual ... + URLFileNameOperatorGreaterThanOrEqual URLFileNameOperator = "GreaterThanOrEqual" + // URLFileNameOperatorLessThan ... + URLFileNameOperatorLessThan URLFileNameOperator = "LessThan" + // URLFileNameOperatorLessThanOrEqual ... + URLFileNameOperatorLessThanOrEqual URLFileNameOperator = "LessThanOrEqual" + // URLFileNameOperatorRegEx ... + URLFileNameOperatorRegEx URLFileNameOperator = "RegEx" +) + +// PossibleURLFileNameOperatorValues returns an array of possible values for the URLFileNameOperator const type. +func PossibleURLFileNameOperatorValues() []URLFileNameOperator { + return []URLFileNameOperator{URLFileNameOperatorAny, URLFileNameOperatorBeginsWith, URLFileNameOperatorContains, URLFileNameOperatorEndsWith, URLFileNameOperatorEqual, URLFileNameOperatorGreaterThan, URLFileNameOperatorGreaterThanOrEqual, URLFileNameOperatorLessThan, URLFileNameOperatorLessThanOrEqual, URLFileNameOperatorRegEx} +} + +// URLPathOperator enumerates the values for url path operator. +type URLPathOperator string + +const ( + // URLPathOperatorAny ... + URLPathOperatorAny URLPathOperator = "Any" + // URLPathOperatorBeginsWith ... + URLPathOperatorBeginsWith URLPathOperator = "BeginsWith" + // URLPathOperatorContains ... + URLPathOperatorContains URLPathOperator = "Contains" + // URLPathOperatorEndsWith ... + URLPathOperatorEndsWith URLPathOperator = "EndsWith" + // URLPathOperatorEqual ... + URLPathOperatorEqual URLPathOperator = "Equal" + // URLPathOperatorGreaterThan ... + URLPathOperatorGreaterThan URLPathOperator = "GreaterThan" + // URLPathOperatorGreaterThanOrEqual ... + URLPathOperatorGreaterThanOrEqual URLPathOperator = "GreaterThanOrEqual" + // URLPathOperatorLessThan ... + URLPathOperatorLessThan URLPathOperator = "LessThan" + // URLPathOperatorLessThanOrEqual ... + URLPathOperatorLessThanOrEqual URLPathOperator = "LessThanOrEqual" + // URLPathOperatorRegEx ... + URLPathOperatorRegEx URLPathOperator = "RegEx" + // URLPathOperatorWildcard ... + URLPathOperatorWildcard URLPathOperator = "Wildcard" +) + +// PossibleURLPathOperatorValues returns an array of possible values for the URLPathOperator const type. +func PossibleURLPathOperatorValues() []URLPathOperator { + return []URLPathOperator{URLPathOperatorAny, URLPathOperatorBeginsWith, URLPathOperatorContains, URLPathOperatorEndsWith, URLPathOperatorEqual, URLPathOperatorGreaterThan, URLPathOperatorGreaterThanOrEqual, URLPathOperatorLessThan, URLPathOperatorLessThanOrEqual, URLPathOperatorRegEx, URLPathOperatorWildcard} +} + +// WafAction enumerates the values for waf action. +type WafAction string + +const ( + // WafActionAllow ... + WafActionAllow WafAction = "allow" + // WafActionBlock ... + WafActionBlock WafAction = "block" + // WafActionLog ... + WafActionLog WafAction = "log" + // WafActionRedirect ... + WafActionRedirect WafAction = "redirect" +) + +// PossibleWafActionValues returns an array of possible values for the WafAction const type. +func PossibleWafActionValues() []WafAction { + return []WafAction{WafActionAllow, WafActionBlock, WafActionLog, WafActionRedirect} +} + +// WafGranularity enumerates the values for waf granularity. +type WafGranularity string + +const ( + // WafGranularityP1D ... + WafGranularityP1D WafGranularity = "P1D" + // WafGranularityPT1H ... + WafGranularityPT1H WafGranularity = "PT1H" + // WafGranularityPT5M ... + WafGranularityPT5M WafGranularity = "PT5M" +) + +// PossibleWafGranularityValues returns an array of possible values for the WafGranularity const type. +func PossibleWafGranularityValues() []WafGranularity { + return []WafGranularity{WafGranularityP1D, WafGranularityPT1H, WafGranularityPT5M} +} + +// WafMatchVariable enumerates the values for waf match variable. +type WafMatchVariable string + +const ( + // WafMatchVariableCookies ... + WafMatchVariableCookies WafMatchVariable = "Cookies" + // WafMatchVariablePostArgs ... + WafMatchVariablePostArgs WafMatchVariable = "PostArgs" + // WafMatchVariableQueryString ... + WafMatchVariableQueryString WafMatchVariable = "QueryString" + // WafMatchVariableRemoteAddr ... + WafMatchVariableRemoteAddr WafMatchVariable = "RemoteAddr" + // WafMatchVariableRequestBody ... + WafMatchVariableRequestBody WafMatchVariable = "RequestBody" + // WafMatchVariableRequestHeader ... + WafMatchVariableRequestHeader WafMatchVariable = "RequestHeader" + // WafMatchVariableRequestMethod ... + WafMatchVariableRequestMethod WafMatchVariable = "RequestMethod" + // WafMatchVariableRequestURI ... + WafMatchVariableRequestURI WafMatchVariable = "RequestUri" + // WafMatchVariableSocketAddr ... + WafMatchVariableSocketAddr WafMatchVariable = "SocketAddr" +) + +// PossibleWafMatchVariableValues returns an array of possible values for the WafMatchVariable const type. +func PossibleWafMatchVariableValues() []WafMatchVariable { + return []WafMatchVariable{WafMatchVariableCookies, WafMatchVariablePostArgs, WafMatchVariableQueryString, WafMatchVariableRemoteAddr, WafMatchVariableRequestBody, WafMatchVariableRequestHeader, WafMatchVariableRequestMethod, WafMatchVariableRequestURI, WafMatchVariableSocketAddr} +} + +// WafMetric enumerates the values for waf metric. +type WafMetric string + +const ( + // WafMetricClientRequestCount ... + WafMetricClientRequestCount WafMetric = "clientRequestCount" +) + +// PossibleWafMetricValues returns an array of possible values for the WafMetric const type. +func PossibleWafMetricValues() []WafMetric { + return []WafMetric{WafMetricClientRequestCount} +} + +// WafRankingGroupBy enumerates the values for waf ranking group by. +type WafRankingGroupBy string + +const ( + // WafRankingGroupByCustomDomain ... + WafRankingGroupByCustomDomain WafRankingGroupBy = "customDomain" + // WafRankingGroupByHTTPStatusCode ... + WafRankingGroupByHTTPStatusCode WafRankingGroupBy = "httpStatusCode" +) + +// PossibleWafRankingGroupByValues returns an array of possible values for the WafRankingGroupBy const type. +func PossibleWafRankingGroupByValues() []WafRankingGroupBy { + return []WafRankingGroupBy{WafRankingGroupByCustomDomain, WafRankingGroupByHTTPStatusCode} +} + +// WafRankingType enumerates the values for waf ranking type. +type WafRankingType string + +const ( + // WafRankingTypeAction ... + WafRankingTypeAction WafRankingType = "action" + // WafRankingTypeClientIP ... + WafRankingTypeClientIP WafRankingType = "clientIp" + // WafRankingTypeCountryOrRegion ... + WafRankingTypeCountryOrRegion WafRankingType = "countryOrRegion" + // WafRankingTypeRuleGroup ... + WafRankingTypeRuleGroup WafRankingType = "ruleGroup" + // WafRankingTypeRuleID ... + WafRankingTypeRuleID WafRankingType = "ruleId" + // WafRankingTypeRuleType ... + WafRankingTypeRuleType WafRankingType = "ruleType" + // WafRankingTypeURL ... + WafRankingTypeURL WafRankingType = "url" + // WafRankingTypeUserAgent ... + WafRankingTypeUserAgent WafRankingType = "userAgent" +) + +// PossibleWafRankingTypeValues returns an array of possible values for the WafRankingType const type. +func PossibleWafRankingTypeValues() []WafRankingType { + return []WafRankingType{WafRankingTypeAction, WafRankingTypeClientIP, WafRankingTypeCountryOrRegion, WafRankingTypeRuleGroup, WafRankingTypeRuleID, WafRankingTypeRuleType, WafRankingTypeURL, WafRankingTypeUserAgent} +} + +// WafRuleType enumerates the values for waf rule type. +type WafRuleType string + +const ( + // WafRuleTypeBot ... + WafRuleTypeBot WafRuleType = "bot" + // WafRuleTypeCustom ... + WafRuleTypeCustom WafRuleType = "custom" + // WafRuleTypeManaged ... + WafRuleTypeManaged WafRuleType = "managed" +) + +// PossibleWafRuleTypeValues returns an array of possible values for the WafRuleType const type. +func PossibleWafRuleTypeValues() []WafRuleType { + return []WafRuleType{WafRuleTypeBot, WafRuleTypeCustom, WafRuleTypeManaged} +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/loganalytics.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/loganalytics.go new file mode 100644 index 000000000000..ab87d86ccc1f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/loganalytics.go @@ -0,0 +1,608 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LogAnalyticsClient is the cdn Management Client +type LogAnalyticsClient struct { + BaseClient +} + +// NewLogAnalyticsClient creates an instance of the LogAnalyticsClient client. +func NewLogAnalyticsClient(subscriptionID string) LogAnalyticsClient { + return NewLogAnalyticsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLogAnalyticsClientWithBaseURI creates an instance of the LogAnalyticsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewLogAnalyticsClientWithBaseURI(baseURI string, subscriptionID string) LogAnalyticsClient { + return LogAnalyticsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetLogAnalyticsLocations get all available location names for AFD log analytics report. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. which is unique within the resource group. +func (client LogAnalyticsClient) GetLogAnalyticsLocations(ctx context.Context, resourceGroupName string, profileName string) (result ContinentsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.GetLogAnalyticsLocations") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.LogAnalyticsClient", "GetLogAnalyticsLocations", err.Error()) + } + + req, err := client.GetLogAnalyticsLocationsPreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsLocations", nil, "Failure preparing request") + return + } + + resp, err := client.GetLogAnalyticsLocationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsLocations", resp, "Failure sending request") + return + } + + result, err = client.GetLogAnalyticsLocationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsLocations", resp, "Failure responding to request") + return + } + + return +} + +// GetLogAnalyticsLocationsPreparer prepares the GetLogAnalyticsLocations request. +func (client LogAnalyticsClient) GetLogAnalyticsLocationsPreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsLocations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLogAnalyticsLocationsSender sends the GetLogAnalyticsLocations request. The method will close the +// http.Response Body if it receives an error. +func (client LogAnalyticsClient) GetLogAnalyticsLocationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetLogAnalyticsLocationsResponder handles the response to the GetLogAnalyticsLocations request. The method always +// closes the http.Response Body. +func (client LogAnalyticsClient) GetLogAnalyticsLocationsResponder(resp *http.Response) (result ContinentsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLogAnalyticsMetrics get log report for AFD profile +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. which is unique within the resource group. +// granularity - +func (client LogAnalyticsClient) GetLogAnalyticsMetrics(ctx context.Context, resourceGroupName string, profileName string, metrics []LogMetric, dateTimeBegin date.Time, dateTimeEnd date.Time, granularity LogMetricsGranularity, customDomains []string, protocols []string, groupBy []LogMetricsGroupBy, continents []string, countryOrRegions []string) (result MetricsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.GetLogAnalyticsMetrics") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: metrics, + Constraints: []validation.Constraint{{Target: "metrics", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: customDomains, + Constraints: []validation.Constraint{{Target: "customDomains", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: protocols, + Constraints: []validation.Constraint{{Target: "protocols", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.LogAnalyticsClient", "GetLogAnalyticsMetrics", err.Error()) + } + + req, err := client.GetLogAnalyticsMetricsPreparer(ctx, resourceGroupName, profileName, metrics, dateTimeBegin, dateTimeEnd, granularity, customDomains, protocols, groupBy, continents, countryOrRegions) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.GetLogAnalyticsMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsMetrics", resp, "Failure sending request") + return + } + + result, err = client.GetLogAnalyticsMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsMetrics", resp, "Failure responding to request") + return + } + + return +} + +// GetLogAnalyticsMetricsPreparer prepares the GetLogAnalyticsMetrics request. +func (client LogAnalyticsClient) GetLogAnalyticsMetricsPreparer(ctx context.Context, resourceGroupName string, profileName string, metrics []LogMetric, dateTimeBegin date.Time, dateTimeEnd date.Time, granularity LogMetricsGranularity, customDomains []string, protocols []string, groupBy []LogMetricsGroupBy, continents []string, countryOrRegions []string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "customDomains": customDomains, + "dateTimeBegin": autorest.Encode("query", dateTimeBegin), + "dateTimeEnd": autorest.Encode("query", dateTimeEnd), + "granularity": autorest.Encode("query", granularity), + "metrics": metrics, + "protocols": protocols, + } + if groupBy != nil && len(groupBy) > 0 { + queryParameters["groupBy"] = groupBy + } + if continents != nil && len(continents) > 0 { + queryParameters["continents"] = continents + } + if countryOrRegions != nil && len(countryOrRegions) > 0 { + queryParameters["countryOrRegions"] = countryOrRegions + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsMetrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLogAnalyticsMetricsSender sends the GetLogAnalyticsMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client LogAnalyticsClient) GetLogAnalyticsMetricsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetLogAnalyticsMetricsResponder handles the response to the GetLogAnalyticsMetrics request. The method always +// closes the http.Response Body. +func (client LogAnalyticsClient) GetLogAnalyticsMetricsResponder(resp *http.Response) (result MetricsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLogAnalyticsRankings get log analytics ranking report for AFD profile +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. which is unique within the resource group. +func (client LogAnalyticsClient) GetLogAnalyticsRankings(ctx context.Context, resourceGroupName string, profileName string, rankings []LogRanking, metrics []LogRankingMetric, maxRanking int32, dateTimeBegin date.Time, dateTimeEnd date.Time, customDomains []string) (result RankingsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.GetLogAnalyticsRankings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: rankings, + Constraints: []validation.Constraint{{Target: "rankings", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: metrics, + Constraints: []validation.Constraint{{Target: "metrics", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.LogAnalyticsClient", "GetLogAnalyticsRankings", err.Error()) + } + + req, err := client.GetLogAnalyticsRankingsPreparer(ctx, resourceGroupName, profileName, rankings, metrics, maxRanking, dateTimeBegin, dateTimeEnd, customDomains) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsRankings", nil, "Failure preparing request") + return + } + + resp, err := client.GetLogAnalyticsRankingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsRankings", resp, "Failure sending request") + return + } + + result, err = client.GetLogAnalyticsRankingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsRankings", resp, "Failure responding to request") + return + } + + return +} + +// GetLogAnalyticsRankingsPreparer prepares the GetLogAnalyticsRankings request. +func (client LogAnalyticsClient) GetLogAnalyticsRankingsPreparer(ctx context.Context, resourceGroupName string, profileName string, rankings []LogRanking, metrics []LogRankingMetric, maxRanking int32, dateTimeBegin date.Time, dateTimeEnd date.Time, customDomains []string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "dateTimeBegin": autorest.Encode("query", dateTimeBegin), + "dateTimeEnd": autorest.Encode("query", dateTimeEnd), + "maxRanking": autorest.Encode("query", maxRanking), + "metrics": metrics, + "rankings": rankings, + } + if customDomains != nil && len(customDomains) > 0 { + queryParameters["customDomains"] = customDomains + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsRankings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLogAnalyticsRankingsSender sends the GetLogAnalyticsRankings request. The method will close the +// http.Response Body if it receives an error. +func (client LogAnalyticsClient) GetLogAnalyticsRankingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetLogAnalyticsRankingsResponder handles the response to the GetLogAnalyticsRankings request. The method always +// closes the http.Response Body. +func (client LogAnalyticsClient) GetLogAnalyticsRankingsResponder(resp *http.Response) (result RankingsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLogAnalyticsResources get all endpoints and custom domains available for AFD log report +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. which is unique within the resource group. +func (client LogAnalyticsClient) GetLogAnalyticsResources(ctx context.Context, resourceGroupName string, profileName string) (result ResourcesResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.GetLogAnalyticsResources") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.LogAnalyticsClient", "GetLogAnalyticsResources", err.Error()) + } + + req, err := client.GetLogAnalyticsResourcesPreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsResources", nil, "Failure preparing request") + return + } + + resp, err := client.GetLogAnalyticsResourcesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsResources", resp, "Failure sending request") + return + } + + result, err = client.GetLogAnalyticsResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetLogAnalyticsResources", resp, "Failure responding to request") + return + } + + return +} + +// GetLogAnalyticsResourcesPreparer prepares the GetLogAnalyticsResources request. +func (client LogAnalyticsClient) GetLogAnalyticsResourcesPreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLogAnalyticsResourcesSender sends the GetLogAnalyticsResources request. The method will close the +// http.Response Body if it receives an error. +func (client LogAnalyticsClient) GetLogAnalyticsResourcesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetLogAnalyticsResourcesResponder handles the response to the GetLogAnalyticsResources request. The method always +// closes the http.Response Body. +func (client LogAnalyticsClient) GetLogAnalyticsResourcesResponder(resp *http.Response) (result ResourcesResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetWafLogAnalyticsMetrics get Waf related log analytics report for AFD profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. which is unique within the resource group. +// granularity - +func (client LogAnalyticsClient) GetWafLogAnalyticsMetrics(ctx context.Context, resourceGroupName string, profileName string, metrics []WafMetric, dateTimeBegin date.Time, dateTimeEnd date.Time, granularity WafGranularity, actions []WafAction, groupBy []WafRankingGroupBy, ruleTypes []WafRuleType) (result WafMetricsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.GetWafLogAnalyticsMetrics") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: metrics, + Constraints: []validation.Constraint{{Target: "metrics", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.LogAnalyticsClient", "GetWafLogAnalyticsMetrics", err.Error()) + } + + req, err := client.GetWafLogAnalyticsMetricsPreparer(ctx, resourceGroupName, profileName, metrics, dateTimeBegin, dateTimeEnd, granularity, actions, groupBy, ruleTypes) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetWafLogAnalyticsMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.GetWafLogAnalyticsMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetWafLogAnalyticsMetrics", resp, "Failure sending request") + return + } + + result, err = client.GetWafLogAnalyticsMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetWafLogAnalyticsMetrics", resp, "Failure responding to request") + return + } + + return +} + +// GetWafLogAnalyticsMetricsPreparer prepares the GetWafLogAnalyticsMetrics request. +func (client LogAnalyticsClient) GetWafLogAnalyticsMetricsPreparer(ctx context.Context, resourceGroupName string, profileName string, metrics []WafMetric, dateTimeBegin date.Time, dateTimeEnd date.Time, granularity WafGranularity, actions []WafAction, groupBy []WafRankingGroupBy, ruleTypes []WafRuleType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "dateTimeBegin": autorest.Encode("query", dateTimeBegin), + "dateTimeEnd": autorest.Encode("query", dateTimeEnd), + "granularity": autorest.Encode("query", granularity), + "metrics": metrics, + } + if actions != nil && len(actions) > 0 { + queryParameters["actions"] = actions + } + if groupBy != nil && len(groupBy) > 0 { + queryParameters["groupBy"] = groupBy + } + if ruleTypes != nil && len(ruleTypes) > 0 { + queryParameters["ruleTypes"] = ruleTypes + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getWafLogAnalyticsMetrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetWafLogAnalyticsMetricsSender sends the GetWafLogAnalyticsMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client LogAnalyticsClient) GetWafLogAnalyticsMetricsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetWafLogAnalyticsMetricsResponder handles the response to the GetWafLogAnalyticsMetrics request. The method always +// closes the http.Response Body. +func (client LogAnalyticsClient) GetWafLogAnalyticsMetricsResponder(resp *http.Response) (result WafMetricsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetWafLogAnalyticsRankings get WAF log analytics charts for AFD profile +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. which is unique within the resource group. +func (client LogAnalyticsClient) GetWafLogAnalyticsRankings(ctx context.Context, resourceGroupName string, profileName string, metrics []WafMetric, dateTimeBegin date.Time, dateTimeEnd date.Time, maxRanking int32, rankings []WafRankingType, actions []WafAction, ruleTypes []WafRuleType) (result WafRankingsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogAnalyticsClient.GetWafLogAnalyticsRankings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: metrics, + Constraints: []validation.Constraint{{Target: "metrics", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: rankings, + Constraints: []validation.Constraint{{Target: "rankings", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.LogAnalyticsClient", "GetWafLogAnalyticsRankings", err.Error()) + } + + req, err := client.GetWafLogAnalyticsRankingsPreparer(ctx, resourceGroupName, profileName, metrics, dateTimeBegin, dateTimeEnd, maxRanking, rankings, actions, ruleTypes) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetWafLogAnalyticsRankings", nil, "Failure preparing request") + return + } + + resp, err := client.GetWafLogAnalyticsRankingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetWafLogAnalyticsRankings", resp, "Failure sending request") + return + } + + result, err = client.GetWafLogAnalyticsRankingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.LogAnalyticsClient", "GetWafLogAnalyticsRankings", resp, "Failure responding to request") + return + } + + return +} + +// GetWafLogAnalyticsRankingsPreparer prepares the GetWafLogAnalyticsRankings request. +func (client LogAnalyticsClient) GetWafLogAnalyticsRankingsPreparer(ctx context.Context, resourceGroupName string, profileName string, metrics []WafMetric, dateTimeBegin date.Time, dateTimeEnd date.Time, maxRanking int32, rankings []WafRankingType, actions []WafAction, ruleTypes []WafRuleType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "dateTimeBegin": autorest.Encode("query", dateTimeBegin), + "dateTimeEnd": autorest.Encode("query", dateTimeEnd), + "maxRanking": autorest.Encode("query", maxRanking), + "metrics": metrics, + "rankings": rankings, + } + if actions != nil && len(actions) > 0 { + queryParameters["actions"] = actions + } + if ruleTypes != nil && len(ruleTypes) > 0 { + queryParameters["ruleTypes"] = ruleTypes + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getWafLogAnalyticsRankings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetWafLogAnalyticsRankingsSender sends the GetWafLogAnalyticsRankings request. The method will close the +// http.Response Body if it receives an error. +func (client LogAnalyticsClient) GetWafLogAnalyticsRankingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetWafLogAnalyticsRankingsResponder handles the response to the GetWafLogAnalyticsRankings request. The method always +// closes the http.Response Body. +func (client LogAnalyticsClient) GetWafLogAnalyticsRankingsResponder(resp *http.Response) (result WafRankingsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/managedrulesets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/managedrulesets.go new file mode 100644 index 000000000000..ef905ffaa799 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/managedrulesets.go @@ -0,0 +1,144 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ManagedRuleSetsClient is the cdn Management Client +type ManagedRuleSetsClient struct { + BaseClient +} + +// NewManagedRuleSetsClient creates an instance of the ManagedRuleSetsClient client. +func NewManagedRuleSetsClient(subscriptionID string) ManagedRuleSetsClient { + return NewManagedRuleSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagedRuleSetsClientWithBaseURI creates an instance of the ManagedRuleSetsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewManagedRuleSetsClientWithBaseURI(baseURI string, subscriptionID string) ManagedRuleSetsClient { + return ManagedRuleSetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all available managed rule sets. +func (client ManagedRuleSetsClient) List(ctx context.Context) (result ManagedRuleSetDefinitionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetsClient.List") + defer func() { + sc := -1 + if result.mrsdl.Response.Response != nil { + sc = result.mrsdl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ManagedRuleSetsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mrsdl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ManagedRuleSetsClient", "List", resp, "Failure sending request") + return + } + + result.mrsdl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ManagedRuleSetsClient", "List", resp, "Failure responding to request") + return + } + if result.mrsdl.hasNextLink() && result.mrsdl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ManagedRuleSetsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/cdnWebApplicationFirewallManagedRuleSets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedRuleSetsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ManagedRuleSetsClient) ListResponder(resp *http.Response) (result ManagedRuleSetDefinitionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ManagedRuleSetsClient) listNextResults(ctx context.Context, lastResults ManagedRuleSetDefinitionList) (result ManagedRuleSetDefinitionList, err error) { + req, err := lastResults.managedRuleSetDefinitionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.ManagedRuleSetsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.ManagedRuleSetsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ManagedRuleSetsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedRuleSetsClient) ListComplete(ctx context.Context) (result ManagedRuleSetDefinitionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/models.go new file mode 100644 index 000000000000..78382b6cd1e0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/models.go @@ -0,0 +1,14642 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" + +// ActivatedResourceReference reference to another resource along with its state. +type ActivatedResourceReference struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // IsActive - READ-ONLY; Whether the resource is active or inactive + IsActive *bool `json:"isActive,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActivatedResourceReference. +func (arr ActivatedResourceReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arr.ID != nil { + objectMap["id"] = arr.ID + } + return json.Marshal(objectMap) +} + +// AFDCustomDomainsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDCustomDomainsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDCustomDomainsClient) (AFDDomain, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDCustomDomainsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDCustomDomainsCreateFuture.Result. +func (future *AFDCustomDomainsCreateFuture) result(client AFDCustomDomainsClient) (ad AFDDomain, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ad.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDCustomDomainsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ad.Response.Response, err = future.GetResult(sender); err == nil && ad.Response.Response.StatusCode != http.StatusNoContent { + ad, err = client.CreateResponder(ad.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsCreateFuture", "Result", ad.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDCustomDomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDCustomDomainsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDCustomDomainsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDCustomDomainsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDCustomDomainsDeleteFuture.Result. +func (future *AFDCustomDomainsDeleteFuture) result(client AFDCustomDomainsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDCustomDomainsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AFDCustomDomainsRefreshValidationTokenFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type AFDCustomDomainsRefreshValidationTokenFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDCustomDomainsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDCustomDomainsRefreshValidationTokenFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDCustomDomainsRefreshValidationTokenFuture.Result. +func (future *AFDCustomDomainsRefreshValidationTokenFuture) result(client AFDCustomDomainsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsRefreshValidationTokenFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDCustomDomainsRefreshValidationTokenFuture") + return + } + ar.Response = future.Response() + return +} + +// AFDCustomDomainsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDCustomDomainsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDCustomDomainsClient) (AFDDomain, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDCustomDomainsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDCustomDomainsUpdateFuture.Result. +func (future *AFDCustomDomainsUpdateFuture) result(client AFDCustomDomainsClient) (ad AFDDomain, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ad.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDCustomDomainsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ad.Response.Response, err = future.GetResult(sender); err == nil && ad.Response.Response.StatusCode != http.StatusNoContent { + ad, err = client.UpdateResponder(ad.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDCustomDomainsUpdateFuture", "Result", ad.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDDomain friendly domain name mapping to the endpoint hostname that the customer provides for branding +// purposes, e.g. www.contoso.com. +type AFDDomain struct { + autorest.Response `json:"-"` + *AFDDomainProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDDomain. +func (ad AFDDomain) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ad.AFDDomainProperties != nil { + objectMap["properties"] = ad.AFDDomainProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDDomain struct. +func (ad *AFDDomain) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aFDDomainProperties AFDDomainProperties + err = json.Unmarshal(*v, &aFDDomainProperties) + if err != nil { + return err + } + ad.AFDDomainProperties = &aFDDomainProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ad.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ad.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ad.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ad.SystemData = &systemData + } + } + } + + return nil +} + +// AFDDomainHTTPSParameters the JSON object that contains the properties to secure a domain. +type AFDDomainHTTPSParameters struct { + // CertificateType - Defines the source of the SSL certificate. Possible values include: 'AfdCertificateTypeCustomerCertificate', 'AfdCertificateTypeManagedCertificate', 'AfdCertificateTypeAzureFirstPartyManagedCertificate' + CertificateType AfdCertificateType `json:"certificateType,omitempty"` + // MinimumTLSVersion - TLS protocol version that will be used for Https. Possible values include: 'AfdMinimumTLSVersionTLS10', 'AfdMinimumTLSVersionTLS12' + MinimumTLSVersion AfdMinimumTLSVersion `json:"minimumTlsVersion,omitempty"` + // Secret - Resource reference to the secret. ie. subs/rg/profile/secret + Secret *ResourceReference `json:"secret,omitempty"` +} + +// AFDDomainListResult result of the request to list domains. It contains a list of domain objects and a +// URL link to get the next set of results. +type AFDDomainListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of AzureFrontDoor domains within a profile. + Value *[]AFDDomain `json:"value,omitempty"` + // NextLink - URL to get the next set of domain objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDDomainListResult. +func (adlr AFDDomainListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adlr.NextLink != nil { + objectMap["nextLink"] = adlr.NextLink + } + return json.Marshal(objectMap) +} + +// AFDDomainListResultIterator provides access to a complete listing of AFDDomain values. +type AFDDomainListResultIterator struct { + i int + page AFDDomainListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AFDDomainListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDDomainListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AFDDomainListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AFDDomainListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AFDDomainListResultIterator) Response() AFDDomainListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AFDDomainListResultIterator) Value() AFDDomain { + if !iter.page.NotDone() { + return AFDDomain{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AFDDomainListResultIterator type. +func NewAFDDomainListResultIterator(page AFDDomainListResultPage) AFDDomainListResultIterator { + return AFDDomainListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (adlr AFDDomainListResult) IsEmpty() bool { + return adlr.Value == nil || len(*adlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (adlr AFDDomainListResult) hasNextLink() bool { + return adlr.NextLink != nil && len(*adlr.NextLink) != 0 +} + +// aFDDomainListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (adlr AFDDomainListResult) aFDDomainListResultPreparer(ctx context.Context) (*http.Request, error) { + if !adlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(adlr.NextLink))) +} + +// AFDDomainListResultPage contains a page of AFDDomain values. +type AFDDomainListResultPage struct { + fn func(context.Context, AFDDomainListResult) (AFDDomainListResult, error) + adlr AFDDomainListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AFDDomainListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDDomainListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.adlr) + if err != nil { + return err + } + page.adlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AFDDomainListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AFDDomainListResultPage) NotDone() bool { + return !page.adlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AFDDomainListResultPage) Response() AFDDomainListResult { + return page.adlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AFDDomainListResultPage) Values() []AFDDomain { + if page.adlr.IsEmpty() { + return nil + } + return *page.adlr.Value +} + +// Creates a new instance of the AFDDomainListResultPage type. +func NewAFDDomainListResultPage(cur AFDDomainListResult, getNextPage func(context.Context, AFDDomainListResult) (AFDDomainListResult, error)) AFDDomainListResultPage { + return AFDDomainListResultPage{ + fn: getNextPage, + adlr: cur, + } +} + +// AFDDomainProperties the JSON object that contains the properties of the domain to create. +type AFDDomainProperties struct { + // ProfileName - READ-ONLY; The name of the profile which holds the domain. + ProfileName *string `json:"profileName,omitempty"` + // TLSSettings - The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl uses AzureFrontDoor managed certificate by default. + TLSSettings *AFDDomainHTTPSParameters `json:"tlsSettings,omitempty"` + // AzureDNSZone - Resource reference to the Azure DNS zone + AzureDNSZone *ResourceReference `json:"azureDnsZone,omitempty"` + // PreValidatedCustomDomainResourceID - Resource reference to the Azure resource where custom domain ownership was prevalidated + PreValidatedCustomDomainResourceID *ResourceReference `json:"preValidatedCustomDomainResourceId,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` + // DomainValidationState - READ-ONLY; Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step. DCV stands for DomainControlValidation. Possible values include: 'DomainValidationStateUnknown', 'DomainValidationStateSubmitting', 'DomainValidationStatePending', 'DomainValidationStateRejected', 'DomainValidationStateTimedOut', 'DomainValidationStatePendingRevalidation', 'DomainValidationStateApproved', 'DomainValidationStateRefreshingValidationToken', 'DomainValidationStateInternalError' + DomainValidationState DomainValidationState `json:"domainValidationState,omitempty"` + // HostName - The host name of the domain. Must be a domain name. + HostName *string `json:"hostName,omitempty"` + // ValidationProperties - READ-ONLY; Values the customer needs to validate domain ownership + ValidationProperties *DomainValidationProperties `json:"validationProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDDomainProperties. +func (adp AFDDomainProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adp.TLSSettings != nil { + objectMap["tlsSettings"] = adp.TLSSettings + } + if adp.AzureDNSZone != nil { + objectMap["azureDnsZone"] = adp.AzureDNSZone + } + if adp.PreValidatedCustomDomainResourceID != nil { + objectMap["preValidatedCustomDomainResourceId"] = adp.PreValidatedCustomDomainResourceID + } + if adp.HostName != nil { + objectMap["hostName"] = adp.HostName + } + return json.Marshal(objectMap) +} + +// AFDDomainUpdateParameters the domain JSON object required for domain creation or update. +type AFDDomainUpdateParameters struct { + *AFDDomainUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDDomainUpdateParameters. +func (adup AFDDomainUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adup.AFDDomainUpdatePropertiesParameters != nil { + objectMap["properties"] = adup.AFDDomainUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDDomainUpdateParameters struct. +func (adup *AFDDomainUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aFDDomainUpdatePropertiesParameters AFDDomainUpdatePropertiesParameters + err = json.Unmarshal(*v, &aFDDomainUpdatePropertiesParameters) + if err != nil { + return err + } + adup.AFDDomainUpdatePropertiesParameters = &aFDDomainUpdatePropertiesParameters + } + } + } + + return nil +} + +// AFDDomainUpdatePropertiesParameters the JSON object that contains the properties of the domain to +// create. +type AFDDomainUpdatePropertiesParameters struct { + // ProfileName - READ-ONLY; The name of the profile which holds the domain. + ProfileName *string `json:"profileName,omitempty"` + // TLSSettings - The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl uses AzureFrontDoor managed certificate by default. + TLSSettings *AFDDomainHTTPSParameters `json:"tlsSettings,omitempty"` + // AzureDNSZone - Resource reference to the Azure DNS zone + AzureDNSZone *ResourceReference `json:"azureDnsZone,omitempty"` + // PreValidatedCustomDomainResourceID - Resource reference to the Azure resource where custom domain ownership was prevalidated + PreValidatedCustomDomainResourceID *ResourceReference `json:"preValidatedCustomDomainResourceId,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDDomainUpdatePropertiesParameters. +func (adupp AFDDomainUpdatePropertiesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adupp.TLSSettings != nil { + objectMap["tlsSettings"] = adupp.TLSSettings + } + if adupp.AzureDNSZone != nil { + objectMap["azureDnsZone"] = adupp.AzureDNSZone + } + if adupp.PreValidatedCustomDomainResourceID != nil { + objectMap["preValidatedCustomDomainResourceId"] = adupp.PreValidatedCustomDomainResourceID + } + return json.Marshal(objectMap) +} + +// AFDEndpoint CDN endpoint is the entity within a CDN profile containing configuration information such as +// origin, protocol, content caching and delivery behavior. The AzureFrontDoor endpoint uses the URL format +// .azureedge.net. +type AFDEndpoint struct { + autorest.Response `json:"-"` + *AFDEndpointProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDEndpoint. +func (ae AFDEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ae.AFDEndpointProperties != nil { + objectMap["properties"] = ae.AFDEndpointProperties + } + if ae.Location != nil { + objectMap["location"] = ae.Location + } + if ae.Tags != nil { + objectMap["tags"] = ae.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDEndpoint struct. +func (ae *AFDEndpoint) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aFDEndpointProperties AFDEndpointProperties + err = json.Unmarshal(*v, &aFDEndpointProperties) + if err != nil { + return err + } + ae.AFDEndpointProperties = &aFDEndpointProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ae.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ae.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ae.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ae.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ae.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ae.SystemData = &systemData + } + } + } + + return nil +} + +// AFDEndpointListResult result of the request to list endpoints. It contains a list of endpoint objects +// and a URL link to get the next set of results. +type AFDEndpointListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of AzureFrontDoor endpoints within a profile + Value *[]AFDEndpoint `json:"value,omitempty"` + // NextLink - URL to get the next set of endpoint objects if there is any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDEndpointListResult. +func (aelr AFDEndpointListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aelr.NextLink != nil { + objectMap["nextLink"] = aelr.NextLink + } + return json.Marshal(objectMap) +} + +// AFDEndpointListResultIterator provides access to a complete listing of AFDEndpoint values. +type AFDEndpointListResultIterator struct { + i int + page AFDEndpointListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AFDEndpointListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AFDEndpointListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AFDEndpointListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AFDEndpointListResultIterator) Response() AFDEndpointListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AFDEndpointListResultIterator) Value() AFDEndpoint { + if !iter.page.NotDone() { + return AFDEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AFDEndpointListResultIterator type. +func NewAFDEndpointListResultIterator(page AFDEndpointListResultPage) AFDEndpointListResultIterator { + return AFDEndpointListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aelr AFDEndpointListResult) IsEmpty() bool { + return aelr.Value == nil || len(*aelr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aelr AFDEndpointListResult) hasNextLink() bool { + return aelr.NextLink != nil && len(*aelr.NextLink) != 0 +} + +// aFDEndpointListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aelr AFDEndpointListResult) aFDEndpointListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aelr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aelr.NextLink))) +} + +// AFDEndpointListResultPage contains a page of AFDEndpoint values. +type AFDEndpointListResultPage struct { + fn func(context.Context, AFDEndpointListResult) (AFDEndpointListResult, error) + aelr AFDEndpointListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AFDEndpointListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDEndpointListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aelr) + if err != nil { + return err + } + page.aelr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AFDEndpointListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AFDEndpointListResultPage) NotDone() bool { + return !page.aelr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AFDEndpointListResultPage) Response() AFDEndpointListResult { + return page.aelr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AFDEndpointListResultPage) Values() []AFDEndpoint { + if page.aelr.IsEmpty() { + return nil + } + return *page.aelr.Value +} + +// Creates a new instance of the AFDEndpointListResultPage type. +func NewAFDEndpointListResultPage(cur AFDEndpointListResult, getNextPage func(context.Context, AFDEndpointListResult) (AFDEndpointListResult, error)) AFDEndpointListResultPage { + return AFDEndpointListResultPage{ + fn: getNextPage, + aelr: cur, + } +} + +// AFDEndpointProperties the JSON object that contains the properties required to create an endpoint. +type AFDEndpointProperties struct { + // ProfileName - READ-ONLY; The name of the profile which holds the endpoint. + ProfileName *string `json:"profileName,omitempty"` + // EnabledState - Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + EnabledState EnabledState `json:"enabledState,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` + // HostName - READ-ONLY; The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. contoso.azureedge.net + HostName *string `json:"hostName,omitempty"` + // AutoGeneratedDomainNameLabelScope - Indicates the endpoint name reuse scope. The default value is TenantReuse. Possible values include: 'AutoGeneratedDomainNameLabelScopeTenantReuse', 'AutoGeneratedDomainNameLabelScopeSubscriptionReuse', 'AutoGeneratedDomainNameLabelScopeResourceGroupReuse', 'AutoGeneratedDomainNameLabelScopeNoReuse' + AutoGeneratedDomainNameLabelScope AutoGeneratedDomainNameLabelScope `json:"autoGeneratedDomainNameLabelScope,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDEndpointProperties. +func (aep AFDEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aep.EnabledState != "" { + objectMap["enabledState"] = aep.EnabledState + } + if aep.AutoGeneratedDomainNameLabelScope != "" { + objectMap["autoGeneratedDomainNameLabelScope"] = aep.AutoGeneratedDomainNameLabelScope + } + return json.Marshal(objectMap) +} + +// AFDEndpointPropertiesUpdateParameters the JSON object containing endpoint update parameters. +type AFDEndpointPropertiesUpdateParameters struct { + // ProfileName - READ-ONLY; The name of the profile which holds the endpoint. + ProfileName *string `json:"profileName,omitempty"` + // EnabledState - Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + EnabledState EnabledState `json:"enabledState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDEndpointPropertiesUpdateParameters. +func (aepup AFDEndpointPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aepup.EnabledState != "" { + objectMap["enabledState"] = aepup.EnabledState + } + return json.Marshal(objectMap) +} + +// AFDEndpointsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDEndpointsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDEndpointsClient) (AFDEndpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDEndpointsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDEndpointsCreateFuture.Result. +func (future *AFDEndpointsCreateFuture) result(client AFDEndpointsClient) (ae AFDEndpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ae.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDEndpointsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ae.Response.Response, err = future.GetResult(sender); err == nil && ae.Response.Response.StatusCode != http.StatusNoContent { + ae, err = client.CreateResponder(ae.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsCreateFuture", "Result", ae.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDEndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDEndpointsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDEndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDEndpointsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDEndpointsDeleteFuture.Result. +func (future *AFDEndpointsDeleteFuture) result(client AFDEndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDEndpointsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AFDEndpointsPurgeContentFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AFDEndpointsPurgeContentFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDEndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDEndpointsPurgeContentFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDEndpointsPurgeContentFuture.Result. +func (future *AFDEndpointsPurgeContentFuture) result(client AFDEndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsPurgeContentFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDEndpointsPurgeContentFuture") + return + } + ar.Response = future.Response() + return +} + +// AFDEndpointsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDEndpointsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDEndpointsClient) (AFDEndpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDEndpointsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDEndpointsUpdateFuture.Result. +func (future *AFDEndpointsUpdateFuture) result(client AFDEndpointsClient) (ae AFDEndpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ae.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDEndpointsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ae.Response.Response, err = future.GetResult(sender); err == nil && ae.Response.Response.StatusCode != http.StatusNoContent { + ae, err = client.UpdateResponder(ae.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDEndpointsUpdateFuture", "Result", ae.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDEndpointUpdateParameters properties required to create or update an endpoint. +type AFDEndpointUpdateParameters struct { + // Tags - Endpoint tags. + Tags map[string]*string `json:"tags"` + *AFDEndpointPropertiesUpdateParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDEndpointUpdateParameters. +func (aeup AFDEndpointUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aeup.Tags != nil { + objectMap["tags"] = aeup.Tags + } + if aeup.AFDEndpointPropertiesUpdateParameters != nil { + objectMap["properties"] = aeup.AFDEndpointPropertiesUpdateParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDEndpointUpdateParameters struct. +func (aeup *AFDEndpointUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + aeup.Tags = tags + } + case "properties": + if v != nil { + var aFDEndpointPropertiesUpdateParameters AFDEndpointPropertiesUpdateParameters + err = json.Unmarshal(*v, &aFDEndpointPropertiesUpdateParameters) + if err != nil { + return err + } + aeup.AFDEndpointPropertiesUpdateParameters = &aFDEndpointPropertiesUpdateParameters + } + } + } + + return nil +} + +// AfdErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type AfdErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// AFDOrigin CDN origin is the source of the content being delivered via CDN. When the edge nodes +// represented by an endpoint do not have the requested content cached, they attempt to fetch it from one +// or more of the configured origins. +type AFDOrigin struct { + autorest.Response `json:"-"` + *AFDOriginProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOrigin. +func (ao AFDOrigin) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ao.AFDOriginProperties != nil { + objectMap["properties"] = ao.AFDOriginProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDOrigin struct. +func (ao *AFDOrigin) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aFDOriginProperties AFDOriginProperties + err = json.Unmarshal(*v, &aFDOriginProperties) + if err != nil { + return err + } + ao.AFDOriginProperties = &aFDOriginProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ao.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ao.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ao.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ao.SystemData = &systemData + } + } + } + + return nil +} + +// AFDOriginGroup aFDOrigin group comprising of origins is used for load balancing to origins when the +// content cannot be served from CDN. +type AFDOriginGroup struct { + autorest.Response `json:"-"` + *AFDOriginGroupProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginGroup. +func (aog AFDOriginGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aog.AFDOriginGroupProperties != nil { + objectMap["properties"] = aog.AFDOriginGroupProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDOriginGroup struct. +func (aog *AFDOriginGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aFDOriginGroupProperties AFDOriginGroupProperties + err = json.Unmarshal(*v, &aFDOriginGroupProperties) + if err != nil { + return err + } + aog.AFDOriginGroupProperties = &aFDOriginGroupProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + aog.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + aog.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + aog.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + aog.SystemData = &systemData + } + } + } + + return nil +} + +// AFDOriginGroupListResult result of the request to list origin groups. It contains a list of origin +// groups objects and a URL link to get the next set of results. +type AFDOriginGroupListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of CDN origin groups within an endpoint + Value *[]AFDOriginGroup `json:"value,omitempty"` + // NextLink - URL to get the next set of origin objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginGroupListResult. +func (aoglr AFDOriginGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aoglr.NextLink != nil { + objectMap["nextLink"] = aoglr.NextLink + } + return json.Marshal(objectMap) +} + +// AFDOriginGroupListResultIterator provides access to a complete listing of AFDOriginGroup values. +type AFDOriginGroupListResultIterator struct { + i int + page AFDOriginGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AFDOriginGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AFDOriginGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AFDOriginGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AFDOriginGroupListResultIterator) Response() AFDOriginGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AFDOriginGroupListResultIterator) Value() AFDOriginGroup { + if !iter.page.NotDone() { + return AFDOriginGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AFDOriginGroupListResultIterator type. +func NewAFDOriginGroupListResultIterator(page AFDOriginGroupListResultPage) AFDOriginGroupListResultIterator { + return AFDOriginGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aoglr AFDOriginGroupListResult) IsEmpty() bool { + return aoglr.Value == nil || len(*aoglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aoglr AFDOriginGroupListResult) hasNextLink() bool { + return aoglr.NextLink != nil && len(*aoglr.NextLink) != 0 +} + +// aFDOriginGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aoglr AFDOriginGroupListResult) aFDOriginGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aoglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aoglr.NextLink))) +} + +// AFDOriginGroupListResultPage contains a page of AFDOriginGroup values. +type AFDOriginGroupListResultPage struct { + fn func(context.Context, AFDOriginGroupListResult) (AFDOriginGroupListResult, error) + aoglr AFDOriginGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AFDOriginGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aoglr) + if err != nil { + return err + } + page.aoglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AFDOriginGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AFDOriginGroupListResultPage) NotDone() bool { + return !page.aoglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AFDOriginGroupListResultPage) Response() AFDOriginGroupListResult { + return page.aoglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AFDOriginGroupListResultPage) Values() []AFDOriginGroup { + if page.aoglr.IsEmpty() { + return nil + } + return *page.aoglr.Value +} + +// Creates a new instance of the AFDOriginGroupListResultPage type. +func NewAFDOriginGroupListResultPage(cur AFDOriginGroupListResult, getNextPage func(context.Context, AFDOriginGroupListResult) (AFDOriginGroupListResult, error)) AFDOriginGroupListResultPage { + return AFDOriginGroupListResultPage{ + fn: getNextPage, + aoglr: cur, + } +} + +// AFDOriginGroupProperties the JSON object that contains the properties of the origin group. +type AFDOriginGroupProperties struct { + // ProfileName - READ-ONLY; The name of the profile which holds the origin group. + ProfileName *string `json:"profileName,omitempty"` + // LoadBalancingSettings - Load balancing settings for a backend pool + LoadBalancingSettings *LoadBalancingSettingsParameters `json:"loadBalancingSettings,omitempty"` + // HealthProbeSettings - Health probe settings to the origin that is used to determine the health of the origin. + HealthProbeSettings *HealthProbeParameters `json:"healthProbeSettings,omitempty"` + // TrafficRestorationTimeToHealedOrNewEndpointsInMinutes - Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes *int32 `json:"trafficRestorationTimeToHealedOrNewEndpointsInMinutes,omitempty"` + // SessionAffinityState - Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + SessionAffinityState EnabledState `json:"sessionAffinityState,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginGroupProperties. +func (aogp AFDOriginGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aogp.LoadBalancingSettings != nil { + objectMap["loadBalancingSettings"] = aogp.LoadBalancingSettings + } + if aogp.HealthProbeSettings != nil { + objectMap["healthProbeSettings"] = aogp.HealthProbeSettings + } + if aogp.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes != nil { + objectMap["trafficRestorationTimeToHealedOrNewEndpointsInMinutes"] = aogp.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes + } + if aogp.SessionAffinityState != "" { + objectMap["sessionAffinityState"] = aogp.SessionAffinityState + } + return json.Marshal(objectMap) +} + +// AFDOriginGroupsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDOriginGroupsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDOriginGroupsClient) (AFDOriginGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDOriginGroupsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDOriginGroupsCreateFuture.Result. +func (future *AFDOriginGroupsCreateFuture) result(client AFDOriginGroupsClient) (aog AFDOriginGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + aog.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDOriginGroupsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if aog.Response.Response, err = future.GetResult(sender); err == nil && aog.Response.Response.StatusCode != http.StatusNoContent { + aog, err = client.CreateResponder(aog.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsCreateFuture", "Result", aog.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDOriginGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDOriginGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDOriginGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDOriginGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDOriginGroupsDeleteFuture.Result. +func (future *AFDOriginGroupsDeleteFuture) result(client AFDOriginGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDOriginGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AFDOriginGroupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDOriginGroupsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDOriginGroupsClient) (AFDOriginGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDOriginGroupsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDOriginGroupsUpdateFuture.Result. +func (future *AFDOriginGroupsUpdateFuture) result(client AFDOriginGroupsClient) (aog AFDOriginGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + aog.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDOriginGroupsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if aog.Response.Response, err = future.GetResult(sender); err == nil && aog.Response.Response.StatusCode != http.StatusNoContent { + aog, err = client.UpdateResponder(aog.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginGroupsUpdateFuture", "Result", aog.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDOriginGroupUpdateParameters aFDOrigin group properties needed for origin group creation or update. +type AFDOriginGroupUpdateParameters struct { + *AFDOriginGroupUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginGroupUpdateParameters. +func (aogup AFDOriginGroupUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aogup.AFDOriginGroupUpdatePropertiesParameters != nil { + objectMap["properties"] = aogup.AFDOriginGroupUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDOriginGroupUpdateParameters struct. +func (aogup *AFDOriginGroupUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aFDOriginGroupUpdatePropertiesParameters AFDOriginGroupUpdatePropertiesParameters + err = json.Unmarshal(*v, &aFDOriginGroupUpdatePropertiesParameters) + if err != nil { + return err + } + aogup.AFDOriginGroupUpdatePropertiesParameters = &aFDOriginGroupUpdatePropertiesParameters + } + } + } + + return nil +} + +// AFDOriginGroupUpdatePropertiesParameters the JSON object that contains the properties of the origin +// group. +type AFDOriginGroupUpdatePropertiesParameters struct { + // ProfileName - READ-ONLY; The name of the profile which holds the origin group. + ProfileName *string `json:"profileName,omitempty"` + // LoadBalancingSettings - Load balancing settings for a backend pool + LoadBalancingSettings *LoadBalancingSettingsParameters `json:"loadBalancingSettings,omitempty"` + // HealthProbeSettings - Health probe settings to the origin that is used to determine the health of the origin. + HealthProbeSettings *HealthProbeParameters `json:"healthProbeSettings,omitempty"` + // TrafficRestorationTimeToHealedOrNewEndpointsInMinutes - Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes *int32 `json:"trafficRestorationTimeToHealedOrNewEndpointsInMinutes,omitempty"` + // SessionAffinityState - Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + SessionAffinityState EnabledState `json:"sessionAffinityState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginGroupUpdatePropertiesParameters. +func (aogupp AFDOriginGroupUpdatePropertiesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aogupp.LoadBalancingSettings != nil { + objectMap["loadBalancingSettings"] = aogupp.LoadBalancingSettings + } + if aogupp.HealthProbeSettings != nil { + objectMap["healthProbeSettings"] = aogupp.HealthProbeSettings + } + if aogupp.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes != nil { + objectMap["trafficRestorationTimeToHealedOrNewEndpointsInMinutes"] = aogupp.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes + } + if aogupp.SessionAffinityState != "" { + objectMap["sessionAffinityState"] = aogupp.SessionAffinityState + } + return json.Marshal(objectMap) +} + +// AFDOriginListResult result of the request to list origins. It contains a list of origin objects and a +// URL link to get the next set of results. +type AFDOriginListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of CDN origins within an endpoint + Value *[]AFDOrigin `json:"value,omitempty"` + // NextLink - URL to get the next set of origin objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginListResult. +func (aolr AFDOriginListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aolr.NextLink != nil { + objectMap["nextLink"] = aolr.NextLink + } + return json.Marshal(objectMap) +} + +// AFDOriginListResultIterator provides access to a complete listing of AFDOrigin values. +type AFDOriginListResultIterator struct { + i int + page AFDOriginListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AFDOriginListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AFDOriginListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AFDOriginListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AFDOriginListResultIterator) Response() AFDOriginListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AFDOriginListResultIterator) Value() AFDOrigin { + if !iter.page.NotDone() { + return AFDOrigin{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AFDOriginListResultIterator type. +func NewAFDOriginListResultIterator(page AFDOriginListResultPage) AFDOriginListResultIterator { + return AFDOriginListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aolr AFDOriginListResult) IsEmpty() bool { + return aolr.Value == nil || len(*aolr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aolr AFDOriginListResult) hasNextLink() bool { + return aolr.NextLink != nil && len(*aolr.NextLink) != 0 +} + +// aFDOriginListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aolr AFDOriginListResult) aFDOriginListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aolr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aolr.NextLink))) +} + +// AFDOriginListResultPage contains a page of AFDOrigin values. +type AFDOriginListResultPage struct { + fn func(context.Context, AFDOriginListResult) (AFDOriginListResult, error) + aolr AFDOriginListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AFDOriginListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AFDOriginListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aolr) + if err != nil { + return err + } + page.aolr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AFDOriginListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AFDOriginListResultPage) NotDone() bool { + return !page.aolr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AFDOriginListResultPage) Response() AFDOriginListResult { + return page.aolr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AFDOriginListResultPage) Values() []AFDOrigin { + if page.aolr.IsEmpty() { + return nil + } + return *page.aolr.Value +} + +// Creates a new instance of the AFDOriginListResultPage type. +func NewAFDOriginListResultPage(cur AFDOriginListResult, getNextPage func(context.Context, AFDOriginListResult) (AFDOriginListResult, error)) AFDOriginListResultPage { + return AFDOriginListResultPage{ + fn: getNextPage, + aolr: cur, + } +} + +// AFDOriginProperties the JSON object that contains the properties of the origin. +type AFDOriginProperties struct { + // OriginGroupName - READ-ONLY; The name of the origin group which contains this origin. + OriginGroupName *string `json:"originGroupName,omitempty"` + // AzureOrigin - Resource reference to the Azure origin resource. + AzureOrigin *ResourceReference `json:"azureOrigin,omitempty"` + // HostName - The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. + HostName *string `json:"hostName,omitempty"` + // HTTPPort - The value of the HTTP port. Must be between 1 and 65535. + HTTPPort *int32 `json:"httpPort,omitempty"` + // HTTPSPort - The value of the HTTPS port. Must be between 1 and 65535. + HTTPSPort *int32 `json:"httpsPort,omitempty"` + // OriginHostHeader - The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint + OriginHostHeader *string `json:"originHostHeader,omitempty"` + // Priority - Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5 + Priority *int32 `json:"priority,omitempty"` + // Weight - Weight of the origin in given origin group for load balancing. Must be between 1 and 1000 + Weight *int32 `json:"weight,omitempty"` + // SharedPrivateLinkResource - The properties of the private link resource for private origin. + SharedPrivateLinkResource *SharedPrivateLinkResourceProperties `json:"sharedPrivateLinkResource,omitempty"` + // EnabledState - Whether to enable health probes to be made against backends defined under backendPools. Health probes can only be disabled if there is a single enabled backend in single enabled backend pool. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + EnabledState EnabledState `json:"enabledState,omitempty"` + // EnforceCertificateNameCheck - Whether to enable certificate name check at origin level + EnforceCertificateNameCheck *bool `json:"enforceCertificateNameCheck,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginProperties. +func (aop AFDOriginProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aop.AzureOrigin != nil { + objectMap["azureOrigin"] = aop.AzureOrigin + } + if aop.HostName != nil { + objectMap["hostName"] = aop.HostName + } + if aop.HTTPPort != nil { + objectMap["httpPort"] = aop.HTTPPort + } + if aop.HTTPSPort != nil { + objectMap["httpsPort"] = aop.HTTPSPort + } + if aop.OriginHostHeader != nil { + objectMap["originHostHeader"] = aop.OriginHostHeader + } + if aop.Priority != nil { + objectMap["priority"] = aop.Priority + } + if aop.Weight != nil { + objectMap["weight"] = aop.Weight + } + if aop.SharedPrivateLinkResource != nil { + objectMap["sharedPrivateLinkResource"] = aop.SharedPrivateLinkResource + } + if aop.EnabledState != "" { + objectMap["enabledState"] = aop.EnabledState + } + if aop.EnforceCertificateNameCheck != nil { + objectMap["enforceCertificateNameCheck"] = aop.EnforceCertificateNameCheck + } + return json.Marshal(objectMap) +} + +// AFDOriginsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDOriginsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDOriginsClient) (AFDOrigin, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDOriginsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDOriginsCreateFuture.Result. +func (future *AFDOriginsCreateFuture) result(client AFDOriginsClient) (ao AFDOrigin, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ao.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDOriginsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ao.Response.Response, err = future.GetResult(sender); err == nil && ao.Response.Response.StatusCode != http.StatusNoContent { + ao, err = client.CreateResponder(ao.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsCreateFuture", "Result", ao.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDOriginsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDOriginsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDOriginsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDOriginsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDOriginsDeleteFuture.Result. +func (future *AFDOriginsDeleteFuture) result(client AFDOriginsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDOriginsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AFDOriginsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AFDOriginsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AFDOriginsClient) (AFDOrigin, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AFDOriginsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AFDOriginsUpdateFuture.Result. +func (future *AFDOriginsUpdateFuture) result(client AFDOriginsClient) (ao AFDOrigin, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ao.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.AFDOriginsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ao.Response.Response, err = future.GetResult(sender); err == nil && ao.Response.Response.StatusCode != http.StatusNoContent { + ao, err = client.UpdateResponder(ao.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.AFDOriginsUpdateFuture", "Result", ao.Response.Response, "Failure responding to request") + } + } + return +} + +// AFDOriginUpdateParameters aFDOrigin properties needed for origin update. +type AFDOriginUpdateParameters struct { + *AFDOriginUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginUpdateParameters. +func (aoup AFDOriginUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aoup.AFDOriginUpdatePropertiesParameters != nil { + objectMap["properties"] = aoup.AFDOriginUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDOriginUpdateParameters struct. +func (aoup *AFDOriginUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aFDOriginUpdatePropertiesParameters AFDOriginUpdatePropertiesParameters + err = json.Unmarshal(*v, &aFDOriginUpdatePropertiesParameters) + if err != nil { + return err + } + aoup.AFDOriginUpdatePropertiesParameters = &aFDOriginUpdatePropertiesParameters + } + } + } + + return nil +} + +// AFDOriginUpdatePropertiesParameters the JSON object that contains the properties of the origin. +type AFDOriginUpdatePropertiesParameters struct { + // OriginGroupName - READ-ONLY; The name of the origin group which contains this origin. + OriginGroupName *string `json:"originGroupName,omitempty"` + // AzureOrigin - Resource reference to the Azure origin resource. + AzureOrigin *ResourceReference `json:"azureOrigin,omitempty"` + // HostName - The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. + HostName *string `json:"hostName,omitempty"` + // HTTPPort - The value of the HTTP port. Must be between 1 and 65535. + HTTPPort *int32 `json:"httpPort,omitempty"` + // HTTPSPort - The value of the HTTPS port. Must be between 1 and 65535. + HTTPSPort *int32 `json:"httpsPort,omitempty"` + // OriginHostHeader - The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint + OriginHostHeader *string `json:"originHostHeader,omitempty"` + // Priority - Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5 + Priority *int32 `json:"priority,omitempty"` + // Weight - Weight of the origin in given origin group for load balancing. Must be between 1 and 1000 + Weight *int32 `json:"weight,omitempty"` + // SharedPrivateLinkResource - The properties of the private link resource for private origin. + SharedPrivateLinkResource *SharedPrivateLinkResourceProperties `json:"sharedPrivateLinkResource,omitempty"` + // EnabledState - Whether to enable health probes to be made against backends defined under backendPools. Health probes can only be disabled if there is a single enabled backend in single enabled backend pool. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + EnabledState EnabledState `json:"enabledState,omitempty"` + // EnforceCertificateNameCheck - Whether to enable certificate name check at origin level + EnforceCertificateNameCheck *bool `json:"enforceCertificateNameCheck,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginUpdatePropertiesParameters. +func (aoupp AFDOriginUpdatePropertiesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aoupp.AzureOrigin != nil { + objectMap["azureOrigin"] = aoupp.AzureOrigin + } + if aoupp.HostName != nil { + objectMap["hostName"] = aoupp.HostName + } + if aoupp.HTTPPort != nil { + objectMap["httpPort"] = aoupp.HTTPPort + } + if aoupp.HTTPSPort != nil { + objectMap["httpsPort"] = aoupp.HTTPSPort + } + if aoupp.OriginHostHeader != nil { + objectMap["originHostHeader"] = aoupp.OriginHostHeader + } + if aoupp.Priority != nil { + objectMap["priority"] = aoupp.Priority + } + if aoupp.Weight != nil { + objectMap["weight"] = aoupp.Weight + } + if aoupp.SharedPrivateLinkResource != nil { + objectMap["sharedPrivateLinkResource"] = aoupp.SharedPrivateLinkResource + } + if aoupp.EnabledState != "" { + objectMap["enabledState"] = aoupp.EnabledState + } + if aoupp.EnforceCertificateNameCheck != nil { + objectMap["enforceCertificateNameCheck"] = aoupp.EnforceCertificateNameCheck + } + return json.Marshal(objectMap) +} + +// AfdPurgeParameters parameters required for content purge. +type AfdPurgeParameters struct { + // ContentPaths - The path to the content to be purged. Can describe a file path or a wild card directory. + ContentPaths *[]string `json:"contentPaths,omitempty"` + // Domains - List of domains. + Domains *[]string `json:"domains,omitempty"` +} + +// AfdRouteCacheConfiguration caching settings for a caching-type route. To disable caching, do not provide +// a cacheConfiguration object. +type AfdRouteCacheConfiguration struct { + // QueryStringCachingBehavior - Defines how Frontdoor caches requests that include query strings. You can ignore any query strings when caching, ignore specific query strings, cache every request with a unique URL, or cache specific query strings. Possible values include: 'AfdQueryStringCachingBehaviorIgnoreQueryString', 'AfdQueryStringCachingBehaviorUseQueryString', 'AfdQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings', 'AfdQueryStringCachingBehaviorIncludeSpecifiedQueryStrings' + QueryStringCachingBehavior AfdQueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` + // QueryParameters - query parameters to include or exclude (comma separated). + QueryParameters *string `json:"queryParameters,omitempty"` + // CompressionSettings - compression settings. + CompressionSettings *CompressionSettings `json:"compressionSettings,omitempty"` +} + +// AFDStateProperties the tracking states for afd resources. +type AFDStateProperties struct { + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDStateProperties. +func (asp AFDStateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureFirstPartyManagedCertificate azure FirstParty Managed Certificate provided by other first party +// resource providers to enable HTTPS. +type AzureFirstPartyManagedCertificate struct { + // Type - Possible values include: 'SecretTypeURLSigningKey', 'SecretTypeCustomerCertificate', 'SecretTypeManagedCertificate', 'SecretTypeAzureFirstPartyManagedCertificate' + Type SecretType `json:"type,omitempty"` + // Subject - READ-ONLY; Subject name in the certificate. + Subject *string `json:"subject,omitempty"` + // ExpirationDate - READ-ONLY; Certificate expiration date. + ExpirationDate *string `json:"expirationDate,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirstPartyManagedCertificate. +func (afpmc AzureFirstPartyManagedCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afpmc.Type != "" { + objectMap["type"] = afpmc.Type + } + return json.Marshal(objectMap) +} + +// AzureFirstPartyManagedCertificateParameters azure FirstParty Managed Certificate provided by other first +// party resource providers to enable HTTPS. +type AzureFirstPartyManagedCertificateParameters struct { + // Type - Possible values include: 'TypeBasicSecretParametersTypeSecretParameters', 'TypeBasicSecretParametersTypeURLSigningKey', 'TypeBasicSecretParametersTypeManagedCertificate', 'TypeBasicSecretParametersTypeCustomerCertificate', 'TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate' + Type TypeBasicSecretParameters `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirstPartyManagedCertificateParameters. +func (afpmcp AzureFirstPartyManagedCertificateParameters) MarshalJSON() ([]byte, error) { + afpmcp.Type = TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate + objectMap := make(map[string]interface{}) + if afpmcp.Type != "" { + objectMap["type"] = afpmcp.Type + } + return json.Marshal(objectMap) +} + +// AsURLSigningKeyParameters is the BasicSecretParameters implementation for AzureFirstPartyManagedCertificateParameters. +func (afpmcp AzureFirstPartyManagedCertificateParameters) AsURLSigningKeyParameters() (*URLSigningKeyParameters, bool) { + return nil, false +} + +// AsManagedCertificateParameters is the BasicSecretParameters implementation for AzureFirstPartyManagedCertificateParameters. +func (afpmcp AzureFirstPartyManagedCertificateParameters) AsManagedCertificateParameters() (*ManagedCertificateParameters, bool) { + return nil, false +} + +// AsCustomerCertificateParameters is the BasicSecretParameters implementation for AzureFirstPartyManagedCertificateParameters. +func (afpmcp AzureFirstPartyManagedCertificateParameters) AsCustomerCertificateParameters() (*CustomerCertificateParameters, bool) { + return nil, false +} + +// AsAzureFirstPartyManagedCertificateParameters is the BasicSecretParameters implementation for AzureFirstPartyManagedCertificateParameters. +func (afpmcp AzureFirstPartyManagedCertificateParameters) AsAzureFirstPartyManagedCertificateParameters() (*AzureFirstPartyManagedCertificateParameters, bool) { + return &afpmcp, true +} + +// AsSecretParameters is the BasicSecretParameters implementation for AzureFirstPartyManagedCertificateParameters. +func (afpmcp AzureFirstPartyManagedCertificateParameters) AsSecretParameters() (*SecretParameters, bool) { + return nil, false +} + +// AsBasicSecretParameters is the BasicSecretParameters implementation for AzureFirstPartyManagedCertificateParameters. +func (afpmcp AzureFirstPartyManagedCertificateParameters) AsBasicSecretParameters() (BasicSecretParameters, bool) { + return &afpmcp, true +} + +// CacheConfiguration caching settings for a caching-type route. To disable caching, do not provide a +// cacheConfiguration object. +type CacheConfiguration struct { + // QueryStringCachingBehavior - Defines how Frontdoor caches requests that include query strings. You can ignore any query strings when caching, ignore specific query strings, cache every request with a unique URL, or cache specific query strings. Possible values include: 'RuleQueryStringCachingBehaviorIgnoreQueryString', 'RuleQueryStringCachingBehaviorUseQueryString', 'RuleQueryStringCachingBehaviorIgnoreSpecifiedQueryStrings', 'RuleQueryStringCachingBehaviorIncludeSpecifiedQueryStrings' + QueryStringCachingBehavior RuleQueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` + // QueryParameters - query parameters to include or exclude (comma separated). + QueryParameters *string `json:"queryParameters,omitempty"` + // IsCompressionEnabled - Indicates whether content compression is enabled. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on AzureFrontDoor when requested content is smaller than 1 byte or larger than 1 MB. Possible values include: 'RuleIsCompressionEnabledEnabled', 'RuleIsCompressionEnabledDisabled' + IsCompressionEnabled RuleIsCompressionEnabled `json:"isCompressionEnabled,omitempty"` + // CacheBehavior - Caching behavior for the requests. Possible values include: 'RuleCacheBehaviorHonorOrigin', 'RuleCacheBehaviorOverrideAlways', 'RuleCacheBehaviorOverrideIfOriginMissing' + CacheBehavior RuleCacheBehavior `json:"cacheBehavior,omitempty"` + // CacheDuration - The duration for which the content needs to be cached. Allowed format is [d.]hh:mm:ss + CacheDuration *string `json:"cacheDuration,omitempty"` +} + +// CacheExpirationActionParameters defines the parameters for the cache expiration action. +type CacheExpirationActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // CacheBehavior - Caching behavior for the requests. Possible values include: 'CacheBehaviorBypassCache', 'CacheBehaviorOverride', 'CacheBehaviorSetIfMissing' + CacheBehavior CacheBehavior `json:"cacheBehavior,omitempty"` + // CacheType - The level at which the content needs to be cached. + CacheType *string `json:"cacheType,omitempty"` + // CacheDuration - The duration for which the content needs to be cached. Allowed format is [d.]hh:mm:ss + CacheDuration *string `json:"cacheDuration,omitempty"` +} + +// CacheKeyQueryStringActionParameters defines the parameters for the cache-key query string action. +type CacheKeyQueryStringActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // QueryStringBehavior - Caching behavior for the requests. Possible values include: 'QueryStringBehaviorInclude', 'QueryStringBehaviorIncludeAll', 'QueryStringBehaviorExclude', 'QueryStringBehaviorExcludeAll' + QueryStringBehavior QueryStringBehavior `json:"queryStringBehavior,omitempty"` + // QueryParameters - query parameters to include or exclude (comma separated). + QueryParameters *string `json:"queryParameters,omitempty"` +} + +// Certificate certificate used for https +type Certificate struct { + // Type - Possible values include: 'SecretTypeURLSigningKey', 'SecretTypeCustomerCertificate', 'SecretTypeManagedCertificate', 'SecretTypeAzureFirstPartyManagedCertificate' + Type SecretType `json:"type,omitempty"` + // Subject - READ-ONLY; Subject name in the certificate. + Subject *string `json:"subject,omitempty"` + // ExpirationDate - READ-ONLY; Certificate expiration date. + ExpirationDate *string `json:"expirationDate,omitempty"` +} + +// MarshalJSON is the custom marshaler for Certificate. +func (c Certificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.Type != "" { + objectMap["type"] = c.Type + } + return json.Marshal(objectMap) +} + +// CertificateSourceParameters defines the parameters for using CDN managed certificate for securing custom +// domain. +type CertificateSourceParameters struct { + TypeName *string `json:"typeName,omitempty"` + // CertificateType - Type of certificate used. Possible values include: 'CertificateTypeShared', 'CertificateTypeDedicated' + CertificateType CertificateType `json:"certificateType,omitempty"` +} + +// CheckEndpointNameAvailabilityInput input of CheckNameAvailability API. +type CheckEndpointNameAvailabilityInput struct { + // Name - The resource name to validate. + Name *string `json:"name,omitempty"` + // Type - The type of the resource whose name is to be validated. Possible values include: 'ResourceTypeMicrosoftCdnProfilesEndpoints', 'ResourceTypeMicrosoftCdnProfilesAfdEndpoints' + Type ResourceType `json:"type,omitempty"` + // AutoGeneratedDomainNameLabelScope - Indicates the endpoint name reuse scope. The default value is TenantReuse. Possible values include: 'AutoGeneratedDomainNameLabelScopeTenantReuse', 'AutoGeneratedDomainNameLabelScopeSubscriptionReuse', 'AutoGeneratedDomainNameLabelScopeResourceGroupReuse', 'AutoGeneratedDomainNameLabelScopeNoReuse' + AutoGeneratedDomainNameLabelScope AutoGeneratedDomainNameLabelScope `json:"autoGeneratedDomainNameLabelScope,omitempty"` +} + +// CheckEndpointNameAvailabilityOutput output of check name availability API. +type CheckEndpointNameAvailabilityOutput struct { + autorest.Response `json:"-"` + // NameAvailable - READ-ONLY; Indicates whether the name is available. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // AvailableHostname - READ-ONLY; Returns the available hostname generated based on the AutoGeneratedDomainNameLabelScope when the name is available, otherwise it returns empty string + AvailableHostname *string `json:"availableHostname,omitempty"` + // Reason - READ-ONLY; The reason why the name is not available. + Reason *string `json:"reason,omitempty"` + // Message - READ-ONLY; The detailed error message describing why the name is not available. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckEndpointNameAvailabilityOutput. +func (cenao CheckEndpointNameAvailabilityOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CheckHostNameAvailabilityInput input of CheckHostNameAvailability API. +type CheckHostNameAvailabilityInput struct { + // HostName - The host name to validate. + HostName *string `json:"hostName,omitempty"` +} + +// CheckNameAvailabilityInput input of CheckNameAvailability API. +type CheckNameAvailabilityInput struct { + // Name - The resource name to validate. + Name *string `json:"name,omitempty"` + // Type - The type of the resource whose name is to be validated. Possible values include: 'ResourceTypeMicrosoftCdnProfilesEndpoints', 'ResourceTypeMicrosoftCdnProfilesAfdEndpoints' + Type ResourceType `json:"type,omitempty"` +} + +// CheckNameAvailabilityOutput output of check name availability API. +type CheckNameAvailabilityOutput struct { + autorest.Response `json:"-"` + // NameAvailable - READ-ONLY; Indicates whether the name is available. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - READ-ONLY; The reason why the name is not available. + Reason *string `json:"reason,omitempty"` + // Message - READ-ONLY; The detailed error message describing why the name is not available. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckNameAvailabilityOutput. +func (cnao CheckNameAvailabilityOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CidrIPAddress CIDR Ip address +type CidrIPAddress struct { + // BaseIPAddress - Ip address itself. + BaseIPAddress *string `json:"baseIpAddress,omitempty"` + // PrefixLength - The length of the prefix of the ip address. + PrefixLength *int32 `json:"prefixLength,omitempty"` +} + +// ClientPortMatchConditionParameters defines the parameters for ClientPort match conditions +type ClientPortMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'ClientPortOperatorAny', 'ClientPortOperatorEqual', 'ClientPortOperatorContains', 'ClientPortOperatorBeginsWith', 'ClientPortOperatorEndsWith', 'ClientPortOperatorLessThan', 'ClientPortOperatorLessThanOrEqual', 'ClientPortOperatorGreaterThan', 'ClientPortOperatorGreaterThanOrEqual', 'ClientPortOperatorRegEx' + Operator ClientPortOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// CompressionSettings settings for compression. +type CompressionSettings struct { + // ContentTypesToCompress - List of content types on which compression applies. The value should be a valid MIME type. + ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"` + // IsCompressionEnabled - Indicates whether content compression is enabled on AzureFrontDoor. Default value is false. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on AzureFrontDoor when requested content is smaller than 1 byte or larger than 1 MB. + IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"` +} + +// ContinentsResponse continents Response +type ContinentsResponse struct { + autorest.Response `json:"-"` + Continents *[]ContinentsResponseContinentsItem `json:"continents,omitempty"` + CountryOrRegions *[]ContinentsResponseCountryOrRegionsItem `json:"countryOrRegions,omitempty"` +} + +// ContinentsResponseContinentsItem ... +type ContinentsResponseContinentsItem struct { + ID *string `json:"id,omitempty"` +} + +// ContinentsResponseCountryOrRegionsItem ... +type ContinentsResponseCountryOrRegionsItem struct { + ID *string `json:"id,omitempty"` + ContinentID *string `json:"continentId,omitempty"` +} + +// CookiesMatchConditionParameters defines the parameters for Cookies match conditions +type CookiesMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Selector - Name of Cookies to be matched + Selector *string `json:"selector,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'CookiesOperatorAny', 'CookiesOperatorEqual', 'CookiesOperatorContains', 'CookiesOperatorBeginsWith', 'CookiesOperatorEndsWith', 'CookiesOperatorLessThan', 'CookiesOperatorLessThanOrEqual', 'CookiesOperatorGreaterThan', 'CookiesOperatorGreaterThanOrEqual', 'CookiesOperatorRegEx' + Operator CookiesOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// CustomDomain friendly domain name mapping to the endpoint hostname that the customer provides for +// branding purposes, e.g. www.contoso.com. +type CustomDomain struct { + autorest.Response `json:"-"` + *CustomDomainProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomain. +func (cd CustomDomain) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cd.CustomDomainProperties != nil { + objectMap["properties"] = cd.CustomDomainProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CustomDomain struct. +func (cd *CustomDomain) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var customDomainProperties CustomDomainProperties + err = json.Unmarshal(*v, &customDomainProperties) + if err != nil { + return err + } + cd.CustomDomainProperties = &customDomainProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cd.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + cd.SystemData = &systemData + } + } + } + + return nil +} + +// BasicCustomDomainHTTPSParameters the JSON object that contains the properties to secure a custom domain. +type BasicCustomDomainHTTPSParameters interface { + AsUserManagedHTTPSParameters() (*UserManagedHTTPSParameters, bool) + AsManagedHTTPSParameters() (*ManagedHTTPSParameters, bool) + AsCustomDomainHTTPSParameters() (*CustomDomainHTTPSParameters, bool) +} + +// CustomDomainHTTPSParameters the JSON object that contains the properties to secure a custom domain. +type CustomDomainHTTPSParameters struct { + // ProtocolType - Defines the TLS extension protocol that is used for secure delivery. Possible values include: 'ProtocolTypeServerNameIndication', 'ProtocolTypeIPBased' + ProtocolType ProtocolType `json:"protocolType,omitempty"` + // MinimumTLSVersion - TLS protocol version that will be used for Https. Possible values include: 'MinimumTLSVersionNone', 'MinimumTLSVersionTLS10', 'MinimumTLSVersionTLS12' + MinimumTLSVersion MinimumTLSVersion `json:"minimumTlsVersion,omitempty"` + // CertificateSource - Possible values include: 'CertificateSourceCustomDomainHTTPSParameters', 'CertificateSourceAzureKeyVault', 'CertificateSourceCdn' + CertificateSource CertificateSource `json:"certificateSource,omitempty"` +} + +func unmarshalBasicCustomDomainHTTPSParameters(body []byte) (BasicCustomDomainHTTPSParameters, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["certificateSource"] { + case string(CertificateSourceAzureKeyVault): + var umhp UserManagedHTTPSParameters + err := json.Unmarshal(body, &umhp) + return umhp, err + case string(CertificateSourceCdn): + var mhp ManagedHTTPSParameters + err := json.Unmarshal(body, &mhp) + return mhp, err + default: + var cdhp CustomDomainHTTPSParameters + err := json.Unmarshal(body, &cdhp) + return cdhp, err + } +} +func unmarshalBasicCustomDomainHTTPSParametersArray(body []byte) ([]BasicCustomDomainHTTPSParameters, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + cdhpArray := make([]BasicCustomDomainHTTPSParameters, len(rawMessages)) + + for index, rawMessage := range rawMessages { + cdhp, err := unmarshalBasicCustomDomainHTTPSParameters(*rawMessage) + if err != nil { + return nil, err + } + cdhpArray[index] = cdhp + } + return cdhpArray, nil +} + +// MarshalJSON is the custom marshaler for CustomDomainHTTPSParameters. +func (cdhp CustomDomainHTTPSParameters) MarshalJSON() ([]byte, error) { + cdhp.CertificateSource = CertificateSourceCustomDomainHTTPSParameters + objectMap := make(map[string]interface{}) + if cdhp.ProtocolType != "" { + objectMap["protocolType"] = cdhp.ProtocolType + } + if cdhp.MinimumTLSVersion != "" { + objectMap["minimumTlsVersion"] = cdhp.MinimumTLSVersion + } + if cdhp.CertificateSource != "" { + objectMap["certificateSource"] = cdhp.CertificateSource + } + return json.Marshal(objectMap) +} + +// AsUserManagedHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for CustomDomainHTTPSParameters. +func (cdhp CustomDomainHTTPSParameters) AsUserManagedHTTPSParameters() (*UserManagedHTTPSParameters, bool) { + return nil, false +} + +// AsManagedHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for CustomDomainHTTPSParameters. +func (cdhp CustomDomainHTTPSParameters) AsManagedHTTPSParameters() (*ManagedHTTPSParameters, bool) { + return nil, false +} + +// AsCustomDomainHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for CustomDomainHTTPSParameters. +func (cdhp CustomDomainHTTPSParameters) AsCustomDomainHTTPSParameters() (*CustomDomainHTTPSParameters, bool) { + return &cdhp, true +} + +// AsBasicCustomDomainHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for CustomDomainHTTPSParameters. +func (cdhp CustomDomainHTTPSParameters) AsBasicCustomDomainHTTPSParameters() (BasicCustomDomainHTTPSParameters, bool) { + return &cdhp, true +} + +// CustomDomainListResult result of the request to list custom domains. It contains a list of custom domain +// objects and a URL link to get the next set of results. +type CustomDomainListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of CDN CustomDomains within an endpoint. + Value *[]CustomDomain `json:"value,omitempty"` + // NextLink - URL to get the next set of custom domain objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomainListResult. +func (cdlr CustomDomainListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cdlr.NextLink != nil { + objectMap["nextLink"] = cdlr.NextLink + } + return json.Marshal(objectMap) +} + +// CustomDomainListResultIterator provides access to a complete listing of CustomDomain values. +type CustomDomainListResultIterator struct { + i int + page CustomDomainListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CustomDomainListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CustomDomainListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CustomDomainListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CustomDomainListResultIterator) Response() CustomDomainListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CustomDomainListResultIterator) Value() CustomDomain { + if !iter.page.NotDone() { + return CustomDomain{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CustomDomainListResultIterator type. +func NewCustomDomainListResultIterator(page CustomDomainListResultPage) CustomDomainListResultIterator { + return CustomDomainListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cdlr CustomDomainListResult) IsEmpty() bool { + return cdlr.Value == nil || len(*cdlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cdlr CustomDomainListResult) hasNextLink() bool { + return cdlr.NextLink != nil && len(*cdlr.NextLink) != 0 +} + +// customDomainListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cdlr CustomDomainListResult) customDomainListResultPreparer(ctx context.Context) (*http.Request, error) { + if !cdlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cdlr.NextLink))) +} + +// CustomDomainListResultPage contains a page of CustomDomain values. +type CustomDomainListResultPage struct { + fn func(context.Context, CustomDomainListResult) (CustomDomainListResult, error) + cdlr CustomDomainListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CustomDomainListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cdlr) + if err != nil { + return err + } + page.cdlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CustomDomainListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CustomDomainListResultPage) NotDone() bool { + return !page.cdlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CustomDomainListResultPage) Response() CustomDomainListResult { + return page.cdlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CustomDomainListResultPage) Values() []CustomDomain { + if page.cdlr.IsEmpty() { + return nil + } + return *page.cdlr.Value +} + +// Creates a new instance of the CustomDomainListResultPage type. +func NewCustomDomainListResultPage(cur CustomDomainListResult, getNextPage func(context.Context, CustomDomainListResult) (CustomDomainListResult, error)) CustomDomainListResultPage { + return CustomDomainListResultPage{ + fn: getNextPage, + cdlr: cur, + } +} + +// CustomDomainParameters the customDomain JSON object required for custom domain creation or update. +type CustomDomainParameters struct { + *CustomDomainPropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomainParameters. +func (cdp CustomDomainParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cdp.CustomDomainPropertiesParameters != nil { + objectMap["properties"] = cdp.CustomDomainPropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CustomDomainParameters struct. +func (cdp *CustomDomainParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var customDomainPropertiesParameters CustomDomainPropertiesParameters + err = json.Unmarshal(*v, &customDomainPropertiesParameters) + if err != nil { + return err + } + cdp.CustomDomainPropertiesParameters = &customDomainPropertiesParameters + } + } + } + + return nil +} + +// CustomDomainProperties the JSON object that contains the properties of the custom domain to create. +type CustomDomainProperties struct { + // HostName - The host name of the custom domain. Must be a domain name. + HostName *string `json:"hostName,omitempty"` + // ResourceState - READ-ONLY; Resource status of the custom domain. Possible values include: 'CustomDomainResourceStateCreating', 'CustomDomainResourceStateActive', 'CustomDomainResourceStateDeleting' + ResourceState CustomDomainResourceState `json:"resourceState,omitempty"` + // CustomHTTPSProvisioningState - READ-ONLY; Provisioning status of Custom Https of the custom domain. Possible values include: 'CustomHTTPSProvisioningStateEnabling', 'CustomHTTPSProvisioningStateEnabled', 'CustomHTTPSProvisioningStateDisabling', 'CustomHTTPSProvisioningStateDisabled', 'CustomHTTPSProvisioningStateFailed' + CustomHTTPSProvisioningState CustomHTTPSProvisioningState `json:"customHttpsProvisioningState,omitempty"` + // CustomHTTPSProvisioningSubstate - READ-ONLY; Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step. Possible values include: 'CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest', 'CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval', 'CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved', 'CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected', 'CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut', 'CustomHTTPSProvisioningSubstateIssuingCertificate', 'CustomHTTPSProvisioningSubstateDeployingCertificate', 'CustomHTTPSProvisioningSubstateCertificateDeployed', 'CustomHTTPSProvisioningSubstateDeletingCertificate', 'CustomHTTPSProvisioningSubstateCertificateDeleted' + CustomHTTPSProvisioningSubstate CustomHTTPSProvisioningSubstate `json:"customHttpsProvisioningSubstate,omitempty"` + // CustomHTTPSParameters - Certificate parameters for securing custom HTTPS + CustomHTTPSParameters BasicCustomDomainHTTPSParameters `json:"customHttpsParameters,omitempty"` + // ValidationData - Special validation or data may be required when delivering CDN to some regions due to local compliance reasons. E.g. ICP license number of a custom domain is required to deliver content in China. + ValidationData *string `json:"validationData,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status of the custom domain. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomainProperties. +func (cdp CustomDomainProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cdp.HostName != nil { + objectMap["hostName"] = cdp.HostName + } + objectMap["customHttpsParameters"] = cdp.CustomHTTPSParameters + if cdp.ValidationData != nil { + objectMap["validationData"] = cdp.ValidationData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CustomDomainProperties struct. +func (cdp *CustomDomainProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "hostName": + if v != nil { + var hostName string + err = json.Unmarshal(*v, &hostName) + if err != nil { + return err + } + cdp.HostName = &hostName + } + case "resourceState": + if v != nil { + var resourceState CustomDomainResourceState + err = json.Unmarshal(*v, &resourceState) + if err != nil { + return err + } + cdp.ResourceState = resourceState + } + case "customHttpsProvisioningState": + if v != nil { + var customHTTPSProvisioningState CustomHTTPSProvisioningState + err = json.Unmarshal(*v, &customHTTPSProvisioningState) + if err != nil { + return err + } + cdp.CustomHTTPSProvisioningState = customHTTPSProvisioningState + } + case "customHttpsProvisioningSubstate": + if v != nil { + var customHTTPSProvisioningSubstate CustomHTTPSProvisioningSubstate + err = json.Unmarshal(*v, &customHTTPSProvisioningSubstate) + if err != nil { + return err + } + cdp.CustomHTTPSProvisioningSubstate = customHTTPSProvisioningSubstate + } + case "customHttpsParameters": + if v != nil { + customHTTPSParameters, err := unmarshalBasicCustomDomainHTTPSParameters(*v) + if err != nil { + return err + } + cdp.CustomHTTPSParameters = customHTTPSParameters + } + case "validationData": + if v != nil { + var validationData string + err = json.Unmarshal(*v, &validationData) + if err != nil { + return err + } + cdp.ValidationData = &validationData + } + case "provisioningState": + if v != nil { + var provisioningState string + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + cdp.ProvisioningState = &provisioningState + } + } + } + + return nil +} + +// CustomDomainPropertiesParameters the JSON object that contains the properties of the custom domain to +// create. +type CustomDomainPropertiesParameters struct { + // HostName - The host name of the custom domain. Must be a domain name. + HostName *string `json:"hostName,omitempty"` +} + +// CustomDomainsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CustomDomainsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomDomainsClient) (CustomDomain, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomDomainsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CustomDomainsCreateFuture.Result. +func (future *CustomDomainsCreateFuture) result(client CustomDomainsClient) (cd CustomDomain, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cd.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.CustomDomainsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cd.Response.Response, err = future.GetResult(sender); err == nil && cd.Response.Response.StatusCode != http.StatusNoContent { + cd, err = client.CreateResponder(cd.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsCreateFuture", "Result", cd.Response.Response, "Failure responding to request") + } + } + return +} + +// CustomDomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CustomDomainsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomDomainsClient) (CustomDomain, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomDomainsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CustomDomainsDeleteFuture.Result. +func (future *CustomDomainsDeleteFuture) result(client CustomDomainsClient) (cd CustomDomain, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cd.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.CustomDomainsDeleteFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cd.Response.Response, err = future.GetResult(sender); err == nil && cd.Response.Response.StatusCode != http.StatusNoContent { + cd, err = client.DeleteResponder(cd.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsDeleteFuture", "Result", cd.Response.Response, "Failure responding to request") + } + } + return +} + +// CustomerCertificate customer Certificate used for https +type CustomerCertificate struct { + // SecretSource - Resource reference to the Azure Key Vault certificate. Expected to be in format of /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{certificateName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ + SecretSource *ResourceReference `json:"secretSource,omitempty"` + // SecretVersion - Certificate version. + SecretVersion *string `json:"secretVersion,omitempty"` + // CertificateAuthority - READ-ONLY; Certificate issuing authority. + CertificateAuthority *string `json:"certificateAuthority,omitempty"` + // UseLatestVersion - Whether to use the latest version for the certificate + UseLatestVersion *bool `json:"useLatestVersion,omitempty"` + // SubjectAlternativeNames - The list of SANs. + SubjectAlternativeNames *[]string `json:"subjectAlternativeNames,omitempty"` + // Thumbprint - READ-ONLY; Certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` + // Type - Possible values include: 'SecretTypeURLSigningKey', 'SecretTypeCustomerCertificate', 'SecretTypeManagedCertificate', 'SecretTypeAzureFirstPartyManagedCertificate' + Type SecretType `json:"type,omitempty"` + // Subject - READ-ONLY; Subject name in the certificate. + Subject *string `json:"subject,omitempty"` + // ExpirationDate - READ-ONLY; Certificate expiration date. + ExpirationDate *string `json:"expirationDate,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomerCertificate. +func (cc CustomerCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cc.SecretSource != nil { + objectMap["secretSource"] = cc.SecretSource + } + if cc.SecretVersion != nil { + objectMap["secretVersion"] = cc.SecretVersion + } + if cc.UseLatestVersion != nil { + objectMap["useLatestVersion"] = cc.UseLatestVersion + } + if cc.SubjectAlternativeNames != nil { + objectMap["subjectAlternativeNames"] = cc.SubjectAlternativeNames + } + if cc.Type != "" { + objectMap["type"] = cc.Type + } + return json.Marshal(objectMap) +} + +// CustomerCertificateParameters customer Certificate used for https +type CustomerCertificateParameters struct { + // SecretSource - Resource reference to the Azure Key Vault certificate. Expected to be in format of /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{certificateName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ + SecretSource *ResourceReference `json:"secretSource,omitempty"` + // SecretVersion - Version of the secret to be used + SecretVersion *string `json:"secretVersion,omitempty"` + // UseLatestVersion - Whether to use the latest version for the certificate + UseLatestVersion *bool `json:"useLatestVersion,omitempty"` + // Subject - READ-ONLY; Subject name in the certificate. + Subject *string `json:"subject,omitempty"` + // ExpirationDate - READ-ONLY; Certificate expiration date. + ExpirationDate *string `json:"expirationDate,omitempty"` + // CertificateAuthority - READ-ONLY; Certificate issuing authority. + CertificateAuthority *string `json:"certificateAuthority,omitempty"` + // SubjectAlternativeNames - The list of SANs. + SubjectAlternativeNames *[]string `json:"subjectAlternativeNames,omitempty"` + // Thumbprint - READ-ONLY; Certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` + // Type - Possible values include: 'TypeBasicSecretParametersTypeSecretParameters', 'TypeBasicSecretParametersTypeURLSigningKey', 'TypeBasicSecretParametersTypeManagedCertificate', 'TypeBasicSecretParametersTypeCustomerCertificate', 'TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate' + Type TypeBasicSecretParameters `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomerCertificateParameters. +func (ccp CustomerCertificateParameters) MarshalJSON() ([]byte, error) { + ccp.Type = TypeBasicSecretParametersTypeCustomerCertificate + objectMap := make(map[string]interface{}) + if ccp.SecretSource != nil { + objectMap["secretSource"] = ccp.SecretSource + } + if ccp.SecretVersion != nil { + objectMap["secretVersion"] = ccp.SecretVersion + } + if ccp.UseLatestVersion != nil { + objectMap["useLatestVersion"] = ccp.UseLatestVersion + } + if ccp.SubjectAlternativeNames != nil { + objectMap["subjectAlternativeNames"] = ccp.SubjectAlternativeNames + } + if ccp.Type != "" { + objectMap["type"] = ccp.Type + } + return json.Marshal(objectMap) +} + +// AsURLSigningKeyParameters is the BasicSecretParameters implementation for CustomerCertificateParameters. +func (ccp CustomerCertificateParameters) AsURLSigningKeyParameters() (*URLSigningKeyParameters, bool) { + return nil, false +} + +// AsManagedCertificateParameters is the BasicSecretParameters implementation for CustomerCertificateParameters. +func (ccp CustomerCertificateParameters) AsManagedCertificateParameters() (*ManagedCertificateParameters, bool) { + return nil, false +} + +// AsCustomerCertificateParameters is the BasicSecretParameters implementation for CustomerCertificateParameters. +func (ccp CustomerCertificateParameters) AsCustomerCertificateParameters() (*CustomerCertificateParameters, bool) { + return &ccp, true +} + +// AsAzureFirstPartyManagedCertificateParameters is the BasicSecretParameters implementation for CustomerCertificateParameters. +func (ccp CustomerCertificateParameters) AsAzureFirstPartyManagedCertificateParameters() (*AzureFirstPartyManagedCertificateParameters, bool) { + return nil, false +} + +// AsSecretParameters is the BasicSecretParameters implementation for CustomerCertificateParameters. +func (ccp CustomerCertificateParameters) AsSecretParameters() (*SecretParameters, bool) { + return nil, false +} + +// AsBasicSecretParameters is the BasicSecretParameters implementation for CustomerCertificateParameters. +func (ccp CustomerCertificateParameters) AsBasicSecretParameters() (BasicSecretParameters, bool) { + return &ccp, true +} + +// CustomRule defines the common attributes for a custom rule that can be included in a waf policy +type CustomRule struct { + // Name - Defines the name of the custom rule + Name *string `json:"name,omitempty"` + // EnabledState - Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified. Possible values include: 'CustomRuleEnabledStateDisabled', 'CustomRuleEnabledStateEnabled' + EnabledState CustomRuleEnabledState `json:"enabledState,omitempty"` + // Priority - Defines in what order this rule be evaluated in the overall list of custom rules + Priority *int32 `json:"priority,omitempty"` + // MatchConditions - List of match conditions. + MatchConditions *[]MatchCondition `json:"matchConditions,omitempty"` + // Action - Describes what action to be applied when rule matches. Possible values include: 'ActionTypeAllow', 'ActionTypeBlock', 'ActionTypeLog', 'ActionTypeRedirect' + Action ActionType `json:"action,omitempty"` +} + +// CustomRuleList defines contents of custom rules +type CustomRuleList struct { + // Rules - List of rules + Rules *[]CustomRule `json:"rules,omitempty"` +} + +// DeepCreatedOrigin the main origin of CDN content which is added when creating a CDN endpoint. +type DeepCreatedOrigin struct { + // Name - Origin name which must be unique within the endpoint. + Name *string `json:"name,omitempty"` + *DeepCreatedOriginProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeepCreatedOrigin. +func (dco DeepCreatedOrigin) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dco.Name != nil { + objectMap["name"] = dco.Name + } + if dco.DeepCreatedOriginProperties != nil { + objectMap["properties"] = dco.DeepCreatedOriginProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DeepCreatedOrigin struct. +func (dco *DeepCreatedOrigin) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dco.Name = &name + } + case "properties": + if v != nil { + var deepCreatedOriginProperties DeepCreatedOriginProperties + err = json.Unmarshal(*v, &deepCreatedOriginProperties) + if err != nil { + return err + } + dco.DeepCreatedOriginProperties = &deepCreatedOriginProperties + } + } + } + + return nil +} + +// DeepCreatedOriginGroup the origin group for CDN content which is added when creating a CDN endpoint. +// Traffic is sent to the origins within the origin group based on origin health. +type DeepCreatedOriginGroup struct { + // Name - Origin group name which must be unique within the endpoint. + Name *string `json:"name,omitempty"` + *DeepCreatedOriginGroupProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeepCreatedOriginGroup. +func (dcog DeepCreatedOriginGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcog.Name != nil { + objectMap["name"] = dcog.Name + } + if dcog.DeepCreatedOriginGroupProperties != nil { + objectMap["properties"] = dcog.DeepCreatedOriginGroupProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DeepCreatedOriginGroup struct. +func (dcog *DeepCreatedOriginGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dcog.Name = &name + } + case "properties": + if v != nil { + var deepCreatedOriginGroupProperties DeepCreatedOriginGroupProperties + err = json.Unmarshal(*v, &deepCreatedOriginGroupProperties) + if err != nil { + return err + } + dcog.DeepCreatedOriginGroupProperties = &deepCreatedOriginGroupProperties + } + } + } + + return nil +} + +// DeepCreatedOriginGroupProperties properties of the origin group created on the CDN endpoint. +type DeepCreatedOriginGroupProperties struct { + // HealthProbeSettings - Health probe settings to the origin that is used to determine the health of the origin. + HealthProbeSettings *HealthProbeParameters `json:"healthProbeSettings,omitempty"` + // Origins - The source of the content being delivered via CDN within given origin group. + Origins *[]ResourceReference `json:"origins,omitempty"` + // TrafficRestorationTimeToHealedOrNewEndpointsInMinutes - Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes *int32 `json:"trafficRestorationTimeToHealedOrNewEndpointsInMinutes,omitempty"` + // ResponseBasedOriginErrorDetectionSettings - The JSON object that contains the properties to determine origin health using real requests/responses.This property is currently not supported. + ResponseBasedOriginErrorDetectionSettings *ResponseBasedOriginErrorDetectionParameters `json:"responseBasedOriginErrorDetectionSettings,omitempty"` +} + +// DeepCreatedOriginProperties properties of the origin created on the CDN endpoint. +type DeepCreatedOriginProperties struct { + // HostName - The address of the origin. It can be a domain name, IPv4 address, or IPv6 address. This should be unique across all origins in an endpoint. + HostName *string `json:"hostName,omitempty"` + // HTTPPort - The value of the HTTP port. Must be between 1 and 65535. + HTTPPort *int32 `json:"httpPort,omitempty"` + // HTTPSPort - The value of the HTTPS port. Must be between 1 and 65535. + HTTPSPort *int32 `json:"httpsPort,omitempty"` + // OriginHostHeader - The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. + OriginHostHeader *string `json:"originHostHeader,omitempty"` + // Priority - Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5. + Priority *int32 `json:"priority,omitempty"` + // Weight - Weight of the origin in given origin group for load balancing. Must be between 1 and 1000 + Weight *int32 `json:"weight,omitempty"` + // Enabled - Origin is enabled for load balancing or not. By default, origin is always enabled. + Enabled *bool `json:"enabled,omitempty"` + // PrivateLinkAlias - The Alias of the Private Link resource. Populating this optional field indicates that this origin is 'Private' + PrivateLinkAlias *string `json:"privateLinkAlias,omitempty"` + // PrivateLinkResourceID - The Resource Id of the Private Link resource. Populating this optional field indicates that this backend is 'Private' + PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` + // PrivateLinkLocation - The location of the Private Link resource. Required only if 'privateLinkResourceId' is populated + PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"` + // PrivateLinkApprovalMessage - A custom message to be included in the approval request to connect to the Private Link. + PrivateLinkApprovalMessage *string `json:"privateLinkApprovalMessage,omitempty"` + // PrivateEndpointStatus - READ-ONLY; The approval status for the connection to the Private Link. Possible values include: 'PrivateEndpointStatusPending', 'PrivateEndpointStatusApproved', 'PrivateEndpointStatusRejected', 'PrivateEndpointStatusDisconnected', 'PrivateEndpointStatusTimeout' + PrivateEndpointStatus PrivateEndpointStatus `json:"privateEndpointStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeepCreatedOriginProperties. +func (dcop DeepCreatedOriginProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcop.HostName != nil { + objectMap["hostName"] = dcop.HostName + } + if dcop.HTTPPort != nil { + objectMap["httpPort"] = dcop.HTTPPort + } + if dcop.HTTPSPort != nil { + objectMap["httpsPort"] = dcop.HTTPSPort + } + if dcop.OriginHostHeader != nil { + objectMap["originHostHeader"] = dcop.OriginHostHeader + } + if dcop.Priority != nil { + objectMap["priority"] = dcop.Priority + } + if dcop.Weight != nil { + objectMap["weight"] = dcop.Weight + } + if dcop.Enabled != nil { + objectMap["enabled"] = dcop.Enabled + } + if dcop.PrivateLinkAlias != nil { + objectMap["privateLinkAlias"] = dcop.PrivateLinkAlias + } + if dcop.PrivateLinkResourceID != nil { + objectMap["privateLinkResourceId"] = dcop.PrivateLinkResourceID + } + if dcop.PrivateLinkLocation != nil { + objectMap["privateLinkLocation"] = dcop.PrivateLinkLocation + } + if dcop.PrivateLinkApprovalMessage != nil { + objectMap["privateLinkApprovalMessage"] = dcop.PrivateLinkApprovalMessage + } + return json.Marshal(objectMap) +} + +// DeliveryRule a rule that specifies a set of actions and conditions +type DeliveryRule struct { + // Name - Name of the rule + Name *string `json:"name,omitempty"` + // Order - The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. + Order *int32 `json:"order,omitempty"` + // Conditions - A list of conditions that must be matched for the actions to be executed + Conditions *[]BasicDeliveryRuleCondition `json:"conditions,omitempty"` + // Actions - A list of actions that are executed when all the conditions of a rule are satisfied. + Actions *[]BasicDeliveryRuleAction `json:"actions,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DeliveryRule struct. +func (dr *DeliveryRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dr.Name = &name + } + case "order": + if v != nil { + var order int32 + err = json.Unmarshal(*v, &order) + if err != nil { + return err + } + dr.Order = &order + } + case "conditions": + if v != nil { + conditions, err := unmarshalBasicDeliveryRuleConditionArray(*v) + if err != nil { + return err + } + dr.Conditions = &conditions + } + case "actions": + if v != nil { + actions, err := unmarshalBasicDeliveryRuleActionArray(*v) + if err != nil { + return err + } + dr.Actions = &actions + } + } + } + + return nil +} + +// BasicDeliveryRuleAction an action for the delivery rule. +type BasicDeliveryRuleAction interface { + AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) + AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) + AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) + AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) + AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) + AsURLRewriteAction() (*URLRewriteAction, bool) + AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) + AsURLSigningAction() (*URLSigningAction, bool) + AsURLRedirectAction() (*URLRedirectAction, bool) + AsDeliveryRuleAction() (*DeliveryRuleAction, bool) +} + +// DeliveryRuleAction an action for the delivery rule. +type DeliveryRuleAction struct { + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +func unmarshalBasicDeliveryRuleAction(body []byte) (BasicDeliveryRuleAction, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["name"] { + case string(NameBasicDeliveryRuleActionNameRouteConfigurationOverride): + var drrcoa DeliveryRuleRouteConfigurationOverrideAction + err := json.Unmarshal(body, &drrcoa) + return drrcoa, err + case string(NameBasicDeliveryRuleActionNameCacheKeyQueryString): + var drckqsa DeliveryRuleCacheKeyQueryStringAction + err := json.Unmarshal(body, &drckqsa) + return drckqsa, err + case string(NameBasicDeliveryRuleActionNameCacheExpiration): + var drcea DeliveryRuleCacheExpirationAction + err := json.Unmarshal(body, &drcea) + return drcea, err + case string(NameBasicDeliveryRuleActionNameModifyResponseHeader): + var drrha DeliveryRuleResponseHeaderAction + err := json.Unmarshal(body, &drrha) + return drrha, err + case string(NameBasicDeliveryRuleActionNameModifyRequestHeader): + var drrha DeliveryRuleRequestHeaderAction + err := json.Unmarshal(body, &drrha) + return drrha, err + case string(NameBasicDeliveryRuleActionNameURLRewrite): + var ura URLRewriteAction + err := json.Unmarshal(body, &ura) + return ura, err + case string(NameBasicDeliveryRuleActionNameOriginGroupOverride): + var ogoa OriginGroupOverrideAction + err := json.Unmarshal(body, &ogoa) + return ogoa, err + case string(NameBasicDeliveryRuleActionNameURLSigning): + var usa URLSigningAction + err := json.Unmarshal(body, &usa) + return usa, err + case string(NameBasicDeliveryRuleActionNameURLRedirect): + var ura URLRedirectAction + err := json.Unmarshal(body, &ura) + return ura, err + default: + var dra DeliveryRuleAction + err := json.Unmarshal(body, &dra) + return dra, err + } +} +func unmarshalBasicDeliveryRuleActionArray(body []byte) ([]BasicDeliveryRuleAction, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + draArray := make([]BasicDeliveryRuleAction, len(rawMessages)) + + for index, rawMessage := range rawMessages { + dra, err := unmarshalBasicDeliveryRuleAction(*rawMessage) + if err != nil { + return nil, err + } + draArray[index] = dra + } + return draArray, nil +} + +// MarshalJSON is the custom marshaler for DeliveryRuleAction. +func (dra DeliveryRuleAction) MarshalJSON() ([]byte, error) { + dra.Name = NameBasicDeliveryRuleActionNameDeliveryRuleAction + objectMap := make(map[string]interface{}) + if dra.Name != "" { + objectMap["name"] = dra.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return &dra, true +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleAction. +func (dra DeliveryRuleAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &dra, true +} + +// DeliveryRuleCacheExpirationAction defines the cache expiration action for the delivery rule. +type DeliveryRuleCacheExpirationAction struct { + // Parameters - Defines the parameters for the action. + Parameters *CacheExpirationActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) MarshalJSON() ([]byte, error) { + drcea.Name = NameBasicDeliveryRuleActionNameCacheExpiration + objectMap := make(map[string]interface{}) + if drcea.Parameters != nil { + objectMap["parameters"] = drcea.Parameters + } + if drcea.Name != "" { + objectMap["name"] = drcea.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return &drcea, true +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheExpirationAction. +func (drcea DeliveryRuleCacheExpirationAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &drcea, true +} + +// DeliveryRuleCacheKeyQueryStringAction defines the cache-key query string action for the delivery rule. +type DeliveryRuleCacheKeyQueryStringAction struct { + // Parameters - Defines the parameters for the action. + Parameters *CacheKeyQueryStringActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) MarshalJSON() ([]byte, error) { + drckqsa.Name = NameBasicDeliveryRuleActionNameCacheKeyQueryString + objectMap := make(map[string]interface{}) + if drckqsa.Parameters != nil { + objectMap["parameters"] = drckqsa.Parameters + } + if drckqsa.Name != "" { + objectMap["name"] = drckqsa.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return &drckqsa, true +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleCacheKeyQueryStringAction. +func (drckqsa DeliveryRuleCacheKeyQueryStringAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &drckqsa, true +} + +// DeliveryRuleClientPortCondition defines the ClientPort condition for the delivery rule. +type DeliveryRuleClientPortCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *ClientPortMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) MarshalJSON() ([]byte, error) { + drcpc.Name = NameClientPort + objectMap := make(map[string]interface{}) + if drcpc.Parameters != nil { + objectMap["parameters"] = drcpc.Parameters + } + if drcpc.Name != "" { + objectMap["name"] = drcpc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return &drcpc, true +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleClientPortCondition. +func (drcpc DeliveryRuleClientPortCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drcpc, true +} + +// BasicDeliveryRuleCondition a condition for the delivery rule. +type BasicDeliveryRuleCondition interface { + AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) + AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) + AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) + AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) + AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) + AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) + AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) + AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) + AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) + AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) + AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) + AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) + AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) + AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) + AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) + AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) + AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) + AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) + AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) + AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) +} + +// DeliveryRuleCondition a condition for the delivery rule. +type DeliveryRuleCondition struct { + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +func unmarshalBasicDeliveryRuleCondition(body []byte) (BasicDeliveryRuleCondition, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["name"] { + case string(NameSslProtocol): + var drspc DeliveryRuleSslProtocolCondition + err := json.Unmarshal(body, &drspc) + return drspc, err + case string(NameHostName): + var drhnc DeliveryRuleHostNameCondition + err := json.Unmarshal(body, &drhnc) + return drhnc, err + case string(NameServerPort): + var drspc DeliveryRuleServerPortCondition + err := json.Unmarshal(body, &drspc) + return drspc, err + case string(NameClientPort): + var drcpc DeliveryRuleClientPortCondition + err := json.Unmarshal(body, &drcpc) + return drcpc, err + case string(NameSocketAddr): + var drsac DeliveryRuleSocketAddrCondition + err := json.Unmarshal(body, &drsac) + return drsac, err + case string(NameIsDevice): + var dridc DeliveryRuleIsDeviceCondition + err := json.Unmarshal(body, &dridc) + return dridc, err + case string(NameCookies): + var drcc DeliveryRuleCookiesCondition + err := json.Unmarshal(body, &drcc) + return drcc, err + case string(NameHTTPVersion): + var drhvc DeliveryRuleHTTPVersionCondition + err := json.Unmarshal(body, &drhvc) + return drhvc, err + case string(NameURLFileName): + var drufnc DeliveryRuleURLFileNameCondition + err := json.Unmarshal(body, &drufnc) + return drufnc, err + case string(NameURLFileExtension): + var drufec DeliveryRuleURLFileExtensionCondition + err := json.Unmarshal(body, &drufec) + return drufec, err + case string(NameURLPath): + var drupc DeliveryRuleURLPathCondition + err := json.Unmarshal(body, &drupc) + return drupc, err + case string(NameRequestScheme): + var drrsc DeliveryRuleRequestSchemeCondition + err := json.Unmarshal(body, &drrsc) + return drrsc, err + case string(NameRequestBody): + var drrbc DeliveryRuleRequestBodyCondition + err := json.Unmarshal(body, &drrbc) + return drrbc, err + case string(NameRequestHeader): + var drrhc DeliveryRuleRequestHeaderCondition + err := json.Unmarshal(body, &drrhc) + return drrhc, err + case string(NameRequestURI): + var drruc DeliveryRuleRequestURICondition + err := json.Unmarshal(body, &drruc) + return drruc, err + case string(NamePostArgs): + var drpac DeliveryRulePostArgsCondition + err := json.Unmarshal(body, &drpac) + return drpac, err + case string(NameQueryString): + var drqsc DeliveryRuleQueryStringCondition + err := json.Unmarshal(body, &drqsc) + return drqsc, err + case string(NameRequestMethod): + var drrmc DeliveryRuleRequestMethodCondition + err := json.Unmarshal(body, &drrmc) + return drrmc, err + case string(NameRemoteAddress): + var drrac DeliveryRuleRemoteAddressCondition + err := json.Unmarshal(body, &drrac) + return drrac, err + default: + var drc DeliveryRuleCondition + err := json.Unmarshal(body, &drc) + return drc, err + } +} +func unmarshalBasicDeliveryRuleConditionArray(body []byte) ([]BasicDeliveryRuleCondition, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + drcArray := make([]BasicDeliveryRuleCondition, len(rawMessages)) + + for index, rawMessage := range rawMessages { + drc, err := unmarshalBasicDeliveryRuleCondition(*rawMessage) + if err != nil { + return nil, err + } + drcArray[index] = drc + } + return drcArray, nil +} + +// MarshalJSON is the custom marshaler for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) MarshalJSON() ([]byte, error) { + drc.Name = NameDeliveryRuleCondition + objectMap := make(map[string]interface{}) + if drc.Name != "" { + objectMap["name"] = drc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return &drc, true +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCondition. +func (drc DeliveryRuleCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drc, true +} + +// DeliveryRuleCookiesCondition defines the Cookies condition for the delivery rule. +type DeliveryRuleCookiesCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *CookiesMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) MarshalJSON() ([]byte, error) { + drcc.Name = NameCookies + objectMap := make(map[string]interface{}) + if drcc.Parameters != nil { + objectMap["parameters"] = drcc.Parameters + } + if drcc.Name != "" { + objectMap["name"] = drcc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return &drcc, true +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleCookiesCondition. +func (drcc DeliveryRuleCookiesCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drcc, true +} + +// DeliveryRuleHostNameCondition defines the HostName condition for the delivery rule. +type DeliveryRuleHostNameCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *HostNameMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) MarshalJSON() ([]byte, error) { + drhnc.Name = NameHostName + objectMap := make(map[string]interface{}) + if drhnc.Parameters != nil { + objectMap["parameters"] = drhnc.Parameters + } + if drhnc.Name != "" { + objectMap["name"] = drhnc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return &drhnc, true +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHostNameCondition. +func (drhnc DeliveryRuleHostNameCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drhnc, true +} + +// DeliveryRuleHTTPVersionCondition defines the HttpVersion condition for the delivery rule. +type DeliveryRuleHTTPVersionCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *HTTPVersionMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) MarshalJSON() ([]byte, error) { + drhvc.Name = NameHTTPVersion + objectMap := make(map[string]interface{}) + if drhvc.Parameters != nil { + objectMap["parameters"] = drhvc.Parameters + } + if drhvc.Name != "" { + objectMap["name"] = drhvc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return &drhvc, true +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleHTTPVersionCondition. +func (drhvc DeliveryRuleHTTPVersionCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drhvc, true +} + +// DeliveryRuleIsDeviceCondition defines the IsDevice condition for the delivery rule. +type DeliveryRuleIsDeviceCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *IsDeviceMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) MarshalJSON() ([]byte, error) { + dridc.Name = NameIsDevice + objectMap := make(map[string]interface{}) + if dridc.Parameters != nil { + objectMap["parameters"] = dridc.Parameters + } + if dridc.Name != "" { + objectMap["name"] = dridc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return &dridc, true +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleIsDeviceCondition. +func (dridc DeliveryRuleIsDeviceCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &dridc, true +} + +// DeliveryRulePostArgsCondition defines the PostArgs condition for the delivery rule. +type DeliveryRulePostArgsCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *PostArgsMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) MarshalJSON() ([]byte, error) { + drpac.Name = NamePostArgs + objectMap := make(map[string]interface{}) + if drpac.Parameters != nil { + objectMap["parameters"] = drpac.Parameters + } + if drpac.Name != "" { + objectMap["name"] = drpac.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return &drpac, true +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRulePostArgsCondition. +func (drpac DeliveryRulePostArgsCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drpac, true +} + +// DeliveryRuleQueryStringCondition defines the QueryString condition for the delivery rule. +type DeliveryRuleQueryStringCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *QueryStringMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) MarshalJSON() ([]byte, error) { + drqsc.Name = NameQueryString + objectMap := make(map[string]interface{}) + if drqsc.Parameters != nil { + objectMap["parameters"] = drqsc.Parameters + } + if drqsc.Name != "" { + objectMap["name"] = drqsc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return &drqsc, true +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleQueryStringCondition. +func (drqsc DeliveryRuleQueryStringCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drqsc, true +} + +// DeliveryRuleRemoteAddressCondition defines the RemoteAddress condition for the delivery rule. +type DeliveryRuleRemoteAddressCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *RemoteAddressMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) MarshalJSON() ([]byte, error) { + drrac.Name = NameRemoteAddress + objectMap := make(map[string]interface{}) + if drrac.Parameters != nil { + objectMap["parameters"] = drrac.Parameters + } + if drrac.Name != "" { + objectMap["name"] = drrac.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return &drrac, true +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRemoteAddressCondition. +func (drrac DeliveryRuleRemoteAddressCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drrac, true +} + +// DeliveryRuleRequestBodyCondition defines the RequestBody condition for the delivery rule. +type DeliveryRuleRequestBodyCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *RequestBodyMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) MarshalJSON() ([]byte, error) { + drrbc.Name = NameRequestBody + objectMap := make(map[string]interface{}) + if drrbc.Parameters != nil { + objectMap["parameters"] = drrbc.Parameters + } + if drrbc.Name != "" { + objectMap["name"] = drrbc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return &drrbc, true +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestBodyCondition. +func (drrbc DeliveryRuleRequestBodyCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drrbc, true +} + +// DeliveryRuleRequestHeaderAction defines the request header action for the delivery rule. +type DeliveryRuleRequestHeaderAction struct { + // Parameters - Defines the parameters for the action. + Parameters *HeaderActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) MarshalJSON() ([]byte, error) { + drrha.Name = NameBasicDeliveryRuleActionNameModifyRequestHeader + objectMap := make(map[string]interface{}) + if drrha.Parameters != nil { + objectMap["parameters"] = drrha.Parameters + } + if drrha.Name != "" { + objectMap["name"] = drrha.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return &drrha, true +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRequestHeaderAction. +func (drrha DeliveryRuleRequestHeaderAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &drrha, true +} + +// DeliveryRuleRequestHeaderCondition defines the RequestHeader condition for the delivery rule. +type DeliveryRuleRequestHeaderCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *RequestHeaderMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) MarshalJSON() ([]byte, error) { + drrhc.Name = NameRequestHeader + objectMap := make(map[string]interface{}) + if drrhc.Parameters != nil { + objectMap["parameters"] = drrhc.Parameters + } + if drrhc.Name != "" { + objectMap["name"] = drrhc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return &drrhc, true +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestHeaderCondition. +func (drrhc DeliveryRuleRequestHeaderCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drrhc, true +} + +// DeliveryRuleRequestMethodCondition defines the RequestMethod condition for the delivery rule. +type DeliveryRuleRequestMethodCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *RequestMethodMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) MarshalJSON() ([]byte, error) { + drrmc.Name = NameRequestMethod + objectMap := make(map[string]interface{}) + if drrmc.Parameters != nil { + objectMap["parameters"] = drrmc.Parameters + } + if drrmc.Name != "" { + objectMap["name"] = drrmc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return &drrmc, true +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestMethodCondition. +func (drrmc DeliveryRuleRequestMethodCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drrmc, true +} + +// DeliveryRuleRequestSchemeCondition defines the RequestScheme condition for the delivery rule. +type DeliveryRuleRequestSchemeCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *RequestSchemeMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) MarshalJSON() ([]byte, error) { + drrsc.Name = NameRequestScheme + objectMap := make(map[string]interface{}) + if drrsc.Parameters != nil { + objectMap["parameters"] = drrsc.Parameters + } + if drrsc.Name != "" { + objectMap["name"] = drrsc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return &drrsc, true +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestSchemeCondition. +func (drrsc DeliveryRuleRequestSchemeCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drrsc, true +} + +// DeliveryRuleRequestURICondition defines the RequestUri condition for the delivery rule. +type DeliveryRuleRequestURICondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *RequestURIMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) MarshalJSON() ([]byte, error) { + drruc.Name = NameRequestURI + objectMap := make(map[string]interface{}) + if drruc.Parameters != nil { + objectMap["parameters"] = drruc.Parameters + } + if drruc.Name != "" { + objectMap["name"] = drruc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return &drruc, true +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleRequestURICondition. +func (drruc DeliveryRuleRequestURICondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drruc, true +} + +// DeliveryRuleResponseHeaderAction defines the response header action for the delivery rule. +type DeliveryRuleResponseHeaderAction struct { + // Parameters - Defines the parameters for the action. + Parameters *HeaderActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) MarshalJSON() ([]byte, error) { + drrha.Name = NameBasicDeliveryRuleActionNameModifyResponseHeader + objectMap := make(map[string]interface{}) + if drrha.Parameters != nil { + objectMap["parameters"] = drrha.Parameters + } + if drrha.Name != "" { + objectMap["name"] = drrha.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return &drrha, true +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleResponseHeaderAction. +func (drrha DeliveryRuleResponseHeaderAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &drrha, true +} + +// DeliveryRuleRouteConfigurationOverrideAction defines the route configuration override action for the +// delivery rule. Only applicable to Frontdoor Standard/Premium Profiles. +type DeliveryRuleRouteConfigurationOverrideAction struct { + // Parameters - Defines the parameters for the action. + Parameters *RouteConfigurationOverrideActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) MarshalJSON() ([]byte, error) { + drrcoa.Name = NameBasicDeliveryRuleActionNameRouteConfigurationOverride + objectMap := make(map[string]interface{}) + if drrcoa.Parameters != nil { + objectMap["parameters"] = drrcoa.Parameters + } + if drrcoa.Name != "" { + objectMap["name"] = drrcoa.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return &drrcoa, true +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for DeliveryRuleRouteConfigurationOverrideAction. +func (drrcoa DeliveryRuleRouteConfigurationOverrideAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &drrcoa, true +} + +// DeliveryRuleServerPortCondition defines the ServerPort condition for the delivery rule. +type DeliveryRuleServerPortCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *ServerPortMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) MarshalJSON() ([]byte, error) { + drspc.Name = NameServerPort + objectMap := make(map[string]interface{}) + if drspc.Parameters != nil { + objectMap["parameters"] = drspc.Parameters + } + if drspc.Name != "" { + objectMap["name"] = drspc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return &drspc, true +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleServerPortCondition. +func (drspc DeliveryRuleServerPortCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drspc, true +} + +// DeliveryRuleSocketAddrCondition defines the SocketAddress condition for the delivery rule. +type DeliveryRuleSocketAddrCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *SocketAddrMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) MarshalJSON() ([]byte, error) { + drsac.Name = NameSocketAddr + objectMap := make(map[string]interface{}) + if drsac.Parameters != nil { + objectMap["parameters"] = drsac.Parameters + } + if drsac.Name != "" { + objectMap["name"] = drsac.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return &drsac, true +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSocketAddrCondition. +func (drsac DeliveryRuleSocketAddrCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drsac, true +} + +// DeliveryRuleSslProtocolCondition defines the SslProtocol condition for the delivery rule. +type DeliveryRuleSslProtocolCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *SslProtocolMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) MarshalJSON() ([]byte, error) { + drspc.Name = NameSslProtocol + objectMap := make(map[string]interface{}) + if drspc.Parameters != nil { + objectMap["parameters"] = drspc.Parameters + } + if drspc.Name != "" { + objectMap["name"] = drspc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return &drspc, true +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleSslProtocolCondition. +func (drspc DeliveryRuleSslProtocolCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drspc, true +} + +// DeliveryRuleURLFileExtensionCondition defines the UrlFileExtension condition for the delivery rule. +type DeliveryRuleURLFileExtensionCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *URLFileExtensionMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) MarshalJSON() ([]byte, error) { + drufec.Name = NameURLFileExtension + objectMap := make(map[string]interface{}) + if drufec.Parameters != nil { + objectMap["parameters"] = drufec.Parameters + } + if drufec.Name != "" { + objectMap["name"] = drufec.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return &drufec, true +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileExtensionCondition. +func (drufec DeliveryRuleURLFileExtensionCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drufec, true +} + +// DeliveryRuleURLFileNameCondition defines the UrlFileName condition for the delivery rule. +type DeliveryRuleURLFileNameCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *URLFileNameMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) MarshalJSON() ([]byte, error) { + drufnc.Name = NameURLFileName + objectMap := make(map[string]interface{}) + if drufnc.Parameters != nil { + objectMap["parameters"] = drufnc.Parameters + } + if drufnc.Name != "" { + objectMap["name"] = drufnc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return &drufnc, true +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLFileNameCondition. +func (drufnc DeliveryRuleURLFileNameCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drufnc, true +} + +// DeliveryRuleURLPathCondition defines the UrlPath condition for the delivery rule. +type DeliveryRuleURLPathCondition struct { + // Parameters - Defines the parameters for the condition. + Parameters *URLPathMatchConditionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameDeliveryRuleCondition', 'NameSslProtocol', 'NameHostName', 'NameServerPort', 'NameClientPort', 'NameSocketAddr', 'NameIsDevice', 'NameCookies', 'NameHTTPVersion', 'NameURLFileName', 'NameURLFileExtension', 'NameURLPath', 'NameRequestScheme', 'NameRequestBody', 'NameRequestHeader', 'NameRequestURI', 'NamePostArgs', 'NameQueryString', 'NameRequestMethod', 'NameRemoteAddress' + Name Name `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) MarshalJSON() ([]byte, error) { + drupc.Name = NameURLPath + objectMap := make(map[string]interface{}) + if drupc.Parameters != nil { + objectMap["parameters"] = drupc.Parameters + } + if drupc.Name != "" { + objectMap["name"] = drupc.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleSslProtocolCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleSslProtocolCondition() (*DeliveryRuleSslProtocolCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHostNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleHostNameCondition() (*DeliveryRuleHostNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleServerPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleServerPortCondition() (*DeliveryRuleServerPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleClientPortCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleClientPortCondition() (*DeliveryRuleClientPortCondition, bool) { + return nil, false +} + +// AsDeliveryRuleSocketAddrCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleSocketAddrCondition() (*DeliveryRuleSocketAddrCondition, bool) { + return nil, false +} + +// AsDeliveryRuleIsDeviceCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleIsDeviceCondition() (*DeliveryRuleIsDeviceCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCookiesCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleCookiesCondition() (*DeliveryRuleCookiesCondition, bool) { + return nil, false +} + +// AsDeliveryRuleHTTPVersionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleHTTPVersionCondition() (*DeliveryRuleHTTPVersionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileNameCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleURLFileNameCondition() (*DeliveryRuleURLFileNameCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLFileExtensionCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleURLFileExtensionCondition() (*DeliveryRuleURLFileExtensionCondition, bool) { + return nil, false +} + +// AsDeliveryRuleURLPathCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleURLPathCondition() (*DeliveryRuleURLPathCondition, bool) { + return &drupc, true +} + +// AsDeliveryRuleRequestSchemeCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleRequestSchemeCondition() (*DeliveryRuleRequestSchemeCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestBodyCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleRequestBodyCondition() (*DeliveryRuleRequestBodyCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleRequestHeaderCondition() (*DeliveryRuleRequestHeaderCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestURICondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleRequestURICondition() (*DeliveryRuleRequestURICondition, bool) { + return nil, false +} + +// AsDeliveryRulePostArgsCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRulePostArgsCondition() (*DeliveryRulePostArgsCondition, bool) { + return nil, false +} + +// AsDeliveryRuleQueryStringCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleQueryStringCondition() (*DeliveryRuleQueryStringCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRequestMethodCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleRequestMethodCondition() (*DeliveryRuleRequestMethodCondition, bool) { + return nil, false +} + +// AsDeliveryRuleRemoteAddressCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleRemoteAddressCondition() (*DeliveryRuleRemoteAddressCondition, bool) { + return nil, false +} + +// AsDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsDeliveryRuleCondition() (*DeliveryRuleCondition, bool) { + return nil, false +} + +// AsBasicDeliveryRuleCondition is the BasicDeliveryRuleCondition implementation for DeliveryRuleURLPathCondition. +func (drupc DeliveryRuleURLPathCondition) AsBasicDeliveryRuleCondition() (BasicDeliveryRuleCondition, bool) { + return &drupc, true +} + +// DimensionProperties type of operation: get, read, delete, etc. +type DimensionProperties struct { + // Name - Name of dimension. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of dimension. + DisplayName *string `json:"displayName,omitempty"` + // InternalName - Internal name of dimension. + InternalName *string `json:"internalName,omitempty"` +} + +// DomainValidationProperties the JSON object that contains the properties to validate a domain. +type DomainValidationProperties struct { + // ValidationToken - READ-ONLY; Challenge used for DNS TXT record or file based validation + ValidationToken *string `json:"validationToken,omitempty"` + // ExpirationDate - READ-ONLY; The date time that the token expires + ExpirationDate *string `json:"expirationDate,omitempty"` +} + +// MarshalJSON is the custom marshaler for DomainValidationProperties. +func (dvp DomainValidationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EdgeNode edgenode is a global Point of Presence (POP) location used to deliver CDN content to end users. +type EdgeNode struct { + *EdgeNodeProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for EdgeNode. +func (en EdgeNode) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if en.EdgeNodeProperties != nil { + objectMap["properties"] = en.EdgeNodeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EdgeNode struct. +func (en *EdgeNode) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var edgeNodeProperties EdgeNodeProperties + err = json.Unmarshal(*v, &edgeNodeProperties) + if err != nil { + return err + } + en.EdgeNodeProperties = &edgeNodeProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + en.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + en.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + en.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + en.SystemData = &systemData + } + } + } + + return nil +} + +// EdgeNodeProperties the JSON object that contains the properties required to create an edgenode. +type EdgeNodeProperties struct { + // IPAddressGroups - List of ip address groups. + IPAddressGroups *[]IPAddressGroup `json:"ipAddressGroups,omitempty"` +} + +// EdgenodeResult result of the request to list CDN edgenodes. It contains a list of ip address group and a +// URL link to get the next set of results. +type EdgenodeResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Edge node of CDN service. + Value *[]EdgeNode `json:"value,omitempty"` + // NextLink - URL to get the next set of edgenode list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for EdgenodeResult. +func (er EdgenodeResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if er.NextLink != nil { + objectMap["nextLink"] = er.NextLink + } + return json.Marshal(objectMap) +} + +// EdgenodeResultIterator provides access to a complete listing of EdgeNode values. +type EdgenodeResultIterator struct { + i int + page EdgenodeResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EdgenodeResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EdgenodeResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EdgenodeResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EdgenodeResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EdgenodeResultIterator) Response() EdgenodeResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EdgenodeResultIterator) Value() EdgeNode { + if !iter.page.NotDone() { + return EdgeNode{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EdgenodeResultIterator type. +func NewEdgenodeResultIterator(page EdgenodeResultPage) EdgenodeResultIterator { + return EdgenodeResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (er EdgenodeResult) IsEmpty() bool { + return er.Value == nil || len(*er.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (er EdgenodeResult) hasNextLink() bool { + return er.NextLink != nil && len(*er.NextLink) != 0 +} + +// edgenodeResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (er EdgenodeResult) edgenodeResultPreparer(ctx context.Context) (*http.Request, error) { + if !er.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(er.NextLink))) +} + +// EdgenodeResultPage contains a page of EdgeNode values. +type EdgenodeResultPage struct { + fn func(context.Context, EdgenodeResult) (EdgenodeResult, error) + er EdgenodeResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EdgenodeResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EdgenodeResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.er) + if err != nil { + return err + } + page.er = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EdgenodeResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EdgenodeResultPage) NotDone() bool { + return !page.er.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EdgenodeResultPage) Response() EdgenodeResult { + return page.er +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EdgenodeResultPage) Values() []EdgeNode { + if page.er.IsEmpty() { + return nil + } + return *page.er.Value +} + +// Creates a new instance of the EdgenodeResultPage type. +func NewEdgenodeResultPage(cur EdgenodeResult, getNextPage func(context.Context, EdgenodeResult) (EdgenodeResult, error)) EdgenodeResultPage { + return EdgenodeResultPage{ + fn: getNextPage, + er: cur, + } +} + +// Endpoint CDN endpoint is the entity within a CDN profile containing configuration information such as +// origin, protocol, content caching and delivery behavior. The CDN endpoint uses the URL format +// .azureedge.net. +type Endpoint struct { + autorest.Response `json:"-"` + *EndpointProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Endpoint. +func (e Endpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.EndpointProperties != nil { + objectMap["properties"] = e.EndpointProperties + } + if e.Location != nil { + objectMap["location"] = e.Location + } + if e.Tags != nil { + objectMap["tags"] = e.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Endpoint struct. +func (e *Endpoint) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var endpointProperties EndpointProperties + err = json.Unmarshal(*v, &endpointProperties) + if err != nil { + return err + } + e.EndpointProperties = &endpointProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + e.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + e.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + e.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + e.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + e.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + e.SystemData = &systemData + } + } + } + + return nil +} + +// EndpointListResult result of the request to list endpoints. It contains a list of endpoint objects and a +// URL link to get the next set of results. +type EndpointListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of CDN endpoints within a profile + Value *[]Endpoint `json:"value,omitempty"` + // NextLink - URL to get the next set of endpoint objects if there is any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointListResult. +func (elr EndpointListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if elr.NextLink != nil { + objectMap["nextLink"] = elr.NextLink + } + return json.Marshal(objectMap) +} + +// EndpointListResultIterator provides access to a complete listing of Endpoint values. +type EndpointListResultIterator struct { + i int + page EndpointListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EndpointListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EndpointListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EndpointListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EndpointListResultIterator) Response() EndpointListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EndpointListResultIterator) Value() Endpoint { + if !iter.page.NotDone() { + return Endpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EndpointListResultIterator type. +func NewEndpointListResultIterator(page EndpointListResultPage) EndpointListResultIterator { + return EndpointListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (elr EndpointListResult) IsEmpty() bool { + return elr.Value == nil || len(*elr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (elr EndpointListResult) hasNextLink() bool { + return elr.NextLink != nil && len(*elr.NextLink) != 0 +} + +// endpointListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (elr EndpointListResult) endpointListResultPreparer(ctx context.Context) (*http.Request, error) { + if !elr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(elr.NextLink))) +} + +// EndpointListResultPage contains a page of Endpoint values. +type EndpointListResultPage struct { + fn func(context.Context, EndpointListResult) (EndpointListResult, error) + elr EndpointListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EndpointListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.elr) + if err != nil { + return err + } + page.elr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EndpointListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EndpointListResultPage) NotDone() bool { + return !page.elr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EndpointListResultPage) Response() EndpointListResult { + return page.elr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EndpointListResultPage) Values() []Endpoint { + if page.elr.IsEmpty() { + return nil + } + return *page.elr.Value +} + +// Creates a new instance of the EndpointListResultPage type. +func NewEndpointListResultPage(cur EndpointListResult, getNextPage func(context.Context, EndpointListResult) (EndpointListResult, error)) EndpointListResultPage { + return EndpointListResultPage{ + fn: getNextPage, + elr: cur, + } +} + +// EndpointProperties the JSON object that contains the properties required to create an endpoint. +type EndpointProperties struct { + // HostName - READ-ONLY; The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. contoso.azureedge.net + HostName *string `json:"hostName,omitempty"` + // Origins - The source of the content being delivered via CDN. + Origins *[]DeepCreatedOrigin `json:"origins,omitempty"` + // OriginGroups - The origin groups comprising of origins that are used for load balancing the traffic based on availability. + OriginGroups *[]DeepCreatedOriginGroup `json:"originGroups,omitempty"` + // CustomDomains - READ-ONLY; The custom domains under the endpoint. + CustomDomains *[]CustomDomain `json:"customDomains,omitempty"` + // ResourceState - READ-ONLY; Resource status of the endpoint. Possible values include: 'EndpointResourceStateCreating', 'EndpointResourceStateDeleting', 'EndpointResourceStateRunning', 'EndpointResourceStateStarting', 'EndpointResourceStateStopped', 'EndpointResourceStateStopping' + ResourceState EndpointResourceState `json:"resourceState,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status of the endpoint. + ProvisioningState *string `json:"provisioningState,omitempty"` + // OriginPath - A directory path on the origin that CDN can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. + OriginPath *string `json:"originPath,omitempty"` + // ContentTypesToCompress - List of content types on which compression applies. The value should be a valid MIME type. + ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"` + // OriginHostHeader - The host header value sent to the origin with each request. This property at Endpoint is only allowed when endpoint uses single origin and can be overridden by the same property specified at origin.If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. + OriginHostHeader *string `json:"originHostHeader,omitempty"` + // IsCompressionEnabled - Indicates whether content compression is enabled on CDN. Default value is false. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on CDN when requested content is smaller than 1 byte or larger than 1 MB. + IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"` + // IsHTTPAllowed - Indicates whether HTTP traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed. + IsHTTPAllowed *bool `json:"isHttpAllowed,omitempty"` + // IsHTTPSAllowed - Indicates whether HTTPS traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed. + IsHTTPSAllowed *bool `json:"isHttpsAllowed,omitempty"` + // QueryStringCachingBehavior - Defines how CDN caches requests that include query strings. You can ignore any query strings when caching, bypass caching to prevent requests that contain query strings from being cached, or cache every request with a unique URL. Possible values include: 'QueryStringCachingBehaviorIgnoreQueryString', 'QueryStringCachingBehaviorBypassCaching', 'QueryStringCachingBehaviorUseQueryString', 'QueryStringCachingBehaviorNotSet' + QueryStringCachingBehavior QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` + // OptimizationType - Specifies what scenario the customer wants this CDN endpoint to optimize for, e.g. Download, Media services. With this information, CDN can apply scenario driven optimization. Possible values include: 'OptimizationTypeGeneralWebDelivery', 'OptimizationTypeGeneralMediaStreaming', 'OptimizationTypeVideoOnDemandMediaStreaming', 'OptimizationTypeLargeFileDownload', 'OptimizationTypeDynamicSiteAcceleration' + OptimizationType OptimizationType `json:"optimizationType,omitempty"` + // ProbePath - Path to a file hosted on the origin which helps accelerate delivery of the dynamic content and calculate the most optimal routes for the CDN. This is relative to the origin path. This property is only relevant when using a single origin. + ProbePath *string `json:"probePath,omitempty"` + // GeoFilters - List of rules defining the user's geo access within a CDN endpoint. Each geo filter defines an access rule to a specified path or content, e.g. block APAC for path /pictures/ + GeoFilters *[]GeoFilter `json:"geoFilters,omitempty"` + // DefaultOriginGroup - A reference to the origin group. + DefaultOriginGroup *ResourceReference `json:"defaultOriginGroup,omitempty"` + // URLSigningKeys - List of keys used to validate the signed URL hashes. + URLSigningKeys *[]URLSigningKey `json:"urlSigningKeys,omitempty"` + // DeliveryPolicy - A policy that specifies the delivery rules to be used for an endpoint. + DeliveryPolicy *EndpointPropertiesUpdateParametersDeliveryPolicy `json:"deliveryPolicy,omitempty"` + // WebApplicationFirewallPolicyLink - Defines the Web Application Firewall policy for the endpoint (if applicable) + WebApplicationFirewallPolicyLink *EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointProperties. +func (ep EndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ep.Origins != nil { + objectMap["origins"] = ep.Origins + } + if ep.OriginGroups != nil { + objectMap["originGroups"] = ep.OriginGroups + } + if ep.OriginPath != nil { + objectMap["originPath"] = ep.OriginPath + } + if ep.ContentTypesToCompress != nil { + objectMap["contentTypesToCompress"] = ep.ContentTypesToCompress + } + if ep.OriginHostHeader != nil { + objectMap["originHostHeader"] = ep.OriginHostHeader + } + if ep.IsCompressionEnabled != nil { + objectMap["isCompressionEnabled"] = ep.IsCompressionEnabled + } + if ep.IsHTTPAllowed != nil { + objectMap["isHttpAllowed"] = ep.IsHTTPAllowed + } + if ep.IsHTTPSAllowed != nil { + objectMap["isHttpsAllowed"] = ep.IsHTTPSAllowed + } + if ep.QueryStringCachingBehavior != "" { + objectMap["queryStringCachingBehavior"] = ep.QueryStringCachingBehavior + } + if ep.OptimizationType != "" { + objectMap["optimizationType"] = ep.OptimizationType + } + if ep.ProbePath != nil { + objectMap["probePath"] = ep.ProbePath + } + if ep.GeoFilters != nil { + objectMap["geoFilters"] = ep.GeoFilters + } + if ep.DefaultOriginGroup != nil { + objectMap["defaultOriginGroup"] = ep.DefaultOriginGroup + } + if ep.URLSigningKeys != nil { + objectMap["urlSigningKeys"] = ep.URLSigningKeys + } + if ep.DeliveryPolicy != nil { + objectMap["deliveryPolicy"] = ep.DeliveryPolicy + } + if ep.WebApplicationFirewallPolicyLink != nil { + objectMap["webApplicationFirewallPolicyLink"] = ep.WebApplicationFirewallPolicyLink + } + return json.Marshal(objectMap) +} + +// EndpointPropertiesUpdateParameters the JSON object containing endpoint update parameters. +type EndpointPropertiesUpdateParameters struct { + // OriginPath - A directory path on the origin that CDN can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. + OriginPath *string `json:"originPath,omitempty"` + // ContentTypesToCompress - List of content types on which compression applies. The value should be a valid MIME type. + ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"` + // OriginHostHeader - The host header value sent to the origin with each request. This property at Endpoint is only allowed when endpoint uses single origin and can be overridden by the same property specified at origin.If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. + OriginHostHeader *string `json:"originHostHeader,omitempty"` + // IsCompressionEnabled - Indicates whether content compression is enabled on CDN. Default value is false. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on CDN when requested content is smaller than 1 byte or larger than 1 MB. + IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"` + // IsHTTPAllowed - Indicates whether HTTP traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed. + IsHTTPAllowed *bool `json:"isHttpAllowed,omitempty"` + // IsHTTPSAllowed - Indicates whether HTTPS traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed. + IsHTTPSAllowed *bool `json:"isHttpsAllowed,omitempty"` + // QueryStringCachingBehavior - Defines how CDN caches requests that include query strings. You can ignore any query strings when caching, bypass caching to prevent requests that contain query strings from being cached, or cache every request with a unique URL. Possible values include: 'QueryStringCachingBehaviorIgnoreQueryString', 'QueryStringCachingBehaviorBypassCaching', 'QueryStringCachingBehaviorUseQueryString', 'QueryStringCachingBehaviorNotSet' + QueryStringCachingBehavior QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` + // OptimizationType - Specifies what scenario the customer wants this CDN endpoint to optimize for, e.g. Download, Media services. With this information, CDN can apply scenario driven optimization. Possible values include: 'OptimizationTypeGeneralWebDelivery', 'OptimizationTypeGeneralMediaStreaming', 'OptimizationTypeVideoOnDemandMediaStreaming', 'OptimizationTypeLargeFileDownload', 'OptimizationTypeDynamicSiteAcceleration' + OptimizationType OptimizationType `json:"optimizationType,omitempty"` + // ProbePath - Path to a file hosted on the origin which helps accelerate delivery of the dynamic content and calculate the most optimal routes for the CDN. This is relative to the origin path. This property is only relevant when using a single origin. + ProbePath *string `json:"probePath,omitempty"` + // GeoFilters - List of rules defining the user's geo access within a CDN endpoint. Each geo filter defines an access rule to a specified path or content, e.g. block APAC for path /pictures/ + GeoFilters *[]GeoFilter `json:"geoFilters,omitempty"` + // DefaultOriginGroup - A reference to the origin group. + DefaultOriginGroup *ResourceReference `json:"defaultOriginGroup,omitempty"` + // URLSigningKeys - List of keys used to validate the signed URL hashes. + URLSigningKeys *[]URLSigningKey `json:"urlSigningKeys,omitempty"` + // DeliveryPolicy - A policy that specifies the delivery rules to be used for an endpoint. + DeliveryPolicy *EndpointPropertiesUpdateParametersDeliveryPolicy `json:"deliveryPolicy,omitempty"` + // WebApplicationFirewallPolicyLink - Defines the Web Application Firewall policy for the endpoint (if applicable) + WebApplicationFirewallPolicyLink *EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` +} + +// EndpointPropertiesUpdateParametersDeliveryPolicy a policy that specifies the delivery rules to be used +// for an endpoint. +type EndpointPropertiesUpdateParametersDeliveryPolicy struct { + // Description - User-friendly description of the policy. + Description *string `json:"description,omitempty"` + // Rules - A list of the delivery rules. + Rules *[]DeliveryRule `json:"rules,omitempty"` +} + +// EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink defines the Web Application Firewall +// policy for the endpoint (if applicable) +type EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// EndpointsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointsClient) (Endpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointsCreateFuture.Result. +func (future *EndpointsCreateFuture) result(client EndpointsClient) (e Endpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.EndpointsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.CreateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsCreateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// EndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointsDeleteFuture.Result. +func (future *EndpointsDeleteFuture) result(client EndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.EndpointsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// EndpointsLoadContentFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointsLoadContentFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointsLoadContentFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointsLoadContentFuture.Result. +func (future *EndpointsLoadContentFuture) result(client EndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsLoadContentFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.EndpointsLoadContentFuture") + return + } + ar.Response = future.Response() + return +} + +// EndpointsPurgeContentFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointsPurgeContentFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointsPurgeContentFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointsPurgeContentFuture.Result. +func (future *EndpointsPurgeContentFuture) result(client EndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsPurgeContentFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.EndpointsPurgeContentFuture") + return + } + ar.Response = future.Response() + return +} + +// EndpointsStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointsStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointsClient) (Endpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointsStartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointsStartFuture.Result. +func (future *EndpointsStartFuture) result(client EndpointsClient) (e Endpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.EndpointsStartFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.StartResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsStartFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// EndpointsStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointsStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointsClient) (Endpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointsStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointsStopFuture.Result. +func (future *EndpointsStopFuture) result(client EndpointsClient) (e Endpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.EndpointsStopFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.StopResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsStopFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// EndpointsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointsClient) (Endpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointsUpdateFuture.Result. +func (future *EndpointsUpdateFuture) result(client EndpointsClient) (e Endpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.EndpointsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.UpdateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsUpdateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// EndpointType defines the ARM Resource ID for the linked endpoints +type EndpointType struct { + // ID - ARM Resource ID string. + ID *string `json:"id,omitempty"` +} + +// EndpointUpdateParameters properties required to create or update an endpoint. +type EndpointUpdateParameters struct { + // Tags - Endpoint tags. + Tags map[string]*string `json:"tags"` + *EndpointPropertiesUpdateParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointUpdateParameters. +func (eup EndpointUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if eup.Tags != nil { + objectMap["tags"] = eup.Tags + } + if eup.EndpointPropertiesUpdateParameters != nil { + objectMap["properties"] = eup.EndpointPropertiesUpdateParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EndpointUpdateParameters struct. +func (eup *EndpointUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + eup.Tags = tags + } + case "properties": + if v != nil { + var endpointPropertiesUpdateParameters EndpointPropertiesUpdateParameters + err = json.Unmarshal(*v, &endpointPropertiesUpdateParameters) + if err != nil { + return err + } + eup.EndpointPropertiesUpdateParameters = &endpointPropertiesUpdateParameters + } + } + } + + return nil +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse error response indicates Azure Front Door Standard or Azure Front Door Premium or CDN +// service is not able to process the incoming request. The reason is provided in the error message. +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// GeoFilter rules defining user's geo access within a CDN endpoint. +type GeoFilter struct { + // RelativePath - Relative path applicable to geo filter. (e.g. '/mypictures', '/mypicture/kitty.jpg', and etc.) + RelativePath *string `json:"relativePath,omitempty"` + // Action - Action of the geo filter, i.e. allow or block access. Possible values include: 'GeoFilterActionsBlock', 'GeoFilterActionsAllow' + Action GeoFilterActions `json:"action,omitempty"` + // CountryCodes - Two letter country or region codes defining user country or region access in a geo filter, e.g. AU, MX, US. + CountryCodes *[]string `json:"countryCodes,omitempty"` +} + +// HeaderActionParameters defines the parameters for the request header action. +type HeaderActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // HeaderAction - Action to perform. Possible values include: 'HeaderActionAppend', 'HeaderActionOverwrite', 'HeaderActionDelete' + HeaderAction HeaderAction `json:"headerAction,omitempty"` + // HeaderName - Name of the header to modify + HeaderName *string `json:"headerName,omitempty"` + // Value - Value for the specified action + Value *string `json:"value,omitempty"` +} + +// HealthProbeParameters the JSON object that contains the properties to send health probes to origin. +type HealthProbeParameters struct { + // ProbePath - The path relative to the origin that is used to determine the health of the origin. + ProbePath *string `json:"probePath,omitempty"` + // ProbeRequestType - The type of health probe request that is made. Possible values include: 'HealthProbeRequestTypeNotSet', 'HealthProbeRequestTypeGET', 'HealthProbeRequestTypeHEAD' + ProbeRequestType HealthProbeRequestType `json:"probeRequestType,omitempty"` + // ProbeProtocol - Protocol to use for health probe. Possible values include: 'ProbeProtocolNotSet', 'ProbeProtocolHTTP', 'ProbeProtocolHTTPS' + ProbeProtocol ProbeProtocol `json:"probeProtocol,omitempty"` + // ProbeIntervalInSeconds - The number of seconds between health probes.Default is 240sec. + ProbeIntervalInSeconds *int32 `json:"probeIntervalInSeconds,omitempty"` +} + +// HostNameMatchConditionParameters defines the parameters for HostName match conditions +type HostNameMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'HostNameOperatorAny', 'HostNameOperatorEqual', 'HostNameOperatorContains', 'HostNameOperatorBeginsWith', 'HostNameOperatorEndsWith', 'HostNameOperatorLessThan', 'HostNameOperatorLessThanOrEqual', 'HostNameOperatorGreaterThan', 'HostNameOperatorGreaterThanOrEqual', 'HostNameOperatorRegEx' + Operator HostNameOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// HTTPErrorRangeParameters the JSON object that represents the range for http status codes +type HTTPErrorRangeParameters struct { + // Begin - The inclusive start of the http status code range. + Begin *int32 `json:"begin,omitempty"` + // End - The inclusive end of the http status code range. + End *int32 `json:"end,omitempty"` +} + +// HTTPVersionMatchConditionParameters defines the parameters for HttpVersion match conditions +type HTTPVersionMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched + Operator *string `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// IPAddressGroup CDN Ip address group +type IPAddressGroup struct { + // DeliveryRegion - The delivery region of the ip address group + DeliveryRegion *string `json:"deliveryRegion,omitempty"` + // Ipv4Addresses - The list of ip v4 addresses. + Ipv4Addresses *[]CidrIPAddress `json:"ipv4Addresses,omitempty"` + // Ipv6Addresses - The list of ip v6 addresses. + Ipv6Addresses *[]CidrIPAddress `json:"ipv6Addresses,omitempty"` +} + +// IsDeviceMatchConditionParameters defines the parameters for IsDevice match conditions +type IsDeviceMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched + Operator *string `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// KeyVaultCertificateSourceParameters describes the parameters for using a user's KeyVault certificate for +// securing custom domain. +type KeyVaultCertificateSourceParameters struct { + TypeName *string `json:"typeName,omitempty"` + // SubscriptionID - Subscription Id of the user's Key Vault containing the SSL certificate + SubscriptionID *string `json:"subscriptionId,omitempty"` + // ResourceGroupName - Resource group of the user's Key Vault containing the SSL certificate + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // VaultName - The name of the user's Key Vault containing the SSL certificate + VaultName *string `json:"vaultName,omitempty"` + // SecretName - The name of Key Vault Secret (representing the full certificate PFX) in Key Vault. + SecretName *string `json:"secretName,omitempty"` + // SecretVersion - The version(GUID) of Key Vault Secret in Key Vault. + SecretVersion *string `json:"secretVersion,omitempty"` + // UpdateRule - Describes the action that shall be taken when the certificate is updated in Key Vault. + UpdateRule *string `json:"updateRule,omitempty"` + // DeleteRule - Describes the action that shall be taken when the certificate is removed from Key Vault. + DeleteRule *string `json:"deleteRule,omitempty"` +} + +// KeyVaultSigningKeyParameters describes the parameters for using a user's KeyVault for URL Signing Key. +type KeyVaultSigningKeyParameters struct { + TypeName *string `json:"typeName,omitempty"` + // SubscriptionID - Subscription Id of the user's Key Vault containing the secret + SubscriptionID *string `json:"subscriptionId,omitempty"` + // ResourceGroupName - Resource group of the user's Key Vault containing the secret + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // VaultName - The name of the user's Key Vault containing the secret + VaultName *string `json:"vaultName,omitempty"` + // SecretName - The name of secret in Key Vault. + SecretName *string `json:"secretName,omitempty"` + // SecretVersion - The version(GUID) of secret in Key Vault. + SecretVersion *string `json:"secretVersion,omitempty"` +} + +// LoadBalancingSettingsParameters round-Robin load balancing settings for a backend pool +type LoadBalancingSettingsParameters struct { + // SampleSize - The number of samples to consider for load balancing decisions + SampleSize *int32 `json:"sampleSize,omitempty"` + // SuccessfulSamplesRequired - The number of samples within the sample period that must succeed + SuccessfulSamplesRequired *int32 `json:"successfulSamplesRequired,omitempty"` + // AdditionalLatencyInMilliseconds - The additional latency in milliseconds for probes to fall into the lowest latency bucket + AdditionalLatencyInMilliseconds *int32 `json:"additionalLatencyInMilliseconds,omitempty"` +} + +// LoadParameters parameters required for content load. +type LoadParameters struct { + // ContentPaths - The path to the content to be loaded. Path should be a relative file URL of the origin. + ContentPaths *[]string `json:"contentPaths,omitempty"` +} + +// LogSpecification log specification of operation. +type LogSpecification struct { + // Name - Name of log specification. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of log specification. + DisplayName *string `json:"displayName,omitempty"` + // BlobDuration - Blob duration of specification. + BlobDuration *string `json:"blobDuration,omitempty"` + // LogFilterPattern - Pattern to filter based on name + LogFilterPattern *string `json:"logFilterPattern,omitempty"` +} + +// ManagedCertificate managed Certificate used for https +type ManagedCertificate struct { + // Type - Possible values include: 'SecretTypeURLSigningKey', 'SecretTypeCustomerCertificate', 'SecretTypeManagedCertificate', 'SecretTypeAzureFirstPartyManagedCertificate' + Type SecretType `json:"type,omitempty"` + // Subject - READ-ONLY; Subject name in the certificate. + Subject *string `json:"subject,omitempty"` + // ExpirationDate - READ-ONLY; Certificate expiration date. + ExpirationDate *string `json:"expirationDate,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedCertificate. +func (mc ManagedCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mc.Type != "" { + objectMap["type"] = mc.Type + } + return json.Marshal(objectMap) +} + +// ManagedCertificateParameters managed Certificate used for https +type ManagedCertificateParameters struct { + // Subject - READ-ONLY; Subject name in the certificate. + Subject *string `json:"subject,omitempty"` + // ExpirationDate - READ-ONLY; Certificate expiration date. + ExpirationDate *string `json:"expirationDate,omitempty"` + // Type - Possible values include: 'TypeBasicSecretParametersTypeSecretParameters', 'TypeBasicSecretParametersTypeURLSigningKey', 'TypeBasicSecretParametersTypeManagedCertificate', 'TypeBasicSecretParametersTypeCustomerCertificate', 'TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate' + Type TypeBasicSecretParameters `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedCertificateParameters. +func (mcp ManagedCertificateParameters) MarshalJSON() ([]byte, error) { + mcp.Type = TypeBasicSecretParametersTypeManagedCertificate + objectMap := make(map[string]interface{}) + if mcp.Type != "" { + objectMap["type"] = mcp.Type + } + return json.Marshal(objectMap) +} + +// AsURLSigningKeyParameters is the BasicSecretParameters implementation for ManagedCertificateParameters. +func (mcp ManagedCertificateParameters) AsURLSigningKeyParameters() (*URLSigningKeyParameters, bool) { + return nil, false +} + +// AsManagedCertificateParameters is the BasicSecretParameters implementation for ManagedCertificateParameters. +func (mcp ManagedCertificateParameters) AsManagedCertificateParameters() (*ManagedCertificateParameters, bool) { + return &mcp, true +} + +// AsCustomerCertificateParameters is the BasicSecretParameters implementation for ManagedCertificateParameters. +func (mcp ManagedCertificateParameters) AsCustomerCertificateParameters() (*CustomerCertificateParameters, bool) { + return nil, false +} + +// AsAzureFirstPartyManagedCertificateParameters is the BasicSecretParameters implementation for ManagedCertificateParameters. +func (mcp ManagedCertificateParameters) AsAzureFirstPartyManagedCertificateParameters() (*AzureFirstPartyManagedCertificateParameters, bool) { + return nil, false +} + +// AsSecretParameters is the BasicSecretParameters implementation for ManagedCertificateParameters. +func (mcp ManagedCertificateParameters) AsSecretParameters() (*SecretParameters, bool) { + return nil, false +} + +// AsBasicSecretParameters is the BasicSecretParameters implementation for ManagedCertificateParameters. +func (mcp ManagedCertificateParameters) AsBasicSecretParameters() (BasicSecretParameters, bool) { + return &mcp, true +} + +// ManagedHTTPSParameters defines the certificate source parameters using CDN managed certificate for +// enabling SSL. +type ManagedHTTPSParameters struct { + // CertificateSourceParameters - Defines the certificate source parameters using CDN managed certificate for enabling SSL. + CertificateSourceParameters *CertificateSourceParameters `json:"certificateSourceParameters,omitempty"` + // ProtocolType - Defines the TLS extension protocol that is used for secure delivery. Possible values include: 'ProtocolTypeServerNameIndication', 'ProtocolTypeIPBased' + ProtocolType ProtocolType `json:"protocolType,omitempty"` + // MinimumTLSVersion - TLS protocol version that will be used for Https. Possible values include: 'MinimumTLSVersionNone', 'MinimumTLSVersionTLS10', 'MinimumTLSVersionTLS12' + MinimumTLSVersion MinimumTLSVersion `json:"minimumTlsVersion,omitempty"` + // CertificateSource - Possible values include: 'CertificateSourceCustomDomainHTTPSParameters', 'CertificateSourceAzureKeyVault', 'CertificateSourceCdn' + CertificateSource CertificateSource `json:"certificateSource,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedHTTPSParameters. +func (mhp ManagedHTTPSParameters) MarshalJSON() ([]byte, error) { + mhp.CertificateSource = CertificateSourceCdn + objectMap := make(map[string]interface{}) + if mhp.CertificateSourceParameters != nil { + objectMap["certificateSourceParameters"] = mhp.CertificateSourceParameters + } + if mhp.ProtocolType != "" { + objectMap["protocolType"] = mhp.ProtocolType + } + if mhp.MinimumTLSVersion != "" { + objectMap["minimumTlsVersion"] = mhp.MinimumTLSVersion + } + if mhp.CertificateSource != "" { + objectMap["certificateSource"] = mhp.CertificateSource + } + return json.Marshal(objectMap) +} + +// AsUserManagedHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for ManagedHTTPSParameters. +func (mhp ManagedHTTPSParameters) AsUserManagedHTTPSParameters() (*UserManagedHTTPSParameters, bool) { + return nil, false +} + +// AsManagedHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for ManagedHTTPSParameters. +func (mhp ManagedHTTPSParameters) AsManagedHTTPSParameters() (*ManagedHTTPSParameters, bool) { + return &mhp, true +} + +// AsCustomDomainHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for ManagedHTTPSParameters. +func (mhp ManagedHTTPSParameters) AsCustomDomainHTTPSParameters() (*CustomDomainHTTPSParameters, bool) { + return nil, false +} + +// AsBasicCustomDomainHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for ManagedHTTPSParameters. +func (mhp ManagedHTTPSParameters) AsBasicCustomDomainHTTPSParameters() (BasicCustomDomainHTTPSParameters, bool) { + return &mhp, true +} + +// ManagedRuleDefinition describes a managed rule definition. +type ManagedRuleDefinition struct { + // RuleID - READ-ONLY; Identifier for the managed rule. + RuleID *string `json:"ruleId,omitempty"` + // Description - READ-ONLY; Describes the functionality of the managed rule. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedRuleDefinition. +func (mrd ManagedRuleDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedRuleGroupDefinition describes a managed rule group. +type ManagedRuleGroupDefinition struct { + // RuleGroupName - READ-ONLY; Name of the managed rule group. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + // Description - READ-ONLY; Description of the managed rule group. + Description *string `json:"description,omitempty"` + // Rules - READ-ONLY; List of rules within the managed rule group. + Rules *[]ManagedRuleDefinition `json:"rules,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedRuleGroupDefinition. +func (mrgd ManagedRuleGroupDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedRuleGroupOverride defines a managed rule group override setting. +type ManagedRuleGroupOverride struct { + // RuleGroupName - Describes the managed rule group within the rule set to override + RuleGroupName *string `json:"ruleGroupName,omitempty"` + // Rules - List of rules that will be disabled. If none specified, all rules in the group will be disabled. + Rules *[]ManagedRuleOverride `json:"rules,omitempty"` +} + +// ManagedRuleOverride defines a managed rule group override setting. +type ManagedRuleOverride struct { + // RuleID - Identifier for the managed rule. + RuleID *string `json:"ruleId,omitempty"` + // EnabledState - Describes if the managed rule is in enabled or disabled state. Defaults to Disabled if not specified. Possible values include: 'ManagedRuleEnabledStateDisabled', 'ManagedRuleEnabledStateEnabled' + EnabledState ManagedRuleEnabledState `json:"enabledState,omitempty"` + // Action - Describes the override action to be applied when rule matches. Possible values include: 'ActionTypeAllow', 'ActionTypeBlock', 'ActionTypeLog', 'ActionTypeRedirect' + Action ActionType `json:"action,omitempty"` +} + +// ManagedRuleSet defines a managed rule set. +type ManagedRuleSet struct { + // RuleSetType - Defines the rule set type to use. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - Defines the version of the rule set to use. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + // AnomalyScore - Verizon only : If the rule set supports anomaly detection mode, this describes the threshold for blocking requests. + AnomalyScore *int32 `json:"anomalyScore,omitempty"` + // RuleGroupOverrides - Defines the rule overrides to apply to the rule set. + RuleGroupOverrides *[]ManagedRuleGroupOverride `json:"ruleGroupOverrides,omitempty"` +} + +// ManagedRuleSetDefinition describes a managed rule set definition. +type ManagedRuleSetDefinition struct { + // ManagedRuleSetDefinitionProperties - Describes managed rule set definition properties. + *ManagedRuleSetDefinitionProperties `json:"properties,omitempty"` + // Sku - The pricing tier (defines a CDN provider, feature list and rate) of the CdnWebApplicationFirewallPolicy. + Sku *Sku `json:"sku,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedRuleSetDefinition. +func (mrsd ManagedRuleSetDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mrsd.ManagedRuleSetDefinitionProperties != nil { + objectMap["properties"] = mrsd.ManagedRuleSetDefinitionProperties + } + if mrsd.Sku != nil { + objectMap["sku"] = mrsd.Sku + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedRuleSetDefinition struct. +func (mrsd *ManagedRuleSetDefinition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managedRuleSetDefinitionProperties ManagedRuleSetDefinitionProperties + err = json.Unmarshal(*v, &managedRuleSetDefinitionProperties) + if err != nil { + return err + } + mrsd.ManagedRuleSetDefinitionProperties = &managedRuleSetDefinitionProperties + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + mrsd.Sku = &sku + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mrsd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mrsd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mrsd.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mrsd.SystemData = &systemData + } + } + } + + return nil +} + +// ManagedRuleSetDefinitionList list of managed rule set definitions available for use in a policy. +type ManagedRuleSetDefinitionList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of managed rule set definitions. + Value *[]ManagedRuleSetDefinition `json:"value,omitempty"` + // NextLink - URL to retrieve next set of managed rule set definitions. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedRuleSetDefinitionList. +func (mrsdl ManagedRuleSetDefinitionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mrsdl.NextLink != nil { + objectMap["nextLink"] = mrsdl.NextLink + } + return json.Marshal(objectMap) +} + +// ManagedRuleSetDefinitionListIterator provides access to a complete listing of ManagedRuleSetDefinition +// values. +type ManagedRuleSetDefinitionListIterator struct { + i int + page ManagedRuleSetDefinitionListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedRuleSetDefinitionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetDefinitionListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedRuleSetDefinitionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedRuleSetDefinitionListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedRuleSetDefinitionListIterator) Response() ManagedRuleSetDefinitionList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedRuleSetDefinitionListIterator) Value() ManagedRuleSetDefinition { + if !iter.page.NotDone() { + return ManagedRuleSetDefinition{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedRuleSetDefinitionListIterator type. +func NewManagedRuleSetDefinitionListIterator(page ManagedRuleSetDefinitionListPage) ManagedRuleSetDefinitionListIterator { + return ManagedRuleSetDefinitionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mrsdl ManagedRuleSetDefinitionList) IsEmpty() bool { + return mrsdl.Value == nil || len(*mrsdl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mrsdl ManagedRuleSetDefinitionList) hasNextLink() bool { + return mrsdl.NextLink != nil && len(*mrsdl.NextLink) != 0 +} + +// managedRuleSetDefinitionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mrsdl ManagedRuleSetDefinitionList) managedRuleSetDefinitionListPreparer(ctx context.Context) (*http.Request, error) { + if !mrsdl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mrsdl.NextLink))) +} + +// ManagedRuleSetDefinitionListPage contains a page of ManagedRuleSetDefinition values. +type ManagedRuleSetDefinitionListPage struct { + fn func(context.Context, ManagedRuleSetDefinitionList) (ManagedRuleSetDefinitionList, error) + mrsdl ManagedRuleSetDefinitionList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedRuleSetDefinitionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetDefinitionListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mrsdl) + if err != nil { + return err + } + page.mrsdl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedRuleSetDefinitionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedRuleSetDefinitionListPage) NotDone() bool { + return !page.mrsdl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedRuleSetDefinitionListPage) Response() ManagedRuleSetDefinitionList { + return page.mrsdl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedRuleSetDefinitionListPage) Values() []ManagedRuleSetDefinition { + if page.mrsdl.IsEmpty() { + return nil + } + return *page.mrsdl.Value +} + +// Creates a new instance of the ManagedRuleSetDefinitionListPage type. +func NewManagedRuleSetDefinitionListPage(cur ManagedRuleSetDefinitionList, getNextPage func(context.Context, ManagedRuleSetDefinitionList) (ManagedRuleSetDefinitionList, error)) ManagedRuleSetDefinitionListPage { + return ManagedRuleSetDefinitionListPage{ + fn: getNextPage, + mrsdl: cur, + } +} + +// ManagedRuleSetDefinitionProperties properties for a managed rule set definition. +type ManagedRuleSetDefinitionProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the managed rule set. + ProvisioningState *string `json:"provisioningState,omitempty"` + // RuleSetType - READ-ONLY; Type of the managed rule set. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - READ-ONLY; Version of the managed rule set type. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + // RuleGroups - READ-ONLY; Rule groups of the managed rule set. + RuleGroups *[]ManagedRuleGroupDefinition `json:"ruleGroups,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedRuleSetDefinitionProperties. +func (mrsdp ManagedRuleSetDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedRuleSetList defines the list of managed rule sets for the policy. +type ManagedRuleSetList struct { + // ManagedRuleSets - List of rule sets. + ManagedRuleSets *[]ManagedRuleSet `json:"managedRuleSets,omitempty"` +} + +// MatchCondition define match conditions +type MatchCondition struct { + // MatchVariable - Match variable to compare against. Possible values include: 'WafMatchVariableRemoteAddr', 'WafMatchVariableSocketAddr', 'WafMatchVariableRequestMethod', 'WafMatchVariableRequestHeader', 'WafMatchVariableRequestURI', 'WafMatchVariableQueryString', 'WafMatchVariableRequestBody', 'WafMatchVariableCookies', 'WafMatchVariablePostArgs' + MatchVariable WafMatchVariable `json:"matchVariable,omitempty"` + // Selector - Selector can used to match a specific key for QueryString, Cookies, RequestHeader or PostArgs. + Selector *string `json:"selector,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'OperatorAny', 'OperatorIPMatch', 'OperatorGeoMatch', 'OperatorEqual', 'OperatorContains', 'OperatorLessThan', 'OperatorGreaterThan', 'OperatorLessThanOrEqual', 'OperatorGreaterThanOrEqual', 'OperatorBeginsWith', 'OperatorEndsWith', 'OperatorRegEx' + Operator Operator `json:"operator,omitempty"` + // NegateCondition - Describes if the result of this condition should be negated. + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValue - List of possible match values. + MatchValue *[]string `json:"matchValue,omitempty"` + // Transforms - List of transforms. + Transforms *[]TransformType `json:"transforms,omitempty"` +} + +// MetricAvailability retention policy of a resource metric. +type MetricAvailability struct { + TimeGrain *string `json:"timeGrain,omitempty"` + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// MetricSpecification metric specification of operation. +type MetricSpecification struct { + // Name - Name of metric specification. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of metric specification. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Display description of metric specification. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + Unit *string `json:"unit,omitempty"` + // AggregationType - The metric aggregation type. Possible values include: 'Average', 'Count', 'Total'. + AggregationType *string `json:"aggregationType,omitempty"` + // Availabilities - Retention policies of a resource metric. + Availabilities *[]MetricAvailability `json:"availabilities,omitempty"` + // SupportedTimeGrainTypes - The supported time grain types for the metrics. + SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` + // Dimensions - The dimensions of metric + Dimensions *[]DimensionProperties `json:"dimensions,omitempty"` + // FillGapWithZero - Property to specify whether to fill gap with zero. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // MetricFilterPattern - Pattern to filter based on name + MetricFilterPattern *string `json:"metricFilterPattern,omitempty"` + // IsInternal - Property to specify metric is internal or not. + IsInternal *bool `json:"isInternal,omitempty"` +} + +// MetricsResponse metrics Response +type MetricsResponse struct { + autorest.Response `json:"-"` + DateTimeBegin *date.Time `json:"dateTimeBegin,omitempty"` + DateTimeEnd *date.Time `json:"dateTimeEnd,omitempty"` + // Granularity - Possible values include: 'GranularityPT5M', 'GranularityPT1H', 'GranularityP1D' + Granularity Granularity `json:"granularity,omitempty"` + Series *[]MetricsResponseSeriesItem `json:"series,omitempty"` +} + +// MetricsResponseSeriesItem ... +type MetricsResponseSeriesItem struct { + Metric *string `json:"metric,omitempty"` + // Unit - Possible values include: 'UnitCount', 'UnitBytes', 'UnitBitsPerSecond', 'UnitMilliSeconds' + Unit Unit `json:"unit,omitempty"` + Groups *[]MetricsResponseSeriesItemGroupsItem `json:"groups,omitempty"` + Data *[]MetricsResponseSeriesItemDataItem `json:"data,omitempty"` +} + +// MetricsResponseSeriesItemDataItem ... +type MetricsResponseSeriesItemDataItem struct { + DateTime *date.Time `json:"dateTime,omitempty"` + Value *float64 `json:"value,omitempty"` +} + +// MetricsResponseSeriesItemGroupsItem ... +type MetricsResponseSeriesItemGroupsItem struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// Operation CDN REST API operation +type Operation struct { + // Name - READ-ONLY; Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - The object that represents the operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - READ-ONLY; The origin of operations. + Origin *string `json:"origin,omitempty"` + // OperationProperties - Properties of operation, include metric specifications. + *OperationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.IsDataAction != nil { + objectMap["isDataAction"] = o.IsDataAction + } + if o.Display != nil { + objectMap["display"] = o.Display + } + if o.OperationProperties != nil { + objectMap["properties"] = o.OperationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Operation struct. +func (o *Operation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o.Name = &name + } + case "isDataAction": + if v != nil { + var isDataAction bool + err = json.Unmarshal(*v, &isDataAction) + if err != nil { + return err + } + o.IsDataAction = &isDataAction + } + case "display": + if v != nil { + var display OperationDisplay + err = json.Unmarshal(*v, &display) + if err != nil { + return err + } + o.Display = &display + } + case "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + o.Origin = &origin + } + case "properties": + if v != nil { + var operationProperties OperationProperties + err = json.Unmarshal(*v, &operationProperties) + if err != nil { + return err + } + o.OperationProperties = &operationProperties + } + } + } + + return nil +} + +// OperationDisplay the object that represents the operation. +type OperationDisplay struct { + // Provider - READ-ONLY; Service provider: Microsoft.Cdn + Provider *string `json:"provider,omitempty"` + // Resource - READ-ONLY; Resource on which the operation is performed: Profile, endpoint, etc. + Resource *string `json:"resource,omitempty"` + // Operation - READ-ONLY; Operation type: Read, write, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - READ-ONLY; Description of operation. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationProperties properties of operation, include metric specifications. +type OperationProperties struct { + // ServiceSpecification - One property of operation, include metric specifications. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// OperationsListResult result of the request to list CDN operations. It contains a list of operations and +// a URL link to get the next set of results. +type OperationsListResult struct { + autorest.Response `json:"-"` + // Value - List of CDN operations supported by the CDN resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationsListResultIterator provides access to a complete listing of Operation values. +type OperationsListResultIterator struct { + i int + page OperationsListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationsListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationsListResultIterator) Response() OperationsListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationsListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationsListResultIterator type. +func NewOperationsListResultIterator(page OperationsListResultPage) OperationsListResultIterator { + return OperationsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationsListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationsListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationsListResult) operationsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationsListResultPage contains a page of Operation values. +type OperationsListResultPage struct { + fn func(context.Context, OperationsListResult) (OperationsListResult, error) + olr OperationsListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationsListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationsListResultPage) Response() OperationsListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationsListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationsListResultPage type. +func NewOperationsListResultPage(cur OperationsListResult, getNextPage func(context.Context, OperationsListResult) (OperationsListResult, error)) OperationsListResultPage { + return OperationsListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// Origin CDN origin is the source of the content being delivered via CDN. When the edge nodes represented +// by an endpoint do not have the requested content cached, they attempt to fetch it from one or more of +// the configured origins. +type Origin struct { + autorest.Response `json:"-"` + *OriginProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Origin. +func (o Origin) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.OriginProperties != nil { + objectMap["properties"] = o.OriginProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Origin struct. +func (o *Origin) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var originProperties OriginProperties + err = json.Unmarshal(*v, &originProperties) + if err != nil { + return err + } + o.OriginProperties = &originProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + o.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + o.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + o.SystemData = &systemData + } + } + } + + return nil +} + +// OriginGroup origin group comprising of origins is used for load balancing to origins when the content +// cannot be served from CDN. +type OriginGroup struct { + autorest.Response `json:"-"` + *OriginGroupProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginGroup. +func (og OriginGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if og.OriginGroupProperties != nil { + objectMap["properties"] = og.OriginGroupProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OriginGroup struct. +func (og *OriginGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var originGroupProperties OriginGroupProperties + err = json.Unmarshal(*v, &originGroupProperties) + if err != nil { + return err + } + og.OriginGroupProperties = &originGroupProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + og.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + og.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + og.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + og.SystemData = &systemData + } + } + } + + return nil +} + +// OriginGroupListResult result of the request to list origin groups. It contains a list of origin groups +// objects and a URL link to get the next set of results. +type OriginGroupListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of CDN origin groups within an endpoint + Value *[]OriginGroup `json:"value,omitempty"` + // NextLink - URL to get the next set of origin objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginGroupListResult. +func (oglr OriginGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oglr.NextLink != nil { + objectMap["nextLink"] = oglr.NextLink + } + return json.Marshal(objectMap) +} + +// OriginGroupListResultIterator provides access to a complete listing of OriginGroup values. +type OriginGroupListResultIterator struct { + i int + page OriginGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OriginGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OriginGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OriginGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OriginGroupListResultIterator) Response() OriginGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OriginGroupListResultIterator) Value() OriginGroup { + if !iter.page.NotDone() { + return OriginGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OriginGroupListResultIterator type. +func NewOriginGroupListResultIterator(page OriginGroupListResultPage) OriginGroupListResultIterator { + return OriginGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (oglr OriginGroupListResult) IsEmpty() bool { + return oglr.Value == nil || len(*oglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (oglr OriginGroupListResult) hasNextLink() bool { + return oglr.NextLink != nil && len(*oglr.NextLink) != 0 +} + +// originGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (oglr OriginGroupListResult) originGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !oglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(oglr.NextLink))) +} + +// OriginGroupListResultPage contains a page of OriginGroup values. +type OriginGroupListResultPage struct { + fn func(context.Context, OriginGroupListResult) (OriginGroupListResult, error) + oglr OriginGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OriginGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.oglr) + if err != nil { + return err + } + page.oglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OriginGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OriginGroupListResultPage) NotDone() bool { + return !page.oglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OriginGroupListResultPage) Response() OriginGroupListResult { + return page.oglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OriginGroupListResultPage) Values() []OriginGroup { + if page.oglr.IsEmpty() { + return nil + } + return *page.oglr.Value +} + +// Creates a new instance of the OriginGroupListResultPage type. +func NewOriginGroupListResultPage(cur OriginGroupListResult, getNextPage func(context.Context, OriginGroupListResult) (OriginGroupListResult, error)) OriginGroupListResultPage { + return OriginGroupListResultPage{ + fn: getNextPage, + oglr: cur, + } +} + +// OriginGroupOverride defines the parameters for the origin group override configuration. +type OriginGroupOverride struct { + // OriginGroup - defines the OriginGroup that would override the DefaultOriginGroup on route. + OriginGroup *ResourceReference `json:"originGroup,omitempty"` + // ForwardingProtocol - Protocol this rule will use when forwarding traffic to backends. Possible values include: 'ForwardingProtocolHTTPOnly', 'ForwardingProtocolHTTPSOnly', 'ForwardingProtocolMatchRequest' + ForwardingProtocol ForwardingProtocol `json:"forwardingProtocol,omitempty"` +} + +// OriginGroupOverrideAction defines the origin group override action for the delivery rule. +type OriginGroupOverrideAction struct { + // Parameters - Defines the parameters for the action. + Parameters *OriginGroupOverrideActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) MarshalJSON() ([]byte, error) { + ogoa.Name = NameBasicDeliveryRuleActionNameOriginGroupOverride + objectMap := make(map[string]interface{}) + if ogoa.Parameters != nil { + objectMap["parameters"] = ogoa.Parameters + } + if ogoa.Name != "" { + objectMap["name"] = ogoa.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return &ogoa, true +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for OriginGroupOverrideAction. +func (ogoa OriginGroupOverrideAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &ogoa, true +} + +// OriginGroupOverrideActionParameters defines the parameters for the origin group override action. +type OriginGroupOverrideActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // OriginGroup - defines the OriginGroup that would override the DefaultOriginGroup. + OriginGroup *ResourceReference `json:"originGroup,omitempty"` +} + +// OriginGroupProperties the JSON object that contains the properties of the origin group. +type OriginGroupProperties struct { + // ResourceState - READ-ONLY; Resource status of the origin group. Possible values include: 'OriginGroupResourceStateCreating', 'OriginGroupResourceStateActive', 'OriginGroupResourceStateDeleting' + ResourceState OriginGroupResourceState `json:"resourceState,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status of the origin group. + ProvisioningState *string `json:"provisioningState,omitempty"` + // HealthProbeSettings - Health probe settings to the origin that is used to determine the health of the origin. + HealthProbeSettings *HealthProbeParameters `json:"healthProbeSettings,omitempty"` + // Origins - The source of the content being delivered via CDN within given origin group. + Origins *[]ResourceReference `json:"origins,omitempty"` + // TrafficRestorationTimeToHealedOrNewEndpointsInMinutes - Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes *int32 `json:"trafficRestorationTimeToHealedOrNewEndpointsInMinutes,omitempty"` + // ResponseBasedOriginErrorDetectionSettings - The JSON object that contains the properties to determine origin health using real requests/responses. This property is currently not supported. + ResponseBasedOriginErrorDetectionSettings *ResponseBasedOriginErrorDetectionParameters `json:"responseBasedOriginErrorDetectionSettings,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginGroupProperties. +func (ogp OriginGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ogp.HealthProbeSettings != nil { + objectMap["healthProbeSettings"] = ogp.HealthProbeSettings + } + if ogp.Origins != nil { + objectMap["origins"] = ogp.Origins + } + if ogp.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes != nil { + objectMap["trafficRestorationTimeToHealedOrNewEndpointsInMinutes"] = ogp.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes + } + if ogp.ResponseBasedOriginErrorDetectionSettings != nil { + objectMap["responseBasedOriginErrorDetectionSettings"] = ogp.ResponseBasedOriginErrorDetectionSettings + } + return json.Marshal(objectMap) +} + +// OriginGroupsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OriginGroupsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OriginGroupsClient) (OriginGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OriginGroupsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OriginGroupsCreateFuture.Result. +func (future *OriginGroupsCreateFuture) result(client OriginGroupsClient) (og OriginGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + og.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.OriginGroupsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if og.Response.Response, err = future.GetResult(sender); err == nil && og.Response.Response.StatusCode != http.StatusNoContent { + og, err = client.CreateResponder(og.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsCreateFuture", "Result", og.Response.Response, "Failure responding to request") + } + } + return +} + +// OriginGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OriginGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OriginGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OriginGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OriginGroupsDeleteFuture.Result. +func (future *OriginGroupsDeleteFuture) result(client OriginGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.OriginGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// OriginGroupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OriginGroupsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OriginGroupsClient) (OriginGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OriginGroupsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OriginGroupsUpdateFuture.Result. +func (future *OriginGroupsUpdateFuture) result(client OriginGroupsClient) (og OriginGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + og.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.OriginGroupsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if og.Response.Response, err = future.GetResult(sender); err == nil && og.Response.Response.StatusCode != http.StatusNoContent { + og, err = client.UpdateResponder(og.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsUpdateFuture", "Result", og.Response.Response, "Failure responding to request") + } + } + return +} + +// OriginGroupUpdateParameters origin group properties needed for origin group creation or update. +type OriginGroupUpdateParameters struct { + *OriginGroupUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginGroupUpdateParameters. +func (ogup OriginGroupUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ogup.OriginGroupUpdatePropertiesParameters != nil { + objectMap["properties"] = ogup.OriginGroupUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OriginGroupUpdateParameters struct. +func (ogup *OriginGroupUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var originGroupUpdatePropertiesParameters OriginGroupUpdatePropertiesParameters + err = json.Unmarshal(*v, &originGroupUpdatePropertiesParameters) + if err != nil { + return err + } + ogup.OriginGroupUpdatePropertiesParameters = &originGroupUpdatePropertiesParameters + } + } + } + + return nil +} + +// OriginGroupUpdatePropertiesParameters the JSON object that contains the properties of the origin group. +type OriginGroupUpdatePropertiesParameters struct { + // HealthProbeSettings - Health probe settings to the origin that is used to determine the health of the origin. + HealthProbeSettings *HealthProbeParameters `json:"healthProbeSettings,omitempty"` + // Origins - The source of the content being delivered via CDN within given origin group. + Origins *[]ResourceReference `json:"origins,omitempty"` + // TrafficRestorationTimeToHealedOrNewEndpointsInMinutes - Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes *int32 `json:"trafficRestorationTimeToHealedOrNewEndpointsInMinutes,omitempty"` + // ResponseBasedOriginErrorDetectionSettings - The JSON object that contains the properties to determine origin health using real requests/responses. This property is currently not supported. + ResponseBasedOriginErrorDetectionSettings *ResponseBasedOriginErrorDetectionParameters `json:"responseBasedOriginErrorDetectionSettings,omitempty"` +} + +// OriginListResult result of the request to list origins. It contains a list of origin objects and a URL +// link to get the next set of results. +type OriginListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of CDN origins within an endpoint + Value *[]Origin `json:"value,omitempty"` + // NextLink - URL to get the next set of origin objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginListResult. +func (olr OriginListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if olr.NextLink != nil { + objectMap["nextLink"] = olr.NextLink + } + return json.Marshal(objectMap) +} + +// OriginListResultIterator provides access to a complete listing of Origin values. +type OriginListResultIterator struct { + i int + page OriginListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OriginListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OriginListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OriginListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OriginListResultIterator) Response() OriginListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OriginListResultIterator) Value() Origin { + if !iter.page.NotDone() { + return Origin{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OriginListResultIterator type. +func NewOriginListResultIterator(page OriginListResultPage) OriginListResultIterator { + return OriginListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OriginListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OriginListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// originListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OriginListResult) originListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OriginListResultPage contains a page of Origin values. +type OriginListResultPage struct { + fn func(context.Context, OriginListResult) (OriginListResult, error) + olr OriginListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OriginListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OriginListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OriginListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OriginListResultPage) Response() OriginListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OriginListResultPage) Values() []Origin { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OriginListResultPage type. +func NewOriginListResultPage(cur OriginListResult, getNextPage func(context.Context, OriginListResult) (OriginListResult, error)) OriginListResultPage { + return OriginListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// OriginProperties the JSON object that contains the properties of the origin. +type OriginProperties struct { + // ResourceState - READ-ONLY; Resource status of the origin. Possible values include: 'OriginResourceStateCreating', 'OriginResourceStateActive', 'OriginResourceStateDeleting' + ResourceState OriginResourceState `json:"resourceState,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status of the origin. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PrivateEndpointStatus - READ-ONLY; The approval status for the connection to the Private Link. Possible values include: 'PrivateEndpointStatusPending', 'PrivateEndpointStatusApproved', 'PrivateEndpointStatusRejected', 'PrivateEndpointStatusDisconnected', 'PrivateEndpointStatusTimeout' + PrivateEndpointStatus PrivateEndpointStatus `json:"privateEndpointStatus,omitempty"` + // HostName - The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. + HostName *string `json:"hostName,omitempty"` + // HTTPPort - The value of the HTTP port. Must be between 1 and 65535. + HTTPPort *int32 `json:"httpPort,omitempty"` + // HTTPSPort - The value of the HTTPS port. Must be between 1 and 65535. + HTTPSPort *int32 `json:"httpsPort,omitempty"` + // OriginHostHeader - The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint + OriginHostHeader *string `json:"originHostHeader,omitempty"` + // Priority - Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5 + Priority *int32 `json:"priority,omitempty"` + // Weight - Weight of the origin in given origin group for load balancing. Must be between 1 and 1000 + Weight *int32 `json:"weight,omitempty"` + // Enabled - Origin is enabled for load balancing or not + Enabled *bool `json:"enabled,omitempty"` + // PrivateLinkAlias - The Alias of the Private Link resource. Populating this optional field indicates that this origin is 'Private' + PrivateLinkAlias *string `json:"privateLinkAlias,omitempty"` + // PrivateLinkResourceID - The Resource Id of the Private Link resource. Populating this optional field indicates that this backend is 'Private' + PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` + // PrivateLinkLocation - The location of the Private Link resource. Required only if 'privateLinkResourceId' is populated + PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"` + // PrivateLinkApprovalMessage - A custom message to be included in the approval request to connect to the Private Link. + PrivateLinkApprovalMessage *string `json:"privateLinkApprovalMessage,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginProperties. +func (op OriginProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if op.HostName != nil { + objectMap["hostName"] = op.HostName + } + if op.HTTPPort != nil { + objectMap["httpPort"] = op.HTTPPort + } + if op.HTTPSPort != nil { + objectMap["httpsPort"] = op.HTTPSPort + } + if op.OriginHostHeader != nil { + objectMap["originHostHeader"] = op.OriginHostHeader + } + if op.Priority != nil { + objectMap["priority"] = op.Priority + } + if op.Weight != nil { + objectMap["weight"] = op.Weight + } + if op.Enabled != nil { + objectMap["enabled"] = op.Enabled + } + if op.PrivateLinkAlias != nil { + objectMap["privateLinkAlias"] = op.PrivateLinkAlias + } + if op.PrivateLinkResourceID != nil { + objectMap["privateLinkResourceId"] = op.PrivateLinkResourceID + } + if op.PrivateLinkLocation != nil { + objectMap["privateLinkLocation"] = op.PrivateLinkLocation + } + if op.PrivateLinkApprovalMessage != nil { + objectMap["privateLinkApprovalMessage"] = op.PrivateLinkApprovalMessage + } + return json.Marshal(objectMap) +} + +// OriginsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OriginsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OriginsClient) (Origin, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OriginsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OriginsCreateFuture.Result. +func (future *OriginsCreateFuture) result(client OriginsClient) (o Origin, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + o.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.OriginsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if o.Response.Response, err = future.GetResult(sender); err == nil && o.Response.Response.StatusCode != http.StatusNoContent { + o, err = client.CreateResponder(o.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsCreateFuture", "Result", o.Response.Response, "Failure responding to request") + } + } + return +} + +// OriginsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OriginsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OriginsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OriginsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OriginsDeleteFuture.Result. +func (future *OriginsDeleteFuture) result(client OriginsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.OriginsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// OriginsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OriginsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OriginsClient) (Origin, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OriginsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OriginsUpdateFuture.Result. +func (future *OriginsUpdateFuture) result(client OriginsClient) (o Origin, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + o.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.OriginsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if o.Response.Response, err = future.GetResult(sender); err == nil && o.Response.Response.StatusCode != http.StatusNoContent { + o, err = client.UpdateResponder(o.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsUpdateFuture", "Result", o.Response.Response, "Failure responding to request") + } + } + return +} + +// OriginUpdateParameters origin properties needed for origin update. +type OriginUpdateParameters struct { + *OriginUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginUpdateParameters. +func (oup OriginUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oup.OriginUpdatePropertiesParameters != nil { + objectMap["properties"] = oup.OriginUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OriginUpdateParameters struct. +func (oup *OriginUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var originUpdatePropertiesParameters OriginUpdatePropertiesParameters + err = json.Unmarshal(*v, &originUpdatePropertiesParameters) + if err != nil { + return err + } + oup.OriginUpdatePropertiesParameters = &originUpdatePropertiesParameters + } + } + } + + return nil +} + +// OriginUpdatePropertiesParameters the JSON object that contains the properties of the origin. +type OriginUpdatePropertiesParameters struct { + // HostName - The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. + HostName *string `json:"hostName,omitempty"` + // HTTPPort - The value of the HTTP port. Must be between 1 and 65535. + HTTPPort *int32 `json:"httpPort,omitempty"` + // HTTPSPort - The value of the HTTPS port. Must be between 1 and 65535. + HTTPSPort *int32 `json:"httpsPort,omitempty"` + // OriginHostHeader - The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint + OriginHostHeader *string `json:"originHostHeader,omitempty"` + // Priority - Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5 + Priority *int32 `json:"priority,omitempty"` + // Weight - Weight of the origin in given origin group for load balancing. Must be between 1 and 1000 + Weight *int32 `json:"weight,omitempty"` + // Enabled - Origin is enabled for load balancing or not + Enabled *bool `json:"enabled,omitempty"` + // PrivateLinkAlias - The Alias of the Private Link resource. Populating this optional field indicates that this origin is 'Private' + PrivateLinkAlias *string `json:"privateLinkAlias,omitempty"` + // PrivateLinkResourceID - The Resource Id of the Private Link resource. Populating this optional field indicates that this backend is 'Private' + PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` + // PrivateLinkLocation - The location of the Private Link resource. Required only if 'privateLinkResourceId' is populated + PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"` + // PrivateLinkApprovalMessage - A custom message to be included in the approval request to connect to the Private Link. + PrivateLinkApprovalMessage *string `json:"privateLinkApprovalMessage,omitempty"` +} + +// PoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PoliciesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PoliciesClient) (WebApplicationFirewallPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PoliciesCreateOrUpdateFuture.Result. +func (future *PoliciesCreateOrUpdateFuture) result(client PoliciesClient) (wafp WebApplicationFirewallPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + wafp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.PoliciesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if wafp.Response.Response, err = future.GetResult(sender); err == nil && wafp.Response.Response.StatusCode != http.StatusNoContent { + wafp, err = client.CreateOrUpdateResponder(wafp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesCreateOrUpdateFuture", "Result", wafp.Response.Response, "Failure responding to request") + } + } + return +} + +// PoliciesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PoliciesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PoliciesClient) (WebApplicationFirewallPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PoliciesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PoliciesUpdateFuture.Result. +func (future *PoliciesUpdateFuture) result(client PoliciesClient) (wafp WebApplicationFirewallPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + wafp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.PoliciesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if wafp.Response.Response, err = future.GetResult(sender); err == nil && wafp.Response.Response.StatusCode != http.StatusNoContent { + wafp, err = client.UpdateResponder(wafp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesUpdateFuture", "Result", wafp.Response.Response, "Failure responding to request") + } + } + return +} + +// PolicySettings defines contents of a web application firewall global configuration +type PolicySettings struct { + // EnabledState - describes if the policy is in enabled state or disabled state. Possible values include: 'PolicyEnabledStateDisabled', 'PolicyEnabledStateEnabled' + EnabledState PolicyEnabledState `json:"enabledState,omitempty"` + // Mode - Describes if it is in detection mode or prevention mode at policy level. Possible values include: 'PolicyModePrevention', 'PolicyModeDetection' + Mode PolicyMode `json:"mode,omitempty"` + // DefaultRedirectURL - If action type is redirect, this field represents the default redirect URL for the client. + DefaultRedirectURL *string `json:"defaultRedirectUrl,omitempty"` + // DefaultCustomBlockResponseStatusCode - If the action type is block, this field defines the default customer overridable http response status code. + DefaultCustomBlockResponseStatusCode *int32 `json:"defaultCustomBlockResponseStatusCode,omitempty"` + // DefaultCustomBlockResponseBody - If the action type is block, customer can override the response body. The body must be specified in base64 encoding. + DefaultCustomBlockResponseBody *string `json:"defaultCustomBlockResponseBody,omitempty"` +} + +// PostArgsMatchConditionParameters defines the parameters for PostArgs match conditions +type PostArgsMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Selector - Name of PostArg to be matched + Selector *string `json:"selector,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'PostArgsOperatorAny', 'PostArgsOperatorEqual', 'PostArgsOperatorContains', 'PostArgsOperatorBeginsWith', 'PostArgsOperatorEndsWith', 'PostArgsOperatorLessThan', 'PostArgsOperatorLessThanOrEqual', 'PostArgsOperatorGreaterThan', 'PostArgsOperatorGreaterThanOrEqual', 'PostArgsOperatorRegEx' + Operator PostArgsOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// Profile a profile is a logical grouping of endpoints that share the same settings. +type Profile struct { + autorest.Response `json:"-"` + // Sku - The pricing tier (defines Azure Front Door Standard or Premium or a CDN provider, feature list and rate) of the profile. + Sku *Sku `json:"sku,omitempty"` + // Kind - READ-ONLY; Kind of the profile. Used by portal to differentiate traditional CDN profile and new AFD profile. + Kind *string `json:"kind,omitempty"` + *ProfileProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Profile. +func (p Profile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.Sku != nil { + objectMap["sku"] = p.Sku + } + if p.ProfileProperties != nil { + objectMap["properties"] = p.ProfileProperties + } + if p.Location != nil { + objectMap["location"] = p.Location + } + if p.Tags != nil { + objectMap["tags"] = p.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Profile struct. +func (p *Profile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + p.Sku = &sku + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + p.Kind = &kind + } + case "properties": + if v != nil { + var profileProperties ProfileProperties + err = json.Unmarshal(*v, &profileProperties) + if err != nil { + return err + } + p.ProfileProperties = &profileProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + p.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + p.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + p.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + p.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + p.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + p.SystemData = &systemData + } + } + } + + return nil +} + +// ProfileListResult result of the request to list profiles. It contains a list of profile objects and a +// URL link to get the next set of results. +type ProfileListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of CDN profiles within a resource group. + Value *[]Profile `json:"value,omitempty"` + // NextLink - URL to get the next set of profile objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProfileListResult. +func (plr ProfileListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.NextLink != nil { + objectMap["nextLink"] = plr.NextLink + } + return json.Marshal(objectMap) +} + +// ProfileListResultIterator provides access to a complete listing of Profile values. +type ProfileListResultIterator struct { + i int + page ProfileListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ProfileListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ProfileListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ProfileListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ProfileListResultIterator) Response() ProfileListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ProfileListResultIterator) Value() Profile { + if !iter.page.NotDone() { + return Profile{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ProfileListResultIterator type. +func NewProfileListResultIterator(page ProfileListResultPage) ProfileListResultIterator { + return ProfileListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plr ProfileListResult) IsEmpty() bool { + return plr.Value == nil || len(*plr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (plr ProfileListResult) hasNextLink() bool { + return plr.NextLink != nil && len(*plr.NextLink) != 0 +} + +// profileListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plr ProfileListResult) profileListResultPreparer(ctx context.Context) (*http.Request, error) { + if !plr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plr.NextLink))) +} + +// ProfileListResultPage contains a page of Profile values. +type ProfileListResultPage struct { + fn func(context.Context, ProfileListResult) (ProfileListResult, error) + plr ProfileListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ProfileListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.plr) + if err != nil { + return err + } + page.plr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ProfileListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ProfileListResultPage) NotDone() bool { + return !page.plr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ProfileListResultPage) Response() ProfileListResult { + return page.plr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ProfileListResultPage) Values() []Profile { + if page.plr.IsEmpty() { + return nil + } + return *page.plr.Value +} + +// Creates a new instance of the ProfileListResultPage type. +func NewProfileListResultPage(cur ProfileListResult, getNextPage func(context.Context, ProfileListResult) (ProfileListResult, error)) ProfileListResultPage { + return ProfileListResultPage{ + fn: getNextPage, + plr: cur, + } +} + +// ProfileProperties the JSON object that contains the properties required to create a profile. +type ProfileProperties struct { + // ResourceState - READ-ONLY; Resource status of the profile. Possible values include: 'ProfileResourceStateCreating', 'ProfileResourceStateActive', 'ProfileResourceStateDeleting', 'ProfileResourceStateDisabled' + ResourceState ProfileResourceState `json:"resourceState,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status of the profile. + ProvisioningState *string `json:"provisioningState,omitempty"` + // FrontDoorID - READ-ONLY; The Id of the frontdoor. + FrontDoorID *string `json:"frontDoorId,omitempty"` + // OriginResponseTimeoutSeconds - Send and receive timeout on forwarding request to the origin. When timeout is reached, the request fails and returns. + OriginResponseTimeoutSeconds *int32 `json:"originResponseTimeoutSeconds,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProfileProperties. +func (pp ProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pp.OriginResponseTimeoutSeconds != nil { + objectMap["originResponseTimeoutSeconds"] = pp.OriginResponseTimeoutSeconds + } + return json.Marshal(objectMap) +} + +// ProfilePropertiesUpdateParameters the JSON object containing profile update parameters. +type ProfilePropertiesUpdateParameters struct { + // OriginResponseTimeoutSeconds - Send and receive timeout on forwarding request to the origin. When timeout is reached, the request fails and returns. + OriginResponseTimeoutSeconds *int32 `json:"originResponseTimeoutSeconds,omitempty"` +} + +// ProfilesCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ProfilesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ProfilesClient) (Profile, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ProfilesCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ProfilesCreateFuture.Result. +func (future *ProfilesCreateFuture) result(client ProfilesClient) (p Profile, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + p.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.ProfilesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent { + p, err = client.CreateResponder(p.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesCreateFuture", "Result", p.Response.Response, "Failure responding to request") + } + } + return +} + +// ProfilesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ProfilesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ProfilesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ProfilesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ProfilesDeleteFuture.Result. +func (future *ProfilesDeleteFuture) result(client ProfilesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.ProfilesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ProfilesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ProfilesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ProfilesClient) (Profile, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ProfilesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ProfilesUpdateFuture.Result. +func (future *ProfilesUpdateFuture) result(client ProfilesClient) (p Profile, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + p.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.ProfilesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent { + p, err = client.UpdateResponder(p.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesUpdateFuture", "Result", p.Response.Response, "Failure responding to request") + } + } + return +} + +// ProfileUpdateParameters properties required to update a profile. +type ProfileUpdateParameters struct { + // Tags - Profile tags + Tags map[string]*string `json:"tags"` + *ProfilePropertiesUpdateParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProfileUpdateParameters. +func (pup ProfileUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pup.Tags != nil { + objectMap["tags"] = pup.Tags + } + if pup.ProfilePropertiesUpdateParameters != nil { + objectMap["properties"] = pup.ProfilePropertiesUpdateParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ProfileUpdateParameters struct. +func (pup *ProfileUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pup.Tags = tags + } + case "properties": + if v != nil { + var profilePropertiesUpdateParameters ProfilePropertiesUpdateParameters + err = json.Unmarshal(*v, &profilePropertiesUpdateParameters) + if err != nil { + return err + } + pup.ProfilePropertiesUpdateParameters = &profilePropertiesUpdateParameters + } + } + } + + return nil +} + +// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than +// required location and tags +type ProxyResource struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PurgeParameters parameters required for content purge. +type PurgeParameters struct { + // ContentPaths - The path to the content to be purged. Can describe a file path or a wild card directory. + ContentPaths *[]string `json:"contentPaths,omitempty"` +} + +// QueryStringMatchConditionParameters defines the parameters for QueryString match conditions +type QueryStringMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'QueryStringOperatorAny', 'QueryStringOperatorEqual', 'QueryStringOperatorContains', 'QueryStringOperatorBeginsWith', 'QueryStringOperatorEndsWith', 'QueryStringOperatorLessThan', 'QueryStringOperatorLessThanOrEqual', 'QueryStringOperatorGreaterThan', 'QueryStringOperatorGreaterThanOrEqual', 'QueryStringOperatorRegEx' + Operator QueryStringOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// RankingsResponse rankings Response +type RankingsResponse struct { + autorest.Response `json:"-"` + DateTimeBegin *date.Time `json:"dateTimeBegin,omitempty"` + DateTimeEnd *date.Time `json:"dateTimeEnd,omitempty"` + Tables *[]RankingsResponseTablesItem `json:"tables,omitempty"` +} + +// RankingsResponseTablesItem ... +type RankingsResponseTablesItem struct { + Ranking *string `json:"ranking,omitempty"` + Data *[]RankingsResponseTablesItemDataItem `json:"data,omitempty"` +} + +// RankingsResponseTablesItemDataItem ... +type RankingsResponseTablesItemDataItem struct { + Name *string `json:"name,omitempty"` + Metrics *[]RankingsResponseTablesItemDataItemMetricsItem `json:"metrics,omitempty"` +} + +// RankingsResponseTablesItemDataItemMetricsItem ... +type RankingsResponseTablesItemDataItemMetricsItem struct { + Metric *string `json:"metric,omitempty"` + Value *int64 `json:"value,omitempty"` + Percentage *float64 `json:"percentage,omitempty"` +} + +// RateLimitRule defines a rate limiting rule that can be included in a waf policy +type RateLimitRule struct { + // RateLimitThreshold - Defines rate limit threshold. + RateLimitThreshold *int32 `json:"rateLimitThreshold,omitempty"` + // RateLimitDurationInMinutes - Defines rate limit duration. Default is 1 minute. + RateLimitDurationInMinutes *int32 `json:"rateLimitDurationInMinutes,omitempty"` + // Name - Defines the name of the custom rule + Name *string `json:"name,omitempty"` + // EnabledState - Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified. Possible values include: 'CustomRuleEnabledStateDisabled', 'CustomRuleEnabledStateEnabled' + EnabledState CustomRuleEnabledState `json:"enabledState,omitempty"` + // Priority - Defines in what order this rule be evaluated in the overall list of custom rules + Priority *int32 `json:"priority,omitempty"` + // MatchConditions - List of match conditions. + MatchConditions *[]MatchCondition `json:"matchConditions,omitempty"` + // Action - Describes what action to be applied when rule matches. Possible values include: 'ActionTypeAllow', 'ActionTypeBlock', 'ActionTypeLog', 'ActionTypeRedirect' + Action ActionType `json:"action,omitempty"` +} + +// RateLimitRuleList defines contents of rate limit rules +type RateLimitRuleList struct { + // Rules - List of rules + Rules *[]RateLimitRule `json:"rules,omitempty"` +} + +// RemoteAddressMatchConditionParameters defines the parameters for RemoteAddress match conditions +type RemoteAddressMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'RemoteAddressOperatorAny', 'RemoteAddressOperatorIPMatch', 'RemoteAddressOperatorGeoMatch' + Operator RemoteAddressOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - Match values to match against. The operator will apply to each value in here with OR semantics. If any of them match the variable with the given operator this match condition is considered a match. + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// RequestBodyMatchConditionParameters defines the parameters for RequestBody match conditions +type RequestBodyMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'RequestBodyOperatorAny', 'RequestBodyOperatorEqual', 'RequestBodyOperatorContains', 'RequestBodyOperatorBeginsWith', 'RequestBodyOperatorEndsWith', 'RequestBodyOperatorLessThan', 'RequestBodyOperatorLessThanOrEqual', 'RequestBodyOperatorGreaterThan', 'RequestBodyOperatorGreaterThanOrEqual', 'RequestBodyOperatorRegEx' + Operator RequestBodyOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// RequestHeaderMatchConditionParameters defines the parameters for RequestHeader match conditions +type RequestHeaderMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Selector - Name of Header to be matched + Selector *string `json:"selector,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'RequestHeaderOperatorAny', 'RequestHeaderOperatorEqual', 'RequestHeaderOperatorContains', 'RequestHeaderOperatorBeginsWith', 'RequestHeaderOperatorEndsWith', 'RequestHeaderOperatorLessThan', 'RequestHeaderOperatorLessThanOrEqual', 'RequestHeaderOperatorGreaterThan', 'RequestHeaderOperatorGreaterThanOrEqual', 'RequestHeaderOperatorRegEx' + Operator RequestHeaderOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// RequestMethodMatchConditionParameters defines the parameters for RequestMethod match conditions +type RequestMethodMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched + Operator *string `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` +} + +// RequestSchemeMatchConditionParameters defines the parameters for RequestScheme match conditions +type RequestSchemeMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched + Operator *string `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` +} + +// RequestURIMatchConditionParameters defines the parameters for RequestUri match conditions +type RequestURIMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'RequestURIOperatorAny', 'RequestURIOperatorEqual', 'RequestURIOperatorContains', 'RequestURIOperatorBeginsWith', 'RequestURIOperatorEndsWith', 'RequestURIOperatorLessThan', 'RequestURIOperatorLessThanOrEqual', 'RequestURIOperatorGreaterThan', 'RequestURIOperatorGreaterThanOrEqual', 'RequestURIOperatorRegEx' + Operator RequestURIOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// Resource the core properties of ARM resources +type Resource struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceReference reference to another resource. +type ResourceReference struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// ResourcesResponse resources Response +type ResourcesResponse struct { + autorest.Response `json:"-"` + Endpoints *[]ResourcesResponseEndpointsItem `json:"endpoints,omitempty"` + CustomDomains *[]ResourcesResponseCustomDomainsItem `json:"customDomains,omitempty"` +} + +// ResourcesResponseCustomDomainsItem ... +type ResourcesResponseCustomDomainsItem struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + EndpointID *string `json:"endpointId,omitempty"` + History *bool `json:"history,omitempty"` +} + +// ResourcesResponseEndpointsItem ... +type ResourcesResponseEndpointsItem struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + History *bool `json:"history,omitempty"` + CustomDomains *[]ResourcesResponseEndpointsItemCustomDomainsItem `json:"customDomains,omitempty"` +} + +// ResourcesResponseEndpointsItemCustomDomainsItem ... +type ResourcesResponseEndpointsItemCustomDomainsItem struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + EndpointID *string `json:"endpointId,omitempty"` + History *bool `json:"history,omitempty"` +} + +// ResourceUsage output of check resource usage API. +type ResourceUsage struct { + // ResourceType - READ-ONLY; Resource type for which the usage is provided. + ResourceType *string `json:"resourceType,omitempty"` + // Unit - READ-ONLY; Unit of the usage. e.g. Count. + Unit *string `json:"unit,omitempty"` + // CurrentValue - READ-ONLY; Actual value of usage on the specified resource type. + CurrentValue *int32 `json:"currentValue,omitempty"` + // Limit - READ-ONLY; Quota of the specified resource type. + Limit *int32 `json:"limit,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceUsage. +func (ru ResourceUsage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceUsageListResult output of check resource usage API. +type ResourceUsageListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of resource usages. + Value *[]ResourceUsage `json:"value,omitempty"` + // NextLink - URL to get the next set of custom domain objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceUsageListResult. +func (rulr ResourceUsageListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rulr.NextLink != nil { + objectMap["nextLink"] = rulr.NextLink + } + return json.Marshal(objectMap) +} + +// ResourceUsageListResultIterator provides access to a complete listing of ResourceUsage values. +type ResourceUsageListResultIterator struct { + i int + page ResourceUsageListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceUsageListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceUsageListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceUsageListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceUsageListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceUsageListResultIterator) Response() ResourceUsageListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceUsageListResultIterator) Value() ResourceUsage { + if !iter.page.NotDone() { + return ResourceUsage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceUsageListResultIterator type. +func NewResourceUsageListResultIterator(page ResourceUsageListResultPage) ResourceUsageListResultIterator { + return ResourceUsageListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rulr ResourceUsageListResult) IsEmpty() bool { + return rulr.Value == nil || len(*rulr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rulr ResourceUsageListResult) hasNextLink() bool { + return rulr.NextLink != nil && len(*rulr.NextLink) != 0 +} + +// resourceUsageListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rulr ResourceUsageListResult) resourceUsageListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rulr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rulr.NextLink))) +} + +// ResourceUsageListResultPage contains a page of ResourceUsage values. +type ResourceUsageListResultPage struct { + fn func(context.Context, ResourceUsageListResult) (ResourceUsageListResult, error) + rulr ResourceUsageListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceUsageListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceUsageListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rulr) + if err != nil { + return err + } + page.rulr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceUsageListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceUsageListResultPage) NotDone() bool { + return !page.rulr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceUsageListResultPage) Response() ResourceUsageListResult { + return page.rulr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceUsageListResultPage) Values() []ResourceUsage { + if page.rulr.IsEmpty() { + return nil + } + return *page.rulr.Value +} + +// Creates a new instance of the ResourceUsageListResultPage type. +func NewResourceUsageListResultPage(cur ResourceUsageListResult, getNextPage func(context.Context, ResourceUsageListResult) (ResourceUsageListResult, error)) ResourceUsageListResultPage { + return ResourceUsageListResultPage{ + fn: getNextPage, + rulr: cur, + } +} + +// ResponseBasedOriginErrorDetectionParameters the JSON object that contains the properties to determine +// origin health using real requests/responses. +type ResponseBasedOriginErrorDetectionParameters struct { + // ResponseBasedDetectedErrorTypes - Type of response errors for real user requests for which origin will be deemed unhealthy. Possible values include: 'ResponseBasedDetectedErrorTypesNone', 'ResponseBasedDetectedErrorTypesTCPErrorsOnly', 'ResponseBasedDetectedErrorTypesTCPAndHTTPErrors' + ResponseBasedDetectedErrorTypes ResponseBasedDetectedErrorTypes `json:"responseBasedDetectedErrorTypes,omitempty"` + // ResponseBasedFailoverThresholdPercentage - The percentage of failed requests in the sample where failover should trigger. + ResponseBasedFailoverThresholdPercentage *int32 `json:"responseBasedFailoverThresholdPercentage,omitempty"` + // HTTPErrorRanges - The list of Http status code ranges that are considered as server errors for origin and it is marked as unhealthy. + HTTPErrorRanges *[]HTTPErrorRangeParameters `json:"httpErrorRanges,omitempty"` +} + +// Route friendly Routes name mapping to the any Routes or secret related information. +type Route struct { + autorest.Response `json:"-"` + *RouteProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Route. +func (r Route) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.RouteProperties != nil { + objectMap["properties"] = r.RouteProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Route struct. +func (r *Route) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routeProperties RouteProperties + err = json.Unmarshal(*v, &routeProperties) + if err != nil { + return err + } + r.RouteProperties = &routeProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + r.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + r.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + r.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + r.SystemData = &systemData + } + } + } + + return nil +} + +// RouteConfigurationOverrideActionParameters defines the parameters for the route configuration override +// action. +type RouteConfigurationOverrideActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // OriginGroupOverride - A reference to the origin group override configuration. Leave empty to use the default origin group on route. + OriginGroupOverride *OriginGroupOverride `json:"originGroupOverride,omitempty"` + // CacheConfiguration - The caching configuration associated with this rule. To disable caching, do not provide a cacheConfiguration object. + CacheConfiguration *CacheConfiguration `json:"cacheConfiguration,omitempty"` +} + +// RouteListResult result of the request to list routes. It contains a list of route objects and a URL link +// to get the next set of results. +type RouteListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of AzureFrontDoor routes within a profile. + Value *[]Route `json:"value,omitempty"` + // NextLink - URL to get the next set of route objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteListResult. +func (rlr RouteListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rlr.NextLink != nil { + objectMap["nextLink"] = rlr.NextLink + } + return json.Marshal(objectMap) +} + +// RouteListResultIterator provides access to a complete listing of Route values. +type RouteListResultIterator struct { + i int + page RouteListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RouteListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RouteListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RouteListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RouteListResultIterator) Response() RouteListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RouteListResultIterator) Value() Route { + if !iter.page.NotDone() { + return Route{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RouteListResultIterator type. +func NewRouteListResultIterator(page RouteListResultPage) RouteListResultIterator { + return RouteListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rlr RouteListResult) IsEmpty() bool { + return rlr.Value == nil || len(*rlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rlr RouteListResult) hasNextLink() bool { + return rlr.NextLink != nil && len(*rlr.NextLink) != 0 +} + +// routeListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rlr RouteListResult) routeListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rlr.NextLink))) +} + +// RouteListResultPage contains a page of Route values. +type RouteListResultPage struct { + fn func(context.Context, RouteListResult) (RouteListResult, error) + rlr RouteListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RouteListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rlr) + if err != nil { + return err + } + page.rlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RouteListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RouteListResultPage) NotDone() bool { + return !page.rlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RouteListResultPage) Response() RouteListResult { + return page.rlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RouteListResultPage) Values() []Route { + if page.rlr.IsEmpty() { + return nil + } + return *page.rlr.Value +} + +// Creates a new instance of the RouteListResultPage type. +func NewRouteListResultPage(cur RouteListResult, getNextPage func(context.Context, RouteListResult) (RouteListResult, error)) RouteListResultPage { + return RouteListResultPage{ + fn: getNextPage, + rlr: cur, + } +} + +// RouteProperties the JSON object that contains the properties of the Routes to create. +type RouteProperties struct { + // EndpointName - READ-ONLY; The name of the endpoint which holds the route. + EndpointName *string `json:"endpointName,omitempty"` + // CustomDomains - Domains referenced by this endpoint. + CustomDomains *[]ActivatedResourceReference `json:"customDomains,omitempty"` + // OriginGroup - A reference to the origin group. + OriginGroup *ResourceReference `json:"originGroup,omitempty"` + // OriginPath - A directory path on the origin that AzureFrontDoor can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. + OriginPath *string `json:"originPath,omitempty"` + // RuleSets - rule sets referenced by this endpoint. + RuleSets *[]ResourceReference `json:"ruleSets,omitempty"` + // SupportedProtocols - List of supported protocols for this route. + SupportedProtocols *[]AFDEndpointProtocols `json:"supportedProtocols,omitempty"` + // PatternsToMatch - The route patterns of the rule. + PatternsToMatch *[]string `json:"patternsToMatch,omitempty"` + // CacheConfiguration - The caching configuration for this route. To disable caching, do not provide a cacheConfiguration object. + CacheConfiguration *AfdRouteCacheConfiguration `json:"cacheConfiguration,omitempty"` + // ForwardingProtocol - Protocol this rule will use when forwarding traffic to backends. Possible values include: 'ForwardingProtocolHTTPOnly', 'ForwardingProtocolHTTPSOnly', 'ForwardingProtocolMatchRequest' + ForwardingProtocol ForwardingProtocol `json:"forwardingProtocol,omitempty"` + // LinkToDefaultDomain - whether this route will be linked to the default endpoint domain. Possible values include: 'LinkToDefaultDomainEnabled', 'LinkToDefaultDomainDisabled' + LinkToDefaultDomain LinkToDefaultDomain `json:"linkToDefaultDomain,omitempty"` + // HTTPSRedirect - Whether to automatically redirect HTTP traffic to HTTPS traffic. Note that this is a easy way to set up this rule and it will be the first rule that gets executed. Possible values include: 'HTTPSRedirectEnabled', 'HTTPSRedirectDisabled' + HTTPSRedirect HTTPSRedirect `json:"httpsRedirect,omitempty"` + // EnabledState - Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + EnabledState EnabledState `json:"enabledState,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteProperties. +func (rp RouteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rp.CustomDomains != nil { + objectMap["customDomains"] = rp.CustomDomains + } + if rp.OriginGroup != nil { + objectMap["originGroup"] = rp.OriginGroup + } + if rp.OriginPath != nil { + objectMap["originPath"] = rp.OriginPath + } + if rp.RuleSets != nil { + objectMap["ruleSets"] = rp.RuleSets + } + if rp.SupportedProtocols != nil { + objectMap["supportedProtocols"] = rp.SupportedProtocols + } + if rp.PatternsToMatch != nil { + objectMap["patternsToMatch"] = rp.PatternsToMatch + } + if rp.CacheConfiguration != nil { + objectMap["cacheConfiguration"] = rp.CacheConfiguration + } + if rp.ForwardingProtocol != "" { + objectMap["forwardingProtocol"] = rp.ForwardingProtocol + } + if rp.LinkToDefaultDomain != "" { + objectMap["linkToDefaultDomain"] = rp.LinkToDefaultDomain + } + if rp.HTTPSRedirect != "" { + objectMap["httpsRedirect"] = rp.HTTPSRedirect + } + if rp.EnabledState != "" { + objectMap["enabledState"] = rp.EnabledState + } + return json.Marshal(objectMap) +} + +// RoutesCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RoutesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RoutesClient) (Route, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RoutesCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RoutesCreateFuture.Result. +func (future *RoutesCreateFuture) result(client RoutesClient) (r Route, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.RoutesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.CreateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesCreateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// RoutesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RoutesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RoutesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RoutesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RoutesDeleteFuture.Result. +func (future *RoutesDeleteFuture) result(client RoutesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.RoutesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RoutesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RoutesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RoutesClient) (Route, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RoutesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RoutesUpdateFuture.Result. +func (future *RoutesUpdateFuture) result(client RoutesClient) (r Route, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.RoutesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.UpdateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesUpdateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// RouteUpdateParameters the domain JSON object required for domain creation or update. +type RouteUpdateParameters struct { + *RouteUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteUpdateParameters. +func (rup RouteUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rup.RouteUpdatePropertiesParameters != nil { + objectMap["properties"] = rup.RouteUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RouteUpdateParameters struct. +func (rup *RouteUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routeUpdatePropertiesParameters RouteUpdatePropertiesParameters + err = json.Unmarshal(*v, &routeUpdatePropertiesParameters) + if err != nil { + return err + } + rup.RouteUpdatePropertiesParameters = &routeUpdatePropertiesParameters + } + } + } + + return nil +} + +// RouteUpdatePropertiesParameters the JSON object that contains the properties of the domain to create. +type RouteUpdatePropertiesParameters struct { + // EndpointName - READ-ONLY; The name of the endpoint which holds the route. + EndpointName *string `json:"endpointName,omitempty"` + // CustomDomains - Domains referenced by this endpoint. + CustomDomains *[]ActivatedResourceReference `json:"customDomains,omitempty"` + // OriginGroup - A reference to the origin group. + OriginGroup *ResourceReference `json:"originGroup,omitempty"` + // OriginPath - A directory path on the origin that AzureFrontDoor can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. + OriginPath *string `json:"originPath,omitempty"` + // RuleSets - rule sets referenced by this endpoint. + RuleSets *[]ResourceReference `json:"ruleSets,omitempty"` + // SupportedProtocols - List of supported protocols for this route. + SupportedProtocols *[]AFDEndpointProtocols `json:"supportedProtocols,omitempty"` + // PatternsToMatch - The route patterns of the rule. + PatternsToMatch *[]string `json:"patternsToMatch,omitempty"` + // CacheConfiguration - The caching configuration for this route. To disable caching, do not provide a cacheConfiguration object. + CacheConfiguration *AfdRouteCacheConfiguration `json:"cacheConfiguration,omitempty"` + // ForwardingProtocol - Protocol this rule will use when forwarding traffic to backends. Possible values include: 'ForwardingProtocolHTTPOnly', 'ForwardingProtocolHTTPSOnly', 'ForwardingProtocolMatchRequest' + ForwardingProtocol ForwardingProtocol `json:"forwardingProtocol,omitempty"` + // LinkToDefaultDomain - whether this route will be linked to the default endpoint domain. Possible values include: 'LinkToDefaultDomainEnabled', 'LinkToDefaultDomainDisabled' + LinkToDefaultDomain LinkToDefaultDomain `json:"linkToDefaultDomain,omitempty"` + // HTTPSRedirect - Whether to automatically redirect HTTP traffic to HTTPS traffic. Note that this is a easy way to set up this rule and it will be the first rule that gets executed. Possible values include: 'HTTPSRedirectEnabled', 'HTTPSRedirectDisabled' + HTTPSRedirect HTTPSRedirect `json:"httpsRedirect,omitempty"` + // EnabledState - Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + EnabledState EnabledState `json:"enabledState,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteUpdatePropertiesParameters. +func (rupp RouteUpdatePropertiesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rupp.CustomDomains != nil { + objectMap["customDomains"] = rupp.CustomDomains + } + if rupp.OriginGroup != nil { + objectMap["originGroup"] = rupp.OriginGroup + } + if rupp.OriginPath != nil { + objectMap["originPath"] = rupp.OriginPath + } + if rupp.RuleSets != nil { + objectMap["ruleSets"] = rupp.RuleSets + } + if rupp.SupportedProtocols != nil { + objectMap["supportedProtocols"] = rupp.SupportedProtocols + } + if rupp.PatternsToMatch != nil { + objectMap["patternsToMatch"] = rupp.PatternsToMatch + } + if rupp.CacheConfiguration != nil { + objectMap["cacheConfiguration"] = rupp.CacheConfiguration + } + if rupp.ForwardingProtocol != "" { + objectMap["forwardingProtocol"] = rupp.ForwardingProtocol + } + if rupp.LinkToDefaultDomain != "" { + objectMap["linkToDefaultDomain"] = rupp.LinkToDefaultDomain + } + if rupp.HTTPSRedirect != "" { + objectMap["httpsRedirect"] = rupp.HTTPSRedirect + } + if rupp.EnabledState != "" { + objectMap["enabledState"] = rupp.EnabledState + } + return json.Marshal(objectMap) +} + +// Rule friendly Rules name mapping to the any Rules or secret related information. +type Rule struct { + autorest.Response `json:"-"` + *RuleProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Rule. +func (r Rule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.RuleProperties != nil { + objectMap["properties"] = r.RuleProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Rule struct. +func (r *Rule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var ruleProperties RuleProperties + err = json.Unmarshal(*v, &ruleProperties) + if err != nil { + return err + } + r.RuleProperties = &ruleProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + r.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + r.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + r.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + r.SystemData = &systemData + } + } + } + + return nil +} + +// RuleListResult result of the request to list rules. It contains a list of rule objects and a URL link to +// get the next set of results. +type RuleListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of AzureFrontDoor rules within a rule set. + Value *[]Rule `json:"value,omitempty"` + // NextLink - URL to get the next set of rule objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleListResult. +func (rlr RuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rlr.NextLink != nil { + objectMap["nextLink"] = rlr.NextLink + } + return json.Marshal(objectMap) +} + +// RuleListResultIterator provides access to a complete listing of Rule values. +type RuleListResultIterator struct { + i int + page RuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RuleListResultIterator) Response() RuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RuleListResultIterator) Value() Rule { + if !iter.page.NotDone() { + return Rule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RuleListResultIterator type. +func NewRuleListResultIterator(page RuleListResultPage) RuleListResultIterator { + return RuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rlr RuleListResult) IsEmpty() bool { + return rlr.Value == nil || len(*rlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rlr RuleListResult) hasNextLink() bool { + return rlr.NextLink != nil && len(*rlr.NextLink) != 0 +} + +// ruleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rlr RuleListResult) ruleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rlr.NextLink))) +} + +// RuleListResultPage contains a page of Rule values. +type RuleListResultPage struct { + fn func(context.Context, RuleListResult) (RuleListResult, error) + rlr RuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rlr) + if err != nil { + return err + } + page.rlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RuleListResultPage) NotDone() bool { + return !page.rlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RuleListResultPage) Response() RuleListResult { + return page.rlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RuleListResultPage) Values() []Rule { + if page.rlr.IsEmpty() { + return nil + } + return *page.rlr.Value +} + +// Creates a new instance of the RuleListResultPage type. +func NewRuleListResultPage(cur RuleListResult, getNextPage func(context.Context, RuleListResult) (RuleListResult, error)) RuleListResultPage { + return RuleListResultPage{ + fn: getNextPage, + rlr: cur, + } +} + +// RuleProperties the JSON object that contains the properties of the Rules to create. +type RuleProperties struct { + // RuleSetName - READ-ONLY; The name of the rule set containing the rule. + RuleSetName *string `json:"ruleSetName,omitempty"` + // Order - The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. + Order *int32 `json:"order,omitempty"` + // Conditions - A list of conditions that must be matched for the actions to be executed + Conditions *[]BasicDeliveryRuleCondition `json:"conditions,omitempty"` + // Actions - A list of actions that are executed when all the conditions of a rule are satisfied. + Actions *[]BasicDeliveryRuleAction `json:"actions,omitempty"` + // MatchProcessingBehavior - If this rule is a match should the rules engine continue running the remaining rules or stop. If not present, defaults to Continue. Possible values include: 'MatchProcessingBehaviorContinue', 'MatchProcessingBehaviorStop' + MatchProcessingBehavior MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleProperties. +func (rp RuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rp.Order != nil { + objectMap["order"] = rp.Order + } + if rp.Conditions != nil { + objectMap["conditions"] = rp.Conditions + } + if rp.Actions != nil { + objectMap["actions"] = rp.Actions + } + if rp.MatchProcessingBehavior != "" { + objectMap["matchProcessingBehavior"] = rp.MatchProcessingBehavior + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RuleProperties struct. +func (rp *RuleProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "ruleSetName": + if v != nil { + var ruleSetName string + err = json.Unmarshal(*v, &ruleSetName) + if err != nil { + return err + } + rp.RuleSetName = &ruleSetName + } + case "order": + if v != nil { + var order int32 + err = json.Unmarshal(*v, &order) + if err != nil { + return err + } + rp.Order = &order + } + case "conditions": + if v != nil { + conditions, err := unmarshalBasicDeliveryRuleConditionArray(*v) + if err != nil { + return err + } + rp.Conditions = &conditions + } + case "actions": + if v != nil { + actions, err := unmarshalBasicDeliveryRuleActionArray(*v) + if err != nil { + return err + } + rp.Actions = &actions + } + case "matchProcessingBehavior": + if v != nil { + var matchProcessingBehavior MatchProcessingBehavior + err = json.Unmarshal(*v, &matchProcessingBehavior) + if err != nil { + return err + } + rp.MatchProcessingBehavior = matchProcessingBehavior + } + case "provisioningState": + if v != nil { + var provisioningState AfdProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + rp.ProvisioningState = provisioningState + } + case "deploymentStatus": + if v != nil { + var deploymentStatus DeploymentStatus + err = json.Unmarshal(*v, &deploymentStatus) + if err != nil { + return err + } + rp.DeploymentStatus = deploymentStatus + } + } + } + + return nil +} + +// RulesCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RulesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RulesClient) (Rule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RulesCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RulesCreateFuture.Result. +func (future *RulesCreateFuture) result(client RulesClient) (r Rule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.RulesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.CreateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesCreateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// RulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RulesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RulesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RulesDeleteFuture.Result. +func (future *RulesDeleteFuture) result(client RulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.RulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RuleSet friendly RuleSet name mapping to the any RuleSet or secret related information. +type RuleSet struct { + autorest.Response `json:"-"` + *RuleSetProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleSet. +func (rs RuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rs.RuleSetProperties != nil { + objectMap["properties"] = rs.RuleSetProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RuleSet struct. +func (rs *RuleSet) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var ruleSetProperties RuleSetProperties + err = json.Unmarshal(*v, &ruleSetProperties) + if err != nil { + return err + } + rs.RuleSetProperties = &ruleSetProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rs.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + rs.SystemData = &systemData + } + } + } + + return nil +} + +// RuleSetListResult result of the request to list rule sets. It contains a list of rule set objects and a +// URL link to get the next set of results. +type RuleSetListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of AzureFrontDoor rule sets within a profile. + Value *[]RuleSet `json:"value,omitempty"` + // NextLink - URL to get the next set of rule set objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleSetListResult. +func (rslr RuleSetListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rslr.NextLink != nil { + objectMap["nextLink"] = rslr.NextLink + } + return json.Marshal(objectMap) +} + +// RuleSetListResultIterator provides access to a complete listing of RuleSet values. +type RuleSetListResultIterator struct { + i int + page RuleSetListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RuleSetListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RuleSetListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RuleSetListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RuleSetListResultIterator) Response() RuleSetListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RuleSetListResultIterator) Value() RuleSet { + if !iter.page.NotDone() { + return RuleSet{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RuleSetListResultIterator type. +func NewRuleSetListResultIterator(page RuleSetListResultPage) RuleSetListResultIterator { + return RuleSetListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rslr RuleSetListResult) IsEmpty() bool { + return rslr.Value == nil || len(*rslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rslr RuleSetListResult) hasNextLink() bool { + return rslr.NextLink != nil && len(*rslr.NextLink) != 0 +} + +// ruleSetListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rslr RuleSetListResult) ruleSetListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rslr.NextLink))) +} + +// RuleSetListResultPage contains a page of RuleSet values. +type RuleSetListResultPage struct { + fn func(context.Context, RuleSetListResult) (RuleSetListResult, error) + rslr RuleSetListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RuleSetListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rslr) + if err != nil { + return err + } + page.rslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RuleSetListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RuleSetListResultPage) NotDone() bool { + return !page.rslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RuleSetListResultPage) Response() RuleSetListResult { + return page.rslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RuleSetListResultPage) Values() []RuleSet { + if page.rslr.IsEmpty() { + return nil + } + return *page.rslr.Value +} + +// Creates a new instance of the RuleSetListResultPage type. +func NewRuleSetListResultPage(cur RuleSetListResult, getNextPage func(context.Context, RuleSetListResult) (RuleSetListResult, error)) RuleSetListResultPage { + return RuleSetListResultPage{ + fn: getNextPage, + rslr: cur, + } +} + +// RuleSetProperties the JSON object that contains the properties of the Rule Set to create. +type RuleSetProperties struct { + // ProfileName - READ-ONLY; The name of the profile which holds the rule set. + ProfileName *string `json:"profileName,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleSetProperties. +func (rsp RuleSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RuleSetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RuleSetsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RuleSetsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RuleSetsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RuleSetsDeleteFuture.Result. +func (future *RuleSetsDeleteFuture) result(client RuleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.RuleSetsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RulesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RulesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RulesClient) (Rule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RulesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RulesUpdateFuture.Result. +func (future *RulesUpdateFuture) result(client RulesClient) (r Rule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.RulesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.UpdateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesUpdateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// RuleUpdateParameters the domain JSON object required for domain creation or update. +type RuleUpdateParameters struct { + *RuleUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleUpdateParameters. +func (rup RuleUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rup.RuleUpdatePropertiesParameters != nil { + objectMap["properties"] = rup.RuleUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RuleUpdateParameters struct. +func (rup *RuleUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var ruleUpdatePropertiesParameters RuleUpdatePropertiesParameters + err = json.Unmarshal(*v, &ruleUpdatePropertiesParameters) + if err != nil { + return err + } + rup.RuleUpdatePropertiesParameters = &ruleUpdatePropertiesParameters + } + } + } + + return nil +} + +// RuleUpdatePropertiesParameters the JSON object that contains the properties of the rule to update. +type RuleUpdatePropertiesParameters struct { + // RuleSetName - READ-ONLY; The name of the rule set containing the rule. + RuleSetName *string `json:"ruleSetName,omitempty"` + // Order - The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. + Order *int32 `json:"order,omitempty"` + // Conditions - A list of conditions that must be matched for the actions to be executed + Conditions *[]BasicDeliveryRuleCondition `json:"conditions,omitempty"` + // Actions - A list of actions that are executed when all the conditions of a rule are satisfied. + Actions *[]BasicDeliveryRuleAction `json:"actions,omitempty"` + // MatchProcessingBehavior - If this rule is a match should the rules engine continue running the remaining rules or stop. If not present, defaults to Continue. Possible values include: 'MatchProcessingBehaviorContinue', 'MatchProcessingBehaviorStop' + MatchProcessingBehavior MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleUpdatePropertiesParameters. +func (rupp RuleUpdatePropertiesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rupp.Order != nil { + objectMap["order"] = rupp.Order + } + if rupp.Conditions != nil { + objectMap["conditions"] = rupp.Conditions + } + if rupp.Actions != nil { + objectMap["actions"] = rupp.Actions + } + if rupp.MatchProcessingBehavior != "" { + objectMap["matchProcessingBehavior"] = rupp.MatchProcessingBehavior + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RuleUpdatePropertiesParameters struct. +func (rupp *RuleUpdatePropertiesParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "ruleSetName": + if v != nil { + var ruleSetName string + err = json.Unmarshal(*v, &ruleSetName) + if err != nil { + return err + } + rupp.RuleSetName = &ruleSetName + } + case "order": + if v != nil { + var order int32 + err = json.Unmarshal(*v, &order) + if err != nil { + return err + } + rupp.Order = &order + } + case "conditions": + if v != nil { + conditions, err := unmarshalBasicDeliveryRuleConditionArray(*v) + if err != nil { + return err + } + rupp.Conditions = &conditions + } + case "actions": + if v != nil { + actions, err := unmarshalBasicDeliveryRuleActionArray(*v) + if err != nil { + return err + } + rupp.Actions = &actions + } + case "matchProcessingBehavior": + if v != nil { + var matchProcessingBehavior MatchProcessingBehavior + err = json.Unmarshal(*v, &matchProcessingBehavior) + if err != nil { + return err + } + rupp.MatchProcessingBehavior = matchProcessingBehavior + } + } + } + + return nil +} + +// Secret friendly Secret name mapping to the any Secret or secret related information. +type Secret struct { + autorest.Response `json:"-"` + *SecretProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Secret. +func (s Secret) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SecretProperties != nil { + objectMap["properties"] = s.SecretProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Secret struct. +func (s *Secret) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var secretProperties SecretProperties + err = json.Unmarshal(*v, &secretProperties) + if err != nil { + return err + } + s.SecretProperties = &secretProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + s.SystemData = &systemData + } + } + } + + return nil +} + +// SecretListResult result of the request to list secrets. It contains a list of Secret objects and a URL +// link to get the next set of results. +type SecretListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of AzureFrontDoor secrets within a profile. + Value *[]Secret `json:"value,omitempty"` + // NextLink - URL to get the next set of Secret objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecretListResult. +func (slr SecretListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if slr.NextLink != nil { + objectMap["nextLink"] = slr.NextLink + } + return json.Marshal(objectMap) +} + +// SecretListResultIterator provides access to a complete listing of Secret values. +type SecretListResultIterator struct { + i int + page SecretListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SecretListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SecretListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecretListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SecretListResultIterator) Response() SecretListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SecretListResultIterator) Value() Secret { + if !iter.page.NotDone() { + return Secret{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SecretListResultIterator type. +func NewSecretListResultIterator(page SecretListResultPage) SecretListResultIterator { + return SecretListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (slr SecretListResult) IsEmpty() bool { + return slr.Value == nil || len(*slr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (slr SecretListResult) hasNextLink() bool { + return slr.NextLink != nil && len(*slr.NextLink) != 0 +} + +// secretListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (slr SecretListResult) secretListResultPreparer(ctx context.Context) (*http.Request, error) { + if !slr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(slr.NextLink))) +} + +// SecretListResultPage contains a page of Secret values. +type SecretListResultPage struct { + fn func(context.Context, SecretListResult) (SecretListResult, error) + slr SecretListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SecretListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.slr) + if err != nil { + return err + } + page.slr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SecretListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecretListResultPage) NotDone() bool { + return !page.slr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecretListResultPage) Response() SecretListResult { + return page.slr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecretListResultPage) Values() []Secret { + if page.slr.IsEmpty() { + return nil + } + return *page.slr.Value +} + +// Creates a new instance of the SecretListResultPage type. +func NewSecretListResultPage(cur SecretListResult, getNextPage func(context.Context, SecretListResult) (SecretListResult, error)) SecretListResultPage { + return SecretListResultPage{ + fn: getNextPage, + slr: cur, + } +} + +// BasicSecretParameters the json object containing secret parameters +type BasicSecretParameters interface { + AsURLSigningKeyParameters() (*URLSigningKeyParameters, bool) + AsManagedCertificateParameters() (*ManagedCertificateParameters, bool) + AsCustomerCertificateParameters() (*CustomerCertificateParameters, bool) + AsAzureFirstPartyManagedCertificateParameters() (*AzureFirstPartyManagedCertificateParameters, bool) + AsSecretParameters() (*SecretParameters, bool) +} + +// SecretParameters the json object containing secret parameters +type SecretParameters struct { + // Type - Possible values include: 'TypeBasicSecretParametersTypeSecretParameters', 'TypeBasicSecretParametersTypeURLSigningKey', 'TypeBasicSecretParametersTypeManagedCertificate', 'TypeBasicSecretParametersTypeCustomerCertificate', 'TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate' + Type TypeBasicSecretParameters `json:"type,omitempty"` +} + +func unmarshalBasicSecretParameters(body []byte) (BasicSecretParameters, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicSecretParametersTypeURLSigningKey): + var uskp URLSigningKeyParameters + err := json.Unmarshal(body, &uskp) + return uskp, err + case string(TypeBasicSecretParametersTypeManagedCertificate): + var mcp ManagedCertificateParameters + err := json.Unmarshal(body, &mcp) + return mcp, err + case string(TypeBasicSecretParametersTypeCustomerCertificate): + var ccp CustomerCertificateParameters + err := json.Unmarshal(body, &ccp) + return ccp, err + case string(TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate): + var afpmcp AzureFirstPartyManagedCertificateParameters + err := json.Unmarshal(body, &afpmcp) + return afpmcp, err + default: + var sp SecretParameters + err := json.Unmarshal(body, &sp) + return sp, err + } +} +func unmarshalBasicSecretParametersArray(body []byte) ([]BasicSecretParameters, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + spArray := make([]BasicSecretParameters, len(rawMessages)) + + for index, rawMessage := range rawMessages { + sp, err := unmarshalBasicSecretParameters(*rawMessage) + if err != nil { + return nil, err + } + spArray[index] = sp + } + return spArray, nil +} + +// MarshalJSON is the custom marshaler for SecretParameters. +func (sp SecretParameters) MarshalJSON() ([]byte, error) { + sp.Type = TypeBasicSecretParametersTypeSecretParameters + objectMap := make(map[string]interface{}) + if sp.Type != "" { + objectMap["type"] = sp.Type + } + return json.Marshal(objectMap) +} + +// AsURLSigningKeyParameters is the BasicSecretParameters implementation for SecretParameters. +func (sp SecretParameters) AsURLSigningKeyParameters() (*URLSigningKeyParameters, bool) { + return nil, false +} + +// AsManagedCertificateParameters is the BasicSecretParameters implementation for SecretParameters. +func (sp SecretParameters) AsManagedCertificateParameters() (*ManagedCertificateParameters, bool) { + return nil, false +} + +// AsCustomerCertificateParameters is the BasicSecretParameters implementation for SecretParameters. +func (sp SecretParameters) AsCustomerCertificateParameters() (*CustomerCertificateParameters, bool) { + return nil, false +} + +// AsAzureFirstPartyManagedCertificateParameters is the BasicSecretParameters implementation for SecretParameters. +func (sp SecretParameters) AsAzureFirstPartyManagedCertificateParameters() (*AzureFirstPartyManagedCertificateParameters, bool) { + return nil, false +} + +// AsSecretParameters is the BasicSecretParameters implementation for SecretParameters. +func (sp SecretParameters) AsSecretParameters() (*SecretParameters, bool) { + return &sp, true +} + +// AsBasicSecretParameters is the BasicSecretParameters implementation for SecretParameters. +func (sp SecretParameters) AsBasicSecretParameters() (BasicSecretParameters, bool) { + return &sp, true +} + +// SecretProperties the JSON object that contains the properties of the Secret to create. +type SecretProperties struct { + // ProfileName - READ-ONLY; The name of the profile which holds the secret. + ProfileName *string `json:"profileName,omitempty"` + // Parameters - object which contains secret parameters + Parameters BasicSecretParameters `json:"parameters,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecretProperties. +func (sp SecretProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["parameters"] = sp.Parameters + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecretProperties struct. +func (sp *SecretProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "profileName": + if v != nil { + var profileName string + err = json.Unmarshal(*v, &profileName) + if err != nil { + return err + } + sp.ProfileName = &profileName + } + case "parameters": + if v != nil { + parameters, err := unmarshalBasicSecretParameters(*v) + if err != nil { + return err + } + sp.Parameters = parameters + } + case "provisioningState": + if v != nil { + var provisioningState AfdProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + sp.ProvisioningState = provisioningState + } + case "deploymentStatus": + if v != nil { + var deploymentStatus DeploymentStatus + err = json.Unmarshal(*v, &deploymentStatus) + if err != nil { + return err + } + sp.DeploymentStatus = deploymentStatus + } + } + } + + return nil +} + +// SecretsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SecretsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecretsClient) (Secret, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecretsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecretsCreateFuture.Result. +func (future *SecretsCreateFuture) result(client SecretsClient) (s Secret, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.SecretsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.CreateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsCreateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// SecretsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SecretsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecretsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecretsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecretsDeleteFuture.Result. +func (future *SecretsDeleteFuture) result(client SecretsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.SecretsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SecurityPoliciesCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SecurityPoliciesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityPoliciesClient) (SecurityPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityPoliciesCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityPoliciesCreateFuture.Result. +func (future *SecurityPoliciesCreateFuture) result(client SecurityPoliciesClient) (sp SecurityPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.SecurityPoliciesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sp.Response.Response, err = future.GetResult(sender); err == nil && sp.Response.Response.StatusCode != http.StatusNoContent { + sp, err = client.CreateResponder(sp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesCreateFuture", "Result", sp.Response.Response, "Failure responding to request") + } + } + return +} + +// SecurityPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SecurityPoliciesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityPoliciesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityPoliciesDeleteFuture.Result. +func (future *SecurityPoliciesDeleteFuture) result(client SecurityPoliciesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.SecurityPoliciesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SecurityPoliciesPatchFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SecurityPoliciesPatchFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityPoliciesClient) (SecurityPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityPoliciesPatchFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityPoliciesPatchFuture.Result. +func (future *SecurityPoliciesPatchFuture) result(client SecurityPoliciesClient) (sp SecurityPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesPatchFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cdn.SecurityPoliciesPatchFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sp.Response.Response, err = future.GetResult(sender); err == nil && sp.Response.Response.StatusCode != http.StatusNoContent { + sp, err = client.PatchResponder(sp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesPatchFuture", "Result", sp.Response.Response, "Failure responding to request") + } + } + return +} + +// SecurityPolicy securityPolicy association for AzureFrontDoor profile +type SecurityPolicy struct { + autorest.Response `json:"-"` + *SecurityPolicyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityPolicy. +func (sp SecurityPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.SecurityPolicyProperties != nil { + objectMap["properties"] = sp.SecurityPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecurityPolicy struct. +func (sp *SecurityPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var securityPolicyProperties SecurityPolicyProperties + err = json.Unmarshal(*v, &securityPolicyProperties) + if err != nil { + return err + } + sp.SecurityPolicyProperties = &securityPolicyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sp.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sp.SystemData = &systemData + } + } + } + + return nil +} + +// SecurityPolicyListResult result of the request to list security policies. It contains a list of security +// policy objects and a URL link to get the next set of results. +type SecurityPolicyListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Security policies within a profile + Value *[]SecurityPolicy `json:"value,omitempty"` + // NextLink - URL to get the next set of security policy objects if there is any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityPolicyListResult. +func (splr SecurityPolicyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if splr.NextLink != nil { + objectMap["nextLink"] = splr.NextLink + } + return json.Marshal(objectMap) +} + +// SecurityPolicyListResultIterator provides access to a complete listing of SecurityPolicy values. +type SecurityPolicyListResultIterator struct { + i int + page SecurityPolicyListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SecurityPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPolicyListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SecurityPolicyListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecurityPolicyListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SecurityPolicyListResultIterator) Response() SecurityPolicyListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SecurityPolicyListResultIterator) Value() SecurityPolicy { + if !iter.page.NotDone() { + return SecurityPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SecurityPolicyListResultIterator type. +func NewSecurityPolicyListResultIterator(page SecurityPolicyListResultPage) SecurityPolicyListResultIterator { + return SecurityPolicyListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (splr SecurityPolicyListResult) IsEmpty() bool { + return splr.Value == nil || len(*splr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (splr SecurityPolicyListResult) hasNextLink() bool { + return splr.NextLink != nil && len(*splr.NextLink) != 0 +} + +// securityPolicyListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (splr SecurityPolicyListResult) securityPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !splr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(splr.NextLink))) +} + +// SecurityPolicyListResultPage contains a page of SecurityPolicy values. +type SecurityPolicyListResultPage struct { + fn func(context.Context, SecurityPolicyListResult) (SecurityPolicyListResult, error) + splr SecurityPolicyListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SecurityPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPolicyListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.splr) + if err != nil { + return err + } + page.splr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SecurityPolicyListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecurityPolicyListResultPage) NotDone() bool { + return !page.splr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecurityPolicyListResultPage) Response() SecurityPolicyListResult { + return page.splr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecurityPolicyListResultPage) Values() []SecurityPolicy { + if page.splr.IsEmpty() { + return nil + } + return *page.splr.Value +} + +// Creates a new instance of the SecurityPolicyListResultPage type. +func NewSecurityPolicyListResultPage(cur SecurityPolicyListResult, getNextPage func(context.Context, SecurityPolicyListResult) (SecurityPolicyListResult, error)) SecurityPolicyListResultPage { + return SecurityPolicyListResultPage{ + fn: getNextPage, + splr: cur, + } +} + +// SecurityPolicyProperties the json object that contains properties required to create a security policy +type SecurityPolicyProperties struct { + // ProfileName - READ-ONLY; The name of the profile which holds the security policy. + ProfileName *string `json:"profileName,omitempty"` + // Parameters - object which contains security policy parameters + Parameters BasicSecurityPolicyPropertiesParameters `json:"parameters,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning status. Possible values include: 'AfdProvisioningStateSucceeded', 'AfdProvisioningStateFailed', 'AfdProvisioningStateUpdating', 'AfdProvisioningStateDeleting', 'AfdProvisioningStateCreating' + ProvisioningState AfdProvisioningState `json:"provisioningState,omitempty"` + // DeploymentStatus - READ-ONLY; Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusInProgress', 'DeploymentStatusSucceeded', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityPolicyProperties. +func (spp SecurityPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["parameters"] = spp.Parameters + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecurityPolicyProperties struct. +func (spp *SecurityPolicyProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "profileName": + if v != nil { + var profileName string + err = json.Unmarshal(*v, &profileName) + if err != nil { + return err + } + spp.ProfileName = &profileName + } + case "parameters": + if v != nil { + parameters, err := unmarshalBasicSecurityPolicyPropertiesParameters(*v) + if err != nil { + return err + } + spp.Parameters = parameters + } + case "provisioningState": + if v != nil { + var provisioningState AfdProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + spp.ProvisioningState = provisioningState + } + case "deploymentStatus": + if v != nil { + var deploymentStatus DeploymentStatus + err = json.Unmarshal(*v, &deploymentStatus) + if err != nil { + return err + } + spp.DeploymentStatus = deploymentStatus + } + } + } + + return nil +} + +// BasicSecurityPolicyPropertiesParameters the json object containing security policy parameters +type BasicSecurityPolicyPropertiesParameters interface { + AsSecurityPolicyWebApplicationFirewallParameters() (*SecurityPolicyWebApplicationFirewallParameters, bool) + AsSecurityPolicyPropertiesParameters() (*SecurityPolicyPropertiesParameters, bool) +} + +// SecurityPolicyPropertiesParameters the json object containing security policy parameters +type SecurityPolicyPropertiesParameters struct { + // Type - Possible values include: 'TypeSecurityPolicyPropertiesParameters', 'TypeWebApplicationFirewall' + Type Type `json:"type,omitempty"` +} + +func unmarshalBasicSecurityPolicyPropertiesParameters(body []byte) (BasicSecurityPolicyPropertiesParameters, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeWebApplicationFirewall): + var spwafp SecurityPolicyWebApplicationFirewallParameters + err := json.Unmarshal(body, &spwafp) + return spwafp, err + default: + var sppp SecurityPolicyPropertiesParameters + err := json.Unmarshal(body, &sppp) + return sppp, err + } +} +func unmarshalBasicSecurityPolicyPropertiesParametersArray(body []byte) ([]BasicSecurityPolicyPropertiesParameters, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + spppArray := make([]BasicSecurityPolicyPropertiesParameters, len(rawMessages)) + + for index, rawMessage := range rawMessages { + sppp, err := unmarshalBasicSecurityPolicyPropertiesParameters(*rawMessage) + if err != nil { + return nil, err + } + spppArray[index] = sppp + } + return spppArray, nil +} + +// MarshalJSON is the custom marshaler for SecurityPolicyPropertiesParameters. +func (sppp SecurityPolicyPropertiesParameters) MarshalJSON() ([]byte, error) { + sppp.Type = TypeSecurityPolicyPropertiesParameters + objectMap := make(map[string]interface{}) + if sppp.Type != "" { + objectMap["type"] = sppp.Type + } + return json.Marshal(objectMap) +} + +// AsSecurityPolicyWebApplicationFirewallParameters is the BasicSecurityPolicyPropertiesParameters implementation for SecurityPolicyPropertiesParameters. +func (sppp SecurityPolicyPropertiesParameters) AsSecurityPolicyWebApplicationFirewallParameters() (*SecurityPolicyWebApplicationFirewallParameters, bool) { + return nil, false +} + +// AsSecurityPolicyPropertiesParameters is the BasicSecurityPolicyPropertiesParameters implementation for SecurityPolicyPropertiesParameters. +func (sppp SecurityPolicyPropertiesParameters) AsSecurityPolicyPropertiesParameters() (*SecurityPolicyPropertiesParameters, bool) { + return &sppp, true +} + +// AsBasicSecurityPolicyPropertiesParameters is the BasicSecurityPolicyPropertiesParameters implementation for SecurityPolicyPropertiesParameters. +func (sppp SecurityPolicyPropertiesParameters) AsBasicSecurityPolicyPropertiesParameters() (BasicSecurityPolicyPropertiesParameters, bool) { + return &sppp, true +} + +// SecurityPolicyUpdateParameters the JSON object containing security policy update parameters. +type SecurityPolicyUpdateParameters struct { + *SecurityPolicyUpdateProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityPolicyUpdateParameters. +func (spup SecurityPolicyUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spup.SecurityPolicyUpdateProperties != nil { + objectMap["properties"] = spup.SecurityPolicyUpdateProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecurityPolicyUpdateParameters struct. +func (spup *SecurityPolicyUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var securityPolicyUpdateProperties SecurityPolicyUpdateProperties + err = json.Unmarshal(*v, &securityPolicyUpdateProperties) + if err != nil { + return err + } + spup.SecurityPolicyUpdateProperties = &securityPolicyUpdateProperties + } + } + } + + return nil +} + +// SecurityPolicyUpdateProperties the json object that contains properties required to update a security +// policy +type SecurityPolicyUpdateProperties struct { + // Parameters - object which contains security policy parameters + Parameters BasicSecurityPolicyPropertiesParameters `json:"parameters,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for SecurityPolicyUpdateProperties struct. +func (spup *SecurityPolicyUpdateProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "parameters": + if v != nil { + parameters, err := unmarshalBasicSecurityPolicyPropertiesParameters(*v) + if err != nil { + return err + } + spup.Parameters = parameters + } + } + } + + return nil +} + +// SecurityPolicyWebApplicationFirewallAssociation settings for security policy patterns to match +type SecurityPolicyWebApplicationFirewallAssociation struct { + // Domains - List of domains. + Domains *[]ActivatedResourceReference `json:"domains,omitempty"` + // PatternsToMatch - List of paths + PatternsToMatch *[]string `json:"patternsToMatch,omitempty"` +} + +// SecurityPolicyWebApplicationFirewallParameters the json object containing security policy waf parameters +type SecurityPolicyWebApplicationFirewallParameters struct { + // WafPolicy - Resource ID. + WafPolicy *ResourceReference `json:"wafPolicy,omitempty"` + // Associations - Waf associations + Associations *[]SecurityPolicyWebApplicationFirewallAssociation `json:"associations,omitempty"` + // Type - Possible values include: 'TypeSecurityPolicyPropertiesParameters', 'TypeWebApplicationFirewall' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityPolicyWebApplicationFirewallParameters. +func (spwafp SecurityPolicyWebApplicationFirewallParameters) MarshalJSON() ([]byte, error) { + spwafp.Type = TypeWebApplicationFirewall + objectMap := make(map[string]interface{}) + if spwafp.WafPolicy != nil { + objectMap["wafPolicy"] = spwafp.WafPolicy + } + if spwafp.Associations != nil { + objectMap["associations"] = spwafp.Associations + } + if spwafp.Type != "" { + objectMap["type"] = spwafp.Type + } + return json.Marshal(objectMap) +} + +// AsSecurityPolicyWebApplicationFirewallParameters is the BasicSecurityPolicyPropertiesParameters implementation for SecurityPolicyWebApplicationFirewallParameters. +func (spwafp SecurityPolicyWebApplicationFirewallParameters) AsSecurityPolicyWebApplicationFirewallParameters() (*SecurityPolicyWebApplicationFirewallParameters, bool) { + return &spwafp, true +} + +// AsSecurityPolicyPropertiesParameters is the BasicSecurityPolicyPropertiesParameters implementation for SecurityPolicyWebApplicationFirewallParameters. +func (spwafp SecurityPolicyWebApplicationFirewallParameters) AsSecurityPolicyPropertiesParameters() (*SecurityPolicyPropertiesParameters, bool) { + return nil, false +} + +// AsBasicSecurityPolicyPropertiesParameters is the BasicSecurityPolicyPropertiesParameters implementation for SecurityPolicyWebApplicationFirewallParameters. +func (spwafp SecurityPolicyWebApplicationFirewallParameters) AsBasicSecurityPolicyPropertiesParameters() (BasicSecurityPolicyPropertiesParameters, bool) { + return &spwafp, true +} + +// ServerPortMatchConditionParameters defines the parameters for ServerPort match conditions +type ServerPortMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'ServerPortOperatorAny', 'ServerPortOperatorEqual', 'ServerPortOperatorContains', 'ServerPortOperatorBeginsWith', 'ServerPortOperatorEndsWith', 'ServerPortOperatorLessThan', 'ServerPortOperatorLessThanOrEqual', 'ServerPortOperatorGreaterThan', 'ServerPortOperatorGreaterThanOrEqual', 'ServerPortOperatorRegEx' + Operator ServerPortOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// ServiceSpecification one property of operation, include log specifications. +type ServiceSpecification struct { + // LogSpecifications - Log specifications of operation. + LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` + // MetricSpecifications - Metric specifications of operation. + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` +} + +// SharedPrivateLinkResourceProperties describes the properties of an existing Shared Private Link Resource +// to use when connecting to a private origin. +type SharedPrivateLinkResourceProperties struct { + // PrivateLink - The resource id of the resource the shared private link resource is for. + PrivateLink *ResourceReference `json:"privateLink,omitempty"` + // PrivateLinkLocation - The location of the shared private link resource + PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"` + // GroupID - The group id from the provider of resource the shared private link resource is for. + GroupID *string `json:"groupId,omitempty"` + // RequestMessage - The request message for requesting approval of the shared private link resource. + RequestMessage *string `json:"requestMessage,omitempty"` + // Status - Status of the shared private link resource. Can be Pending, Approved, Rejected, Disconnected, or Timeout. Possible values include: 'SharedPrivateLinkResourceStatusPending', 'SharedPrivateLinkResourceStatusApproved', 'SharedPrivateLinkResourceStatusRejected', 'SharedPrivateLinkResourceStatusDisconnected', 'SharedPrivateLinkResourceStatusTimeout' + Status SharedPrivateLinkResourceStatus `json:"status,omitempty"` +} + +// Sku standard_Verizon = The SKU name for a Standard Verizon CDN profile. +// Premium_Verizon = The SKU name for a Premium Verizon CDN profile. +// Custom_Verizon = The SKU name for a Custom Verizon CDN profile. +// Standard_Akamai = The SKU name for an Akamai CDN profile. +// Standard_ChinaCdn = The SKU name for a China CDN profile for VOD, Web and download scenarios using GB +// based billing model. +// Standard_Microsoft = The SKU name for a Standard Microsoft CDN profile. +// Standard_AzureFrontDoor = The SKU name for an Azure Front Door Standard profile. +// Premium_AzureFrontDoor = The SKU name for an Azure Front Door Premium profile. +// Standard_955BandWidth_ChinaCdn = The SKU name for a China CDN profile for VOD, Web and download +// scenarios using 95-5 peak bandwidth billing model. +// Standard_AvgBandWidth_ChinaCdn = The SKU name for a China CDN profile for VOD, Web and download +// scenarios using monthly average peak bandwidth billing model. +// StandardPlus_ChinaCdn = The SKU name for a China CDN profile for live-streaming using GB based billing +// model. +// StandardPlus_955BandWidth_ChinaCdn = The SKU name for a China CDN live-streaming profile using 95-5 peak +// bandwidth billing model. +// StandardPlus_AvgBandWidth_ChinaCdn = The SKU name for a China CDN live-streaming profile using monthly +// average peak bandwidth billing model. +type Sku struct { + // Name - Name of the pricing tier. Possible values include: 'SkuNameStandardVerizon', 'SkuNamePremiumVerizon', 'SkuNameCustomVerizon', 'SkuNameStandardAkamai', 'SkuNameStandardChinaCdn', 'SkuNameStandardMicrosoft', 'SkuNameStandardAzureFrontDoor', 'SkuNamePremiumAzureFrontDoor', 'SkuNameStandard955BandWidthChinaCdn', 'SkuNameStandardAvgBandWidthChinaCdn', 'SkuNameStandardPlusChinaCdn', 'SkuNameStandardPlus955BandWidthChinaCdn', 'SkuNameStandardPlusAvgBandWidthChinaCdn' + Name SkuName `json:"name,omitempty"` +} + +// SocketAddrMatchConditionParameters defines the parameters for SocketAddress match conditions +type SocketAddrMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'SocketAddrOperatorAny', 'SocketAddrOperatorIPMatch' + Operator SocketAddrOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// SslProtocolMatchConditionParameters defines the parameters for SslProtocol match conditions +type SslProtocolMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched + Operator *string `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]SslProtocol `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// SsoURI the URI required to login to the supplemental portal from the Azure portal. +type SsoURI struct { + autorest.Response `json:"-"` + // SsoURIValue - READ-ONLY; The URI used to login to the supplemental portal. + SsoURIValue *string `json:"ssoUriValue,omitempty"` +} + +// MarshalJSON is the custom marshaler for SsoURI. +func (su SsoURI) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SupportedOptimizationTypesListResult the result of the GetSupportedOptimizationTypes API +type SupportedOptimizationTypesListResult struct { + autorest.Response `json:"-"` + // SupportedOptimizationTypes - READ-ONLY; Supported optimization types for a profile. + SupportedOptimizationTypes *[]OptimizationType `json:"supportedOptimizationTypes,omitempty"` +} + +// MarshalJSON is the custom marshaler for SupportedOptimizationTypesListResult. +func (sotlr SupportedOptimizationTypesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SystemData read only system data +type SystemData struct { + // CreatedBy - An identifier for the identity that created the resource + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'IdentityTypeUser', 'IdentityTypeApplication', 'IdentityTypeManagedIdentity', 'IdentityTypeKey' + CreatedByType IdentityType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC) + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - An identifier for the identity that last modified the resource + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'IdentityTypeUser', 'IdentityTypeApplication', 'IdentityTypeManagedIdentity', 'IdentityTypeKey' + LastModifiedByType IdentityType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TrackedResource the resource model definition for a ARM tracked top level resource. +type TrackedResource struct { + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Location != nil { + objectMap["location"] = tr.Location + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + +// URLFileExtensionMatchConditionParameters defines the parameters for UrlFileExtension match conditions +type URLFileExtensionMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'URLFileExtensionOperatorAny', 'URLFileExtensionOperatorEqual', 'URLFileExtensionOperatorContains', 'URLFileExtensionOperatorBeginsWith', 'URLFileExtensionOperatorEndsWith', 'URLFileExtensionOperatorLessThan', 'URLFileExtensionOperatorLessThanOrEqual', 'URLFileExtensionOperatorGreaterThan', 'URLFileExtensionOperatorGreaterThanOrEqual', 'URLFileExtensionOperatorRegEx' + Operator URLFileExtensionOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// URLFileNameMatchConditionParameters defines the parameters for UrlFilename match conditions +type URLFileNameMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'URLFileNameOperatorAny', 'URLFileNameOperatorEqual', 'URLFileNameOperatorContains', 'URLFileNameOperatorBeginsWith', 'URLFileNameOperatorEndsWith', 'URLFileNameOperatorLessThan', 'URLFileNameOperatorLessThanOrEqual', 'URLFileNameOperatorGreaterThan', 'URLFileNameOperatorGreaterThanOrEqual', 'URLFileNameOperatorRegEx' + Operator URLFileNameOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// URLPathMatchConditionParameters defines the parameters for UrlPath match conditions +type URLPathMatchConditionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Operator - Describes operator to be matched. Possible values include: 'URLPathOperatorAny', 'URLPathOperatorEqual', 'URLPathOperatorContains', 'URLPathOperatorBeginsWith', 'URLPathOperatorEndsWith', 'URLPathOperatorLessThan', 'URLPathOperatorLessThanOrEqual', 'URLPathOperatorGreaterThan', 'URLPathOperatorGreaterThanOrEqual', 'URLPathOperatorWildcard', 'URLPathOperatorRegEx' + Operator URLPathOperator `json:"operator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValues - The match value for the condition of the delivery rule + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// URLRedirectAction defines the url redirect action for the delivery rule. +type URLRedirectAction struct { + // Parameters - Defines the parameters for the action. + Parameters *URLRedirectActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for URLRedirectAction. +func (ura URLRedirectAction) MarshalJSON() ([]byte, error) { + ura.Name = NameBasicDeliveryRuleActionNameURLRedirect + objectMap := make(map[string]interface{}) + if ura.Parameters != nil { + objectMap["parameters"] = ura.Parameters + } + if ura.Name != "" { + objectMap["name"] = ura.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return &ura, true +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for URLRedirectAction. +func (ura URLRedirectAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &ura, true +} + +// URLRedirectActionParameters defines the parameters for the url redirect action. +type URLRedirectActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // RedirectType - The redirect type the rule will use when redirecting traffic. Possible values include: 'RedirectTypeMoved', 'RedirectTypeFound', 'RedirectTypeTemporaryRedirect', 'RedirectTypePermanentRedirect' + RedirectType RedirectType `json:"redirectType,omitempty"` + // DestinationProtocol - Protocol to use for the redirect. The default value is MatchRequest. Possible values include: 'DestinationProtocolMatchRequest', 'DestinationProtocolHTTP', 'DestinationProtocolHTTPS' + DestinationProtocol DestinationProtocol `json:"destinationProtocol,omitempty"` + // CustomPath - The full path to redirect. Path cannot be empty and must start with /. Leave empty to use the incoming path as destination path. + CustomPath *string `json:"customPath,omitempty"` + // CustomHostname - Host to redirect. Leave empty to use the incoming host as the destination host. + CustomHostname *string `json:"customHostname,omitempty"` + // CustomQueryString - The set of query strings to be placed in the redirect URL. Setting this value would replace any existing query string; leave empty to preserve the incoming query string. Query string must be in = format. ? and & will be added automatically so do not include them. + CustomQueryString *string `json:"customQueryString,omitempty"` + // CustomFragment - Fragment to add to the redirect URL. Fragment is the part of the URL that comes after #. Do not include the #. + CustomFragment *string `json:"customFragment,omitempty"` +} + +// URLRewriteAction defines the url rewrite action for the delivery rule. +type URLRewriteAction struct { + // Parameters - Defines the parameters for the action. + Parameters *URLRewriteActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for URLRewriteAction. +func (ura URLRewriteAction) MarshalJSON() ([]byte, error) { + ura.Name = NameBasicDeliveryRuleActionNameURLRewrite + objectMap := make(map[string]interface{}) + if ura.Parameters != nil { + objectMap["parameters"] = ura.Parameters + } + if ura.Name != "" { + objectMap["name"] = ura.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return &ura, true +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsURLSigningAction() (*URLSigningAction, bool) { + return nil, false +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for URLRewriteAction. +func (ura URLRewriteAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &ura, true +} + +// URLRewriteActionParameters defines the parameters for the url rewrite action. +type URLRewriteActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // SourcePattern - define a request URI pattern that identifies the type of requests that may be rewritten. If value is blank, all strings are matched. + SourcePattern *string `json:"sourcePattern,omitempty"` + // Destination - Define the relative URL to which the above requests will be rewritten by. + Destination *string `json:"destination,omitempty"` + // PreserveUnmatchedPath - Whether to preserve unmatched path. Default value is true. + PreserveUnmatchedPath *bool `json:"preserveUnmatchedPath,omitempty"` +} + +// URLSigningAction defines the url signing action for the delivery rule. +type URLSigningAction struct { + // Parameters - Defines the parameters for the action. + Parameters *URLSigningActionParameters `json:"parameters,omitempty"` + // Name - Possible values include: 'NameBasicDeliveryRuleActionNameDeliveryRuleAction', 'NameBasicDeliveryRuleActionNameRouteConfigurationOverride', 'NameBasicDeliveryRuleActionNameCacheKeyQueryString', 'NameBasicDeliveryRuleActionNameCacheExpiration', 'NameBasicDeliveryRuleActionNameModifyResponseHeader', 'NameBasicDeliveryRuleActionNameModifyRequestHeader', 'NameBasicDeliveryRuleActionNameURLRewrite', 'NameBasicDeliveryRuleActionNameOriginGroupOverride', 'NameBasicDeliveryRuleActionNameURLSigning', 'NameBasicDeliveryRuleActionNameURLRedirect' + Name NameBasicDeliveryRuleAction `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for URLSigningAction. +func (usa URLSigningAction) MarshalJSON() ([]byte, error) { + usa.Name = NameBasicDeliveryRuleActionNameURLSigning + objectMap := make(map[string]interface{}) + if usa.Parameters != nil { + objectMap["parameters"] = usa.Parameters + } + if usa.Name != "" { + objectMap["name"] = usa.Name + } + return json.Marshal(objectMap) +} + +// AsDeliveryRuleRouteConfigurationOverrideAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsDeliveryRuleRouteConfigurationOverrideAction() (*DeliveryRuleRouteConfigurationOverrideAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheKeyQueryStringAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsDeliveryRuleCacheKeyQueryStringAction() (*DeliveryRuleCacheKeyQueryStringAction, bool) { + return nil, false +} + +// AsDeliveryRuleCacheExpirationAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsDeliveryRuleCacheExpirationAction() (*DeliveryRuleCacheExpirationAction, bool) { + return nil, false +} + +// AsDeliveryRuleResponseHeaderAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsDeliveryRuleResponseHeaderAction() (*DeliveryRuleResponseHeaderAction, bool) { + return nil, false +} + +// AsDeliveryRuleRequestHeaderAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsDeliveryRuleRequestHeaderAction() (*DeliveryRuleRequestHeaderAction, bool) { + return nil, false +} + +// AsURLRewriteAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsURLRewriteAction() (*URLRewriteAction, bool) { + return nil, false +} + +// AsOriginGroupOverrideAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsOriginGroupOverrideAction() (*OriginGroupOverrideAction, bool) { + return nil, false +} + +// AsURLSigningAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsURLSigningAction() (*URLSigningAction, bool) { + return &usa, true +} + +// AsURLRedirectAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsURLRedirectAction() (*URLRedirectAction, bool) { + return nil, false +} + +// AsDeliveryRuleAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsDeliveryRuleAction() (*DeliveryRuleAction, bool) { + return nil, false +} + +// AsBasicDeliveryRuleAction is the BasicDeliveryRuleAction implementation for URLSigningAction. +func (usa URLSigningAction) AsBasicDeliveryRuleAction() (BasicDeliveryRuleAction, bool) { + return &usa, true +} + +// URLSigningActionParameters defines the parameters for the Url Signing action. +type URLSigningActionParameters struct { + TypeName *string `json:"typeName,omitempty"` + // Algorithm - Algorithm to use for URL signing. Possible values include: 'AlgorithmSHA256' + Algorithm Algorithm `json:"algorithm,omitempty"` + // ParameterNameOverride - Defines which query string parameters in the url to be considered for expires, key id etc. + ParameterNameOverride *[]URLSigningParamIdentifier `json:"parameterNameOverride,omitempty"` +} + +// URLSigningKey url signing key +type URLSigningKey struct { + // KeyID - Defines the customer defined key Id. This id will exist in the incoming request to indicate the key used to form the hash. + KeyID *string `json:"keyId,omitempty"` + // KeySourceParameters - Defines the parameters for using customer key vault for Url Signing Key. + KeySourceParameters *KeyVaultSigningKeyParameters `json:"keySourceParameters,omitempty"` +} + +// URLSigningKeyParameters url signing key parameters +type URLSigningKeyParameters struct { + // KeyID - Defines the customer defined key Id. This id will exist in the incoming request to indicate the key used to form the hash. + KeyID *string `json:"keyId,omitempty"` + // SecretSource - Resource reference to the Azure Key Vault secret. Expected to be in format of /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{secretName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ + SecretSource *ResourceReference `json:"secretSource,omitempty"` + // SecretVersion - Version of the secret to be used + SecretVersion *string `json:"secretVersion,omitempty"` + // Type - Possible values include: 'TypeBasicSecretParametersTypeSecretParameters', 'TypeBasicSecretParametersTypeURLSigningKey', 'TypeBasicSecretParametersTypeManagedCertificate', 'TypeBasicSecretParametersTypeCustomerCertificate', 'TypeBasicSecretParametersTypeAzureFirstPartyManagedCertificate' + Type TypeBasicSecretParameters `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for URLSigningKeyParameters. +func (uskp URLSigningKeyParameters) MarshalJSON() ([]byte, error) { + uskp.Type = TypeBasicSecretParametersTypeURLSigningKey + objectMap := make(map[string]interface{}) + if uskp.KeyID != nil { + objectMap["keyId"] = uskp.KeyID + } + if uskp.SecretSource != nil { + objectMap["secretSource"] = uskp.SecretSource + } + if uskp.SecretVersion != nil { + objectMap["secretVersion"] = uskp.SecretVersion + } + if uskp.Type != "" { + objectMap["type"] = uskp.Type + } + return json.Marshal(objectMap) +} + +// AsURLSigningKeyParameters is the BasicSecretParameters implementation for URLSigningKeyParameters. +func (uskp URLSigningKeyParameters) AsURLSigningKeyParameters() (*URLSigningKeyParameters, bool) { + return &uskp, true +} + +// AsManagedCertificateParameters is the BasicSecretParameters implementation for URLSigningKeyParameters. +func (uskp URLSigningKeyParameters) AsManagedCertificateParameters() (*ManagedCertificateParameters, bool) { + return nil, false +} + +// AsCustomerCertificateParameters is the BasicSecretParameters implementation for URLSigningKeyParameters. +func (uskp URLSigningKeyParameters) AsCustomerCertificateParameters() (*CustomerCertificateParameters, bool) { + return nil, false +} + +// AsAzureFirstPartyManagedCertificateParameters is the BasicSecretParameters implementation for URLSigningKeyParameters. +func (uskp URLSigningKeyParameters) AsAzureFirstPartyManagedCertificateParameters() (*AzureFirstPartyManagedCertificateParameters, bool) { + return nil, false +} + +// AsSecretParameters is the BasicSecretParameters implementation for URLSigningKeyParameters. +func (uskp URLSigningKeyParameters) AsSecretParameters() (*SecretParameters, bool) { + return nil, false +} + +// AsBasicSecretParameters is the BasicSecretParameters implementation for URLSigningKeyParameters. +func (uskp URLSigningKeyParameters) AsBasicSecretParameters() (BasicSecretParameters, bool) { + return &uskp, true +} + +// URLSigningParamIdentifier defines how to identify a parameter for a specific purpose e.g. expires +type URLSigningParamIdentifier struct { + // ParamIndicator - Indicates the purpose of the parameter. Possible values include: 'ParamIndicatorExpires', 'ParamIndicatorKeyID', 'ParamIndicatorSignature' + ParamIndicator ParamIndicator `json:"paramIndicator,omitempty"` + // ParamName - Parameter name + ParamName *string `json:"paramName,omitempty"` +} + +// Usage describes resource usage. +type Usage struct { + // ID - READ-ONLY; Resource identifier. + ID *string `json:"id,omitempty"` + // Unit - An enum describing the unit of measurement. + Unit *string `json:"unit,omitempty"` + // CurrentValue - The current value of the usage. + CurrentValue *int64 `json:"currentValue,omitempty"` + // Limit - The limit of usage. + Limit *int64 `json:"limit,omitempty"` + // Name - The name of the type of usage. + Name *UsageName `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for Usage. +func (u Usage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if u.Unit != nil { + objectMap["unit"] = u.Unit + } + if u.CurrentValue != nil { + objectMap["currentValue"] = u.CurrentValue + } + if u.Limit != nil { + objectMap["limit"] = u.Limit + } + if u.Name != nil { + objectMap["name"] = u.Name + } + return json.Marshal(objectMap) +} + +// UsageName the usage names. +type UsageName struct { + // Value - A string describing the resource name. + Value *string `json:"value,omitempty"` + // LocalizedValue - A localized string describing the resource name. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// UsagesListResult the list usages operation response. +type UsagesListResult struct { + autorest.Response `json:"-"` + // Value - The list of resource usages. + Value *[]Usage `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// UsagesListResultIterator provides access to a complete listing of Usage values. +type UsagesListResultIterator struct { + i int + page UsagesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *UsagesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *UsagesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter UsagesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter UsagesListResultIterator) Response() UsagesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter UsagesListResultIterator) Value() Usage { + if !iter.page.NotDone() { + return Usage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the UsagesListResultIterator type. +func NewUsagesListResultIterator(page UsagesListResultPage) UsagesListResultIterator { + return UsagesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ulr UsagesListResult) IsEmpty() bool { + return ulr.Value == nil || len(*ulr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ulr UsagesListResult) hasNextLink() bool { + return ulr.NextLink != nil && len(*ulr.NextLink) != 0 +} + +// usagesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ulr UsagesListResult) usagesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ulr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ulr.NextLink))) +} + +// UsagesListResultPage contains a page of Usage values. +type UsagesListResultPage struct { + fn func(context.Context, UsagesListResult) (UsagesListResult, error) + ulr UsagesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *UsagesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ulr) + if err != nil { + return err + } + page.ulr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *UsagesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page UsagesListResultPage) NotDone() bool { + return !page.ulr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page UsagesListResultPage) Response() UsagesListResult { + return page.ulr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page UsagesListResultPage) Values() []Usage { + if page.ulr.IsEmpty() { + return nil + } + return *page.ulr.Value +} + +// Creates a new instance of the UsagesListResultPage type. +func NewUsagesListResultPage(cur UsagesListResult, getNextPage func(context.Context, UsagesListResult) (UsagesListResult, error)) UsagesListResultPage { + return UsagesListResultPage{ + fn: getNextPage, + ulr: cur, + } +} + +// UserManagedHTTPSParameters defines the certificate source parameters using user's keyvault certificate +// for enabling SSL. +type UserManagedHTTPSParameters struct { + // CertificateSourceParameters - Defines the certificate source parameters using user's keyvault certificate for enabling SSL. + CertificateSourceParameters *KeyVaultCertificateSourceParameters `json:"certificateSourceParameters,omitempty"` + // ProtocolType - Defines the TLS extension protocol that is used for secure delivery. Possible values include: 'ProtocolTypeServerNameIndication', 'ProtocolTypeIPBased' + ProtocolType ProtocolType `json:"protocolType,omitempty"` + // MinimumTLSVersion - TLS protocol version that will be used for Https. Possible values include: 'MinimumTLSVersionNone', 'MinimumTLSVersionTLS10', 'MinimumTLSVersionTLS12' + MinimumTLSVersion MinimumTLSVersion `json:"minimumTlsVersion,omitempty"` + // CertificateSource - Possible values include: 'CertificateSourceCustomDomainHTTPSParameters', 'CertificateSourceAzureKeyVault', 'CertificateSourceCdn' + CertificateSource CertificateSource `json:"certificateSource,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserManagedHTTPSParameters. +func (umhp UserManagedHTTPSParameters) MarshalJSON() ([]byte, error) { + umhp.CertificateSource = CertificateSourceAzureKeyVault + objectMap := make(map[string]interface{}) + if umhp.CertificateSourceParameters != nil { + objectMap["certificateSourceParameters"] = umhp.CertificateSourceParameters + } + if umhp.ProtocolType != "" { + objectMap["protocolType"] = umhp.ProtocolType + } + if umhp.MinimumTLSVersion != "" { + objectMap["minimumTlsVersion"] = umhp.MinimumTLSVersion + } + if umhp.CertificateSource != "" { + objectMap["certificateSource"] = umhp.CertificateSource + } + return json.Marshal(objectMap) +} + +// AsUserManagedHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for UserManagedHTTPSParameters. +func (umhp UserManagedHTTPSParameters) AsUserManagedHTTPSParameters() (*UserManagedHTTPSParameters, bool) { + return &umhp, true +} + +// AsManagedHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for UserManagedHTTPSParameters. +func (umhp UserManagedHTTPSParameters) AsManagedHTTPSParameters() (*ManagedHTTPSParameters, bool) { + return nil, false +} + +// AsCustomDomainHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for UserManagedHTTPSParameters. +func (umhp UserManagedHTTPSParameters) AsCustomDomainHTTPSParameters() (*CustomDomainHTTPSParameters, bool) { + return nil, false +} + +// AsBasicCustomDomainHTTPSParameters is the BasicCustomDomainHTTPSParameters implementation for UserManagedHTTPSParameters. +func (umhp UserManagedHTTPSParameters) AsBasicCustomDomainHTTPSParameters() (BasicCustomDomainHTTPSParameters, bool) { + return &umhp, true +} + +// ValidateCustomDomainInput input of the custom domain to be validated for DNS mapping. +type ValidateCustomDomainInput struct { + // HostName - The host name of the custom domain. Must be a domain name. + HostName *string `json:"hostName,omitempty"` +} + +// ValidateCustomDomainOutput output of custom domain validation. +type ValidateCustomDomainOutput struct { + autorest.Response `json:"-"` + // CustomDomainValidated - READ-ONLY; Indicates whether the custom domain is valid or not. + CustomDomainValidated *bool `json:"customDomainValidated,omitempty"` + // Reason - READ-ONLY; The reason why the custom domain is not valid. + Reason *string `json:"reason,omitempty"` + // Message - READ-ONLY; Error message describing why the custom domain is not valid. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for ValidateCustomDomainOutput. +func (vcdo ValidateCustomDomainOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ValidateProbeInput input of the validate probe API. +type ValidateProbeInput struct { + // ProbeURL - The probe URL to validate. + ProbeURL *string `json:"probeURL,omitempty"` +} + +// ValidateProbeOutput output of the validate probe API. +type ValidateProbeOutput struct { + autorest.Response `json:"-"` + // IsValid - READ-ONLY; Indicates whether the probe URL is accepted or not. + IsValid *bool `json:"isValid,omitempty"` + // ErrorCode - READ-ONLY; Specifies the error code when the probe url is not accepted. + ErrorCode *string `json:"errorCode,omitempty"` + // Message - READ-ONLY; The detailed error message describing why the probe URL is not accepted. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for ValidateProbeOutput. +func (vpo ValidateProbeOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ValidateSecretInput input of the secret to be validated. +type ValidateSecretInput struct { + // SecretType - The secret type. Possible values include: 'SecretTypeURLSigningKey', 'SecretTypeCustomerCertificate', 'SecretTypeManagedCertificate', 'SecretTypeAzureFirstPartyManagedCertificate' + SecretType SecretType `json:"secretType,omitempty"` + // SecretSource - Resource reference to the Azure Key Vault secret. Expected to be in format of /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{secretName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ + SecretSource *ResourceReference `json:"secretSource,omitempty"` + // SecretVersion - Secret version, if customer is using a specific version. + SecretVersion *string `json:"secretVersion,omitempty"` +} + +// ValidateSecretOutput output of the validated secret. +type ValidateSecretOutput struct { + autorest.Response `json:"-"` + // Status - The validation status. Possible values include: 'StatusValid', 'StatusInvalid', 'StatusAccessDenied', 'StatusCertificateExpired' + Status Status `json:"status,omitempty"` + // Message - Detailed error message + Message *string `json:"message,omitempty"` +} + +// ValidationToken the validation token. +type ValidationToken struct { + // Token - READ-ONLY + Token *string `json:"token,omitempty"` +} + +// MarshalJSON is the custom marshaler for ValidationToken. +func (vt ValidationToken) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// WafMetricsResponse waf Metrics Response +type WafMetricsResponse struct { + autorest.Response `json:"-"` + DateTimeBegin *date.Time `json:"dateTimeBegin,omitempty"` + DateTimeEnd *date.Time `json:"dateTimeEnd,omitempty"` + // Granularity - Possible values include: 'Granularity1PT5M', 'Granularity1PT1H', 'Granularity1P1D' + Granularity Granularity1 `json:"granularity,omitempty"` + Series *[]WafMetricsResponseSeriesItem `json:"series,omitempty"` +} + +// WafMetricsResponseSeriesItem ... +type WafMetricsResponseSeriesItem struct { + Metric *string `json:"metric,omitempty"` + // Unit - Possible values include: 'Unit1Count' + Unit Unit1 `json:"unit,omitempty"` + Groups *[]WafMetricsResponseSeriesItemGroupsItem `json:"groups,omitempty"` + Data *[]WafMetricsResponseSeriesItemDataItem `json:"data,omitempty"` +} + +// WafMetricsResponseSeriesItemDataItem ... +type WafMetricsResponseSeriesItemDataItem struct { + DateTime *date.Time `json:"dateTime,omitempty"` + Value *float64 `json:"value,omitempty"` +} + +// WafMetricsResponseSeriesItemGroupsItem ... +type WafMetricsResponseSeriesItemGroupsItem struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// WafRankingsResponse waf Rankings Response +type WafRankingsResponse struct { + autorest.Response `json:"-"` + DateTimeBegin *date.Time `json:"dateTimeBegin,omitempty"` + DateTimeEnd *date.Time `json:"dateTimeEnd,omitempty"` + Groups *[]string `json:"groups,omitempty"` + Data *[]WafRankingsResponseDataItem `json:"data,omitempty"` +} + +// WafRankingsResponseDataItem ... +type WafRankingsResponseDataItem struct { + GroupValues *[]string `json:"groupValues,omitempty"` + Metrics *[]WafRankingsResponseDataItemMetricsItem `json:"metrics,omitempty"` +} + +// WafRankingsResponseDataItemMetricsItem ... +type WafRankingsResponseDataItemMetricsItem struct { + Metric *string `json:"metric,omitempty"` + Value *int64 `json:"value,omitempty"` + Percentage *float64 `json:"percentage,omitempty"` +} + +// WebApplicationFirewallPolicy defines web application firewall policy for Azure CDN. +type WebApplicationFirewallPolicy struct { + autorest.Response `json:"-"` + // WebApplicationFirewallPolicyProperties - Properties of the web application firewall policy. + *WebApplicationFirewallPolicyProperties `json:"properties,omitempty"` + // Etag - Gets a unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Sku - The pricing tier (defines a CDN provider, feature list and rate) of the CdnWebApplicationFirewallPolicy. + Sku *Sku `json:"sku,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicy. +func (wafp WebApplicationFirewallPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafp.WebApplicationFirewallPolicyProperties != nil { + objectMap["properties"] = wafp.WebApplicationFirewallPolicyProperties + } + if wafp.Etag != nil { + objectMap["etag"] = wafp.Etag + } + if wafp.Sku != nil { + objectMap["sku"] = wafp.Sku + } + if wafp.Location != nil { + objectMap["location"] = wafp.Location + } + if wafp.Tags != nil { + objectMap["tags"] = wafp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WebApplicationFirewallPolicy struct. +func (wafp *WebApplicationFirewallPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var webApplicationFirewallPolicyProperties WebApplicationFirewallPolicyProperties + err = json.Unmarshal(*v, &webApplicationFirewallPolicyProperties) + if err != nil { + return err + } + wafp.WebApplicationFirewallPolicyProperties = &webApplicationFirewallPolicyProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + wafp.Etag = &etag + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + wafp.Sku = &sku + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + wafp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + wafp.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + wafp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + wafp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + wafp.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + wafp.SystemData = &systemData + } + } + } + + return nil +} + +// WebApplicationFirewallPolicyList defines a list of WebApplicationFirewallPolicies for Azure CDN. It +// contains a list of WebApplicationFirewallPolicy objects and a URL link to get the next set of results. +type WebApplicationFirewallPolicyList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Azure CDN WebApplicationFirewallPolicies within a resource group. + Value *[]WebApplicationFirewallPolicy `json:"value,omitempty"` + // NextLink - URL to get the next set of WebApplicationFirewallPolicy objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyList. +func (wafpl WebApplicationFirewallPolicyList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafpl.NextLink != nil { + objectMap["nextLink"] = wafpl.NextLink + } + return json.Marshal(objectMap) +} + +// WebApplicationFirewallPolicyListIterator provides access to a complete listing of +// WebApplicationFirewallPolicy values. +type WebApplicationFirewallPolicyListIterator struct { + i int + page WebApplicationFirewallPolicyListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *WebApplicationFirewallPolicyListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPolicyListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *WebApplicationFirewallPolicyListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WebApplicationFirewallPolicyListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter WebApplicationFirewallPolicyListIterator) Response() WebApplicationFirewallPolicyList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter WebApplicationFirewallPolicyListIterator) Value() WebApplicationFirewallPolicy { + if !iter.page.NotDone() { + return WebApplicationFirewallPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WebApplicationFirewallPolicyListIterator type. +func NewWebApplicationFirewallPolicyListIterator(page WebApplicationFirewallPolicyListPage) WebApplicationFirewallPolicyListIterator { + return WebApplicationFirewallPolicyListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wafpl WebApplicationFirewallPolicyList) IsEmpty() bool { + return wafpl.Value == nil || len(*wafpl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wafpl WebApplicationFirewallPolicyList) hasNextLink() bool { + return wafpl.NextLink != nil && len(*wafpl.NextLink) != 0 +} + +// webApplicationFirewallPolicyListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wafpl WebApplicationFirewallPolicyList) webApplicationFirewallPolicyListPreparer(ctx context.Context) (*http.Request, error) { + if !wafpl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wafpl.NextLink))) +} + +// WebApplicationFirewallPolicyListPage contains a page of WebApplicationFirewallPolicy values. +type WebApplicationFirewallPolicyListPage struct { + fn func(context.Context, WebApplicationFirewallPolicyList) (WebApplicationFirewallPolicyList, error) + wafpl WebApplicationFirewallPolicyList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *WebApplicationFirewallPolicyListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPolicyListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.wafpl) + if err != nil { + return err + } + page.wafpl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *WebApplicationFirewallPolicyListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WebApplicationFirewallPolicyListPage) NotDone() bool { + return !page.wafpl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WebApplicationFirewallPolicyListPage) Response() WebApplicationFirewallPolicyList { + return page.wafpl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WebApplicationFirewallPolicyListPage) Values() []WebApplicationFirewallPolicy { + if page.wafpl.IsEmpty() { + return nil + } + return *page.wafpl.Value +} + +// Creates a new instance of the WebApplicationFirewallPolicyListPage type. +func NewWebApplicationFirewallPolicyListPage(cur WebApplicationFirewallPolicyList, getNextPage func(context.Context, WebApplicationFirewallPolicyList) (WebApplicationFirewallPolicyList, error)) WebApplicationFirewallPolicyListPage { + return WebApplicationFirewallPolicyListPage{ + fn: getNextPage, + wafpl: cur, + } +} + +// WebApplicationFirewallPolicyPatchParameters properties required to update a +// CdnWebApplicationFirewallPolicy. +type WebApplicationFirewallPolicyPatchParameters struct { + // Tags - CdnWebApplicationFirewallPolicy tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyPatchParameters. +func (wafppp WebApplicationFirewallPolicyPatchParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafppp.Tags != nil { + objectMap["tags"] = wafppp.Tags + } + return json.Marshal(objectMap) +} + +// WebApplicationFirewallPolicyProperties defines CDN web application firewall policy properties. +type WebApplicationFirewallPolicyProperties struct { + // PolicySettings - Describes policySettings for policy + PolicySettings *PolicySettings `json:"policySettings,omitempty"` + // RateLimitRules - Describes rate limit rules inside the policy. + RateLimitRules *RateLimitRuleList `json:"rateLimitRules,omitempty"` + // CustomRules - Describes custom rules inside the policy. + CustomRules *CustomRuleList `json:"customRules,omitempty"` + // ManagedRules - Describes managed rules inside the policy. + ManagedRules *ManagedRuleSetList `json:"managedRules,omitempty"` + // EndpointLinks - READ-ONLY; Describes Azure CDN endpoints associated with this Web Application Firewall policy. + EndpointLinks *[]EndpointType `json:"endpointLinks,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the WebApplicationFirewallPolicy. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ResourceState - READ-ONLY; Possible values include: 'PolicyResourceStateCreating', 'PolicyResourceStateEnabling', 'PolicyResourceStateEnabled', 'PolicyResourceStateDisabling', 'PolicyResourceStateDisabled', 'PolicyResourceStateDeleting' + ResourceState PolicyResourceState `json:"resourceState,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyProperties. +func (wafpp WebApplicationFirewallPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafpp.PolicySettings != nil { + objectMap["policySettings"] = wafpp.PolicySettings + } + if wafpp.RateLimitRules != nil { + objectMap["rateLimitRules"] = wafpp.RateLimitRules + } + if wafpp.CustomRules != nil { + objectMap["customRules"] = wafpp.CustomRules + } + if wafpp.ManagedRules != nil { + objectMap["managedRules"] = wafpp.ManagedRules + } + return json.Marshal(objectMap) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/operations.go new file mode 100644 index 000000000000..d9e4f38bbab4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/operations.go @@ -0,0 +1,140 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the cdn Management Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available CDN REST API operations. +func (client OperationsClient) List(ctx context.Context) (result OperationsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Cdn/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationsListResult) (result OperationsListResult, err error) { + req, err := lastResults.operationsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/origingroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/origingroups.go new file mode 100644 index 000000000000..8c75811b3a68 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/origingroups.go @@ -0,0 +1,526 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OriginGroupsClient is the cdn Management Client +type OriginGroupsClient struct { + BaseClient +} + +// NewOriginGroupsClient creates an instance of the OriginGroupsClient client. +func NewOriginGroupsClient(subscriptionID string) OriginGroupsClient { + return NewOriginGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOriginGroupsClientWithBaseURI creates an instance of the OriginGroupsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOriginGroupsClientWithBaseURI(baseURI string, subscriptionID string) OriginGroupsClient { + return OriginGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new origin group within the specified endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originGroupName - name of the origin group which is unique within the endpoint. +// originGroup - origin group properties +func (client OriginGroupsClient) Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string, originGroup OriginGroup) (result OriginGroupsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginGroupsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, endpointName, originGroupName, originGroup) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client OriginGroupsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string, originGroup OriginGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}", pathParameters), + autorest.WithJSON(originGroup), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client OriginGroupsClient) CreateSender(req *http.Request) (future OriginGroupsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client OriginGroupsClient) CreateResponder(resp *http.Response) (result OriginGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing origin group within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originGroupName - name of the origin group which is unique within the endpoint. +func (client OriginGroupsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string) (result OriginGroupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginGroupsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, endpointName, originGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OriginGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client OriginGroupsClient) DeleteSender(req *http.Request) (future OriginGroupsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client OriginGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing origin group within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originGroupName - name of the origin group which is unique within the endpoint. +func (client OriginGroupsClient) Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string) (result OriginGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginGroupsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, endpointName, originGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OriginGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OriginGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OriginGroupsClient) GetResponder(resp *http.Response) (result OriginGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByEndpoint lists all of the existing origin groups within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client OriginGroupsClient) ListByEndpoint(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result OriginGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupsClient.ListByEndpoint") + defer func() { + sc := -1 + if result.oglr.Response.Response != nil { + sc = result.oglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginGroupsClient", "ListByEndpoint", err.Error()) + } + + result.fn = client.listByEndpointNextResults + req, err := client.ListByEndpointPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "ListByEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.oglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "ListByEndpoint", resp, "Failure sending request") + return + } + + result.oglr, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "ListByEndpoint", resp, "Failure responding to request") + return + } + if result.oglr.hasNextLink() && result.oglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByEndpointPreparer prepares the ListByEndpoint request. +func (client OriginGroupsClient) ListByEndpointPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByEndpointSender sends the ListByEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client OriginGroupsClient) ListByEndpointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByEndpointResponder handles the response to the ListByEndpoint request. The method always +// closes the http.Response Body. +func (client OriginGroupsClient) ListByEndpointResponder(resp *http.Response) (result OriginGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByEndpointNextResults retrieves the next set of results, if any. +func (client OriginGroupsClient) listByEndpointNextResults(ctx context.Context, lastResults OriginGroupListResult) (result OriginGroupListResult, err error) { + req, err := lastResults.originGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "listByEndpointNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "listByEndpointNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "listByEndpointNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByEndpointComplete enumerates all values, automatically crossing page boundaries as required. +func (client OriginGroupsClient) ListByEndpointComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result OriginGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupsClient.ListByEndpoint") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByEndpoint(ctx, resourceGroupName, profileName, endpointName) + return +} + +// Update updates an existing origin group within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originGroupName - name of the origin group which is unique within the endpoint. +// originGroupUpdateProperties - origin group properties +func (client OriginGroupsClient) Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string, originGroupUpdateProperties OriginGroupUpdateParameters) (result OriginGroupsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginGroupsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginGroupsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, endpointName, originGroupName, originGroupUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client OriginGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originGroupName string, originGroupUpdateProperties OriginGroupUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}", pathParameters), + autorest.WithJSON(originGroupUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client OriginGroupsClient) UpdateSender(req *http.Request) (future OriginGroupsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client OriginGroupsClient) UpdateResponder(resp *http.Response) (result OriginGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/origins.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/origins.go new file mode 100644 index 000000000000..d0a5c06706cc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/origins.go @@ -0,0 +1,526 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OriginsClient is the cdn Management Client +type OriginsClient struct { + BaseClient +} + +// NewOriginsClient creates an instance of the OriginsClient client. +func NewOriginsClient(subscriptionID string) OriginsClient { + return NewOriginsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOriginsClientWithBaseURI creates an instance of the OriginsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOriginsClientWithBaseURI(baseURI string, subscriptionID string) OriginsClient { + return OriginsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new origin within the specified endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originName - name of the origin that is unique within the endpoint. +// origin - origin properties +func (client OriginsClient) Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string, origin Origin) (result OriginsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, endpointName, originName, origin) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client OriginsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string, origin Origin) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", pathParameters), + autorest.WithJSON(origin), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client OriginsClient) CreateSender(req *http.Request) (future OriginsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client OriginsClient) CreateResponder(resp *http.Response) (result Origin, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing origin within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originName - name of the origin which is unique within the endpoint. +func (client OriginsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string) (result OriginsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, endpointName, originName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OriginsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client OriginsClient) DeleteSender(req *http.Request) (future OriginsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client OriginsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing origin within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originName - name of the origin which is unique within the endpoint. +func (client OriginsClient) Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string) (result Origin, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, endpointName, originName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OriginsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OriginsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OriginsClient) GetResponder(resp *http.Response) (result Origin, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByEndpoint lists all of the existing origins within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client OriginsClient) ListByEndpoint(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result OriginListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginsClient.ListByEndpoint") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginsClient", "ListByEndpoint", err.Error()) + } + + result.fn = client.listByEndpointNextResults + req, err := client.ListByEndpointPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", resp, "Failure sending request") + return + } + + result.olr, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByEndpointPreparer prepares the ListByEndpoint request. +func (client OriginsClient) ListByEndpointPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByEndpointSender sends the ListByEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client OriginsClient) ListByEndpointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByEndpointResponder handles the response to the ListByEndpoint request. The method always +// closes the http.Response Body. +func (client OriginsClient) ListByEndpointResponder(resp *http.Response) (result OriginListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByEndpointNextResults retrieves the next set of results, if any. +func (client OriginsClient) listByEndpointNextResults(ctx context.Context, lastResults OriginListResult) (result OriginListResult, err error) { + req, err := lastResults.originListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.OriginsClient", "listByEndpointNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.OriginsClient", "listByEndpointNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "listByEndpointNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByEndpointComplete enumerates all values, automatically crossing page boundaries as required. +func (client OriginsClient) ListByEndpointComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result OriginListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginsClient.ListByEndpoint") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByEndpoint(ctx, resourceGroupName, profileName, endpointName) + return +} + +// Update updates an existing origin within an endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// originName - name of the origin which is unique within the endpoint. +// originUpdateProperties - origin properties +func (client OriginsClient) Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string, originUpdateProperties OriginUpdateParameters) (result OriginsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OriginsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.OriginsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, endpointName, originName, originUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client OriginsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, originName string, originUpdateProperties OriginUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", pathParameters), + autorest.WithJSON(originUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client OriginsClient) UpdateSender(req *http.Request) (future OriginsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client OriginsClient) UpdateResponder(resp *http.Response) (result Origin, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/policies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/policies.go new file mode 100644 index 000000000000..da7694f354ff --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/policies.go @@ -0,0 +1,520 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PoliciesClient is the cdn Management Client +type PoliciesClient struct { + BaseClient +} + +// NewPoliciesClient creates an instance of the PoliciesClient client. +func NewPoliciesClient(subscriptionID string) PoliciesClient { + return NewPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPoliciesClientWithBaseURI creates an instance of the PoliciesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewPoliciesClientWithBaseURI(baseURI string, subscriptionID string) PoliciesClient { + return PoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update policy with specified rule set name within a resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// policyName - the name of the CdnWebApplicationFirewallPolicy. +// cdnWebApplicationFirewallPolicy - policy to be created. +func (client PoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, policyName string, cdnWebApplicationFirewallPolicy WebApplicationFirewallPolicy) (result PoliciesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: policyName, + Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}, + {TargetValue: cdnWebApplicationFirewallPolicy, + Constraints: []validation.Constraint{{Target: "cdnWebApplicationFirewallPolicy.WebApplicationFirewallPolicyProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cdnWebApplicationFirewallPolicy.WebApplicationFirewallPolicyProperties.PolicySettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cdnWebApplicationFirewallPolicy.WebApplicationFirewallPolicyProperties.PolicySettings.DefaultCustomBlockResponseBody", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cdnWebApplicationFirewallPolicy.WebApplicationFirewallPolicyProperties.PolicySettings.DefaultCustomBlockResponseBody", Name: validation.Pattern, Rule: `^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$`, Chain: nil}}}, + }}, + }}, + {Target: "cdnWebApplicationFirewallPolicy.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.PoliciesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, policyName, cdnWebApplicationFirewallPolicy) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, policyName string, cdnWebApplicationFirewallPolicy WebApplicationFirewallPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}", pathParameters), + autorest.WithJSON(cdnWebApplicationFirewallPolicy), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) CreateOrUpdateSender(req *http.Request) (future PoliciesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result WebApplicationFirewallPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes Policy +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// policyName - the name of the CdnWebApplicationFirewallPolicy. +func (client PoliciesClient) Delete(ctx context.Context, resourceGroupName string, policyName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: policyName, + Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.PoliciesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, policyName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, policyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve protection policy with specified name within a resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// policyName - the name of the CdnWebApplicationFirewallPolicy. +func (client PoliciesClient) Get(ctx context.Context, resourceGroupName string, policyName string) (result WebApplicationFirewallPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: policyName, + Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.PoliciesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, policyName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, policyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PoliciesClient) GetResponder(resp *http.Response) (result WebApplicationFirewallPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the protection policies within a resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +func (client PoliciesClient) List(ctx context.Context, resourceGroupName string) (result WebApplicationFirewallPolicyListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.List") + defer func() { + sc := -1 + if result.wafpl.Response.Response != nil { + sc = result.wafpl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.PoliciesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.wafpl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "List", resp, "Failure sending request") + return + } + + result.wafpl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "List", resp, "Failure responding to request") + return + } + if result.wafpl.hasNextLink() && result.wafpl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PoliciesClient) ListResponder(resp *http.Response) (result WebApplicationFirewallPolicyList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PoliciesClient) listNextResults(ctx context.Context, lastResults WebApplicationFirewallPolicyList) (result WebApplicationFirewallPolicyList, err error) { + req, err := lastResults.webApplicationFirewallPolicyListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.PoliciesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.PoliciesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PoliciesClient) ListComplete(ctx context.Context, resourceGroupName string) (result WebApplicationFirewallPolicyListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// Update update an existing CdnWebApplicationFirewallPolicy with the specified policy name under the specified +// subscription and resource group +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// policyName - the name of the CdnWebApplicationFirewallPolicy. +// cdnWebApplicationFirewallPolicyPatchParameters - cdnWebApplicationFirewallPolicy parameters to be patched. +func (client PoliciesClient) Update(ctx context.Context, resourceGroupName string, policyName string, cdnWebApplicationFirewallPolicyPatchParameters WebApplicationFirewallPolicyPatchParameters) (result PoliciesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: policyName, + Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.PoliciesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, policyName, cdnWebApplicationFirewallPolicyPatchParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.PoliciesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PoliciesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, policyName string, cdnWebApplicationFirewallPolicyPatchParameters WebApplicationFirewallPolicyPatchParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}", pathParameters), + autorest.WithJSON(cdnWebApplicationFirewallPolicyPatchParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) UpdateSender(req *http.Request) (future PoliciesUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PoliciesClient) UpdateResponder(resp *http.Response) (result WebApplicationFirewallPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/profiles.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/profiles.go new file mode 100644 index 000000000000..ef90caf19ff5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/profiles.go @@ -0,0 +1,938 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ProfilesClient is the cdn Management Client +type ProfilesClient struct { + BaseClient +} + +// NewProfilesClient creates an instance of the ProfilesClient client. +func NewProfilesClient(subscriptionID string) ProfilesClient { + return NewProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProfilesClientWithBaseURI creates an instance of the ProfilesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewProfilesClientWithBaseURI(baseURI string, subscriptionID string) ProfilesClient { + return ProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new Azure Front Door Standard or Azure Front Door Premium or CDN profile with a profile name under +// the specified subscription and resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +// profile - profile properties needed to create a new profile. +func (client ProfilesClient) Create(ctx context.Context, resourceGroupName string, profileName string, profile Profile) (result ProfilesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: profile, + Constraints: []validation.Constraint{{Target: "profile.Sku", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "profile.ProfileProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "profile.ProfileProperties.OriginResponseTimeoutSeconds", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "profile.ProfileProperties.OriginResponseTimeoutSeconds", Name: validation.InclusiveMinimum, Rule: int64(16), Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, profile) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ProfilesClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, profile Profile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + profile.Kind = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), + autorest.WithJSON(profile), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) CreateSender(req *http.Request) (future ProfilesCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ProfilesClient) CreateResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing Azure Front Door Standard or Azure Front Door Premium or CDN profile with the specified +// parameters. Deleting a profile will result in the deletion of all of the sub-resources including endpoints, origins +// and custom domains. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +func (client ProfilesClient) Delete(ctx context.Context, resourceGroupName string, profileName string) (result ProfilesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ProfilesClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) DeleteSender(req *http.Request) (future ProfilesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateSsoURI generates a dynamic SSO URI used to sign in to the CDN supplemental portal. Supplemental portal is +// used to configure advanced feature capabilities that are not yet available in the Azure portal, such as core reports +// in a standard profile; rules engine, advanced HTTP reports, and real-time stats and alerts in a premium profile. The +// SSO URI changes approximately every 10 minutes. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the CDN profile which is unique within the resource group. +func (client ProfilesClient) GenerateSsoURI(ctx context.Context, resourceGroupName string, profileName string) (result SsoURI, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.GenerateSsoURI") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "GenerateSsoURI", err.Error()) + } + + req, err := client.GenerateSsoURIPreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateSsoURISender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", resp, "Failure sending request") + return + } + + result, err = client.GenerateSsoURIResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", resp, "Failure responding to request") + return + } + + return +} + +// GenerateSsoURIPreparer prepares the GenerateSsoURI request. +func (client ProfilesClient) GenerateSsoURIPreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/generateSsoUri", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateSsoURISender sends the GenerateSsoURI request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) GenerateSsoURISender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GenerateSsoURIResponder handles the response to the GenerateSsoURI request. The method always +// closes the http.Response Body. +func (client ProfilesClient) GenerateSsoURIResponder(resp *http.Response) (result SsoURI, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets an Azure Front Door Standard or Azure Front Door Premium or CDN profile with the specified profile name +// under the specified subscription and resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +func (client ProfilesClient) Get(ctx context.Context, resourceGroupName string, profileName string) (result Profile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProfilesClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProfilesClient) GetResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the Azure Front Door Standard, Azure Front Door Premium, and CDN profiles within an Azure +// subscription. +func (client ProfilesClient) List(ctx context.Context) (result ProfileListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.List") + defer func() { + sc := -1 + if result.plr.Response.Response != nil { + sc = result.plr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.plr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", resp, "Failure sending request") + return + } + + result.plr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", resp, "Failure responding to request") + return + } + if result.plr.hasNextLink() && result.plr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ProfilesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListResponder(resp *http.Response) (result ProfileListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ProfilesClient) listNextResults(ctx context.Context, lastResults ProfileListResult) (result ProfileListResult, err error) { + req, err := lastResults.profileListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProfilesClient) ListComplete(ctx context.Context) (result ProfileListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists all of the Azure Front Door Standard, Azure Front Door Premium, and CDN profiles within a +// resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +func (client ProfilesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ProfileListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.plr.Response.Response != nil { + sc = result.plr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.plr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.plr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.plr.hasNextLink() && result.plr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ProfilesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListByResourceGroupResponder(resp *http.Response) (result ProfileListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ProfilesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ProfileListResult) (result ProfileListResult, err error) { + req, err := lastResults.profileListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProfilesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ProfileListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListResourceUsage checks the quota and actual usage of endpoints under the given Azure Front Door Standard or Azure +// Front Door Premium or CDN profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +func (client ProfilesClient) ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string) (result ResourceUsageListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.ListResourceUsage") + defer func() { + sc := -1 + if result.rulr.Response.Response != nil { + sc = result.rulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "ListResourceUsage", err.Error()) + } + + result.fn = client.listResourceUsageNextResults + req, err := client.ListResourceUsagePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.rulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure sending request") + return + } + + result.rulr, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure responding to request") + return + } + if result.rulr.hasNextLink() && result.rulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client ProfilesClient) ListResourceUsagePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkResourceUsage", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listResourceUsageNextResults retrieves the next set of results, if any. +func (client ProfilesClient) listResourceUsageNextResults(ctx context.Context, lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) { + req, err := lastResults.resourceUsageListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listResourceUsageNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listResourceUsageNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "listResourceUsageNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListResourceUsageComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProfilesClient) ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string) (result ResourceUsageListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.ListResourceUsage") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListResourceUsage(ctx, resourceGroupName, profileName) + return +} + +// ListSupportedOptimizationTypes gets the supported optimization types for the current profile. A user can create an +// endpoint with an optimization type from the listed values. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +func (client ProfilesClient) ListSupportedOptimizationTypes(ctx context.Context, resourceGroupName string, profileName string) (result SupportedOptimizationTypesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.ListSupportedOptimizationTypes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "ListSupportedOptimizationTypes", err.Error()) + } + + req, err := client.ListSupportedOptimizationTypesPreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListSupportedOptimizationTypes", nil, "Failure preparing request") + return + } + + resp, err := client.ListSupportedOptimizationTypesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListSupportedOptimizationTypes", resp, "Failure sending request") + return + } + + result, err = client.ListSupportedOptimizationTypesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListSupportedOptimizationTypes", resp, "Failure responding to request") + return + } + + return +} + +// ListSupportedOptimizationTypesPreparer prepares the ListSupportedOptimizationTypes request. +func (client ProfilesClient) ListSupportedOptimizationTypesPreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getSupportedOptimizationTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSupportedOptimizationTypesSender sends the ListSupportedOptimizationTypes request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListSupportedOptimizationTypesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSupportedOptimizationTypesResponder handles the response to the ListSupportedOptimizationTypes request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListSupportedOptimizationTypesResponder(resp *http.Response) (result SupportedOptimizationTypesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing Azure Front Door Standard or Azure Front Door Premium or CDN profile with the specified +// profile name under the specified subscription and resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is +// unique within the resource group. +// profileUpdateParameters - profile properties needed to update an existing profile. +func (client ProfilesClient) Update(ctx context.Context, resourceGroupName string, profileName string, profileUpdateParameters ProfileUpdateParameters) (result ProfilesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ProfilesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, profileUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ProfilesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, profileUpdateParameters ProfileUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), + autorest.WithJSON(profileUpdateParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) UpdateSender(req *http.Request) (future ProfilesUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ProfilesClient) UpdateResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/resourceusage.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/resourceusage.go new file mode 100644 index 000000000000..6507ba14dfc9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/resourceusage.go @@ -0,0 +1,144 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ResourceUsageClient is the cdn Management Client +type ResourceUsageClient struct { + BaseClient +} + +// NewResourceUsageClient creates an instance of the ResourceUsageClient client. +func NewResourceUsageClient(subscriptionID string) ResourceUsageClient { + return NewResourceUsageClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResourceUsageClientWithBaseURI creates an instance of the ResourceUsageClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewResourceUsageClientWithBaseURI(baseURI string, subscriptionID string) ResourceUsageClient { + return ResourceUsageClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List check the quota and actual usage of the CDN profiles under the given subscription. +func (client ResourceUsageClient) List(ctx context.Context) (result ResourceUsageListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceUsageClient.List") + defer func() { + sc := -1 + if result.rulr.Response.Response != nil { + sc = result.rulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ResourceUsageClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ResourceUsageClient", "List", resp, "Failure sending request") + return + } + + result.rulr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ResourceUsageClient", "List", resp, "Failure responding to request") + return + } + if result.rulr.hasNextLink() && result.rulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ResourceUsageClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceUsageClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ResourceUsageClient) ListResponder(resp *http.Response) (result ResourceUsageListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ResourceUsageClient) listNextResults(ctx context.Context, lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) { + req, err := lastResults.resourceUsageListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.ResourceUsageClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.ResourceUsageClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ResourceUsageClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ResourceUsageClient) ListComplete(ctx context.Context) (result ResourceUsageListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceUsageClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/routes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/routes.go new file mode 100644 index 000000000000..aa270800aea1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/routes.go @@ -0,0 +1,538 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RoutesClient is the cdn Management Client +type RoutesClient struct { + BaseClient +} + +// NewRoutesClient creates an instance of the RoutesClient client. +func NewRoutesClient(subscriptionID string) RoutesClient { + return NewRoutesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoutesClientWithBaseURI creates an instance of the RoutesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewRoutesClientWithBaseURI(baseURI string, subscriptionID string) RoutesClient { + return RoutesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new route with the specified route name under the specified subscription, resource group, profile, +// and AzureFrontDoor endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// routeName - name of the routing rule. +// route - route properties +func (client RoutesClient) Create(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string, route Route) (result RoutesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: route, + Constraints: []validation.Constraint{{Target: "route.RouteProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "route.RouteProperties.OriginGroup", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("cdn.RoutesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, endpointName, routeName, route) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client RoutesClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string, route Route) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}", pathParameters), + autorest.WithJSON(route), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) CreateSender(req *http.Request) (future RoutesCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client RoutesClient) CreateResponder(resp *http.Response) (result Route, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing route with the specified route name under the specified subscription, resource group, +// profile, and AzureFrontDoor endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// routeName - name of the routing rule. +func (client RoutesClient) Delete(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string) (result RoutesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RoutesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, endpointName, routeName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RoutesClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) DeleteSender(req *http.Request) (future RoutesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RoutesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing route with the specified route name under the specified subscription, resource group, profile, +// and AzureFrontDoor endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// routeName - name of the routing rule. +func (client RoutesClient) Get(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string) (result Route, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RoutesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, endpointName, routeName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoutesClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoutesClient) GetResponder(resp *http.Response) (result Route, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByEndpoint lists all of the existing origins within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +func (client RoutesClient) ListByEndpoint(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result RouteListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.ListByEndpoint") + defer func() { + sc := -1 + if result.rlr.Response.Response != nil { + sc = result.rlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RoutesClient", "ListByEndpoint", err.Error()) + } + + result.fn = client.listByEndpointNextResults + req, err := client.ListByEndpointPreparer(ctx, resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "ListByEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.rlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "ListByEndpoint", resp, "Failure sending request") + return + } + + result.rlr, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "ListByEndpoint", resp, "Failure responding to request") + return + } + if result.rlr.hasNextLink() && result.rlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByEndpointPreparer prepares the ListByEndpoint request. +func (client RoutesClient) ListByEndpointPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByEndpointSender sends the ListByEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) ListByEndpointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByEndpointResponder handles the response to the ListByEndpoint request. The method always +// closes the http.Response Body. +func (client RoutesClient) ListByEndpointResponder(resp *http.Response) (result RouteListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByEndpointNextResults retrieves the next set of results, if any. +func (client RoutesClient) listByEndpointNextResults(ctx context.Context, lastResults RouteListResult) (result RouteListResult, err error) { + req, err := lastResults.routeListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.RoutesClient", "listByEndpointNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.RoutesClient", "listByEndpointNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "listByEndpointNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByEndpointComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoutesClient) ListByEndpointComplete(ctx context.Context, resourceGroupName string, profileName string, endpointName string) (result RouteListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.ListByEndpoint") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByEndpoint(ctx, resourceGroupName, profileName, endpointName) + return +} + +// Update updates an existing route with the specified route name under the specified subscription, resource group, +// profile, and AzureFrontDoor endpoint. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// endpointName - name of the endpoint under the profile which is unique globally. +// routeName - name of the routing rule. +// routeUpdateProperties - route update properties +func (client RoutesClient) Update(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string, routeUpdateProperties RouteUpdateParameters) (result RoutesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RoutesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, endpointName, routeName, routeUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RoutesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client RoutesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointName string, routeName string, routeUpdateProperties RouteUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}", pathParameters), + autorest.WithJSON(routeUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) UpdateSender(req *http.Request) (future RoutesUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client RoutesClient) UpdateResponder(resp *http.Response) (result Route, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/rules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/rules.go new file mode 100644 index 000000000000..e3e894517995 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/rules.go @@ -0,0 +1,536 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RulesClient is the cdn Management Client +type RulesClient struct { + BaseClient +} + +// NewRulesClient creates an instance of the RulesClient client. +func NewRulesClient(subscriptionID string) RulesClient { + return NewRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRulesClientWithBaseURI creates an instance of the RulesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewRulesClientWithBaseURI(baseURI string, subscriptionID string) RulesClient { + return RulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new delivery rule within the specified rule set. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile. +// ruleName - name of the delivery rule which is unique within the endpoint. +// rule - the delivery rule properties. +func (client RulesClient) Create(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string, rule Rule) (result RulesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: rule, + Constraints: []validation.Constraint{{Target: "rule.RuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "rule.RuleProperties.Order", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "rule.RuleProperties.Actions", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("cdn.RulesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, ruleSetName, ruleName, rule) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client RulesClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string, rule Rule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}", pathParameters), + autorest.WithJSON(rule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client RulesClient) CreateSender(req *http.Request) (future RulesCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client RulesClient) CreateResponder(resp *http.Response) (result Rule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing delivery rule within a rule set. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile. +// ruleName - name of the delivery rule which is unique within the endpoint. +func (client RulesClient) Delete(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string) (result RulesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RulesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, ruleSetName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RulesClient) DeleteSender(req *http.Request) (future RulesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing delivery rule within a rule set. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile. +// ruleName - name of the delivery rule which is unique within the endpoint. +func (client RulesClient) Get(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string) (result Rule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RulesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, ruleSetName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RulesClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RulesClient) GetResponder(resp *http.Response) (result Rule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByRuleSet lists all of the existing delivery rules within a rule set. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile. +func (client RulesClient) ListByRuleSet(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result RuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.ListByRuleSet") + defer func() { + sc := -1 + if result.rlr.Response.Response != nil { + sc = result.rlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RulesClient", "ListByRuleSet", err.Error()) + } + + result.fn = client.listByRuleSetNextResults + req, err := client.ListByRuleSetPreparer(ctx, resourceGroupName, profileName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "ListByRuleSet", nil, "Failure preparing request") + return + } + + resp, err := client.ListByRuleSetSender(req) + if err != nil { + result.rlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "ListByRuleSet", resp, "Failure sending request") + return + } + + result.rlr, err = client.ListByRuleSetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "ListByRuleSet", resp, "Failure responding to request") + return + } + if result.rlr.hasNextLink() && result.rlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByRuleSetPreparer prepares the ListByRuleSet request. +func (client RulesClient) ListByRuleSetPreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByRuleSetSender sends the ListByRuleSet request. The method will close the +// http.Response Body if it receives an error. +func (client RulesClient) ListByRuleSetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByRuleSetResponder handles the response to the ListByRuleSet request. The method always +// closes the http.Response Body. +func (client RulesClient) ListByRuleSetResponder(resp *http.Response) (result RuleListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByRuleSetNextResults retrieves the next set of results, if any. +func (client RulesClient) listByRuleSetNextResults(ctx context.Context, lastResults RuleListResult) (result RuleListResult, err error) { + req, err := lastResults.ruleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.RulesClient", "listByRuleSetNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByRuleSetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.RulesClient", "listByRuleSetNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByRuleSetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "listByRuleSetNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByRuleSetComplete enumerates all values, automatically crossing page boundaries as required. +func (client RulesClient) ListByRuleSetComplete(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result RuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.ListByRuleSet") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByRuleSet(ctx, resourceGroupName, profileName, ruleSetName) + return +} + +// Update updates an existing delivery rule within a rule set. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile. +// ruleName - name of the delivery rule which is unique within the endpoint. +// ruleUpdateProperties - delivery rule properties +func (client RulesClient) Update(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string, ruleUpdateProperties RuleUpdateParameters) (result RulesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RulesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, ruleSetName, ruleName, ruleUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RulesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client RulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string, ruleName string, ruleUpdateProperties RuleUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}", pathParameters), + autorest.WithJSON(ruleUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client RulesClient) UpdateSender(req *http.Request) (future RulesUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client RulesClient) UpdateResponder(resp *http.Response) (result Rule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/rulesets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/rulesets.go new file mode 100644 index 000000000000..b42a1bf78c3c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/rulesets.go @@ -0,0 +1,553 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RuleSetsClient is the cdn Management Client +type RuleSetsClient struct { + BaseClient +} + +// NewRuleSetsClient creates an instance of the RuleSetsClient client. +func NewRuleSetsClient(subscriptionID string) RuleSetsClient { + return NewRuleSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRuleSetsClientWithBaseURI creates an instance of the RuleSetsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewRuleSetsClientWithBaseURI(baseURI string, subscriptionID string) RuleSetsClient { + return RuleSetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new rule set within the specified profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile which is unique globally +func (client RuleSetsClient) Create(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result RuleSet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RuleSetsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client RuleSetsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client RuleSetsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client RuleSetsClient) CreateResponder(resp *http.Response) (result RuleSet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing AzureFrontDoor rule set with the specified rule set name under the specified +// subscription, resource group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile which is unique globally. +func (client RuleSetsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result RuleSetsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RuleSetsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RuleSetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RuleSetsClient) DeleteSender(req *http.Request) (future RuleSetsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RuleSetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing AzureFrontDoor rule set with the specified rule set name under the specified subscription, +// resource group and profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile which is unique globally. +func (client RuleSetsClient) Get(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result RuleSet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RuleSetsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RuleSetsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RuleSetsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RuleSetsClient) GetResponder(resp *http.Response) (result RuleSet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile lists existing AzureFrontDoor rule sets within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +func (client RuleSetsClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result RuleSetListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetsClient.ListByProfile") + defer func() { + sc := -1 + if result.rslr.Response.Response != nil { + sc = result.rslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RuleSetsClient", "ListByProfile", err.Error()) + } + + result.fn = client.listByProfileNextResults + req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.rslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "ListByProfile", resp, "Failure sending request") + return + } + + result.rslr, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "ListByProfile", resp, "Failure responding to request") + return + } + if result.rslr.hasNextLink() && result.rslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client RuleSetsClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client RuleSetsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client RuleSetsClient) ListByProfileResponder(resp *http.Response) (result RuleSetListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByProfileNextResults retrieves the next set of results, if any. +func (client RuleSetsClient) listByProfileNextResults(ctx context.Context, lastResults RuleSetListResult) (result RuleSetListResult, err error) { + req, err := lastResults.ruleSetListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "listByProfileNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "listByProfileNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "listByProfileNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. +func (client RuleSetsClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result RuleSetListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetsClient.ListByProfile") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) + return +} + +// ListResourceUsage checks the quota and actual usage of endpoints under the given CDN profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// ruleSetName - name of the rule set under the profile which is unique globally. +func (client RuleSetsClient) ListResourceUsage(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result UsagesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.ulr.Response.Response != nil { + sc = result.ulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.RuleSetsClient", "ListResourceUsage", err.Error()) + } + + result.fn = client.listResourceUsageNextResults + req, err := client.ListResourceUsagePreparer(ctx, resourceGroupName, profileName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "ListResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.ulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "ListResourceUsage", resp, "Failure sending request") + return + } + + result.ulr, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "ListResourceUsage", resp, "Failure responding to request") + return + } + if result.ulr.hasNextLink() && result.ulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client RuleSetsClient) ListResourceUsagePreparer(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client RuleSetsClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always +// closes the http.Response Body. +func (client RuleSetsClient) ListResourceUsageResponder(resp *http.Response) (result UsagesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listResourceUsageNextResults retrieves the next set of results, if any. +func (client RuleSetsClient) listResourceUsageNextResults(ctx context.Context, lastResults UsagesListResult) (result UsagesListResult, err error) { + req, err := lastResults.usagesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "listResourceUsageNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "listResourceUsageNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.RuleSetsClient", "listResourceUsageNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListResourceUsageComplete enumerates all values, automatically crossing page boundaries as required. +func (client RuleSetsClient) ListResourceUsageComplete(ctx context.Context, resourceGroupName string, profileName string, ruleSetName string) (result UsagesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuleSetsClient.ListResourceUsage") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListResourceUsage(ctx, resourceGroupName, profileName, ruleSetName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/secrets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/secrets.go new file mode 100644 index 000000000000..7706c4e7efad --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/secrets.go @@ -0,0 +1,428 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SecretsClient is the cdn Management Client +type SecretsClient struct { + BaseClient +} + +// NewSecretsClient creates an instance of the SecretsClient client. +func NewSecretsClient(subscriptionID string) SecretsClient { + return NewSecretsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSecretsClientWithBaseURI creates an instance of the SecretsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSecretsClientWithBaseURI(baseURI string, subscriptionID string) SecretsClient { + return SecretsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new Secret within the specified profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// secretName - name of the Secret under the profile. +// secret - the Secret properties. +func (client SecretsClient) Create(ctx context.Context, resourceGroupName string, profileName string, secretName string, secret Secret) (result SecretsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecretsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, secretName, secret) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client SecretsClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, secretName string, secret Secret) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "secretName": autorest.Encode("path", secretName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}", pathParameters), + autorest.WithJSON(secret), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) CreateSender(req *http.Request) (future SecretsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client SecretsClient) CreateResponder(resp *http.Response) (result Secret, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing Secret within profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// secretName - name of the Secret under the profile. +func (client SecretsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, secretName string) (result SecretsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecretsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, secretName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SecretsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, secretName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "secretName": autorest.Encode("path", secretName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) DeleteSender(req *http.Request) (future SecretsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SecretsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing Secret within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// secretName - name of the Secret under the profile. +func (client SecretsClient) Get(ctx context.Context, resourceGroupName string, profileName string, secretName string) (result Secret, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecretsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, secretName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SecretsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, secretName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "secretName": autorest.Encode("path", secretName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SecretsClient) GetResponder(resp *http.Response) (result Secret, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile lists existing AzureFrontDoor secrets. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +func (client SecretsClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result SecretListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.ListByProfile") + defer func() { + sc := -1 + if result.slr.Response.Response != nil { + sc = result.slr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecretsClient", "ListByProfile", err.Error()) + } + + result.fn = client.listByProfileNextResults + req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "ListByProfile", resp, "Failure sending request") + return + } + + result.slr, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "ListByProfile", resp, "Failure responding to request") + return + } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client SecretsClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client SecretsClient) ListByProfileResponder(resp *http.Response) (result SecretListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByProfileNextResults retrieves the next set of results, if any. +func (client SecretsClient) listByProfileNextResults(ctx context.Context, lastResults SecretListResult) (result SecretListResult, err error) { + req, err := lastResults.secretListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.SecretsClient", "listByProfileNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.SecretsClient", "listByProfileNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecretsClient", "listByProfileNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecretsClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result SecretListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.ListByProfile") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/securitypolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/securitypolicies.go new file mode 100644 index 000000000000..fae4f8d8c600 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/securitypolicies.go @@ -0,0 +1,522 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SecurityPoliciesClient is the cdn Management Client +type SecurityPoliciesClient struct { + BaseClient +} + +// NewSecurityPoliciesClient creates an instance of the SecurityPoliciesClient client. +func NewSecurityPoliciesClient(subscriptionID string) SecurityPoliciesClient { + return NewSecurityPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSecurityPoliciesClientWithBaseURI creates an instance of the SecurityPoliciesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewSecurityPoliciesClientWithBaseURI(baseURI string, subscriptionID string) SecurityPoliciesClient { + return SecurityPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new security policy within the specified profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// securityPolicyName - name of the security policy under the profile. +// securityPolicy - the security policy properties. +func (client SecurityPoliciesClient) Create(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string, securityPolicy SecurityPolicy) (result SecurityPoliciesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPoliciesClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecurityPoliciesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, profileName, securityPolicyName, securityPolicy) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client SecurityPoliciesClient) CreatePreparer(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string, securityPolicy SecurityPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityPolicyName": autorest.Encode("path", securityPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}", pathParameters), + autorest.WithJSON(securityPolicy), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPoliciesClient) CreateSender(req *http.Request) (future SecurityPoliciesCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client SecurityPoliciesClient) CreateResponder(resp *http.Response) (result SecurityPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing security policy within profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// securityPolicyName - name of the security policy under the profile. +func (client SecurityPoliciesClient) Delete(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string) (result SecurityPoliciesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPoliciesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecurityPoliciesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, securityPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SecurityPoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityPolicyName": autorest.Encode("path", securityPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPoliciesClient) DeleteSender(req *http.Request) (future SecurityPoliciesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SecurityPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing security policy within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// securityPolicyName - name of the security policy under the profile. +func (client SecurityPoliciesClient) Get(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string) (result SecurityPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecurityPoliciesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, securityPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SecurityPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityPolicyName": autorest.Encode("path", securityPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SecurityPoliciesClient) GetResponder(resp *http.Response) (result SecurityPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile lists security policies associated with the profile +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +func (client SecurityPoliciesClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result SecurityPolicyListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPoliciesClient.ListByProfile") + defer func() { + sc := -1 + if result.splr.Response.Response != nil { + sc = result.splr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecurityPoliciesClient", "ListByProfile", err.Error()) + } + + result.fn = client.listByProfileNextResults + req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.splr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "ListByProfile", resp, "Failure sending request") + return + } + + result.splr, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "ListByProfile", resp, "Failure responding to request") + return + } + if result.splr.hasNextLink() && result.splr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client SecurityPoliciesClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPoliciesClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client SecurityPoliciesClient) ListByProfileResponder(resp *http.Response) (result SecurityPolicyListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByProfileNextResults retrieves the next set of results, if any. +func (client SecurityPoliciesClient) listByProfileNextResults(ctx context.Context, lastResults SecurityPolicyListResult) (result SecurityPolicyListResult, err error) { + req, err := lastResults.securityPolicyListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "listByProfileNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "listByProfileNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "listByProfileNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecurityPoliciesClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result SecurityPolicyListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPoliciesClient.ListByProfile") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) + return +} + +// Patch updates an existing security policy within a profile. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique +// within the resource group. +// securityPolicyName - name of the security policy under the profile. +// securityPolicyUpdateProperties - security policy update properties +func (client SecurityPoliciesClient) Patch(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string, securityPolicyUpdateProperties SecurityPolicyUpdateParameters) (result SecurityPoliciesPatchFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPoliciesClient.Patch") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.SecurityPoliciesClient", "Patch", err.Error()) + } + + req, err := client.PatchPreparer(ctx, resourceGroupName, profileName, securityPolicyName, securityPolicyUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Patch", nil, "Failure preparing request") + return + } + + result, err = client.PatchSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.SecurityPoliciesClient", "Patch", result.Response(), "Failure sending request") + return + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client SecurityPoliciesClient) PatchPreparer(ctx context.Context, resourceGroupName string, profileName string, securityPolicyName string, securityPolicyUpdateProperties SecurityPolicyUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityPolicyName": autorest.Encode("path", securityPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}", pathParameters), + autorest.WithJSON(securityPolicyUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPoliciesClient) PatchSender(req *http.Request) (future SecurityPoliciesPatchFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client SecurityPoliciesClient) PatchResponder(resp *http.Response) (result SecurityPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/validate.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/validate.go new file mode 100644 index 000000000000..3811b70cf397 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/validate.go @@ -0,0 +1,113 @@ +package cdn + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ValidateClient is the cdn Management Client +type ValidateClient struct { + BaseClient +} + +// NewValidateClient creates an instance of the ValidateClient client. +func NewValidateClient(subscriptionID string) ValidateClient { + return NewValidateClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewValidateClientWithBaseURI creates an instance of the ValidateClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewValidateClientWithBaseURI(baseURI string, subscriptionID string) ValidateClient { + return ValidateClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// SecretMethod validate a Secret in the profile. +// Parameters: +// validateSecretInput - the Secret source. +func (client ValidateClient) SecretMethod(ctx context.Context, validateSecretInput ValidateSecretInput) (result ValidateSecretOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ValidateClient.SecretMethod") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: validateSecretInput, + Constraints: []validation.Constraint{{Target: "validateSecretInput.SecretSource", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cdn.ValidateClient", "SecretMethod", err.Error()) + } + + req, err := client.SecretMethodPreparer(ctx, validateSecretInput) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ValidateClient", "SecretMethod", nil, "Failure preparing request") + return + } + + resp, err := client.SecretMethodSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ValidateClient", "SecretMethod", resp, "Failure sending request") + return + } + + result, err = client.SecretMethodResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ValidateClient", "SecretMethod", resp, "Failure responding to request") + return + } + + return +} + +// SecretMethodPreparer prepares the SecretMethod request. +func (client ValidateClient) SecretMethodPreparer(ctx context.Context, validateSecretInput ValidateSecretInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateSecret", pathParameters), + autorest.WithJSON(validateSecretInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SecretMethodSender sends the SecretMethod request. The method will close the +// http.Response Body if it receives an error. +func (client ValidateClient) SecretMethodSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SecretMethodResponder handles the response to the SecretMethod request. The method always +// closes the http.Response Body. +func (client ValidateClient) SecretMethodResponder(resp *http.Response) (result ValidateSecretOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/version.go new file mode 100644 index 000000000000..40472d9c3503 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn/version.go @@ -0,0 +1,19 @@ +package cdn + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " cdn/2021-06-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/_meta.json new file mode 100644 index 000000000000..ee8af71f0437 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "3e1f462ff6a7daa705ac58f1772dd5c429bb8d2e", + "readme": "/_/azure-rest-api-specs/specification/frontdoor/resource-manager/readme.md", + "tag": "package-2020-11", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-11 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/frontdoor/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/client.go new file mode 100644 index 000000000000..b5284d3d55b3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/client.go @@ -0,0 +1,41 @@ +// Package frontdoor implements the Azure ARM Frontdoor service API version . +// +// FrontDoor Client +package frontdoor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Frontdoor + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Frontdoor. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/endpoints.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/endpoints.go new file mode 100644 index 000000000000..2f8be50aaca6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/endpoints.go @@ -0,0 +1,129 @@ +package frontdoor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EndpointsClient is the frontDoor Client +type EndpointsClient struct { + BaseClient +} + +// NewEndpointsClient creates an instance of the EndpointsClient client. +func NewEndpointsClient(subscriptionID string) EndpointsClient { + return NewEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEndpointsClientWithBaseURI creates an instance of the EndpointsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewEndpointsClientWithBaseURI(baseURI string, subscriptionID string) EndpointsClient { + return EndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// PurgeContent removes a content from Front Door. +// Parameters: +// 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 a single file, or a directory with a wildcard, e.g. '/pictures/*' which removes all folders +// and files in the directory. +func (client EndpointsClient) PurgeContent(ctx context.Context, resourceGroupName string, frontDoorName string, contentFilePaths PurgeParameters) (result EndpointsPurgeContentFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.PurgeContent") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: frontDoorName, + Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, + {TargetValue: contentFilePaths, + Constraints: []validation.Constraint{{Target: "contentFilePaths.ContentPaths", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.EndpointsClient", "PurgeContent", err.Error()) + } + + req, err := client.PurgeContentPreparer(ctx, resourceGroupName, frontDoorName, contentFilePaths) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.EndpointsClient", "PurgeContent", nil, "Failure preparing request") + return + } + + result, err = client.PurgeContentSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.EndpointsClient", "PurgeContent", result.Response(), "Failure sending request") + return + } + + return +} + +// PurgeContentPreparer prepares the PurgeContent request. +func (client EndpointsClient) PurgeContentPreparer(ctx context.Context, resourceGroupName string, frontDoorName string, contentFilePaths PurgeParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "frontDoorName": autorest.Encode("path", frontDoorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/purge", pathParameters), + autorest.WithJSON(contentFilePaths), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PurgeContentSender sends the PurgeContent request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) PurgeContentSender(req *http.Request) (future EndpointsPurgeContentFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PurgeContentResponder handles the response to the PurgeContent request. The method always +// closes the http.Response Body. +func (client EndpointsClient) PurgeContentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/enums.go new file mode 100644 index 000000000000..61ed833e4002 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/enums.go @@ -0,0 +1,960 @@ +package frontdoor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // ActionTypeAllow ... + ActionTypeAllow ActionType = "Allow" + // ActionTypeBlock ... + ActionTypeBlock ActionType = "Block" + // ActionTypeLog ... + ActionTypeLog ActionType = "Log" + // ActionTypeRedirect ... + ActionTypeRedirect ActionType = "Redirect" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ActionTypeAllow, ActionTypeBlock, ActionTypeLog, ActionTypeRedirect} +} + +// AggregationInterval enumerates the values for aggregation interval. +type AggregationInterval string + +const ( + // AggregationIntervalDaily ... + AggregationIntervalDaily AggregationInterval = "Daily" + // AggregationIntervalHourly ... + AggregationIntervalHourly AggregationInterval = "Hourly" +) + +// PossibleAggregationIntervalValues returns an array of possible values for the AggregationInterval const type. +func PossibleAggregationIntervalValues() []AggregationInterval { + return []AggregationInterval{AggregationIntervalDaily, AggregationIntervalHourly} +} + +// Availability enumerates the values for availability. +type Availability string + +const ( + // AvailabilityAvailable ... + AvailabilityAvailable Availability = "Available" + // AvailabilityUnavailable ... + AvailabilityUnavailable Availability = "Unavailable" +) + +// PossibleAvailabilityValues returns an array of possible values for the Availability const type. +func PossibleAvailabilityValues() []Availability { + return []Availability{AvailabilityAvailable, AvailabilityUnavailable} +} + +// BackendEnabledState enumerates the values for backend enabled state. +type BackendEnabledState string + +const ( + // BackendEnabledStateDisabled ... + BackendEnabledStateDisabled BackendEnabledState = "Disabled" + // BackendEnabledStateEnabled ... + BackendEnabledStateEnabled BackendEnabledState = "Enabled" +) + +// PossibleBackendEnabledStateValues returns an array of possible values for the BackendEnabledState const type. +func PossibleBackendEnabledStateValues() []BackendEnabledState { + return []BackendEnabledState{BackendEnabledStateDisabled, BackendEnabledStateEnabled} +} + +// CertificateSource enumerates the values for certificate source. +type CertificateSource string + +const ( + // CertificateSourceAzureKeyVault ... + CertificateSourceAzureKeyVault CertificateSource = "AzureKeyVault" + // CertificateSourceFrontDoor ... + CertificateSourceFrontDoor CertificateSource = "FrontDoor" +) + +// PossibleCertificateSourceValues returns an array of possible values for the CertificateSource const type. +func PossibleCertificateSourceValues() []CertificateSource { + return []CertificateSource{CertificateSourceAzureKeyVault, CertificateSourceFrontDoor} +} + +// CertificateType enumerates the values for certificate type. +type CertificateType string + +const ( + // CertificateTypeDedicated ... + CertificateTypeDedicated CertificateType = "Dedicated" +) + +// PossibleCertificateTypeValues returns an array of possible values for the CertificateType const type. +func PossibleCertificateTypeValues() []CertificateType { + return []CertificateType{CertificateTypeDedicated} +} + +// CustomHTTPSProvisioningState enumerates the values for custom https provisioning state. +type CustomHTTPSProvisioningState string + +const ( + // CustomHTTPSProvisioningStateDisabled ... + CustomHTTPSProvisioningStateDisabled CustomHTTPSProvisioningState = "Disabled" + // CustomHTTPSProvisioningStateDisabling ... + CustomHTTPSProvisioningStateDisabling CustomHTTPSProvisioningState = "Disabling" + // CustomHTTPSProvisioningStateEnabled ... + CustomHTTPSProvisioningStateEnabled CustomHTTPSProvisioningState = "Enabled" + // CustomHTTPSProvisioningStateEnabling ... + CustomHTTPSProvisioningStateEnabling CustomHTTPSProvisioningState = "Enabling" + // CustomHTTPSProvisioningStateFailed ... + CustomHTTPSProvisioningStateFailed CustomHTTPSProvisioningState = "Failed" +) + +// PossibleCustomHTTPSProvisioningStateValues returns an array of possible values for the CustomHTTPSProvisioningState const type. +func PossibleCustomHTTPSProvisioningStateValues() []CustomHTTPSProvisioningState { + return []CustomHTTPSProvisioningState{CustomHTTPSProvisioningStateDisabled, CustomHTTPSProvisioningStateDisabling, CustomHTTPSProvisioningStateEnabled, CustomHTTPSProvisioningStateEnabling, CustomHTTPSProvisioningStateFailed} +} + +// CustomHTTPSProvisioningSubstate enumerates the values for custom https provisioning substate. +type CustomHTTPSProvisioningSubstate string + +const ( + // CustomHTTPSProvisioningSubstateCertificateDeleted ... + CustomHTTPSProvisioningSubstateCertificateDeleted CustomHTTPSProvisioningSubstate = "CertificateDeleted" + // CustomHTTPSProvisioningSubstateCertificateDeployed ... + CustomHTTPSProvisioningSubstateCertificateDeployed CustomHTTPSProvisioningSubstate = "CertificateDeployed" + // CustomHTTPSProvisioningSubstateDeletingCertificate ... + CustomHTTPSProvisioningSubstateDeletingCertificate CustomHTTPSProvisioningSubstate = "DeletingCertificate" + // CustomHTTPSProvisioningSubstateDeployingCertificate ... + CustomHTTPSProvisioningSubstateDeployingCertificate CustomHTTPSProvisioningSubstate = "DeployingCertificate" + // CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved ... + CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestApproved" + // CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected ... + CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestRejected" + // CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut ... + CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestTimedOut" + // CustomHTTPSProvisioningSubstateIssuingCertificate ... + CustomHTTPSProvisioningSubstateIssuingCertificate CustomHTTPSProvisioningSubstate = "IssuingCertificate" + // CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval ... + CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval CustomHTTPSProvisioningSubstate = "PendingDomainControlValidationREquestApproval" + // CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest ... + CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest CustomHTTPSProvisioningSubstate = "SubmittingDomainControlValidationRequest" +) + +// PossibleCustomHTTPSProvisioningSubstateValues returns an array of possible values for the CustomHTTPSProvisioningSubstate const type. +func PossibleCustomHTTPSProvisioningSubstateValues() []CustomHTTPSProvisioningSubstate { + return []CustomHTTPSProvisioningSubstate{CustomHTTPSProvisioningSubstateCertificateDeleted, CustomHTTPSProvisioningSubstateCertificateDeployed, CustomHTTPSProvisioningSubstateDeletingCertificate, CustomHTTPSProvisioningSubstateDeployingCertificate, CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved, CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected, CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut, CustomHTTPSProvisioningSubstateIssuingCertificate, CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval, CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest} +} + +// CustomRuleEnabledState enumerates the values for custom rule enabled state. +type CustomRuleEnabledState string + +const ( + // CustomRuleEnabledStateDisabled ... + CustomRuleEnabledStateDisabled CustomRuleEnabledState = "Disabled" + // CustomRuleEnabledStateEnabled ... + CustomRuleEnabledStateEnabled CustomRuleEnabledState = "Enabled" +) + +// PossibleCustomRuleEnabledStateValues returns an array of possible values for the CustomRuleEnabledState const type. +func PossibleCustomRuleEnabledStateValues() []CustomRuleEnabledState { + return []CustomRuleEnabledState{CustomRuleEnabledStateDisabled, CustomRuleEnabledStateEnabled} +} + +// DynamicCompressionEnabled enumerates the values for dynamic compression enabled. +type DynamicCompressionEnabled string + +const ( + // DynamicCompressionEnabledDisabled ... + DynamicCompressionEnabledDisabled DynamicCompressionEnabled = "Disabled" + // DynamicCompressionEnabledEnabled ... + DynamicCompressionEnabledEnabled DynamicCompressionEnabled = "Enabled" +) + +// PossibleDynamicCompressionEnabledValues returns an array of possible values for the DynamicCompressionEnabled const type. +func PossibleDynamicCompressionEnabledValues() []DynamicCompressionEnabled { + return []DynamicCompressionEnabled{DynamicCompressionEnabledDisabled, DynamicCompressionEnabledEnabled} +} + +// EnabledState enumerates the values for enabled state. +type EnabledState string + +const ( + // EnabledStateDisabled ... + EnabledStateDisabled EnabledState = "Disabled" + // EnabledStateEnabled ... + EnabledStateEnabled EnabledState = "Enabled" +) + +// PossibleEnabledStateValues returns an array of possible values for the EnabledState const type. +func PossibleEnabledStateValues() []EnabledState { + return []EnabledState{EnabledStateDisabled, EnabledStateEnabled} +} + +// EndpointType enumerates the values for endpoint type. +type EndpointType string + +const ( + // EndpointTypeAFD ... + EndpointTypeAFD EndpointType = "AFD" + // EndpointTypeATM ... + EndpointTypeATM EndpointType = "ATM" + // EndpointTypeAzureRegion ... + EndpointTypeAzureRegion EndpointType = "AzureRegion" + // EndpointTypeCDN ... + EndpointTypeCDN EndpointType = "CDN" +) + +// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. +func PossibleEndpointTypeValues() []EndpointType { + return []EndpointType{EndpointTypeAFD, EndpointTypeATM, EndpointTypeAzureRegion, EndpointTypeCDN} +} + +// EnforceCertificateNameCheckEnabledState enumerates the values for enforce certificate name check enabled +// state. +type EnforceCertificateNameCheckEnabledState string + +const ( + // EnforceCertificateNameCheckEnabledStateDisabled ... + EnforceCertificateNameCheckEnabledStateDisabled EnforceCertificateNameCheckEnabledState = "Disabled" + // EnforceCertificateNameCheckEnabledStateEnabled ... + EnforceCertificateNameCheckEnabledStateEnabled EnforceCertificateNameCheckEnabledState = "Enabled" +) + +// PossibleEnforceCertificateNameCheckEnabledStateValues returns an array of possible values for the EnforceCertificateNameCheckEnabledState const type. +func PossibleEnforceCertificateNameCheckEnabledStateValues() []EnforceCertificateNameCheckEnabledState { + return []EnforceCertificateNameCheckEnabledState{EnforceCertificateNameCheckEnabledStateDisabled, EnforceCertificateNameCheckEnabledStateEnabled} +} + +// ForwardingProtocol enumerates the values for forwarding protocol. +type ForwardingProtocol string + +const ( + // ForwardingProtocolHTTPOnly ... + ForwardingProtocolHTTPOnly ForwardingProtocol = "HttpOnly" + // ForwardingProtocolHTTPSOnly ... + ForwardingProtocolHTTPSOnly ForwardingProtocol = "HttpsOnly" + // ForwardingProtocolMatchRequest ... + ForwardingProtocolMatchRequest ForwardingProtocol = "MatchRequest" +) + +// PossibleForwardingProtocolValues returns an array of possible values for the ForwardingProtocol const type. +func PossibleForwardingProtocolValues() []ForwardingProtocol { + return []ForwardingProtocol{ForwardingProtocolHTTPOnly, ForwardingProtocolHTTPSOnly, ForwardingProtocolMatchRequest} +} + +// HeaderActionType enumerates the values for header action type. +type HeaderActionType string + +const ( + // HeaderActionTypeAppend ... + HeaderActionTypeAppend HeaderActionType = "Append" + // HeaderActionTypeDelete ... + HeaderActionTypeDelete HeaderActionType = "Delete" + // HeaderActionTypeOverwrite ... + HeaderActionTypeOverwrite HeaderActionType = "Overwrite" +) + +// PossibleHeaderActionTypeValues returns an array of possible values for the HeaderActionType const type. +func PossibleHeaderActionTypeValues() []HeaderActionType { + return []HeaderActionType{HeaderActionTypeAppend, HeaderActionTypeDelete, HeaderActionTypeOverwrite} +} + +// HealthProbeEnabled enumerates the values for health probe enabled. +type HealthProbeEnabled string + +const ( + // HealthProbeEnabledDisabled ... + HealthProbeEnabledDisabled HealthProbeEnabled = "Disabled" + // HealthProbeEnabledEnabled ... + HealthProbeEnabledEnabled HealthProbeEnabled = "Enabled" +) + +// PossibleHealthProbeEnabledValues returns an array of possible values for the HealthProbeEnabled const type. +func PossibleHealthProbeEnabledValues() []HealthProbeEnabled { + return []HealthProbeEnabled{HealthProbeEnabledDisabled, HealthProbeEnabledEnabled} +} + +// HealthProbeMethod enumerates the values for health probe method. +type HealthProbeMethod string + +const ( + // HealthProbeMethodGET ... + HealthProbeMethodGET HealthProbeMethod = "GET" + // HealthProbeMethodHEAD ... + HealthProbeMethodHEAD HealthProbeMethod = "HEAD" +) + +// PossibleHealthProbeMethodValues returns an array of possible values for the HealthProbeMethod const type. +func PossibleHealthProbeMethodValues() []HealthProbeMethod { + return []HealthProbeMethod{HealthProbeMethodGET, HealthProbeMethodHEAD} +} + +// LatencyScorecardAggregationInterval enumerates the values for latency scorecard aggregation interval. +type LatencyScorecardAggregationInterval string + +const ( + // LatencyScorecardAggregationIntervalDaily ... + LatencyScorecardAggregationIntervalDaily LatencyScorecardAggregationInterval = "Daily" + // LatencyScorecardAggregationIntervalMonthly ... + LatencyScorecardAggregationIntervalMonthly LatencyScorecardAggregationInterval = "Monthly" + // LatencyScorecardAggregationIntervalWeekly ... + LatencyScorecardAggregationIntervalWeekly LatencyScorecardAggregationInterval = "Weekly" +) + +// PossibleLatencyScorecardAggregationIntervalValues returns an array of possible values for the LatencyScorecardAggregationInterval const type. +func PossibleLatencyScorecardAggregationIntervalValues() []LatencyScorecardAggregationInterval { + return []LatencyScorecardAggregationInterval{LatencyScorecardAggregationIntervalDaily, LatencyScorecardAggregationIntervalMonthly, LatencyScorecardAggregationIntervalWeekly} +} + +// ManagedRuleEnabledState enumerates the values for managed rule enabled state. +type ManagedRuleEnabledState string + +const ( + // ManagedRuleEnabledStateDisabled ... + ManagedRuleEnabledStateDisabled ManagedRuleEnabledState = "Disabled" + // ManagedRuleEnabledStateEnabled ... + ManagedRuleEnabledStateEnabled ManagedRuleEnabledState = "Enabled" +) + +// PossibleManagedRuleEnabledStateValues returns an array of possible values for the ManagedRuleEnabledState const type. +func PossibleManagedRuleEnabledStateValues() []ManagedRuleEnabledState { + return []ManagedRuleEnabledState{ManagedRuleEnabledStateDisabled, ManagedRuleEnabledStateEnabled} +} + +// ManagedRuleExclusionMatchVariable enumerates the values for managed rule exclusion match variable. +type ManagedRuleExclusionMatchVariable string + +const ( + // ManagedRuleExclusionMatchVariableQueryStringArgNames ... + ManagedRuleExclusionMatchVariableQueryStringArgNames ManagedRuleExclusionMatchVariable = "QueryStringArgNames" + // ManagedRuleExclusionMatchVariableRequestBodyJSONArgNames ... + ManagedRuleExclusionMatchVariableRequestBodyJSONArgNames ManagedRuleExclusionMatchVariable = "RequestBodyJsonArgNames" + // ManagedRuleExclusionMatchVariableRequestBodyPostArgNames ... + ManagedRuleExclusionMatchVariableRequestBodyPostArgNames ManagedRuleExclusionMatchVariable = "RequestBodyPostArgNames" + // ManagedRuleExclusionMatchVariableRequestCookieNames ... + ManagedRuleExclusionMatchVariableRequestCookieNames ManagedRuleExclusionMatchVariable = "RequestCookieNames" + // ManagedRuleExclusionMatchVariableRequestHeaderNames ... + ManagedRuleExclusionMatchVariableRequestHeaderNames ManagedRuleExclusionMatchVariable = "RequestHeaderNames" +) + +// PossibleManagedRuleExclusionMatchVariableValues returns an array of possible values for the ManagedRuleExclusionMatchVariable const type. +func PossibleManagedRuleExclusionMatchVariableValues() []ManagedRuleExclusionMatchVariable { + return []ManagedRuleExclusionMatchVariable{ManagedRuleExclusionMatchVariableQueryStringArgNames, ManagedRuleExclusionMatchVariableRequestBodyJSONArgNames, ManagedRuleExclusionMatchVariableRequestBodyPostArgNames, ManagedRuleExclusionMatchVariableRequestCookieNames, ManagedRuleExclusionMatchVariableRequestHeaderNames} +} + +// ManagedRuleExclusionSelectorMatchOperator enumerates the values for managed rule exclusion selector match +// operator. +type ManagedRuleExclusionSelectorMatchOperator string + +const ( + // ManagedRuleExclusionSelectorMatchOperatorContains ... + ManagedRuleExclusionSelectorMatchOperatorContains ManagedRuleExclusionSelectorMatchOperator = "Contains" + // ManagedRuleExclusionSelectorMatchOperatorEndsWith ... + ManagedRuleExclusionSelectorMatchOperatorEndsWith ManagedRuleExclusionSelectorMatchOperator = "EndsWith" + // ManagedRuleExclusionSelectorMatchOperatorEquals ... + ManagedRuleExclusionSelectorMatchOperatorEquals ManagedRuleExclusionSelectorMatchOperator = "Equals" + // ManagedRuleExclusionSelectorMatchOperatorEqualsAny ... + ManagedRuleExclusionSelectorMatchOperatorEqualsAny ManagedRuleExclusionSelectorMatchOperator = "EqualsAny" + // ManagedRuleExclusionSelectorMatchOperatorStartsWith ... + ManagedRuleExclusionSelectorMatchOperatorStartsWith ManagedRuleExclusionSelectorMatchOperator = "StartsWith" +) + +// PossibleManagedRuleExclusionSelectorMatchOperatorValues returns an array of possible values for the ManagedRuleExclusionSelectorMatchOperator const type. +func PossibleManagedRuleExclusionSelectorMatchOperatorValues() []ManagedRuleExclusionSelectorMatchOperator { + return []ManagedRuleExclusionSelectorMatchOperator{ManagedRuleExclusionSelectorMatchOperatorContains, ManagedRuleExclusionSelectorMatchOperatorEndsWith, ManagedRuleExclusionSelectorMatchOperatorEquals, ManagedRuleExclusionSelectorMatchOperatorEqualsAny, ManagedRuleExclusionSelectorMatchOperatorStartsWith} +} + +// ManagedRuleSetActionType enumerates the values for managed rule set action type. +type ManagedRuleSetActionType string + +const ( + // ManagedRuleSetActionTypeBlock ... + ManagedRuleSetActionTypeBlock ManagedRuleSetActionType = "Block" + // ManagedRuleSetActionTypeLog ... + ManagedRuleSetActionTypeLog ManagedRuleSetActionType = "Log" + // ManagedRuleSetActionTypeRedirect ... + ManagedRuleSetActionTypeRedirect ManagedRuleSetActionType = "Redirect" +) + +// PossibleManagedRuleSetActionTypeValues returns an array of possible values for the ManagedRuleSetActionType const type. +func PossibleManagedRuleSetActionTypeValues() []ManagedRuleSetActionType { + return []ManagedRuleSetActionType{ManagedRuleSetActionTypeBlock, ManagedRuleSetActionTypeLog, ManagedRuleSetActionTypeRedirect} +} + +// MatchProcessingBehavior enumerates the values for match processing behavior. +type MatchProcessingBehavior string + +const ( + // MatchProcessingBehaviorContinue ... + MatchProcessingBehaviorContinue MatchProcessingBehavior = "Continue" + // MatchProcessingBehaviorStop ... + MatchProcessingBehaviorStop MatchProcessingBehavior = "Stop" +) + +// PossibleMatchProcessingBehaviorValues returns an array of possible values for the MatchProcessingBehavior const type. +func PossibleMatchProcessingBehaviorValues() []MatchProcessingBehavior { + return []MatchProcessingBehavior{MatchProcessingBehaviorContinue, MatchProcessingBehaviorStop} +} + +// MatchVariable enumerates the values for match variable. +type MatchVariable string + +const ( + // MatchVariableCookies ... + MatchVariableCookies MatchVariable = "Cookies" + // MatchVariablePostArgs ... + MatchVariablePostArgs MatchVariable = "PostArgs" + // MatchVariableQueryString ... + MatchVariableQueryString MatchVariable = "QueryString" + // MatchVariableRemoteAddr ... + MatchVariableRemoteAddr MatchVariable = "RemoteAddr" + // MatchVariableRequestBody ... + MatchVariableRequestBody MatchVariable = "RequestBody" + // MatchVariableRequestHeader ... + MatchVariableRequestHeader MatchVariable = "RequestHeader" + // MatchVariableRequestMethod ... + MatchVariableRequestMethod MatchVariable = "RequestMethod" + // MatchVariableRequestURI ... + MatchVariableRequestURI MatchVariable = "RequestUri" + // MatchVariableSocketAddr ... + MatchVariableSocketAddr MatchVariable = "SocketAddr" +) + +// PossibleMatchVariableValues returns an array of possible values for the MatchVariable const type. +func PossibleMatchVariableValues() []MatchVariable { + return []MatchVariable{MatchVariableCookies, MatchVariablePostArgs, MatchVariableQueryString, MatchVariableRemoteAddr, MatchVariableRequestBody, MatchVariableRequestHeader, MatchVariableRequestMethod, MatchVariableRequestURI, MatchVariableSocketAddr} +} + +// MinimumTLSVersion enumerates the values for minimum tls version. +type MinimumTLSVersion string + +const ( + // MinimumTLSVersionOneFullStopTwo ... + MinimumTLSVersionOneFullStopTwo MinimumTLSVersion = "1.2" + // MinimumTLSVersionOneFullStopZero ... + MinimumTLSVersionOneFullStopZero MinimumTLSVersion = "1.0" +) + +// PossibleMinimumTLSVersionValues returns an array of possible values for the MinimumTLSVersion const type. +func PossibleMinimumTLSVersionValues() []MinimumTLSVersion { + return []MinimumTLSVersion{MinimumTLSVersionOneFullStopTwo, MinimumTLSVersionOneFullStopZero} +} + +// NetworkExperimentResourceState enumerates the values for network experiment resource state. +type NetworkExperimentResourceState string + +const ( + // NetworkExperimentResourceStateCreating ... + NetworkExperimentResourceStateCreating NetworkExperimentResourceState = "Creating" + // NetworkExperimentResourceStateDeleting ... + NetworkExperimentResourceStateDeleting NetworkExperimentResourceState = "Deleting" + // NetworkExperimentResourceStateDisabled ... + NetworkExperimentResourceStateDisabled NetworkExperimentResourceState = "Disabled" + // NetworkExperimentResourceStateDisabling ... + NetworkExperimentResourceStateDisabling NetworkExperimentResourceState = "Disabling" + // NetworkExperimentResourceStateEnabled ... + NetworkExperimentResourceStateEnabled NetworkExperimentResourceState = "Enabled" + // NetworkExperimentResourceStateEnabling ... + NetworkExperimentResourceStateEnabling NetworkExperimentResourceState = "Enabling" +) + +// PossibleNetworkExperimentResourceStateValues returns an array of possible values for the NetworkExperimentResourceState const type. +func PossibleNetworkExperimentResourceStateValues() []NetworkExperimentResourceState { + return []NetworkExperimentResourceState{NetworkExperimentResourceStateCreating, NetworkExperimentResourceStateDeleting, NetworkExperimentResourceStateDisabled, NetworkExperimentResourceStateDisabling, NetworkExperimentResourceStateEnabled, NetworkExperimentResourceStateEnabling} +} + +// NetworkOperationStatus enumerates the values for network operation status. +type NetworkOperationStatus string + +const ( + // NetworkOperationStatusFailed ... + NetworkOperationStatusFailed NetworkOperationStatus = "Failed" + // NetworkOperationStatusInProgress ... + NetworkOperationStatusInProgress NetworkOperationStatus = "InProgress" + // NetworkOperationStatusSucceeded ... + NetworkOperationStatusSucceeded NetworkOperationStatus = "Succeeded" +) + +// PossibleNetworkOperationStatusValues returns an array of possible values for the NetworkOperationStatus const type. +func PossibleNetworkOperationStatusValues() []NetworkOperationStatus { + return []NetworkOperationStatus{NetworkOperationStatusFailed, NetworkOperationStatusInProgress, NetworkOperationStatusSucceeded} +} + +// OdataType enumerates the values for odata type. +type OdataType string + +const ( + // OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration ... + OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration OdataType = "#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration" + // OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration ... + OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration OdataType = "#Microsoft.Azure.FrontDoor.Models.FrontdoorRedirectConfiguration" + // OdataTypeRouteConfiguration ... + OdataTypeRouteConfiguration OdataType = "RouteConfiguration" +) + +// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. +func PossibleOdataTypeValues() []OdataType { + return []OdataType{OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration, OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration, OdataTypeRouteConfiguration} +} + +// Operator enumerates the values for operator. +type Operator string + +const ( + // OperatorAny ... + OperatorAny Operator = "Any" + // OperatorBeginsWith ... + OperatorBeginsWith Operator = "BeginsWith" + // OperatorContains ... + OperatorContains Operator = "Contains" + // OperatorEndsWith ... + OperatorEndsWith Operator = "EndsWith" + // OperatorEqual ... + OperatorEqual Operator = "Equal" + // OperatorGeoMatch ... + OperatorGeoMatch Operator = "GeoMatch" + // OperatorGreaterThan ... + OperatorGreaterThan Operator = "GreaterThan" + // OperatorGreaterThanOrEqual ... + OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" + // OperatorIPMatch ... + OperatorIPMatch Operator = "IPMatch" + // OperatorLessThan ... + OperatorLessThan Operator = "LessThan" + // OperatorLessThanOrEqual ... + OperatorLessThanOrEqual Operator = "LessThanOrEqual" + // OperatorRegEx ... + OperatorRegEx Operator = "RegEx" +) + +// PossibleOperatorValues returns an array of possible values for the Operator const type. +func PossibleOperatorValues() []Operator { + return []Operator{OperatorAny, OperatorBeginsWith, OperatorContains, OperatorEndsWith, OperatorEqual, OperatorGeoMatch, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorIPMatch, OperatorLessThan, OperatorLessThanOrEqual, OperatorRegEx} +} + +// PolicyEnabledState enumerates the values for policy enabled state. +type PolicyEnabledState string + +const ( + // PolicyEnabledStateDisabled ... + PolicyEnabledStateDisabled PolicyEnabledState = "Disabled" + // PolicyEnabledStateEnabled ... + PolicyEnabledStateEnabled PolicyEnabledState = "Enabled" +) + +// PossiblePolicyEnabledStateValues returns an array of possible values for the PolicyEnabledState const type. +func PossiblePolicyEnabledStateValues() []PolicyEnabledState { + return []PolicyEnabledState{PolicyEnabledStateDisabled, PolicyEnabledStateEnabled} +} + +// PolicyMode enumerates the values for policy mode. +type PolicyMode string + +const ( + // PolicyModeDetection ... + PolicyModeDetection PolicyMode = "Detection" + // PolicyModePrevention ... + PolicyModePrevention PolicyMode = "Prevention" +) + +// PossiblePolicyModeValues returns an array of possible values for the PolicyMode const type. +func PossiblePolicyModeValues() []PolicyMode { + return []PolicyMode{PolicyModeDetection, PolicyModePrevention} +} + +// PolicyRequestBodyCheck enumerates the values for policy request body check. +type PolicyRequestBodyCheck string + +const ( + // PolicyRequestBodyCheckDisabled ... + PolicyRequestBodyCheckDisabled PolicyRequestBodyCheck = "Disabled" + // PolicyRequestBodyCheckEnabled ... + PolicyRequestBodyCheckEnabled PolicyRequestBodyCheck = "Enabled" +) + +// PossiblePolicyRequestBodyCheckValues returns an array of possible values for the PolicyRequestBodyCheck const type. +func PossiblePolicyRequestBodyCheckValues() []PolicyRequestBodyCheck { + return []PolicyRequestBodyCheck{PolicyRequestBodyCheckDisabled, PolicyRequestBodyCheckEnabled} +} + +// PolicyResourceState enumerates the values for policy resource state. +type PolicyResourceState string + +const ( + // PolicyResourceStateCreating ... + PolicyResourceStateCreating PolicyResourceState = "Creating" + // PolicyResourceStateDeleting ... + PolicyResourceStateDeleting PolicyResourceState = "Deleting" + // PolicyResourceStateDisabled ... + PolicyResourceStateDisabled PolicyResourceState = "Disabled" + // PolicyResourceStateDisabling ... + PolicyResourceStateDisabling PolicyResourceState = "Disabling" + // PolicyResourceStateEnabled ... + PolicyResourceStateEnabled PolicyResourceState = "Enabled" + // PolicyResourceStateEnabling ... + PolicyResourceStateEnabling PolicyResourceState = "Enabling" +) + +// PossiblePolicyResourceStateValues returns an array of possible values for the PolicyResourceState const type. +func PossiblePolicyResourceStateValues() []PolicyResourceState { + return []PolicyResourceState{PolicyResourceStateCreating, PolicyResourceStateDeleting, PolicyResourceStateDisabled, PolicyResourceStateDisabling, PolicyResourceStateEnabled, PolicyResourceStateEnabling} +} + +// PrivateEndpointStatus enumerates the values for private endpoint status. +type PrivateEndpointStatus string + +const ( + // PrivateEndpointStatusApproved ... + PrivateEndpointStatusApproved PrivateEndpointStatus = "Approved" + // PrivateEndpointStatusDisconnected ... + PrivateEndpointStatusDisconnected PrivateEndpointStatus = "Disconnected" + // PrivateEndpointStatusPending ... + PrivateEndpointStatusPending PrivateEndpointStatus = "Pending" + // PrivateEndpointStatusRejected ... + PrivateEndpointStatusRejected PrivateEndpointStatus = "Rejected" + // PrivateEndpointStatusTimeout ... + PrivateEndpointStatusTimeout PrivateEndpointStatus = "Timeout" +) + +// PossiblePrivateEndpointStatusValues returns an array of possible values for the PrivateEndpointStatus const type. +func PossiblePrivateEndpointStatusValues() []PrivateEndpointStatus { + return []PrivateEndpointStatus{PrivateEndpointStatusApproved, PrivateEndpointStatusDisconnected, PrivateEndpointStatusPending, PrivateEndpointStatusRejected, PrivateEndpointStatusTimeout} +} + +// Protocol enumerates the values for protocol. +type Protocol string + +const ( + // ProtocolHTTP ... + ProtocolHTTP Protocol = "Http" + // ProtocolHTTPS ... + ProtocolHTTPS Protocol = "Https" +) + +// PossibleProtocolValues returns an array of possible values for the Protocol const type. +func PossibleProtocolValues() []Protocol { + return []Protocol{ProtocolHTTP, ProtocolHTTPS} +} + +// Query enumerates the values for query. +type Query string + +const ( + // QueryStripAll ... + QueryStripAll Query = "StripAll" + // QueryStripAllExcept ... + QueryStripAllExcept Query = "StripAllExcept" + // QueryStripNone ... + QueryStripNone Query = "StripNone" + // QueryStripOnly ... + QueryStripOnly Query = "StripOnly" +) + +// PossibleQueryValues returns an array of possible values for the Query const type. +func PossibleQueryValues() []Query { + return []Query{QueryStripAll, QueryStripAllExcept, QueryStripNone, QueryStripOnly} +} + +// RedirectProtocol enumerates the values for redirect protocol. +type RedirectProtocol string + +const ( + // RedirectProtocolHTTPOnly ... + RedirectProtocolHTTPOnly RedirectProtocol = "HttpOnly" + // RedirectProtocolHTTPSOnly ... + RedirectProtocolHTTPSOnly RedirectProtocol = "HttpsOnly" + // RedirectProtocolMatchRequest ... + RedirectProtocolMatchRequest RedirectProtocol = "MatchRequest" +) + +// PossibleRedirectProtocolValues returns an array of possible values for the RedirectProtocol const type. +func PossibleRedirectProtocolValues() []RedirectProtocol { + return []RedirectProtocol{RedirectProtocolHTTPOnly, RedirectProtocolHTTPSOnly, RedirectProtocolMatchRequest} +} + +// RedirectType enumerates the values for redirect type. +type RedirectType string + +const ( + // RedirectTypeFound ... + RedirectTypeFound RedirectType = "Found" + // RedirectTypeMoved ... + RedirectTypeMoved RedirectType = "Moved" + // RedirectTypePermanentRedirect ... + RedirectTypePermanentRedirect RedirectType = "PermanentRedirect" + // RedirectTypeTemporaryRedirect ... + RedirectTypeTemporaryRedirect RedirectType = "TemporaryRedirect" +) + +// PossibleRedirectTypeValues returns an array of possible values for the RedirectType const type. +func PossibleRedirectTypeValues() []RedirectType { + return []RedirectType{RedirectTypeFound, RedirectTypeMoved, RedirectTypePermanentRedirect, RedirectTypeTemporaryRedirect} +} + +// ResourceState enumerates the values for resource state. +type ResourceState string + +const ( + // ResourceStateCreating ... + ResourceStateCreating ResourceState = "Creating" + // ResourceStateDeleting ... + ResourceStateDeleting ResourceState = "Deleting" + // ResourceStateDisabled ... + ResourceStateDisabled ResourceState = "Disabled" + // ResourceStateDisabling ... + ResourceStateDisabling ResourceState = "Disabling" + // ResourceStateEnabled ... + ResourceStateEnabled ResourceState = "Enabled" + // ResourceStateEnabling ... + ResourceStateEnabling ResourceState = "Enabling" +) + +// PossibleResourceStateValues returns an array of possible values for the ResourceState const type. +func PossibleResourceStateValues() []ResourceState { + return []ResourceState{ResourceStateCreating, ResourceStateDeleting, ResourceStateDisabled, ResourceStateDisabling, ResourceStateEnabled, ResourceStateEnabling} +} + +// ResourceType enumerates the values for resource type. +type ResourceType string + +const ( + // ResourceTypeMicrosoftNetworkfrontDoors ... + ResourceTypeMicrosoftNetworkfrontDoors ResourceType = "Microsoft.Network/frontDoors" + // ResourceTypeMicrosoftNetworkfrontDoorsfrontendEndpoints ... + ResourceTypeMicrosoftNetworkfrontDoorsfrontendEndpoints ResourceType = "Microsoft.Network/frontDoors/frontendEndpoints" +) + +// PossibleResourceTypeValues returns an array of possible values for the ResourceType const type. +func PossibleResourceTypeValues() []ResourceType { + return []ResourceType{ResourceTypeMicrosoftNetworkfrontDoors, ResourceTypeMicrosoftNetworkfrontDoorsfrontendEndpoints} +} + +// RoutingRuleEnabledState enumerates the values for routing rule enabled state. +type RoutingRuleEnabledState string + +const ( + // RoutingRuleEnabledStateDisabled ... + RoutingRuleEnabledStateDisabled RoutingRuleEnabledState = "Disabled" + // RoutingRuleEnabledStateEnabled ... + RoutingRuleEnabledStateEnabled RoutingRuleEnabledState = "Enabled" +) + +// PossibleRoutingRuleEnabledStateValues returns an array of possible values for the RoutingRuleEnabledState const type. +func PossibleRoutingRuleEnabledStateValues() []RoutingRuleEnabledState { + return []RoutingRuleEnabledState{RoutingRuleEnabledStateDisabled, RoutingRuleEnabledStateEnabled} +} + +// RulesEngineMatchVariable enumerates the values for rules engine match variable. +type RulesEngineMatchVariable string + +const ( + // RulesEngineMatchVariableIsMobile ... + RulesEngineMatchVariableIsMobile RulesEngineMatchVariable = "IsMobile" + // RulesEngineMatchVariablePostArgs ... + RulesEngineMatchVariablePostArgs RulesEngineMatchVariable = "PostArgs" + // RulesEngineMatchVariableQueryString ... + RulesEngineMatchVariableQueryString RulesEngineMatchVariable = "QueryString" + // RulesEngineMatchVariableRemoteAddr ... + RulesEngineMatchVariableRemoteAddr RulesEngineMatchVariable = "RemoteAddr" + // RulesEngineMatchVariableRequestBody ... + RulesEngineMatchVariableRequestBody RulesEngineMatchVariable = "RequestBody" + // RulesEngineMatchVariableRequestFilename ... + RulesEngineMatchVariableRequestFilename RulesEngineMatchVariable = "RequestFilename" + // RulesEngineMatchVariableRequestFilenameExtension ... + RulesEngineMatchVariableRequestFilenameExtension RulesEngineMatchVariable = "RequestFilenameExtension" + // RulesEngineMatchVariableRequestHeader ... + RulesEngineMatchVariableRequestHeader RulesEngineMatchVariable = "RequestHeader" + // RulesEngineMatchVariableRequestMethod ... + RulesEngineMatchVariableRequestMethod RulesEngineMatchVariable = "RequestMethod" + // RulesEngineMatchVariableRequestPath ... + RulesEngineMatchVariableRequestPath RulesEngineMatchVariable = "RequestPath" + // RulesEngineMatchVariableRequestScheme ... + RulesEngineMatchVariableRequestScheme RulesEngineMatchVariable = "RequestScheme" + // RulesEngineMatchVariableRequestURI ... + RulesEngineMatchVariableRequestURI RulesEngineMatchVariable = "RequestUri" +) + +// PossibleRulesEngineMatchVariableValues returns an array of possible values for the RulesEngineMatchVariable const type. +func PossibleRulesEngineMatchVariableValues() []RulesEngineMatchVariable { + return []RulesEngineMatchVariable{RulesEngineMatchVariableIsMobile, RulesEngineMatchVariablePostArgs, RulesEngineMatchVariableQueryString, RulesEngineMatchVariableRemoteAddr, RulesEngineMatchVariableRequestBody, RulesEngineMatchVariableRequestFilename, RulesEngineMatchVariableRequestFilenameExtension, RulesEngineMatchVariableRequestHeader, RulesEngineMatchVariableRequestMethod, RulesEngineMatchVariableRequestPath, RulesEngineMatchVariableRequestScheme, RulesEngineMatchVariableRequestURI} +} + +// RulesEngineOperator enumerates the values for rules engine operator. +type RulesEngineOperator string + +const ( + // RulesEngineOperatorAny ... + RulesEngineOperatorAny RulesEngineOperator = "Any" + // RulesEngineOperatorBeginsWith ... + RulesEngineOperatorBeginsWith RulesEngineOperator = "BeginsWith" + // RulesEngineOperatorContains ... + RulesEngineOperatorContains RulesEngineOperator = "Contains" + // RulesEngineOperatorEndsWith ... + RulesEngineOperatorEndsWith RulesEngineOperator = "EndsWith" + // RulesEngineOperatorEqual ... + RulesEngineOperatorEqual RulesEngineOperator = "Equal" + // RulesEngineOperatorGeoMatch ... + RulesEngineOperatorGeoMatch RulesEngineOperator = "GeoMatch" + // RulesEngineOperatorGreaterThan ... + RulesEngineOperatorGreaterThan RulesEngineOperator = "GreaterThan" + // RulesEngineOperatorGreaterThanOrEqual ... + RulesEngineOperatorGreaterThanOrEqual RulesEngineOperator = "GreaterThanOrEqual" + // RulesEngineOperatorIPMatch ... + RulesEngineOperatorIPMatch RulesEngineOperator = "IPMatch" + // RulesEngineOperatorLessThan ... + RulesEngineOperatorLessThan RulesEngineOperator = "LessThan" + // RulesEngineOperatorLessThanOrEqual ... + RulesEngineOperatorLessThanOrEqual RulesEngineOperator = "LessThanOrEqual" +) + +// PossibleRulesEngineOperatorValues returns an array of possible values for the RulesEngineOperator const type. +func PossibleRulesEngineOperatorValues() []RulesEngineOperator { + return []RulesEngineOperator{RulesEngineOperatorAny, RulesEngineOperatorBeginsWith, RulesEngineOperatorContains, RulesEngineOperatorEndsWith, RulesEngineOperatorEqual, RulesEngineOperatorGeoMatch, RulesEngineOperatorGreaterThan, RulesEngineOperatorGreaterThanOrEqual, RulesEngineOperatorIPMatch, RulesEngineOperatorLessThan, RulesEngineOperatorLessThanOrEqual} +} + +// RuleType enumerates the values for rule type. +type RuleType string + +const ( + // RuleTypeMatchRule ... + RuleTypeMatchRule RuleType = "MatchRule" + // RuleTypeRateLimitRule ... + RuleTypeRateLimitRule RuleType = "RateLimitRule" +) + +// PossibleRuleTypeValues returns an array of possible values for the RuleType const type. +func PossibleRuleTypeValues() []RuleType { + return []RuleType{RuleTypeMatchRule, RuleTypeRateLimitRule} +} + +// SessionAffinityEnabledState enumerates the values for session affinity enabled state. +type SessionAffinityEnabledState string + +const ( + // SessionAffinityEnabledStateDisabled ... + SessionAffinityEnabledStateDisabled SessionAffinityEnabledState = "Disabled" + // SessionAffinityEnabledStateEnabled ... + SessionAffinityEnabledStateEnabled SessionAffinityEnabledState = "Enabled" +) + +// PossibleSessionAffinityEnabledStateValues returns an array of possible values for the SessionAffinityEnabledState const type. +func PossibleSessionAffinityEnabledStateValues() []SessionAffinityEnabledState { + return []SessionAffinityEnabledState{SessionAffinityEnabledStateDisabled, SessionAffinityEnabledStateEnabled} +} + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // SkuNameClassicAzureFrontDoor ... + SkuNameClassicAzureFrontDoor SkuName = "Classic_AzureFrontDoor" + // SkuNamePremiumAzureFrontDoor ... + SkuNamePremiumAzureFrontDoor SkuName = "Premium_AzureFrontDoor" + // SkuNameStandardAzureFrontDoor ... + SkuNameStandardAzureFrontDoor SkuName = "Standard_AzureFrontDoor" +) + +// PossibleSkuNameValues returns an array of possible values for the SkuName const type. +func PossibleSkuNameValues() []SkuName { + return []SkuName{SkuNameClassicAzureFrontDoor, SkuNamePremiumAzureFrontDoor, SkuNameStandardAzureFrontDoor} +} + +// State enumerates the values for state. +type State string + +const ( + // StateDisabled ... + StateDisabled State = "Disabled" + // StateEnabled ... + StateEnabled State = "Enabled" +) + +// PossibleStateValues returns an array of possible values for the State const type. +func PossibleStateValues() []State { + return []State{StateDisabled, StateEnabled} +} + +// TimeseriesAggregationInterval enumerates the values for timeseries aggregation interval. +type TimeseriesAggregationInterval string + +const ( + // TimeseriesAggregationIntervalDaily ... + TimeseriesAggregationIntervalDaily TimeseriesAggregationInterval = "Daily" + // TimeseriesAggregationIntervalHourly ... + TimeseriesAggregationIntervalHourly TimeseriesAggregationInterval = "Hourly" +) + +// PossibleTimeseriesAggregationIntervalValues returns an array of possible values for the TimeseriesAggregationInterval const type. +func PossibleTimeseriesAggregationIntervalValues() []TimeseriesAggregationInterval { + return []TimeseriesAggregationInterval{TimeseriesAggregationIntervalDaily, TimeseriesAggregationIntervalHourly} +} + +// TimeseriesType enumerates the values for timeseries type. +type TimeseriesType string + +const ( + // TimeseriesTypeLatencyP50 ... + TimeseriesTypeLatencyP50 TimeseriesType = "LatencyP50" + // TimeseriesTypeLatencyP75 ... + TimeseriesTypeLatencyP75 TimeseriesType = "LatencyP75" + // TimeseriesTypeLatencyP95 ... + TimeseriesTypeLatencyP95 TimeseriesType = "LatencyP95" + // TimeseriesTypeMeasurementCounts ... + TimeseriesTypeMeasurementCounts TimeseriesType = "MeasurementCounts" +) + +// PossibleTimeseriesTypeValues returns an array of possible values for the TimeseriesType const type. +func PossibleTimeseriesTypeValues() []TimeseriesType { + return []TimeseriesType{TimeseriesTypeLatencyP50, TimeseriesTypeLatencyP75, TimeseriesTypeLatencyP95, TimeseriesTypeMeasurementCounts} +} + +// Transform enumerates the values for transform. +type Transform string + +const ( + // TransformLowercase ... + TransformLowercase Transform = "Lowercase" + // TransformRemoveNulls ... + TransformRemoveNulls Transform = "RemoveNulls" + // TransformTrim ... + TransformTrim Transform = "Trim" + // TransformUppercase ... + TransformUppercase Transform = "Uppercase" + // TransformURLDecode ... + TransformURLDecode Transform = "UrlDecode" + // TransformURLEncode ... + TransformURLEncode Transform = "UrlEncode" +) + +// PossibleTransformValues returns an array of possible values for the Transform const type. +func PossibleTransformValues() []Transform { + return []Transform{TransformLowercase, TransformRemoveNulls, TransformTrim, TransformUppercase, TransformURLDecode, TransformURLEncode} +} + +// TransformType enumerates the values for transform type. +type TransformType string + +const ( + // TransformTypeLowercase ... + TransformTypeLowercase TransformType = "Lowercase" + // TransformTypeRemoveNulls ... + TransformTypeRemoveNulls TransformType = "RemoveNulls" + // TransformTypeTrim ... + TransformTypeTrim TransformType = "Trim" + // TransformTypeUppercase ... + TransformTypeUppercase TransformType = "Uppercase" + // TransformTypeURLDecode ... + TransformTypeURLDecode TransformType = "UrlDecode" + // TransformTypeURLEncode ... + TransformTypeURLEncode TransformType = "UrlEncode" +) + +// PossibleTransformTypeValues returns an array of possible values for the TransformType const type. +func PossibleTransformTypeValues() []TransformType { + return []TransformType{TransformTypeLowercase, TransformTypeRemoveNulls, TransformTypeTrim, TransformTypeUppercase, TransformTypeURLDecode, TransformTypeURLEncode} +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/experiments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/experiments.go new file mode 100644 index 000000000000..bad6eb0c780f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/experiments.go @@ -0,0 +1,534 @@ +package frontdoor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExperimentsClient is the frontDoor Client +type ExperimentsClient struct { + BaseClient +} + +// NewExperimentsClient creates an instance of the ExperimentsClient client. +func NewExperimentsClient(subscriptionID string) ExperimentsClient { + return NewExperimentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExperimentsClientWithBaseURI creates an instance of the ExperimentsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewExperimentsClientWithBaseURI(baseURI string, subscriptionID string) ExperimentsClient { + return ExperimentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - the Profile identifier associated with the Tenant and Partner +// experimentName - the Experiment identifier associated with the Experiment +// parameters - the Experiment resource +func (client ExperimentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, profileName string, experimentName string, parameters Experiment) (result ExperimentsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: profileName, + Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: experimentName, + Constraints: []validation.Constraint{{Target: "experimentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.ExperimentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, profileName, experimentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExperimentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, experimentName string, parameters Experiment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "experimentName": autorest.Encode("path", experimentName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ExperimentsClient) CreateOrUpdateSender(req *http.Request) (future ExperimentsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExperimentsClient) CreateOrUpdateResponder(resp *http.Response) (result Experiment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - the Profile identifier associated with the Tenant and Partner +// experimentName - the Experiment identifier associated with the Experiment +func (client ExperimentsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, experimentName string) (result ExperimentsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: profileName, + Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: experimentName, + Constraints: []validation.Constraint{{Target: "experimentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.ExperimentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, experimentName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExperimentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, experimentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "experimentName": autorest.Encode("path", experimentName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExperimentsClient) DeleteSender(req *http.Request) (future ExperimentsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExperimentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - the Profile identifier associated with the Tenant and Partner +// experimentName - the Experiment identifier associated with the Experiment +func (client ExperimentsClient) Get(ctx context.Context, resourceGroupName string, profileName string, experimentName string) (result Experiment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: profileName, + Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: experimentName, + Constraints: []validation.Constraint{{Target: "experimentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.ExperimentsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, experimentName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExperimentsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, experimentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "experimentName": autorest.Encode("path", experimentName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExperimentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExperimentsClient) GetResponder(resp *http.Response) (result Experiment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile sends the list by profile request. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - the Profile identifier associated with the Tenant and Partner +func (client ExperimentsClient) ListByProfile(ctx context.Context, resourceGroupName string, profileName string) (result ExperimentListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentsClient.ListByProfile") + defer func() { + sc := -1 + if result.el.Response.Response != nil { + sc = result.el.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: profileName, + Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.ExperimentsClient", "ListByProfile", err.Error()) + } + + result.fn = client.listByProfileNextResults + req, err := client.ListByProfilePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.el.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "ListByProfile", resp, "Failure sending request") + return + } + + result.el, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "ListByProfile", resp, "Failure responding to request") + return + } + if result.el.hasNextLink() && result.el.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client ExperimentsClient) ListByProfilePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client ExperimentsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client ExperimentsClient) ListByProfileResponder(resp *http.Response) (result ExperimentList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByProfileNextResults retrieves the next set of results, if any. +func (client ExperimentsClient) listByProfileNextResults(ctx context.Context, lastResults ExperimentList) (result ExperimentList, err error) { + req, err := lastResults.experimentListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "listByProfileNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "listByProfileNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "listByProfileNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByProfileComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExperimentsClient) ListByProfileComplete(ctx context.Context, resourceGroupName string, profileName string) (result ExperimentListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentsClient.ListByProfile") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByProfile(ctx, resourceGroupName, profileName) + return +} + +// Update updates an Experiment +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - the Profile identifier associated with the Tenant and Partner +// experimentName - the Experiment identifier associated with the Experiment +// parameters - the Experiment Update Model +func (client ExperimentsClient) Update(ctx context.Context, resourceGroupName string, profileName string, experimentName string, parameters ExperimentUpdateModel) (result ExperimentsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: profileName, + Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: experimentName, + Constraints: []validation.Constraint{{Target: "experimentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.ExperimentsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, experimentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ExperimentsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, experimentName string, parameters ExperimentUpdateModel) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "experimentName": autorest.Encode("path", experimentName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ExperimentsClient) UpdateSender(req *http.Request) (future ExperimentsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ExperimentsClient) UpdateResponder(resp *http.Response) (result Experiment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontdoors.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontdoors.go new file mode 100644 index 000000000000..903e1eae2460 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontdoors.go @@ -0,0 +1,635 @@ +package frontdoor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// FrontDoorsClient is the frontDoor Client +type FrontDoorsClient struct { + BaseClient +} + +// NewFrontDoorsClient creates an instance of the FrontDoorsClient client. +func NewFrontDoorsClient(subscriptionID string) FrontDoorsClient { + return NewFrontDoorsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFrontDoorsClientWithBaseURI creates an instance of the FrontDoorsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewFrontDoorsClientWithBaseURI(baseURI string, subscriptionID string) FrontDoorsClient { + return FrontDoorsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a new Front Door with a Front Door name under the specified subscription and resource group. +// Parameters: +// 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. +func (client FrontDoorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, frontDoorName string, frontDoorParameters FrontDoor) (result FrontDoorsCreateOrUpdateFutureType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: frontDoorName, + Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.FrontDoorsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, frontDoorName, frontDoorParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FrontDoorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, frontDoorName string, frontDoorParameters FrontDoor) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "frontDoorName": autorest.Encode("path", frontDoorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}", pathParameters), + autorest.WithJSON(frontDoorParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client FrontDoorsClient) CreateOrUpdateSender(req *http.Request) (future FrontDoorsCreateOrUpdateFutureType, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client FrontDoorsClient) CreateOrUpdateResponder(resp *http.Response) (result FrontDoor, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing Front Door with the specified parameters. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// frontDoorName - name of the Front Door which is globally unique. +func (client FrontDoorsClient) Delete(ctx context.Context, resourceGroupName string, frontDoorName string) (result FrontDoorsDeleteFutureType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: frontDoorName, + Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.FrontDoorsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, frontDoorName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FrontDoorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, frontDoorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "frontDoorName": autorest.Encode("path", frontDoorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client FrontDoorsClient) DeleteSender(req *http.Request) (future FrontDoorsDeleteFutureType, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FrontDoorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a Front Door with the specified Front Door name under the specified subscription and resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// frontDoorName - name of the Front Door which is globally unique. +func (client FrontDoorsClient) Get(ctx context.Context, resourceGroupName string, frontDoorName string) (result FrontDoor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: frontDoorName, + Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.FrontDoorsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, frontDoorName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FrontDoorsClient) GetPreparer(ctx context.Context, resourceGroupName string, frontDoorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "frontDoorName": autorest.Encode("path", frontDoorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FrontDoorsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client FrontDoorsClient) GetResponder(resp *http.Response) (result FrontDoor, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the Front Doors within an Azure subscription. +func (client FrontDoorsClient) List(ctx context.Context) (result ListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.List") + defer func() { + sc := -1 + if result.lr.Response.Response != nil { + sc = result.lr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "List", resp, "Failure sending request") + return + } + + result.lr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "List", resp, "Failure responding to request") + return + } + if result.lr.hasNextLink() && result.lr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client FrontDoorsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/frontDoors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FrontDoorsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client FrontDoorsClient) ListResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client FrontDoorsClient) listNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.listResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client FrontDoorsClient) ListComplete(ctx context.Context) (result ListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists all of the Front Doors within a resource group under a subscription. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +func (client FrontDoorsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.lr.Response.Response != nil { + sc = result.lr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.FrontDoorsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.lr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.lr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.lr.hasNextLink() && result.lr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client FrontDoorsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client FrontDoorsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client FrontDoorsClient) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client FrontDoorsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.listResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client FrontDoorsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ValidateCustomDomain validates the custom domain mapping to ensure it maps to the correct Front Door endpoint in +// DNS. +// Parameters: +// 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. +func (client FrontDoorsClient) ValidateCustomDomain(ctx context.Context, resourceGroupName string, frontDoorName string, customDomainProperties ValidateCustomDomainInput) (result ValidateCustomDomainOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FrontDoorsClient.ValidateCustomDomain") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: frontDoorName, + Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, + {TargetValue: customDomainProperties, + Constraints: []validation.Constraint{{Target: "customDomainProperties.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.FrontDoorsClient", "ValidateCustomDomain", err.Error()) + } + + req, err := client.ValidateCustomDomainPreparer(ctx, resourceGroupName, frontDoorName, customDomainProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "ValidateCustomDomain", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateCustomDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "ValidateCustomDomain", resp, "Failure sending request") + return + } + + result, err = client.ValidateCustomDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsClient", "ValidateCustomDomain", resp, "Failure responding to request") + return + } + + return +} + +// ValidateCustomDomainPreparer prepares the ValidateCustomDomain request. +func (client FrontDoorsClient) ValidateCustomDomainPreparer(ctx context.Context, resourceGroupName string, frontDoorName string, customDomainProperties ValidateCustomDomainInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "frontDoorName": autorest.Encode("path", frontDoorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/validateCustomDomain", pathParameters), + autorest.WithJSON(customDomainProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateCustomDomainSender sends the ValidateCustomDomain request. The method will close the +// http.Response Body if it receives an error. +func (client FrontDoorsClient) ValidateCustomDomainSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateCustomDomainResponder handles the response to the ValidateCustomDomain request. The method always +// closes the http.Response Body. +func (client FrontDoorsClient) ValidateCustomDomainResponder(resp *http.Response) (result ValidateCustomDomainOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontendendpoints.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontendendpoints.go new file mode 100644 index 000000000000..928b44b7c7cc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/frontendendpoints.go @@ -0,0 +1,454 @@ +package frontdoor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// FrontendEndpointsClient is the frontDoor Client +type FrontendEndpointsClient struct { + BaseClient +} + +// NewFrontendEndpointsClient creates an instance of the FrontendEndpointsClient client. +func NewFrontendEndpointsClient(subscriptionID string) FrontendEndpointsClient { + return NewFrontendEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFrontendEndpointsClientWithBaseURI creates an instance of the FrontendEndpointsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewFrontendEndpointsClientWithBaseURI(baseURI string, subscriptionID string) FrontendEndpointsClient { + return FrontendEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// DisableHTTPS disables a frontendEndpoint for HTTPS traffic +// Parameters: +// 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. +func (client FrontendEndpointsClient) DisableHTTPS(ctx context.Context, resourceGroupName string, frontDoorName string, frontendEndpointName string) (result FrontendEndpointsDisableHTTPSFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FrontendEndpointsClient.DisableHTTPS") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: frontDoorName, + Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, + {TargetValue: frontendEndpointName, + Constraints: []validation.Constraint{{Target: "frontendEndpointName", Name: validation.MaxLength, Rule: 255, Chain: nil}, + {Target: "frontendEndpointName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "frontendEndpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.FrontendEndpointsClient", "DisableHTTPS", err.Error()) + } + + req, err := client.DisableHTTPSPreparer(ctx, resourceGroupName, frontDoorName, frontendEndpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "DisableHTTPS", nil, "Failure preparing request") + return + } + + result, err = client.DisableHTTPSSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "DisableHTTPS", result.Response(), "Failure sending request") + return + } + + return +} + +// DisableHTTPSPreparer prepares the DisableHTTPS request. +func (client FrontendEndpointsClient) DisableHTTPSPreparer(ctx context.Context, resourceGroupName string, frontDoorName string, frontendEndpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "frontDoorName": autorest.Encode("path", frontDoorName), + "frontendEndpointName": autorest.Encode("path", frontendEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/disableHttps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableHTTPSSender sends the DisableHTTPS request. The method will close the +// http.Response Body if it receives an error. +func (client FrontendEndpointsClient) DisableHTTPSSender(req *http.Request) (future FrontendEndpointsDisableHTTPSFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DisableHTTPSResponder handles the response to the DisableHTTPS request. The method always +// closes the http.Response Body. +func (client FrontendEndpointsClient) DisableHTTPSResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// EnableHTTPS enables a frontendEndpoint for HTTPS traffic +// Parameters: +// 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. +// customHTTPSConfiguration - the configuration specifying how to enable HTTPS +func (client FrontendEndpointsClient) EnableHTTPS(ctx context.Context, resourceGroupName string, frontDoorName string, frontendEndpointName string, customHTTPSConfiguration CustomHTTPSConfiguration) (result FrontendEndpointsEnableHTTPSFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FrontendEndpointsClient.EnableHTTPS") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: frontDoorName, + Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, + {TargetValue: frontendEndpointName, + Constraints: []validation.Constraint{{Target: "frontendEndpointName", Name: validation.MaxLength, Rule: 255, Chain: nil}, + {Target: "frontendEndpointName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "frontendEndpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$`, Chain: nil}}}, + {TargetValue: customHTTPSConfiguration, + Constraints: []validation.Constraint{{Target: "customHTTPSConfiguration.ProtocolType", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.FrontendEndpointsClient", "EnableHTTPS", err.Error()) + } + + req, err := client.EnableHTTPSPreparer(ctx, resourceGroupName, frontDoorName, frontendEndpointName, customHTTPSConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "EnableHTTPS", nil, "Failure preparing request") + return + } + + result, err = client.EnableHTTPSSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "EnableHTTPS", result.Response(), "Failure sending request") + return + } + + return +} + +// EnableHTTPSPreparer prepares the EnableHTTPS request. +func (client FrontendEndpointsClient) EnableHTTPSPreparer(ctx context.Context, resourceGroupName string, frontDoorName string, frontendEndpointName string, customHTTPSConfiguration CustomHTTPSConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "frontDoorName": autorest.Encode("path", frontDoorName), + "frontendEndpointName": autorest.Encode("path", frontendEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/enableHttps", pathParameters), + autorest.WithJSON(customHTTPSConfiguration), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableHTTPSSender sends the EnableHTTPS request. The method will close the +// http.Response Body if it receives an error. +func (client FrontendEndpointsClient) EnableHTTPSSender(req *http.Request) (future FrontendEndpointsEnableHTTPSFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// EnableHTTPSResponder handles the response to the EnableHTTPS request. The method always +// closes the http.Response Body. +func (client FrontendEndpointsClient) EnableHTTPSResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a Frontend endpoint with the specified name within the specified Front Door. +// Parameters: +// 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. +func (client FrontendEndpointsClient) Get(ctx context.Context, resourceGroupName string, frontDoorName string, frontendEndpointName string) (result FrontendEndpoint, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FrontendEndpointsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: frontDoorName, + Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, + {TargetValue: frontendEndpointName, + Constraints: []validation.Constraint{{Target: "frontendEndpointName", Name: validation.MaxLength, Rule: 255, Chain: nil}, + {Target: "frontendEndpointName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "frontendEndpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.FrontendEndpointsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, frontDoorName, frontendEndpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FrontendEndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, frontDoorName string, frontendEndpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "frontDoorName": autorest.Encode("path", frontDoorName), + "frontendEndpointName": autorest.Encode("path", frontendEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FrontendEndpointsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client FrontendEndpointsClient) GetResponder(resp *http.Response) (result FrontendEndpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByFrontDoor lists all of the frontend endpoints within a Front Door. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// frontDoorName - name of the Front Door which is globally unique. +func (client FrontendEndpointsClient) ListByFrontDoor(ctx context.Context, resourceGroupName string, frontDoorName string) (result FrontendEndpointsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FrontendEndpointsClient.ListByFrontDoor") + defer func() { + sc := -1 + if result.felr.Response.Response != nil { + sc = result.felr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: frontDoorName, + Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.FrontendEndpointsClient", "ListByFrontDoor", err.Error()) + } + + result.fn = client.listByFrontDoorNextResults + req, err := client.ListByFrontDoorPreparer(ctx, resourceGroupName, frontDoorName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "ListByFrontDoor", nil, "Failure preparing request") + return + } + + resp, err := client.ListByFrontDoorSender(req) + if err != nil { + result.felr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "ListByFrontDoor", resp, "Failure sending request") + return + } + + result.felr, err = client.ListByFrontDoorResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "ListByFrontDoor", resp, "Failure responding to request") + return + } + if result.felr.hasNextLink() && result.felr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByFrontDoorPreparer prepares the ListByFrontDoor request. +func (client FrontendEndpointsClient) ListByFrontDoorPreparer(ctx context.Context, resourceGroupName string, frontDoorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "frontDoorName": autorest.Encode("path", frontDoorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByFrontDoorSender sends the ListByFrontDoor request. The method will close the +// http.Response Body if it receives an error. +func (client FrontendEndpointsClient) ListByFrontDoorSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByFrontDoorResponder handles the response to the ListByFrontDoor request. The method always +// closes the http.Response Body. +func (client FrontendEndpointsClient) ListByFrontDoorResponder(resp *http.Response) (result FrontendEndpointsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByFrontDoorNextResults retrieves the next set of results, if any. +func (client FrontendEndpointsClient) listByFrontDoorNextResults(ctx context.Context, lastResults FrontendEndpointsListResult) (result FrontendEndpointsListResult, err error) { + req, err := lastResults.frontendEndpointsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "listByFrontDoorNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByFrontDoorSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "listByFrontDoorNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByFrontDoorResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsClient", "listByFrontDoorNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByFrontDoorComplete enumerates all values, automatically crossing page boundaries as required. +func (client FrontendEndpointsClient) ListByFrontDoorComplete(ctx context.Context, resourceGroupName string, frontDoorName string) (result FrontendEndpointsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FrontendEndpointsClient.ListByFrontDoor") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByFrontDoor(ctx, resourceGroupName, frontDoorName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/managedrulesets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/managedrulesets.go new file mode 100644 index 000000000000..4073568b2ea7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/managedrulesets.go @@ -0,0 +1,144 @@ +package frontdoor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ManagedRuleSetsClient is the frontDoor Client +type ManagedRuleSetsClient struct { + BaseClient +} + +// NewManagedRuleSetsClient creates an instance of the ManagedRuleSetsClient client. +func NewManagedRuleSetsClient(subscriptionID string) ManagedRuleSetsClient { + return NewManagedRuleSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagedRuleSetsClientWithBaseURI creates an instance of the ManagedRuleSetsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewManagedRuleSetsClientWithBaseURI(baseURI string, subscriptionID string) ManagedRuleSetsClient { + return ManagedRuleSetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all available managed rule sets. +func (client ManagedRuleSetsClient) List(ctx context.Context) (result ManagedRuleSetDefinitionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetsClient.List") + defer func() { + sc := -1 + if result.mrsdl.Response.Response != nil { + sc = result.mrsdl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ManagedRuleSetsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mrsdl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.ManagedRuleSetsClient", "List", resp, "Failure sending request") + return + } + + result.mrsdl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ManagedRuleSetsClient", "List", resp, "Failure responding to request") + return + } + if result.mrsdl.hasNextLink() && result.mrsdl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ManagedRuleSetsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallManagedRuleSets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedRuleSetsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ManagedRuleSetsClient) ListResponder(resp *http.Response) (result ManagedRuleSetDefinitionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ManagedRuleSetsClient) listNextResults(ctx context.Context, lastResults ManagedRuleSetDefinitionList) (result ManagedRuleSetDefinitionList, err error) { + req, err := lastResults.managedRuleSetDefinitionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "frontdoor.ManagedRuleSetsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "frontdoor.ManagedRuleSetsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ManagedRuleSetsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedRuleSetsClient) ListComplete(ctx context.Context) (result ManagedRuleSetDefinitionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/models.go new file mode 100644 index 000000000000..e92b4014c593 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/models.go @@ -0,0 +1,4945 @@ +package frontdoor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor" + +// AzureAsyncOperationResult the response body contains the status of the specified asynchronous operation, +// indicating whether it has succeeded, is in progress, or has failed. Note that this status is distinct +// from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous +// operation succeeded, the response body includes the HTTP status code for the successful request. If the +// asynchronous operation failed, the response body includes the HTTP status code for the failed request +// and error information regarding the failure. +type AzureAsyncOperationResult struct { + // Status - Status of the Azure async operation. Possible values are: 'InProgress', 'Succeeded', and 'Failed'. Possible values include: 'NetworkOperationStatusInProgress', 'NetworkOperationStatusSucceeded', 'NetworkOperationStatusFailed' + Status NetworkOperationStatus `json:"status,omitempty"` + Error *Error `json:"error,omitempty"` +} + +// Backend backend address of a frontDoor load balancer. +type Backend struct { + // Address - Location of the backend (IP address or FQDN) + Address *string `json:"address,omitempty"` + // PrivateLinkAlias - The Alias of the Private Link resource. Populating this optional field indicates that this backend is 'Private' + PrivateLinkAlias *string `json:"privateLinkAlias,omitempty"` + // PrivateLinkResourceID - The Resource Id of the Private Link resource. Populating this optional field indicates that this backend is 'Private' + PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` + // PrivateLinkLocation - The location of the Private Link resource. Required only if 'privateLinkResourceId' is populated + PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"` + // PrivateEndpointStatus - READ-ONLY; The Approval status for the connection to the Private Link. Possible values include: 'PrivateEndpointStatusPending', 'PrivateEndpointStatusApproved', 'PrivateEndpointStatusRejected', 'PrivateEndpointStatusDisconnected', 'PrivateEndpointStatusTimeout' + PrivateEndpointStatus PrivateEndpointStatus `json:"privateEndpointStatus,omitempty"` + // PrivateLinkApprovalMessage - A custom message to be included in the approval request to connect to the Private Link + PrivateLinkApprovalMessage *string `json:"privateLinkApprovalMessage,omitempty"` + // HTTPPort - The HTTP TCP port number. Must be between 1 and 65535. + HTTPPort *int32 `json:"httpPort,omitempty"` + // HTTPSPort - The HTTPS TCP port number. Must be between 1 and 65535. + HTTPSPort *int32 `json:"httpsPort,omitempty"` + // EnabledState - Whether to enable use of this backend. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'BackendEnabledStateEnabled', 'BackendEnabledStateDisabled' + EnabledState BackendEnabledState `json:"enabledState,omitempty"` + // Priority - Priority to use for load balancing. Higher priorities will not be used for load balancing if any lower priority backend is healthy. + Priority *int32 `json:"priority,omitempty"` + // Weight - Weight of this endpoint for load balancing purposes. + Weight *int32 `json:"weight,omitempty"` + // BackendHostHeader - The value to use as the host header sent to the backend. If blank or unspecified, this defaults to the incoming host. + BackendHostHeader *string `json:"backendHostHeader,omitempty"` +} + +// MarshalJSON is the custom marshaler for Backend. +func (b Backend) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if b.Address != nil { + objectMap["address"] = b.Address + } + if b.PrivateLinkAlias != nil { + objectMap["privateLinkAlias"] = b.PrivateLinkAlias + } + if b.PrivateLinkResourceID != nil { + objectMap["privateLinkResourceId"] = b.PrivateLinkResourceID + } + if b.PrivateLinkLocation != nil { + objectMap["privateLinkLocation"] = b.PrivateLinkLocation + } + if b.PrivateLinkApprovalMessage != nil { + objectMap["privateLinkApprovalMessage"] = b.PrivateLinkApprovalMessage + } + if b.HTTPPort != nil { + objectMap["httpPort"] = b.HTTPPort + } + if b.HTTPSPort != nil { + objectMap["httpsPort"] = b.HTTPSPort + } + if b.EnabledState != "" { + objectMap["enabledState"] = b.EnabledState + } + if b.Priority != nil { + objectMap["priority"] = b.Priority + } + if b.Weight != nil { + objectMap["weight"] = b.Weight + } + if b.BackendHostHeader != nil { + objectMap["backendHostHeader"] = b.BackendHostHeader + } + return json.Marshal(objectMap) +} + +// BackendPool a backend pool is a collection of backends that can be routed to. +type BackendPool struct { + // BackendPoolProperties - Properties of the Front Door Backend Pool + *BackendPoolProperties `json:"properties,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackendPool. +func (bp BackendPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bp.BackendPoolProperties != nil { + objectMap["properties"] = bp.BackendPoolProperties + } + if bp.Name != nil { + objectMap["name"] = bp.Name + } + if bp.ID != nil { + objectMap["id"] = bp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BackendPool struct. +func (bp *BackendPool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var backendPoolProperties BackendPoolProperties + err = json.Unmarshal(*v, &backendPoolProperties) + if err != nil { + return err + } + bp.BackendPoolProperties = &backendPoolProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bp.ID = &ID + } + } + } + + return nil +} + +// BackendPoolListResult result of the request to list Backend Pools. It contains a list of Backend Pools +// objects and a URL link to get the next set of results. +type BackendPoolListResult struct { + // Value - READ-ONLY; List of Backend Pools within a Front Door. + Value *[]BackendPool `json:"value,omitempty"` + // NextLink - URL to get the next set of BackendPool objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackendPoolListResult. +func (bplr BackendPoolListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bplr.NextLink != nil { + objectMap["nextLink"] = bplr.NextLink + } + return json.Marshal(objectMap) +} + +// BackendPoolProperties the JSON object that contains the properties required to create a Backend Pool. +type BackendPoolProperties struct { + // ResourceState - Resource status. Possible values include: 'ResourceStateCreating', 'ResourceStateEnabling', 'ResourceStateEnabled', 'ResourceStateDisabling', 'ResourceStateDisabled', 'ResourceStateDeleting' + ResourceState ResourceState `json:"resourceState,omitempty"` + // Backends - The set of backends for this pool + Backends *[]Backend `json:"backends,omitempty"` + // LoadBalancingSettings - Load balancing settings for a backend pool + LoadBalancingSettings *SubResource `json:"loadBalancingSettings,omitempty"` + // HealthProbeSettings - L7 health probe settings for a backend pool + HealthProbeSettings *SubResource `json:"healthProbeSettings,omitempty"` +} + +// BackendPoolsSettings settings that apply to all backend pools. +type BackendPoolsSettings struct { + // EnforceCertificateNameCheck - Whether to enforce certificate name check on HTTPS requests to all backend pools. No effect on non-HTTPS requests. Possible values include: 'EnforceCertificateNameCheckEnabledStateEnabled', 'EnforceCertificateNameCheckEnabledStateDisabled' + EnforceCertificateNameCheck EnforceCertificateNameCheckEnabledState `json:"enforceCertificateNameCheck,omitempty"` + // SendRecvTimeoutSeconds - Send and receive timeout on forwarding request to the backend. When timeout is reached, the request fails and returns. + SendRecvTimeoutSeconds *int32 `json:"sendRecvTimeoutSeconds,omitempty"` +} + +// BackendPoolUpdateParameters a collection of backends that can be routed to. +type BackendPoolUpdateParameters struct { + // Backends - The set of backends for this pool + Backends *[]Backend `json:"backends,omitempty"` + // LoadBalancingSettings - Load balancing settings for a backend pool + LoadBalancingSettings *SubResource `json:"loadBalancingSettings,omitempty"` + // HealthProbeSettings - L7 health probe settings for a backend pool + HealthProbeSettings *SubResource `json:"healthProbeSettings,omitempty"` +} + +// CacheConfiguration caching settings for a caching-type route. To disable caching, do not provide a +// cacheConfiguration object. +type CacheConfiguration struct { + // QueryParameterStripDirective - Treatment of URL query terms when forming the cache key. Possible values include: 'QueryStripNone', 'QueryStripAll', 'QueryStripOnly', 'QueryStripAllExcept' + QueryParameterStripDirective Query `json:"queryParameterStripDirective,omitempty"` + // QueryParameters - query parameters to include or exclude (comma separated). + QueryParameters *string `json:"queryParameters,omitempty"` + // DynamicCompression - Whether to use dynamic compression for cached content. Possible values include: 'DynamicCompressionEnabledEnabled', 'DynamicCompressionEnabledDisabled' + DynamicCompression DynamicCompressionEnabled `json:"dynamicCompression,omitempty"` + // CacheDuration - The duration for which the content needs to be cached. Allowed format is in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations). HTTP requires the value to be no more than a year + CacheDuration *string `json:"cacheDuration,omitempty"` +} + +// CertificateSourceParameters parameters required for enabling SSL with Front Door-managed certificates +type CertificateSourceParameters struct { + // CertificateType - Defines the type of the certificate used for secure connections to a frontendEndpoint. Possible values include: 'CertificateTypeDedicated' + CertificateType CertificateType `json:"certificateType,omitempty"` +} + +// CheckNameAvailabilityInput input of CheckNameAvailability API. +type CheckNameAvailabilityInput struct { + // Name - The resource name to validate. + Name *string `json:"name,omitempty"` + // Type - The type of the resource whose name is to be validated. Possible values include: 'ResourceTypeMicrosoftNetworkfrontDoors', 'ResourceTypeMicrosoftNetworkfrontDoorsfrontendEndpoints' + Type ResourceType `json:"type,omitempty"` +} + +// CheckNameAvailabilityOutput output of check name availability API. +type CheckNameAvailabilityOutput struct { + autorest.Response `json:"-"` + // NameAvailability - READ-ONLY; Indicates whether the name is available. Possible values include: 'AvailabilityAvailable', 'AvailabilityUnavailable' + NameAvailability Availability `json:"nameAvailability,omitempty"` + // Reason - READ-ONLY; The reason why the name is not available. + Reason *string `json:"reason,omitempty"` + // Message - READ-ONLY; The detailed error message describing why the name is not available. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckNameAvailabilityOutput. +func (cnao CheckNameAvailabilityOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CustomHTTPSConfiguration https settings for a domain +type CustomHTTPSConfiguration struct { + // CertificateSource - Defines the source of the SSL certificate. Possible values include: 'CertificateSourceAzureKeyVault', 'CertificateSourceFrontDoor' + CertificateSource CertificateSource `json:"certificateSource,omitempty"` + // ProtocolType - Defines the TLS extension protocol that is used for secure delivery + ProtocolType *string `json:"protocolType,omitempty"` + // MinimumTLSVersion - The minimum TLS version required from the clients to establish an SSL handshake with Front Door. Possible values include: 'MinimumTLSVersionOneFullStopZero', 'MinimumTLSVersionOneFullStopTwo' + MinimumTLSVersion MinimumTLSVersion `json:"minimumTlsVersion,omitempty"` + // KeyVaultCertificateSourceParameters - KeyVault certificate source parameters (if certificateSource=AzureKeyVault) + *KeyVaultCertificateSourceParameters `json:"keyVaultCertificateSourceParameters,omitempty"` + // CertificateSourceParameters - Parameters required for enabling SSL with Front Door-managed certificates (if certificateSource=FrontDoor) + *CertificateSourceParameters `json:"frontDoorCertificateSourceParameters,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomHTTPSConfiguration. +func (chc CustomHTTPSConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if chc.CertificateSource != "" { + objectMap["certificateSource"] = chc.CertificateSource + } + if chc.ProtocolType != nil { + objectMap["protocolType"] = chc.ProtocolType + } + if chc.MinimumTLSVersion != "" { + objectMap["minimumTlsVersion"] = chc.MinimumTLSVersion + } + if chc.KeyVaultCertificateSourceParameters != nil { + objectMap["keyVaultCertificateSourceParameters"] = chc.KeyVaultCertificateSourceParameters + } + if chc.CertificateSourceParameters != nil { + objectMap["frontDoorCertificateSourceParameters"] = chc.CertificateSourceParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CustomHTTPSConfiguration struct. +func (chc *CustomHTTPSConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "certificateSource": + if v != nil { + var certificateSource CertificateSource + err = json.Unmarshal(*v, &certificateSource) + if err != nil { + return err + } + chc.CertificateSource = certificateSource + } + case "protocolType": + if v != nil { + var protocolType string + err = json.Unmarshal(*v, &protocolType) + if err != nil { + return err + } + chc.ProtocolType = &protocolType + } + case "minimumTlsVersion": + if v != nil { + var minimumTLSVersion MinimumTLSVersion + err = json.Unmarshal(*v, &minimumTLSVersion) + if err != nil { + return err + } + chc.MinimumTLSVersion = minimumTLSVersion + } + case "keyVaultCertificateSourceParameters": + if v != nil { + var keyVaultCertificateSourceParameters KeyVaultCertificateSourceParameters + err = json.Unmarshal(*v, &keyVaultCertificateSourceParameters) + if err != nil { + return err + } + chc.KeyVaultCertificateSourceParameters = &keyVaultCertificateSourceParameters + } + case "frontDoorCertificateSourceParameters": + if v != nil { + var certificateSourceParameters CertificateSourceParameters + err = json.Unmarshal(*v, &certificateSourceParameters) + if err != nil { + return err + } + chc.CertificateSourceParameters = &certificateSourceParameters + } + } + } + + return nil +} + +// CustomRule defines contents of a web application rule +type CustomRule struct { + // Name - Describes the name of the rule. + Name *string `json:"name,omitempty"` + // Priority - Describes priority of the rule. Rules with a lower value will be evaluated before rules with a higher value. + Priority *int32 `json:"priority,omitempty"` + // EnabledState - Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified. Possible values include: 'CustomRuleEnabledStateDisabled', 'CustomRuleEnabledStateEnabled' + EnabledState CustomRuleEnabledState `json:"enabledState,omitempty"` + // RuleType - Describes type of rule. Possible values include: 'RuleTypeMatchRule', 'RuleTypeRateLimitRule' + RuleType RuleType `json:"ruleType,omitempty"` + // RateLimitDurationInMinutes - Time window for resetting the rate limit count. Default is 1 minute. + RateLimitDurationInMinutes *int32 `json:"rateLimitDurationInMinutes,omitempty"` + // RateLimitThreshold - Number of allowed requests per client within the time window. + RateLimitThreshold *int32 `json:"rateLimitThreshold,omitempty"` + // MatchConditions - List of match conditions. + MatchConditions *[]MatchCondition `json:"matchConditions,omitempty"` + // Action - Describes what action to be applied when rule matches. Possible values include: 'ActionTypeAllow', 'ActionTypeBlock', 'ActionTypeLog', 'ActionTypeRedirect' + Action ActionType `json:"action,omitempty"` +} + +// CustomRuleList defines contents of custom rules +type CustomRuleList struct { + // Rules - List of rules + Rules *[]CustomRule `json:"rules,omitempty"` +} + +// Endpoint defines the endpoint properties +type Endpoint struct { + // Name - The name of the endpoint + Name *string `json:"name,omitempty"` + // Endpoint - The endpoint URL + Endpoint *string `json:"endpoint,omitempty"` +} + +// EndpointsPurgeContentFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointsPurgeContentFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointsPurgeContentFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointsPurgeContentFuture.Result. +func (future *EndpointsPurgeContentFuture) result(client EndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.EndpointsPurgeContentFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("frontdoor.EndpointsPurgeContentFuture") + return + } + ar.Response = future.Response() + return +} + +// Error ... +type Error struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` + Details *[]ErrorDetails `json:"details,omitempty"` + InnerError *string `json:"innerError,omitempty"` +} + +// ErrorDetails ... +type ErrorDetails struct { + Code *string `json:"code,omitempty"` + Target *string `json:"target,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ErrorResponse error response indicates Front Door service is not able to process the incoming request. +// The reason is provided in the error message. +type ErrorResponse struct { + // Code - READ-ONLY; Error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorResponse. +func (er ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Experiment defines the properties of an Experiment +type Experiment struct { + autorest.Response `json:"-"` + // ExperimentProperties - The properties of an Experiment + *ExperimentProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Experiment. +func (e Experiment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExperimentProperties != nil { + objectMap["properties"] = e.ExperimentProperties + } + if e.Location != nil { + objectMap["location"] = e.Location + } + if e.Tags != nil { + objectMap["tags"] = e.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Experiment struct. +func (e *Experiment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var experimentProperties ExperimentProperties + err = json.Unmarshal(*v, &experimentProperties) + if err != nil { + return err + } + e.ExperimentProperties = &experimentProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + e.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + e.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + e.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + e.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + e.Tags = tags + } + } + } + + return nil +} + +// ExperimentList defines a list of Experiments. It contains a list of Experiment objects and a URL link to +// get the next set of results. +type ExperimentList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Experiments within a resource group. + Value *[]Experiment `json:"value,omitempty"` + // NextLink - URL to get the next set of Experiment objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExperimentList. +func (el ExperimentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if el.NextLink != nil { + objectMap["nextLink"] = el.NextLink + } + return json.Marshal(objectMap) +} + +// ExperimentListIterator provides access to a complete listing of Experiment values. +type ExperimentListIterator struct { + i int + page ExperimentListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExperimentListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExperimentListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExperimentListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExperimentListIterator) Response() ExperimentList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExperimentListIterator) Value() Experiment { + if !iter.page.NotDone() { + return Experiment{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExperimentListIterator type. +func NewExperimentListIterator(page ExperimentListPage) ExperimentListIterator { + return ExperimentListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (el ExperimentList) IsEmpty() bool { + return el.Value == nil || len(*el.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (el ExperimentList) hasNextLink() bool { + return el.NextLink != nil && len(*el.NextLink) != 0 +} + +// experimentListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (el ExperimentList) experimentListPreparer(ctx context.Context) (*http.Request, error) { + if !el.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(el.NextLink))) +} + +// ExperimentListPage contains a page of Experiment values. +type ExperimentListPage struct { + fn func(context.Context, ExperimentList) (ExperimentList, error) + el ExperimentList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExperimentListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.el) + if err != nil { + return err + } + page.el = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExperimentListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExperimentListPage) NotDone() bool { + return !page.el.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExperimentListPage) Response() ExperimentList { + return page.el +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExperimentListPage) Values() []Experiment { + if page.el.IsEmpty() { + return nil + } + return *page.el.Value +} + +// Creates a new instance of the ExperimentListPage type. +func NewExperimentListPage(cur ExperimentList, getNextPage func(context.Context, ExperimentList) (ExperimentList, error)) ExperimentListPage { + return ExperimentListPage{ + fn: getNextPage, + el: cur, + } +} + +// ExperimentProperties defines the properties of an experiment +type ExperimentProperties struct { + // Description - The description of the details or intents of the Experiment + Description *string `json:"description,omitempty"` + // EndpointA - The endpoint A of an experiment + EndpointA *Endpoint `json:"endpointA,omitempty"` + // EndpointB - The endpoint B of an experiment + EndpointB *Endpoint `json:"endpointB,omitempty"` + // EnabledState - The state of the Experiment. Possible values include: 'StateEnabled', 'StateDisabled' + EnabledState State `json:"enabledState,omitempty"` + // ResourceState - Resource status. Possible values include: 'NetworkExperimentResourceStateCreating', 'NetworkExperimentResourceStateEnabling', 'NetworkExperimentResourceStateEnabled', 'NetworkExperimentResourceStateDisabling', 'NetworkExperimentResourceStateDisabled', 'NetworkExperimentResourceStateDeleting' + ResourceState NetworkExperimentResourceState `json:"resourceState,omitempty"` + // Status - READ-ONLY; The description of Experiment status from the server side + Status *string `json:"status,omitempty"` + // ScriptFileURI - READ-ONLY; The uri to the Script used in the Experiment + ScriptFileURI *string `json:"scriptFileUri,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExperimentProperties. +func (ep ExperimentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ep.Description != nil { + objectMap["description"] = ep.Description + } + if ep.EndpointA != nil { + objectMap["endpointA"] = ep.EndpointA + } + if ep.EndpointB != nil { + objectMap["endpointB"] = ep.EndpointB + } + if ep.EnabledState != "" { + objectMap["enabledState"] = ep.EnabledState + } + if ep.ResourceState != "" { + objectMap["resourceState"] = ep.ResourceState + } + return json.Marshal(objectMap) +} + +// ExperimentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExperimentsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExperimentsClient) (Experiment, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExperimentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExperimentsCreateOrUpdateFuture.Result. +func (future *ExperimentsCreateOrUpdateFuture) result(client ExperimentsClient) (e Experiment, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("frontdoor.ExperimentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.CreateOrUpdateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsCreateOrUpdateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExperimentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExperimentsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExperimentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExperimentsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExperimentsDeleteFuture.Result. +func (future *ExperimentsDeleteFuture) result(client ExperimentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("frontdoor.ExperimentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExperimentsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExperimentsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExperimentsClient) (Experiment, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExperimentsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExperimentsUpdateFuture.Result. +func (future *ExperimentsUpdateFuture) result(client ExperimentsClient) (e Experiment, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("frontdoor.ExperimentsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.UpdateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ExperimentsUpdateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExperimentUpdateModel defines modifiable attributes of an Experiment +type ExperimentUpdateModel struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ExperimentUpdateProperties - The properties of a Profile + *ExperimentUpdateProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExperimentUpdateModel. +func (eum ExperimentUpdateModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if eum.Tags != nil { + objectMap["tags"] = eum.Tags + } + if eum.ExperimentUpdateProperties != nil { + objectMap["properties"] = eum.ExperimentUpdateProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExperimentUpdateModel struct. +func (eum *ExperimentUpdateModel) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + eum.Tags = tags + } + case "properties": + if v != nil { + var experimentUpdateProperties ExperimentUpdateProperties + err = json.Unmarshal(*v, &experimentUpdateProperties) + if err != nil { + return err + } + eum.ExperimentUpdateProperties = &experimentUpdateProperties + } + } + } + + return nil +} + +// ExperimentUpdateProperties defines the properties of an experiment +type ExperimentUpdateProperties struct { + // Description - The description of the intent or details of the Experiment + Description *string `json:"description,omitempty"` + // EnabledState - The state of the Experiment. Possible values include: 'StateEnabled', 'StateDisabled' + EnabledState State `json:"enabledState,omitempty"` +} + +// ForwardingConfiguration describes Forwarding Route. +type ForwardingConfiguration struct { + // CustomForwardingPath - A custom path used to rewrite resource paths matched by this rule. Leave empty to use incoming path. + CustomForwardingPath *string `json:"customForwardingPath,omitempty"` + // ForwardingProtocol - Protocol this rule will use when forwarding traffic to backends. Possible values include: 'ForwardingProtocolHTTPOnly', 'ForwardingProtocolHTTPSOnly', 'ForwardingProtocolMatchRequest' + ForwardingProtocol ForwardingProtocol `json:"forwardingProtocol,omitempty"` + // CacheConfiguration - The caching configuration associated with this rule. + CacheConfiguration *CacheConfiguration `json:"cacheConfiguration,omitempty"` + // BackendPool - A reference to the BackendPool which this rule routes to. + BackendPool *SubResource `json:"backendPool,omitempty"` + // OdataType - Possible values include: 'OdataTypeRouteConfiguration', 'OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration', 'OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration' + OdataType OdataType `json:"@odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ForwardingConfiguration. +func (fc ForwardingConfiguration) MarshalJSON() ([]byte, error) { + fc.OdataType = OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration + objectMap := make(map[string]interface{}) + if fc.CustomForwardingPath != nil { + objectMap["customForwardingPath"] = fc.CustomForwardingPath + } + if fc.ForwardingProtocol != "" { + objectMap["forwardingProtocol"] = fc.ForwardingProtocol + } + if fc.CacheConfiguration != nil { + objectMap["cacheConfiguration"] = fc.CacheConfiguration + } + if fc.BackendPool != nil { + objectMap["backendPool"] = fc.BackendPool + } + if fc.OdataType != "" { + objectMap["@odata.type"] = fc.OdataType + } + return json.Marshal(objectMap) +} + +// AsForwardingConfiguration is the BasicRouteConfiguration implementation for ForwardingConfiguration. +func (fc ForwardingConfiguration) AsForwardingConfiguration() (*ForwardingConfiguration, bool) { + return &fc, true +} + +// AsRedirectConfiguration is the BasicRouteConfiguration implementation for ForwardingConfiguration. +func (fc ForwardingConfiguration) AsRedirectConfiguration() (*RedirectConfiguration, bool) { + return nil, false +} + +// AsRouteConfiguration is the BasicRouteConfiguration implementation for ForwardingConfiguration. +func (fc ForwardingConfiguration) AsRouteConfiguration() (*RouteConfiguration, bool) { + return nil, false +} + +// AsBasicRouteConfiguration is the BasicRouteConfiguration implementation for ForwardingConfiguration. +func (fc ForwardingConfiguration) AsBasicRouteConfiguration() (BasicRouteConfiguration, bool) { + return &fc, true +} + +// FrontDoor front Door represents a collection of backend endpoints to route traffic to along with rules +// that specify how traffic is sent there. +type FrontDoor struct { + autorest.Response `json:"-"` + // Properties - Properties of the Front Door Load Balancer + *Properties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for FrontDoor. +func (fd FrontDoor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fd.Properties != nil { + objectMap["properties"] = fd.Properties + } + if fd.Location != nil { + objectMap["location"] = fd.Location + } + if fd.Tags != nil { + objectMap["tags"] = fd.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FrontDoor struct. +func (fd *FrontDoor) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var properties Properties + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + fd.Properties = &properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fd.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + fd.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + fd.Tags = tags + } + } + } + + return nil +} + +// FrontDoorsCreateOrUpdateFutureType an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FrontDoorsCreateOrUpdateFutureType struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FrontDoorsClient) (FrontDoor, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FrontDoorsCreateOrUpdateFutureType) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FrontDoorsCreateOrUpdateFutureType.Result. +func (future *FrontDoorsCreateOrUpdateFutureType) result(client FrontDoorsClient) (fd FrontDoor, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsCreateOrUpdateFutureType", "Result", future.Response(), "Polling failure") + return + } + if !done { + fd.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("frontdoor.FrontDoorsCreateOrUpdateFutureType") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fd.Response.Response, err = future.GetResult(sender); err == nil && fd.Response.Response.StatusCode != http.StatusNoContent { + fd, err = client.CreateOrUpdateResponder(fd.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsCreateOrUpdateFutureType", "Result", fd.Response.Response, "Failure responding to request") + } + } + return +} + +// FrontDoorsDeleteFutureType an abstraction for monitoring and retrieving the results of a long-running +// operation. +type FrontDoorsDeleteFutureType struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FrontDoorsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FrontDoorsDeleteFutureType) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FrontDoorsDeleteFutureType.Result. +func (future *FrontDoorsDeleteFutureType) result(client FrontDoorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontDoorsDeleteFutureType", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("frontdoor.FrontDoorsDeleteFutureType") + return + } + ar.Response = future.Response() + return +} + +// FrontendEndpoint a frontend endpoint used for routing. +type FrontendEndpoint struct { + autorest.Response `json:"-"` + // FrontendEndpointProperties - Properties of the Frontend endpoint + *FrontendEndpointProperties `json:"properties,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for FrontendEndpoint. +func (fe FrontendEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fe.FrontendEndpointProperties != nil { + objectMap["properties"] = fe.FrontendEndpointProperties + } + if fe.Name != nil { + objectMap["name"] = fe.Name + } + if fe.ID != nil { + objectMap["id"] = fe.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FrontendEndpoint struct. +func (fe *FrontendEndpoint) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var frontendEndpointProperties FrontendEndpointProperties + err = json.Unmarshal(*v, &frontendEndpointProperties) + if err != nil { + return err + } + fe.FrontendEndpointProperties = &frontendEndpointProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fe.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fe.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fe.ID = &ID + } + } + } + + return nil +} + +// FrontendEndpointLink defines the Resource ID for a Frontend Endpoint. +type FrontendEndpointLink struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// FrontendEndpointProperties the JSON object that contains the properties required to create a frontend +// endpoint. +type FrontendEndpointProperties struct { + // ResourceState - Resource status. Possible values include: 'ResourceStateCreating', 'ResourceStateEnabling', 'ResourceStateEnabled', 'ResourceStateDisabling', 'ResourceStateDisabled', 'ResourceStateDeleting' + ResourceState ResourceState `json:"resourceState,omitempty"` + // CustomHTTPSProvisioningState - READ-ONLY; Provisioning status of Custom Https of the frontendEndpoint. Possible values include: 'CustomHTTPSProvisioningStateEnabling', 'CustomHTTPSProvisioningStateEnabled', 'CustomHTTPSProvisioningStateDisabling', 'CustomHTTPSProvisioningStateDisabled', 'CustomHTTPSProvisioningStateFailed' + CustomHTTPSProvisioningState CustomHTTPSProvisioningState `json:"customHttpsProvisioningState,omitempty"` + // CustomHTTPSProvisioningSubstate - READ-ONLY; Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step. Possible values include: 'CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest', 'CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval', 'CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved', 'CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected', 'CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut', 'CustomHTTPSProvisioningSubstateIssuingCertificate', 'CustomHTTPSProvisioningSubstateDeployingCertificate', 'CustomHTTPSProvisioningSubstateCertificateDeployed', 'CustomHTTPSProvisioningSubstateDeletingCertificate', 'CustomHTTPSProvisioningSubstateCertificateDeleted' + CustomHTTPSProvisioningSubstate CustomHTTPSProvisioningSubstate `json:"customHttpsProvisioningSubstate,omitempty"` + // CustomHTTPSConfiguration - READ-ONLY; The configuration specifying how to enable HTTPS + CustomHTTPSConfiguration *CustomHTTPSConfiguration `json:"customHttpsConfiguration,omitempty"` + // HostName - The host name of the frontendEndpoint. Must be a domain name. + HostName *string `json:"hostName,omitempty"` + // SessionAffinityEnabledState - Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible values include: 'SessionAffinityEnabledStateEnabled', 'SessionAffinityEnabledStateDisabled' + SessionAffinityEnabledState SessionAffinityEnabledState `json:"sessionAffinityEnabledState,omitempty"` + // SessionAffinityTTLSeconds - UNUSED. This field will be ignored. The TTL to use in seconds for session affinity, if applicable. + SessionAffinityTTLSeconds *int32 `json:"sessionAffinityTtlSeconds,omitempty"` + // WebApplicationFirewallPolicyLink - Defines the Web Application Firewall policy for each host (if applicable) + WebApplicationFirewallPolicyLink *FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for FrontendEndpointProperties. +func (fep FrontendEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fep.ResourceState != "" { + objectMap["resourceState"] = fep.ResourceState + } + if fep.HostName != nil { + objectMap["hostName"] = fep.HostName + } + if fep.SessionAffinityEnabledState != "" { + objectMap["sessionAffinityEnabledState"] = fep.SessionAffinityEnabledState + } + if fep.SessionAffinityTTLSeconds != nil { + objectMap["sessionAffinityTtlSeconds"] = fep.SessionAffinityTTLSeconds + } + if fep.WebApplicationFirewallPolicyLink != nil { + objectMap["webApplicationFirewallPolicyLink"] = fep.WebApplicationFirewallPolicyLink + } + return json.Marshal(objectMap) +} + +// FrontendEndpointsDisableHTTPSFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FrontendEndpointsDisableHTTPSFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FrontendEndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FrontendEndpointsDisableHTTPSFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FrontendEndpointsDisableHTTPSFuture.Result. +func (future *FrontendEndpointsDisableHTTPSFuture) result(client FrontendEndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsDisableHTTPSFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("frontdoor.FrontendEndpointsDisableHTTPSFuture") + return + } + ar.Response = future.Response() + return +} + +// FrontendEndpointsEnableHTTPSFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FrontendEndpointsEnableHTTPSFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FrontendEndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FrontendEndpointsEnableHTTPSFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FrontendEndpointsEnableHTTPSFuture.Result. +func (future *FrontendEndpointsEnableHTTPSFuture) result(client FrontendEndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.FrontendEndpointsEnableHTTPSFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("frontdoor.FrontendEndpointsEnableHTTPSFuture") + return + } + ar.Response = future.Response() + return +} + +// FrontendEndpointsListResult result of the request to list frontend endpoints. It contains a list of +// Frontend endpoint objects and a URL link to get the next set of results. +type FrontendEndpointsListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Frontend endpoints within a Front Door. + Value *[]FrontendEndpoint `json:"value,omitempty"` + // NextLink - URL to get the next set of frontend endpoints if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for FrontendEndpointsListResult. +func (felr FrontendEndpointsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if felr.NextLink != nil { + objectMap["nextLink"] = felr.NextLink + } + return json.Marshal(objectMap) +} + +// FrontendEndpointsListResultIterator provides access to a complete listing of FrontendEndpoint values. +type FrontendEndpointsListResultIterator struct { + i int + page FrontendEndpointsListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *FrontendEndpointsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FrontendEndpointsListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *FrontendEndpointsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FrontendEndpointsListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter FrontendEndpointsListResultIterator) Response() FrontendEndpointsListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter FrontendEndpointsListResultIterator) Value() FrontendEndpoint { + if !iter.page.NotDone() { + return FrontendEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FrontendEndpointsListResultIterator type. +func NewFrontendEndpointsListResultIterator(page FrontendEndpointsListResultPage) FrontendEndpointsListResultIterator { + return FrontendEndpointsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (felr FrontendEndpointsListResult) IsEmpty() bool { + return felr.Value == nil || len(*felr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (felr FrontendEndpointsListResult) hasNextLink() bool { + return felr.NextLink != nil && len(*felr.NextLink) != 0 +} + +// frontendEndpointsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (felr FrontendEndpointsListResult) frontendEndpointsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !felr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(felr.NextLink))) +} + +// FrontendEndpointsListResultPage contains a page of FrontendEndpoint values. +type FrontendEndpointsListResultPage struct { + fn func(context.Context, FrontendEndpointsListResult) (FrontendEndpointsListResult, error) + felr FrontendEndpointsListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *FrontendEndpointsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FrontendEndpointsListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.felr) + if err != nil { + return err + } + page.felr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *FrontendEndpointsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FrontendEndpointsListResultPage) NotDone() bool { + return !page.felr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FrontendEndpointsListResultPage) Response() FrontendEndpointsListResult { + return page.felr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FrontendEndpointsListResultPage) Values() []FrontendEndpoint { + if page.felr.IsEmpty() { + return nil + } + return *page.felr.Value +} + +// Creates a new instance of the FrontendEndpointsListResultPage type. +func NewFrontendEndpointsListResultPage(cur FrontendEndpointsListResult, getNextPage func(context.Context, FrontendEndpointsListResult) (FrontendEndpointsListResult, error)) FrontendEndpointsListResultPage { + return FrontendEndpointsListResultPage{ + fn: getNextPage, + felr: cur, + } +} + +// FrontendEndpointUpdateParameters frontend endpoint used in routing rule +type FrontendEndpointUpdateParameters struct { + // HostName - The host name of the frontendEndpoint. Must be a domain name. + HostName *string `json:"hostName,omitempty"` + // SessionAffinityEnabledState - Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible values include: 'SessionAffinityEnabledStateEnabled', 'SessionAffinityEnabledStateDisabled' + SessionAffinityEnabledState SessionAffinityEnabledState `json:"sessionAffinityEnabledState,omitempty"` + // SessionAffinityTTLSeconds - UNUSED. This field will be ignored. The TTL to use in seconds for session affinity, if applicable. + SessionAffinityTTLSeconds *int32 `json:"sessionAffinityTtlSeconds,omitempty"` + // WebApplicationFirewallPolicyLink - Defines the Web Application Firewall policy for each host (if applicable) + WebApplicationFirewallPolicyLink *FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` +} + +// FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink defines the Web Application Firewall +// policy for each host (if applicable) +type FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// HeaderAction an action that can manipulate an http header. +type HeaderAction struct { + // HeaderActionType - Which type of manipulation to apply to the header. Possible values include: 'HeaderActionTypeAppend', 'HeaderActionTypeDelete', 'HeaderActionTypeOverwrite' + HeaderActionType HeaderActionType `json:"headerActionType,omitempty"` + // HeaderName - The name of the header this action will apply to. + HeaderName *string `json:"headerName,omitempty"` + // Value - The value to update the given header name with. This value is not used if the actionType is Delete. + Value *string `json:"value,omitempty"` +} + +// HealthProbeSettingsListResult result of the request to list HealthProbeSettings. It contains a list of +// HealthProbeSettings objects and a URL link to get the next set of results. +type HealthProbeSettingsListResult struct { + // Value - READ-ONLY; List of HealthProbeSettings within a Front Door. + Value *[]HealthProbeSettingsModel `json:"value,omitempty"` + // NextLink - URL to get the next set of HealthProbeSettings objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for HealthProbeSettingsListResult. +func (hpslr HealthProbeSettingsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hpslr.NextLink != nil { + objectMap["nextLink"] = hpslr.NextLink + } + return json.Marshal(objectMap) +} + +// HealthProbeSettingsModel load balancing settings for a backend pool +type HealthProbeSettingsModel struct { + // HealthProbeSettingsProperties - Properties of the health probe settings + *HealthProbeSettingsProperties `json:"properties,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for HealthProbeSettingsModel. +func (hpsm HealthProbeSettingsModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hpsm.HealthProbeSettingsProperties != nil { + objectMap["properties"] = hpsm.HealthProbeSettingsProperties + } + if hpsm.Name != nil { + objectMap["name"] = hpsm.Name + } + if hpsm.ID != nil { + objectMap["id"] = hpsm.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for HealthProbeSettingsModel struct. +func (hpsm *HealthProbeSettingsModel) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var healthProbeSettingsProperties HealthProbeSettingsProperties + err = json.Unmarshal(*v, &healthProbeSettingsProperties) + if err != nil { + return err + } + hpsm.HealthProbeSettingsProperties = &healthProbeSettingsProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + hpsm.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + hpsm.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + hpsm.ID = &ID + } + } + } + + return nil +} + +// HealthProbeSettingsProperties the JSON object that contains the properties required to create a health +// probe settings. +type HealthProbeSettingsProperties struct { + // ResourceState - Resource status. Possible values include: 'ResourceStateCreating', 'ResourceStateEnabling', 'ResourceStateEnabled', 'ResourceStateDisabling', 'ResourceStateDisabled', 'ResourceStateDeleting' + ResourceState ResourceState `json:"resourceState,omitempty"` + // Path - The path to use for the health probe. Default is / + Path *string `json:"path,omitempty"` + // Protocol - Protocol scheme to use for this probe. Possible values include: 'ProtocolHTTP', 'ProtocolHTTPS' + Protocol Protocol `json:"protocol,omitempty"` + // IntervalInSeconds - The number of seconds between health probes. + IntervalInSeconds *int32 `json:"intervalInSeconds,omitempty"` + // HealthProbeMethod - Configures which HTTP method to use to probe the backends defined under backendPools. Possible values include: 'HealthProbeMethodGET', 'HealthProbeMethodHEAD' + HealthProbeMethod HealthProbeMethod `json:"healthProbeMethod,omitempty"` + // EnabledState - Whether to enable health probes to be made against backends defined under backendPools. Health probes can only be disabled if there is a single enabled backend in single enabled backend pool. Possible values include: 'HealthProbeEnabledEnabled', 'HealthProbeEnabledDisabled' + EnabledState HealthProbeEnabled `json:"enabledState,omitempty"` +} + +// HealthProbeSettingsUpdateParameters l7 health probe settings for a backend pool +type HealthProbeSettingsUpdateParameters struct { + // Path - The path to use for the health probe. Default is / + Path *string `json:"path,omitempty"` + // Protocol - Protocol scheme to use for this probe. Possible values include: 'ProtocolHTTP', 'ProtocolHTTPS' + Protocol Protocol `json:"protocol,omitempty"` + // IntervalInSeconds - The number of seconds between health probes. + IntervalInSeconds *int32 `json:"intervalInSeconds,omitempty"` + // HealthProbeMethod - Configures which HTTP method to use to probe the backends defined under backendPools. Possible values include: 'HealthProbeMethodGET', 'HealthProbeMethodHEAD' + HealthProbeMethod HealthProbeMethod `json:"healthProbeMethod,omitempty"` + // EnabledState - Whether to enable health probes to be made against backends defined under backendPools. Health probes can only be disabled if there is a single enabled backend in single enabled backend pool. Possible values include: 'HealthProbeEnabledEnabled', 'HealthProbeEnabledDisabled' + EnabledState HealthProbeEnabled `json:"enabledState,omitempty"` +} + +// KeyVaultCertificateSourceParameters parameters required for bring-your-own-certification via Key Vault +type KeyVaultCertificateSourceParameters struct { + // Vault - The Key Vault containing the SSL certificate + Vault *KeyVaultCertificateSourceParametersVault `json:"vault,omitempty"` + // SecretName - The name of the Key Vault secret representing the full certificate PFX + SecretName *string `json:"secretName,omitempty"` + // SecretVersion - The version of the Key Vault secret representing the full certificate PFX + SecretVersion *string `json:"secretVersion,omitempty"` +} + +// KeyVaultCertificateSourceParametersVault the Key Vault containing the SSL certificate +type KeyVaultCertificateSourceParametersVault struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// LatencyMetric defines the properties of a latency metric used in the latency scorecard +type LatencyMetric struct { + // Name - READ-ONLY; The name of the Latency Metric + Name *string `json:"name,omitempty"` + // EndDateTimeUTC - READ-ONLY; The end time of the Latency Scorecard in UTC + EndDateTimeUTC *string `json:"endDateTimeUTC,omitempty"` + // AValue - READ-ONLY; The metric value of the A endpoint + AValue *float64 `json:"aValue,omitempty"` + // BValue - READ-ONLY; The metric value of the B endpoint + BValue *float64 `json:"bValue,omitempty"` + // Delta - READ-ONLY; The difference in value between endpoint A and B + Delta *float64 `json:"delta,omitempty"` + // DeltaPercent - READ-ONLY; The percent difference between endpoint A and B + DeltaPercent *float64 `json:"deltaPercent,omitempty"` + // ACLower95CI - READ-ONLY; The lower end of the 95% confidence interval for endpoint A + ACLower95CI *float64 `json:"aCLower95CI,omitempty"` + // AHUpper95CI - READ-ONLY; The upper end of the 95% confidence interval for endpoint A + AHUpper95CI *float64 `json:"aHUpper95CI,omitempty"` + // BCLower95CI - READ-ONLY; The lower end of the 95% confidence interval for endpoint B + BCLower95CI *float64 `json:"bCLower95CI,omitempty"` + // BUpper95CI - READ-ONLY; The upper end of the 95% confidence interval for endpoint B + BUpper95CI *float64 `json:"bUpper95CI,omitempty"` +} + +// MarshalJSON is the custom marshaler for LatencyMetric. +func (lm LatencyMetric) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// LatencyScorecard defines the LatencyScorecard +type LatencyScorecard struct { + autorest.Response `json:"-"` + // LatencyScorecardProperties - The properties of a latency scorecard + *LatencyScorecardProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LatencyScorecard. +func (ls LatencyScorecard) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ls.LatencyScorecardProperties != nil { + objectMap["properties"] = ls.LatencyScorecardProperties + } + if ls.Location != nil { + objectMap["location"] = ls.Location + } + if ls.Tags != nil { + objectMap["tags"] = ls.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LatencyScorecard struct. +func (ls *LatencyScorecard) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var latencyScorecardProperties LatencyScorecardProperties + err = json.Unmarshal(*v, &latencyScorecardProperties) + if err != nil { + return err + } + ls.LatencyScorecardProperties = &latencyScorecardProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ls.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ls.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ls.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ls.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ls.Tags = tags + } + } + } + + return nil +} + +// LatencyScorecardProperties defines a the properties of a Latency Scorecard +type LatencyScorecardProperties struct { + // ID - READ-ONLY; The unique identifier of the Latency Scorecard + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the Latency Scorecard + Name *string `json:"name,omitempty"` + // Description - READ-ONLY; The description of the Latency Scorecard + Description *string `json:"description,omitempty"` + // EndpointA - READ-ONLY; The A endpoint in the scorecard + EndpointA *string `json:"endpointA,omitempty"` + // EndpointB - READ-ONLY; The B endpoint in the scorecard + EndpointB *string `json:"endpointB,omitempty"` + // StartDateTimeUTC - READ-ONLY; The start time of the Latency Scorecard in UTC + StartDateTimeUTC *date.Time `json:"startDateTimeUTC,omitempty"` + // EndDateTimeUTC - READ-ONLY; The end time of the Latency Scorecard in UTC + EndDateTimeUTC *date.Time `json:"endDateTimeUTC,omitempty"` + // Country - READ-ONLY; The country associated with the Latency Scorecard. Values are country ISO codes as specified here- https://www.iso.org/iso-3166-country-codes.html + Country *string `json:"country,omitempty"` + // LatencyMetrics - The latency metrics of the Latency Scorecard + LatencyMetrics *[]LatencyMetric `json:"latencyMetrics,omitempty"` +} + +// MarshalJSON is the custom marshaler for LatencyScorecardProperties. +func (lsp LatencyScorecardProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lsp.LatencyMetrics != nil { + objectMap["latencyMetrics"] = lsp.LatencyMetrics + } + return json.Marshal(objectMap) +} + +// ListResult result of the request to list Front Doors. It contains a list of Front Door objects and a URL +// link to get the next set of results. +type ListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Front Doors within a resource group. + Value *[]FrontDoor `json:"value,omitempty"` + // NextLink - URL to get the next set of Front Door objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListResult. +func (lr ListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lr.NextLink != nil { + objectMap["nextLink"] = lr.NextLink + } + return json.Marshal(objectMap) +} + +// ListResultIterator provides access to a complete listing of FrontDoor values. +type ListResultIterator struct { + i int + page ListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListResultIterator) Response() ListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListResultIterator) Value() FrontDoor { + if !iter.page.NotDone() { + return FrontDoor{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListResultIterator type. +func NewListResultIterator(page ListResultPage) ListResultIterator { + return ListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lr ListResult) IsEmpty() bool { + return lr.Value == nil || len(*lr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lr ListResult) hasNextLink() bool { + return lr.NextLink != nil && len(*lr.NextLink) != 0 +} + +// listResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { + if !lr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lr.NextLink))) +} + +// ListResultPage contains a page of FrontDoor values. +type ListResultPage struct { + fn func(context.Context, ListResult) (ListResult, error) + lr ListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lr) + if err != nil { + return err + } + page.lr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListResultPage) NotDone() bool { + return !page.lr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListResultPage) Response() ListResult { + return page.lr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListResultPage) Values() []FrontDoor { + if page.lr.IsEmpty() { + return nil + } + return *page.lr.Value +} + +// Creates a new instance of the ListResultPage type. +func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { + return ListResultPage{ + fn: getNextPage, + lr: cur, + } +} + +// LoadBalancingSettingsListResult result of the request to list load balancing settings. It contains a +// list of load balancing settings objects and a URL link to get the next set of results. +type LoadBalancingSettingsListResult struct { + // Value - READ-ONLY; List of Backend Pools within a Front Door. + Value *[]LoadBalancingSettingsModel `json:"value,omitempty"` + // NextLink - URL to get the next set of LoadBalancingSettings objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancingSettingsListResult. +func (lbslr LoadBalancingSettingsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbslr.NextLink != nil { + objectMap["nextLink"] = lbslr.NextLink + } + return json.Marshal(objectMap) +} + +// LoadBalancingSettingsModel load balancing settings for a backend pool +type LoadBalancingSettingsModel struct { + // LoadBalancingSettingsProperties - Properties of the load balancing settings + *LoadBalancingSettingsProperties `json:"properties,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancingSettingsModel. +func (lbsm LoadBalancingSettingsModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbsm.LoadBalancingSettingsProperties != nil { + objectMap["properties"] = lbsm.LoadBalancingSettingsProperties + } + if lbsm.Name != nil { + objectMap["name"] = lbsm.Name + } + if lbsm.ID != nil { + objectMap["id"] = lbsm.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LoadBalancingSettingsModel struct. +func (lbsm *LoadBalancingSettingsModel) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var loadBalancingSettingsProperties LoadBalancingSettingsProperties + err = json.Unmarshal(*v, &loadBalancingSettingsProperties) + if err != nil { + return err + } + lbsm.LoadBalancingSettingsProperties = &loadBalancingSettingsProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lbsm.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lbsm.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lbsm.ID = &ID + } + } + } + + return nil +} + +// LoadBalancingSettingsProperties the JSON object that contains the properties required to create load +// balancing settings +type LoadBalancingSettingsProperties struct { + // ResourceState - Resource status. Possible values include: 'ResourceStateCreating', 'ResourceStateEnabling', 'ResourceStateEnabled', 'ResourceStateDisabling', 'ResourceStateDisabled', 'ResourceStateDeleting' + ResourceState ResourceState `json:"resourceState,omitempty"` + // SampleSize - The number of samples to consider for load balancing decisions + SampleSize *int32 `json:"sampleSize,omitempty"` + // SuccessfulSamplesRequired - The number of samples within the sample period that must succeed + SuccessfulSamplesRequired *int32 `json:"successfulSamplesRequired,omitempty"` + // AdditionalLatencyMilliseconds - The additional latency in milliseconds for probes to fall into the lowest latency bucket + AdditionalLatencyMilliseconds *int32 `json:"additionalLatencyMilliseconds,omitempty"` +} + +// LoadBalancingSettingsUpdateParameters round-Robin load balancing settings for a backend pool +type LoadBalancingSettingsUpdateParameters struct { + // SampleSize - The number of samples to consider for load balancing decisions + SampleSize *int32 `json:"sampleSize,omitempty"` + // SuccessfulSamplesRequired - The number of samples within the sample period that must succeed + SuccessfulSamplesRequired *int32 `json:"successfulSamplesRequired,omitempty"` + // AdditionalLatencyMilliseconds - The additional latency in milliseconds for probes to fall into the lowest latency bucket + AdditionalLatencyMilliseconds *int32 `json:"additionalLatencyMilliseconds,omitempty"` +} + +// ManagedRuleDefinition describes a managed rule definition. +type ManagedRuleDefinition struct { + // RuleID - READ-ONLY; Identifier for the managed rule. + RuleID *string `json:"ruleId,omitempty"` + // DefaultState - READ-ONLY; Describes the default state for the managed rule. Possible values include: 'ManagedRuleEnabledStateDisabled', 'ManagedRuleEnabledStateEnabled' + DefaultState ManagedRuleEnabledState `json:"defaultState,omitempty"` + // DefaultAction - READ-ONLY; Describes the default action to be applied when the managed rule matches. Possible values include: 'ActionTypeAllow', 'ActionTypeBlock', 'ActionTypeLog', 'ActionTypeRedirect' + DefaultAction ActionType `json:"defaultAction,omitempty"` + // Description - READ-ONLY; Describes the functionality of the managed rule. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedRuleDefinition. +func (mrd ManagedRuleDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedRuleExclusion exclude variables from managed rule evaluation. +type ManagedRuleExclusion struct { + // MatchVariable - The variable type to be excluded. Possible values include: 'ManagedRuleExclusionMatchVariableRequestHeaderNames', 'ManagedRuleExclusionMatchVariableRequestCookieNames', 'ManagedRuleExclusionMatchVariableQueryStringArgNames', 'ManagedRuleExclusionMatchVariableRequestBodyPostArgNames', 'ManagedRuleExclusionMatchVariableRequestBodyJSONArgNames' + MatchVariable ManagedRuleExclusionMatchVariable `json:"matchVariable,omitempty"` + // SelectorMatchOperator - Comparison operator to apply to the selector when specifying which elements in the collection this exclusion applies to. Possible values include: 'ManagedRuleExclusionSelectorMatchOperatorEquals', 'ManagedRuleExclusionSelectorMatchOperatorContains', 'ManagedRuleExclusionSelectorMatchOperatorStartsWith', 'ManagedRuleExclusionSelectorMatchOperatorEndsWith', 'ManagedRuleExclusionSelectorMatchOperatorEqualsAny' + SelectorMatchOperator ManagedRuleExclusionSelectorMatchOperator `json:"selectorMatchOperator,omitempty"` + // Selector - Selector value for which elements in the collection this exclusion applies to. + Selector *string `json:"selector,omitempty"` +} + +// ManagedRuleGroupDefinition describes a managed rule group. +type ManagedRuleGroupDefinition struct { + // RuleGroupName - READ-ONLY; Name of the managed rule group. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + // Description - READ-ONLY; Description of the managed rule group. + Description *string `json:"description,omitempty"` + // Rules - READ-ONLY; List of rules within the managed rule group. + Rules *[]ManagedRuleDefinition `json:"rules,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedRuleGroupDefinition. +func (mrgd ManagedRuleGroupDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedRuleGroupOverride defines a managed rule group override setting. +type ManagedRuleGroupOverride struct { + // RuleGroupName - Describes the managed rule group to override. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + // Exclusions - Describes the exclusions that are applied to all rules in the group. + Exclusions *[]ManagedRuleExclusion `json:"exclusions,omitempty"` + // Rules - List of rules that will be disabled. If none specified, all rules in the group will be disabled. + Rules *[]ManagedRuleOverride `json:"rules,omitempty"` +} + +// ManagedRuleOverride defines a managed rule group override setting. +type ManagedRuleOverride struct { + // RuleID - Identifier for the managed rule. + RuleID *string `json:"ruleId,omitempty"` + // EnabledState - Describes if the managed rule is in enabled or disabled state. Defaults to Disabled if not specified. Possible values include: 'ManagedRuleEnabledStateDisabled', 'ManagedRuleEnabledStateEnabled' + EnabledState ManagedRuleEnabledState `json:"enabledState,omitempty"` + // Action - Describes the override action to be applied when rule matches. Possible values include: 'ActionTypeAllow', 'ActionTypeBlock', 'ActionTypeLog', 'ActionTypeRedirect' + Action ActionType `json:"action,omitempty"` + // Exclusions - Describes the exclusions that are applied to this specific rule. + Exclusions *[]ManagedRuleExclusion `json:"exclusions,omitempty"` +} + +// ManagedRuleSet defines a managed rule set. +type ManagedRuleSet struct { + // RuleSetType - Defines the rule set type to use. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - Defines the version of the rule set to use. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + // RuleSetAction - Possible values include: 'ManagedRuleSetActionTypeBlock', 'ManagedRuleSetActionTypeLog', 'ManagedRuleSetActionTypeRedirect' + RuleSetAction ManagedRuleSetActionType `json:"ruleSetAction,omitempty"` + // Exclusions - Describes the exclusions that are applied to all rules in the set. + Exclusions *[]ManagedRuleExclusion `json:"exclusions,omitempty"` + // RuleGroupOverrides - Defines the rule group overrides to apply to the rule set. + RuleGroupOverrides *[]ManagedRuleGroupOverride `json:"ruleGroupOverrides,omitempty"` +} + +// ManagedRuleSetDefinition describes the a managed rule set definition. +type ManagedRuleSetDefinition struct { + // ManagedRuleSetDefinitionProperties - Properties for a managed rule set definition. + *ManagedRuleSetDefinitionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ManagedRuleSetDefinition. +func (mrsd ManagedRuleSetDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mrsd.ManagedRuleSetDefinitionProperties != nil { + objectMap["properties"] = mrsd.ManagedRuleSetDefinitionProperties + } + if mrsd.Location != nil { + objectMap["location"] = mrsd.Location + } + if mrsd.Tags != nil { + objectMap["tags"] = mrsd.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedRuleSetDefinition struct. +func (mrsd *ManagedRuleSetDefinition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managedRuleSetDefinitionProperties ManagedRuleSetDefinitionProperties + err = json.Unmarshal(*v, &managedRuleSetDefinitionProperties) + if err != nil { + return err + } + mrsd.ManagedRuleSetDefinitionProperties = &managedRuleSetDefinitionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mrsd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mrsd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mrsd.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mrsd.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mrsd.Tags = tags + } + } + } + + return nil +} + +// ManagedRuleSetDefinitionList list of managed rule set definitions available for use in a policy. +type ManagedRuleSetDefinitionList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of managed rule set definitions. + Value *[]ManagedRuleSetDefinition `json:"value,omitempty"` + // NextLink - URL to retrieve next set of managed rule set definitions. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedRuleSetDefinitionList. +func (mrsdl ManagedRuleSetDefinitionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mrsdl.NextLink != nil { + objectMap["nextLink"] = mrsdl.NextLink + } + return json.Marshal(objectMap) +} + +// ManagedRuleSetDefinitionListIterator provides access to a complete listing of ManagedRuleSetDefinition +// values. +type ManagedRuleSetDefinitionListIterator struct { + i int + page ManagedRuleSetDefinitionListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedRuleSetDefinitionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetDefinitionListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedRuleSetDefinitionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedRuleSetDefinitionListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedRuleSetDefinitionListIterator) Response() ManagedRuleSetDefinitionList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedRuleSetDefinitionListIterator) Value() ManagedRuleSetDefinition { + if !iter.page.NotDone() { + return ManagedRuleSetDefinition{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedRuleSetDefinitionListIterator type. +func NewManagedRuleSetDefinitionListIterator(page ManagedRuleSetDefinitionListPage) ManagedRuleSetDefinitionListIterator { + return ManagedRuleSetDefinitionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mrsdl ManagedRuleSetDefinitionList) IsEmpty() bool { + return mrsdl.Value == nil || len(*mrsdl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mrsdl ManagedRuleSetDefinitionList) hasNextLink() bool { + return mrsdl.NextLink != nil && len(*mrsdl.NextLink) != 0 +} + +// managedRuleSetDefinitionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mrsdl ManagedRuleSetDefinitionList) managedRuleSetDefinitionListPreparer(ctx context.Context) (*http.Request, error) { + if !mrsdl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mrsdl.NextLink))) +} + +// ManagedRuleSetDefinitionListPage contains a page of ManagedRuleSetDefinition values. +type ManagedRuleSetDefinitionListPage struct { + fn func(context.Context, ManagedRuleSetDefinitionList) (ManagedRuleSetDefinitionList, error) + mrsdl ManagedRuleSetDefinitionList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedRuleSetDefinitionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRuleSetDefinitionListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mrsdl) + if err != nil { + return err + } + page.mrsdl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedRuleSetDefinitionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedRuleSetDefinitionListPage) NotDone() bool { + return !page.mrsdl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedRuleSetDefinitionListPage) Response() ManagedRuleSetDefinitionList { + return page.mrsdl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedRuleSetDefinitionListPage) Values() []ManagedRuleSetDefinition { + if page.mrsdl.IsEmpty() { + return nil + } + return *page.mrsdl.Value +} + +// Creates a new instance of the ManagedRuleSetDefinitionListPage type. +func NewManagedRuleSetDefinitionListPage(cur ManagedRuleSetDefinitionList, getNextPage func(context.Context, ManagedRuleSetDefinitionList) (ManagedRuleSetDefinitionList, error)) ManagedRuleSetDefinitionListPage { + return ManagedRuleSetDefinitionListPage{ + fn: getNextPage, + mrsdl: cur, + } +} + +// ManagedRuleSetDefinitionProperties properties for a managed rule set definition. +type ManagedRuleSetDefinitionProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the managed rule set. + ProvisioningState *string `json:"provisioningState,omitempty"` + // RuleSetID - READ-ONLY; Id of the managed rule set. + RuleSetID *string `json:"ruleSetId,omitempty"` + // RuleSetType - READ-ONLY; Type of the managed rule set. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - READ-ONLY; Version of the managed rule set type. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + // RuleGroups - READ-ONLY; Rule groups of the managed rule set. + RuleGroups *[]ManagedRuleGroupDefinition `json:"ruleGroups,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedRuleSetDefinitionProperties. +func (mrsdp ManagedRuleSetDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedRuleSetList defines the list of managed rule sets for the policy. +type ManagedRuleSetList struct { + // ManagedRuleSets - List of rule sets. + ManagedRuleSets *[]ManagedRuleSet `json:"managedRuleSets,omitempty"` +} + +// MatchCondition define a match condition. +type MatchCondition struct { + // MatchVariable - Request variable to compare with. Possible values include: 'MatchVariableRemoteAddr', 'MatchVariableRequestMethod', 'MatchVariableQueryString', 'MatchVariablePostArgs', 'MatchVariableRequestURI', 'MatchVariableRequestHeader', 'MatchVariableRequestBody', 'MatchVariableCookies', 'MatchVariableSocketAddr' + MatchVariable MatchVariable `json:"matchVariable,omitempty"` + // Selector - Match against a specific key from the QueryString, PostArgs, RequestHeader or Cookies variables. Default is null. + Selector *string `json:"selector,omitempty"` + // Operator - Comparison type to use for matching with the variable value. Possible values include: 'OperatorAny', 'OperatorIPMatch', 'OperatorGeoMatch', 'OperatorEqual', 'OperatorContains', 'OperatorLessThan', 'OperatorGreaterThan', 'OperatorLessThanOrEqual', 'OperatorGreaterThanOrEqual', 'OperatorBeginsWith', 'OperatorEndsWith', 'OperatorRegEx' + Operator Operator `json:"operator,omitempty"` + // NegateCondition - Describes if the result of this condition should be negated. + NegateCondition *bool `json:"negateCondition,omitempty"` + // MatchValue - List of possible match values. + MatchValue *[]string `json:"matchValue,omitempty"` + // Transforms - List of transforms. + Transforms *[]TransformType `json:"transforms,omitempty"` +} + +// NetworkExperimentProfilesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type NetworkExperimentProfilesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(NetworkExperimentProfilesClient) (Profile, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *NetworkExperimentProfilesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for NetworkExperimentProfilesCreateOrUpdateFuture.Result. +func (future *NetworkExperimentProfilesCreateOrUpdateFuture) result(client NetworkExperimentProfilesClient) (p Profile, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + p.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("frontdoor.NetworkExperimentProfilesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent { + p, err = client.CreateOrUpdateResponder(p.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesCreateOrUpdateFuture", "Result", p.Response.Response, "Failure responding to request") + } + } + return +} + +// NetworkExperimentProfilesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type NetworkExperimentProfilesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(NetworkExperimentProfilesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *NetworkExperimentProfilesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for NetworkExperimentProfilesDeleteFuture.Result. +func (future *NetworkExperimentProfilesDeleteFuture) result(client NetworkExperimentProfilesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("frontdoor.NetworkExperimentProfilesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// NetworkExperimentProfilesUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type NetworkExperimentProfilesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(NetworkExperimentProfilesClient) (Profile, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *NetworkExperimentProfilesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for NetworkExperimentProfilesUpdateFuture.Result. +func (future *NetworkExperimentProfilesUpdateFuture) result(client NetworkExperimentProfilesClient) (p Profile, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + p.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("frontdoor.NetworkExperimentProfilesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent { + p, err = client.UpdateResponder(p.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesUpdateFuture", "Result", p.Response.Response, "Failure responding to request") + } + } + return +} + +// PoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PoliciesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PoliciesClient) (WebApplicationFirewallPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PoliciesCreateOrUpdateFuture.Result. +func (future *PoliciesCreateOrUpdateFuture) result(client PoliciesClient) (wafp WebApplicationFirewallPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.PoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + wafp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("frontdoor.PoliciesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if wafp.Response.Response, err = future.GetResult(sender); err == nil && wafp.Response.Response.StatusCode != http.StatusNoContent { + wafp, err = client.CreateOrUpdateResponder(wafp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.PoliciesCreateOrUpdateFuture", "Result", wafp.Response.Response, "Failure responding to request") + } + } + return +} + +// PoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PoliciesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PoliciesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PoliciesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PoliciesDeleteFuture.Result. +func (future *PoliciesDeleteFuture) result(client PoliciesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.PoliciesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("frontdoor.PoliciesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PolicySettings defines top-level WebApplicationFirewallPolicy configuration settings. +type PolicySettings struct { + // EnabledState - Describes if the policy is in enabled or disabled state. Defaults to Enabled if not specified. Possible values include: 'PolicyEnabledStateDisabled', 'PolicyEnabledStateEnabled' + EnabledState PolicyEnabledState `json:"enabledState,omitempty"` + // Mode - Describes if it is in detection mode or prevention mode at policy level. Possible values include: 'PolicyModePrevention', 'PolicyModeDetection' + Mode PolicyMode `json:"mode,omitempty"` + // RedirectURL - If action type is redirect, this field represents redirect URL for the client. + RedirectURL *string `json:"redirectUrl,omitempty"` + // CustomBlockResponseStatusCode - If the action type is block, customer can override the response status code. + CustomBlockResponseStatusCode *int32 `json:"customBlockResponseStatusCode,omitempty"` + // CustomBlockResponseBody - If the action type is block, customer can override the response body. The body must be specified in base64 encoding. + CustomBlockResponseBody *string `json:"customBlockResponseBody,omitempty"` + // RequestBodyCheck - Describes if policy managed rules will inspect the request body content. Possible values include: 'PolicyRequestBodyCheckDisabled', 'PolicyRequestBodyCheckEnabled' + RequestBodyCheck PolicyRequestBodyCheck `json:"requestBodyCheck,omitempty"` +} + +// PreconfiguredEndpoint defines the properties of a preconfigured endpoint +type PreconfiguredEndpoint struct { + // PreconfiguredEndpointProperties - The properties of a preconfiguredEndpoint + *PreconfiguredEndpointProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PreconfiguredEndpoint. +func (peVar PreconfiguredEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.PreconfiguredEndpointProperties != nil { + objectMap["properties"] = peVar.PreconfiguredEndpointProperties + } + if peVar.Location != nil { + objectMap["location"] = peVar.Location + } + if peVar.Tags != nil { + objectMap["tags"] = peVar.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PreconfiguredEndpoint struct. +func (peVar *PreconfiguredEndpoint) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var preconfiguredEndpointProperties PreconfiguredEndpointProperties + err = json.Unmarshal(*v, &preconfiguredEndpointProperties) + if err != nil { + return err + } + peVar.PreconfiguredEndpointProperties = &preconfiguredEndpointProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + peVar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + peVar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + peVar.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + peVar.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + peVar.Tags = tags + } + } + } + + return nil +} + +// PreconfiguredEndpointList defines a list of preconfigured endpoints. +type PreconfiguredEndpointList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of PreconfiguredEndpoints supported by NetworkExperiment. + Value *[]PreconfiguredEndpoint `json:"value,omitempty"` + // NextLink - URL to get the next set of PreconfiguredEndpoints if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PreconfiguredEndpointList. +func (pel PreconfiguredEndpointList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pel.NextLink != nil { + objectMap["nextLink"] = pel.NextLink + } + return json.Marshal(objectMap) +} + +// PreconfiguredEndpointListIterator provides access to a complete listing of PreconfiguredEndpoint values. +type PreconfiguredEndpointListIterator struct { + i int + page PreconfiguredEndpointListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PreconfiguredEndpointListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PreconfiguredEndpointListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PreconfiguredEndpointListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PreconfiguredEndpointListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PreconfiguredEndpointListIterator) Response() PreconfiguredEndpointList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PreconfiguredEndpointListIterator) Value() PreconfiguredEndpoint { + if !iter.page.NotDone() { + return PreconfiguredEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PreconfiguredEndpointListIterator type. +func NewPreconfiguredEndpointListIterator(page PreconfiguredEndpointListPage) PreconfiguredEndpointListIterator { + return PreconfiguredEndpointListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pel PreconfiguredEndpointList) IsEmpty() bool { + return pel.Value == nil || len(*pel.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pel PreconfiguredEndpointList) hasNextLink() bool { + return pel.NextLink != nil && len(*pel.NextLink) != 0 +} + +// preconfiguredEndpointListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pel PreconfiguredEndpointList) preconfiguredEndpointListPreparer(ctx context.Context) (*http.Request, error) { + if !pel.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pel.NextLink))) +} + +// PreconfiguredEndpointListPage contains a page of PreconfiguredEndpoint values. +type PreconfiguredEndpointListPage struct { + fn func(context.Context, PreconfiguredEndpointList) (PreconfiguredEndpointList, error) + pel PreconfiguredEndpointList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PreconfiguredEndpointListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PreconfiguredEndpointListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pel) + if err != nil { + return err + } + page.pel = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PreconfiguredEndpointListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PreconfiguredEndpointListPage) NotDone() bool { + return !page.pel.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PreconfiguredEndpointListPage) Response() PreconfiguredEndpointList { + return page.pel +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PreconfiguredEndpointListPage) Values() []PreconfiguredEndpoint { + if page.pel.IsEmpty() { + return nil + } + return *page.pel.Value +} + +// Creates a new instance of the PreconfiguredEndpointListPage type. +func NewPreconfiguredEndpointListPage(cur PreconfiguredEndpointList, getNextPage func(context.Context, PreconfiguredEndpointList) (PreconfiguredEndpointList, error)) PreconfiguredEndpointListPage { + return PreconfiguredEndpointListPage{ + fn: getNextPage, + pel: cur, + } +} + +// PreconfiguredEndpointProperties defines the properties of a preconfigured endpoint +type PreconfiguredEndpointProperties struct { + // Description - The description of the endpoint + Description *string `json:"description,omitempty"` + // Endpoint - The endpoint that is preconfigured + Endpoint *string `json:"endpoint,omitempty"` + // EndpointType - The type of endpoint. Possible values include: 'EndpointTypeAFD', 'EndpointTypeAzureRegion', 'EndpointTypeCDN', 'EndpointTypeATM' + EndpointType EndpointType `json:"endpointType,omitempty"` + // Backend - The preconfigured endpoint backend + Backend *string `json:"backend,omitempty"` +} + +// Profile defines an Network Experiment Profile and lists of Experiments +type Profile struct { + autorest.Response `json:"-"` + // ProfileProperties - The properties of a Profile + *ProfileProperties `json:"properties,omitempty"` + // Etag - Gets a unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Profile. +func (p Profile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.ProfileProperties != nil { + objectMap["properties"] = p.ProfileProperties + } + if p.Etag != nil { + objectMap["etag"] = p.Etag + } + if p.Location != nil { + objectMap["location"] = p.Location + } + if p.Tags != nil { + objectMap["tags"] = p.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Profile struct. +func (p *Profile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var profileProperties ProfileProperties + err = json.Unmarshal(*v, &profileProperties) + if err != nil { + return err + } + p.ProfileProperties = &profileProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + p.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + p.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + p.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + p.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + p.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + p.Tags = tags + } + } + } + + return nil +} + +// ProfileList defines a list of Profiles. It contains a list of Profile objects and a URL link to get the +// next set of results. +type ProfileList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Profiles within a resource group. + Value *[]Profile `json:"value,omitempty"` + // NextLink - URL to get the next set of Profile objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProfileList. +func (pl ProfileList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pl.NextLink != nil { + objectMap["nextLink"] = pl.NextLink + } + return json.Marshal(objectMap) +} + +// ProfileListIterator provides access to a complete listing of Profile values. +type ProfileListIterator struct { + i int + page ProfileListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ProfileListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ProfileListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ProfileListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ProfileListIterator) Response() ProfileList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ProfileListIterator) Value() Profile { + if !iter.page.NotDone() { + return Profile{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ProfileListIterator type. +func NewProfileListIterator(page ProfileListPage) ProfileListIterator { + return ProfileListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pl ProfileList) IsEmpty() bool { + return pl.Value == nil || len(*pl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pl ProfileList) hasNextLink() bool { + return pl.NextLink != nil && len(*pl.NextLink) != 0 +} + +// profileListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pl ProfileList) profileListPreparer(ctx context.Context) (*http.Request, error) { + if !pl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pl.NextLink))) +} + +// ProfileListPage contains a page of Profile values. +type ProfileListPage struct { + fn func(context.Context, ProfileList) (ProfileList, error) + pl ProfileList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ProfileListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pl) + if err != nil { + return err + } + page.pl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ProfileListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ProfileListPage) NotDone() bool { + return !page.pl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ProfileListPage) Response() ProfileList { + return page.pl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ProfileListPage) Values() []Profile { + if page.pl.IsEmpty() { + return nil + } + return *page.pl.Value +} + +// Creates a new instance of the ProfileListPage type. +func NewProfileListPage(cur ProfileList, getNextPage func(context.Context, ProfileList) (ProfileList, error)) ProfileListPage { + return ProfileListPage{ + fn: getNextPage, + pl: cur, + } +} + +// ProfileProperties defines the properties of an experiment +type ProfileProperties struct { + // ResourceState - Resource status. Possible values include: 'NetworkExperimentResourceStateCreating', 'NetworkExperimentResourceStateEnabling', 'NetworkExperimentResourceStateEnabled', 'NetworkExperimentResourceStateDisabling', 'NetworkExperimentResourceStateDisabled', 'NetworkExperimentResourceStateDeleting' + ResourceState NetworkExperimentResourceState `json:"resourceState,omitempty"` + // EnabledState - The state of the Experiment. Possible values include: 'StateEnabled', 'StateDisabled' + EnabledState State `json:"enabledState,omitempty"` +} + +// ProfileUpdateModel defines modifiable attributes of a Profile +type ProfileUpdateModel struct { + // ProfileUpdateProperties - The properties of a Profile + *ProfileUpdateProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ProfileUpdateModel. +func (pum ProfileUpdateModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pum.ProfileUpdateProperties != nil { + objectMap["properties"] = pum.ProfileUpdateProperties + } + if pum.Tags != nil { + objectMap["tags"] = pum.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ProfileUpdateModel struct. +func (pum *ProfileUpdateModel) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var profileUpdateProperties ProfileUpdateProperties + err = json.Unmarshal(*v, &profileUpdateProperties) + if err != nil { + return err + } + pum.ProfileUpdateProperties = &profileUpdateProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pum.Tags = tags + } + } + } + + return nil +} + +// ProfileUpdateProperties defines the properties of an experiment +type ProfileUpdateProperties struct { + // EnabledState - The enabled state of the Profile. Possible values include: 'StateEnabled', 'StateDisabled' + EnabledState State `json:"enabledState,omitempty"` +} + +// Properties the JSON object that contains the properties required to create an endpoint. +type Properties struct { + // ResourceState - Resource status of the Front Door. Possible values include: 'ResourceStateCreating', 'ResourceStateEnabling', 'ResourceStateEnabled', 'ResourceStateDisabling', 'ResourceStateDisabled', 'ResourceStateDeleting' + ResourceState ResourceState `json:"resourceState,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the Front Door. + ProvisioningState *string `json:"provisioningState,omitempty"` + // Cname - READ-ONLY; The host that each frontendEndpoint must CNAME to. + Cname *string `json:"cname,omitempty"` + // FrontdoorID - READ-ONLY; The Id of the frontdoor. + FrontdoorID *string `json:"frontdoorId,omitempty"` + // RulesEngines - READ-ONLY; Rules Engine Configurations available to routing rules. + RulesEngines *[]RulesEngine `json:"rulesEngines,omitempty"` + // FriendlyName - A friendly name for the frontDoor + FriendlyName *string `json:"friendlyName,omitempty"` + // RoutingRules - Routing rules associated with this Front Door. + RoutingRules *[]RoutingRule `json:"routingRules,omitempty"` + // LoadBalancingSettings - Load balancing settings associated with this Front Door instance. + LoadBalancingSettings *[]LoadBalancingSettingsModel `json:"loadBalancingSettings,omitempty"` + // HealthProbeSettings - Health probe settings associated with this Front Door instance. + HealthProbeSettings *[]HealthProbeSettingsModel `json:"healthProbeSettings,omitempty"` + // BackendPools - Backend pools available to routing rules. + BackendPools *[]BackendPool `json:"backendPools,omitempty"` + // FrontendEndpoints - Frontend endpoints available to routing rules. + FrontendEndpoints *[]FrontendEndpoint `json:"frontendEndpoints,omitempty"` + // BackendPoolsSettings - Settings for all backendPools + BackendPoolsSettings *BackendPoolsSettings `json:"backendPoolsSettings,omitempty"` + // EnabledState - Operational status of the Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + EnabledState EnabledState `json:"enabledState,omitempty"` +} + +// MarshalJSON is the custom marshaler for Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.ResourceState != "" { + objectMap["resourceState"] = p.ResourceState + } + if p.FriendlyName != nil { + objectMap["friendlyName"] = p.FriendlyName + } + if p.RoutingRules != nil { + objectMap["routingRules"] = p.RoutingRules + } + if p.LoadBalancingSettings != nil { + objectMap["loadBalancingSettings"] = p.LoadBalancingSettings + } + if p.HealthProbeSettings != nil { + objectMap["healthProbeSettings"] = p.HealthProbeSettings + } + if p.BackendPools != nil { + objectMap["backendPools"] = p.BackendPools + } + if p.FrontendEndpoints != nil { + objectMap["frontendEndpoints"] = p.FrontendEndpoints + } + if p.BackendPoolsSettings != nil { + objectMap["backendPoolsSettings"] = p.BackendPoolsSettings + } + if p.EnabledState != "" { + objectMap["enabledState"] = p.EnabledState + } + return json.Marshal(objectMap) +} + +// PurgeParameters parameters required for content purge. +type PurgeParameters struct { + // ContentPaths - The path to the content to be purged. Can describe a file path or a wild card directory. + ContentPaths *[]string `json:"contentPaths,omitempty"` +} + +// RedirectConfiguration describes Redirect Route. +type RedirectConfiguration struct { + // RedirectType - The redirect type the rule will use when redirecting traffic. Possible values include: 'RedirectTypeMoved', 'RedirectTypeFound', 'RedirectTypeTemporaryRedirect', 'RedirectTypePermanentRedirect' + RedirectType RedirectType `json:"redirectType,omitempty"` + // RedirectProtocol - The protocol of the destination to where the traffic is redirected. Possible values include: 'RedirectProtocolHTTPOnly', 'RedirectProtocolHTTPSOnly', 'RedirectProtocolMatchRequest' + RedirectProtocol RedirectProtocol `json:"redirectProtocol,omitempty"` + // CustomHost - Host to redirect. Leave empty to use the incoming host as the destination host. + CustomHost *string `json:"customHost,omitempty"` + // CustomPath - The full path to redirect. Path cannot be empty and must start with /. Leave empty to use the incoming path as destination path. + CustomPath *string `json:"customPath,omitempty"` + // CustomFragment - Fragment to add to the redirect URL. Fragment is the part of the URL that comes after #. Do not include the #. + CustomFragment *string `json:"customFragment,omitempty"` + // CustomQueryString - The set of query strings to be placed in the redirect URL. Setting this value would replace any existing query string; leave empty to preserve the incoming query string. Query string must be in = format. The first ? and & will be added automatically so do not include them in the front, but do separate multiple query strings with &. + CustomQueryString *string `json:"customQueryString,omitempty"` + // OdataType - Possible values include: 'OdataTypeRouteConfiguration', 'OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration', 'OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration' + OdataType OdataType `json:"@odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RedirectConfiguration. +func (rc RedirectConfiguration) MarshalJSON() ([]byte, error) { + rc.OdataType = OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration + objectMap := make(map[string]interface{}) + if rc.RedirectType != "" { + objectMap["redirectType"] = rc.RedirectType + } + if rc.RedirectProtocol != "" { + objectMap["redirectProtocol"] = rc.RedirectProtocol + } + if rc.CustomHost != nil { + objectMap["customHost"] = rc.CustomHost + } + if rc.CustomPath != nil { + objectMap["customPath"] = rc.CustomPath + } + if rc.CustomFragment != nil { + objectMap["customFragment"] = rc.CustomFragment + } + if rc.CustomQueryString != nil { + objectMap["customQueryString"] = rc.CustomQueryString + } + if rc.OdataType != "" { + objectMap["@odata.type"] = rc.OdataType + } + return json.Marshal(objectMap) +} + +// AsForwardingConfiguration is the BasicRouteConfiguration implementation for RedirectConfiguration. +func (rc RedirectConfiguration) AsForwardingConfiguration() (*ForwardingConfiguration, bool) { + return nil, false +} + +// AsRedirectConfiguration is the BasicRouteConfiguration implementation for RedirectConfiguration. +func (rc RedirectConfiguration) AsRedirectConfiguration() (*RedirectConfiguration, bool) { + return &rc, true +} + +// AsRouteConfiguration is the BasicRouteConfiguration implementation for RedirectConfiguration. +func (rc RedirectConfiguration) AsRouteConfiguration() (*RouteConfiguration, bool) { + return nil, false +} + +// AsBasicRouteConfiguration is the BasicRouteConfiguration implementation for RedirectConfiguration. +func (rc RedirectConfiguration) AsBasicRouteConfiguration() (BasicRouteConfiguration, bool) { + return &rc, true +} + +// Resource common resource representation. +type Resource struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// BasicRouteConfiguration base class for all types of Route. +type BasicRouteConfiguration interface { + AsForwardingConfiguration() (*ForwardingConfiguration, bool) + AsRedirectConfiguration() (*RedirectConfiguration, bool) + AsRouteConfiguration() (*RouteConfiguration, bool) +} + +// RouteConfiguration base class for all types of Route. +type RouteConfiguration struct { + // OdataType - Possible values include: 'OdataTypeRouteConfiguration', 'OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration', 'OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration' + OdataType OdataType `json:"@odata.type,omitempty"` +} + +func unmarshalBasicRouteConfiguration(body []byte) (BasicRouteConfiguration, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["@odata.type"] { + case string(OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorForwardingConfiguration): + var fc ForwardingConfiguration + err := json.Unmarshal(body, &fc) + return fc, err + case string(OdataTypeMicrosoftAzureFrontDoorModelsFrontdoorRedirectConfiguration): + var rc RedirectConfiguration + err := json.Unmarshal(body, &rc) + return rc, err + default: + var rc RouteConfiguration + err := json.Unmarshal(body, &rc) + return rc, err + } +} +func unmarshalBasicRouteConfigurationArray(body []byte) ([]BasicRouteConfiguration, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + rcArray := make([]BasicRouteConfiguration, len(rawMessages)) + + for index, rawMessage := range rawMessages { + rc, err := unmarshalBasicRouteConfiguration(*rawMessage) + if err != nil { + return nil, err + } + rcArray[index] = rc + } + return rcArray, nil +} + +// MarshalJSON is the custom marshaler for RouteConfiguration. +func (rc RouteConfiguration) MarshalJSON() ([]byte, error) { + rc.OdataType = OdataTypeRouteConfiguration + objectMap := make(map[string]interface{}) + if rc.OdataType != "" { + objectMap["@odata.type"] = rc.OdataType + } + return json.Marshal(objectMap) +} + +// AsForwardingConfiguration is the BasicRouteConfiguration implementation for RouteConfiguration. +func (rc RouteConfiguration) AsForwardingConfiguration() (*ForwardingConfiguration, bool) { + return nil, false +} + +// AsRedirectConfiguration is the BasicRouteConfiguration implementation for RouteConfiguration. +func (rc RouteConfiguration) AsRedirectConfiguration() (*RedirectConfiguration, bool) { + return nil, false +} + +// AsRouteConfiguration is the BasicRouteConfiguration implementation for RouteConfiguration. +func (rc RouteConfiguration) AsRouteConfiguration() (*RouteConfiguration, bool) { + return &rc, true +} + +// AsBasicRouteConfiguration is the BasicRouteConfiguration implementation for RouteConfiguration. +func (rc RouteConfiguration) AsBasicRouteConfiguration() (BasicRouteConfiguration, bool) { + return &rc, true +} + +// RoutingRule a routing rule represents a specification for traffic to treat and where to send it, along +// with health probe information. +type RoutingRule struct { + // RoutingRuleProperties - Properties of the Front Door Routing Rule + *RoutingRuleProperties `json:"properties,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoutingRule. +func (rr RoutingRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rr.RoutingRuleProperties != nil { + objectMap["properties"] = rr.RoutingRuleProperties + } + if rr.Name != nil { + objectMap["name"] = rr.Name + } + if rr.ID != nil { + objectMap["id"] = rr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoutingRule struct. +func (rr *RoutingRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routingRuleProperties RoutingRuleProperties + err = json.Unmarshal(*v, &routingRuleProperties) + if err != nil { + return err + } + rr.RoutingRuleProperties = &routingRuleProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rr.ID = &ID + } + } + } + + return nil +} + +// RoutingRuleLink defines the Resource ID for a Routing Rule. +type RoutingRuleLink struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// RoutingRuleListResult result of the request to list Routing Rules. It contains a list of Routing Rule +// objects and a URL link to get the next set of results. +type RoutingRuleListResult struct { + // Value - READ-ONLY; List of Routing Rules within a Front Door. + Value *[]RoutingRule `json:"value,omitempty"` + // NextLink - URL to get the next set of RoutingRule objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoutingRuleListResult. +func (rrlr RoutingRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rrlr.NextLink != nil { + objectMap["nextLink"] = rrlr.NextLink + } + return json.Marshal(objectMap) +} + +// RoutingRuleProperties the JSON object that contains the properties required to create a routing rule. +type RoutingRuleProperties struct { + // ResourceState - Resource status. Possible values include: 'ResourceStateCreating', 'ResourceStateEnabling', 'ResourceStateEnabled', 'ResourceStateDisabling', 'ResourceStateDisabled', 'ResourceStateDeleting' + ResourceState ResourceState `json:"resourceState,omitempty"` + // FrontendEndpoints - Frontend endpoints associated with this rule + FrontendEndpoints *[]SubResource `json:"frontendEndpoints,omitempty"` + // AcceptedProtocols - Protocol schemes to match for this rule + AcceptedProtocols *[]Protocol `json:"acceptedProtocols,omitempty"` + // PatternsToMatch - The route patterns of the rule. + PatternsToMatch *[]string `json:"patternsToMatch,omitempty"` + // EnabledState - Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'RoutingRuleEnabledStateEnabled', 'RoutingRuleEnabledStateDisabled' + EnabledState RoutingRuleEnabledState `json:"enabledState,omitempty"` + // RouteConfiguration - A reference to the routing configuration. + RouteConfiguration BasicRouteConfiguration `json:"routeConfiguration,omitempty"` + // RulesEngine - A reference to a specific Rules Engine Configuration to apply to this route. + RulesEngine *SubResource `json:"rulesEngine,omitempty"` + // WebApplicationFirewallPolicyLink - Defines the Web Application Firewall policy for each routing rule (if applicable) + WebApplicationFirewallPolicyLink *RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for RoutingRuleProperties struct. +func (rrp *RoutingRuleProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "resourceState": + if v != nil { + var resourceState ResourceState + err = json.Unmarshal(*v, &resourceState) + if err != nil { + return err + } + rrp.ResourceState = resourceState + } + case "frontendEndpoints": + if v != nil { + var frontendEndpoints []SubResource + err = json.Unmarshal(*v, &frontendEndpoints) + if err != nil { + return err + } + rrp.FrontendEndpoints = &frontendEndpoints + } + case "acceptedProtocols": + if v != nil { + var acceptedProtocols []Protocol + err = json.Unmarshal(*v, &acceptedProtocols) + if err != nil { + return err + } + rrp.AcceptedProtocols = &acceptedProtocols + } + case "patternsToMatch": + if v != nil { + var patternsToMatch []string + err = json.Unmarshal(*v, &patternsToMatch) + if err != nil { + return err + } + rrp.PatternsToMatch = &patternsToMatch + } + case "enabledState": + if v != nil { + var enabledState RoutingRuleEnabledState + err = json.Unmarshal(*v, &enabledState) + if err != nil { + return err + } + rrp.EnabledState = enabledState + } + case "routeConfiguration": + if v != nil { + routeConfiguration, err := unmarshalBasicRouteConfiguration(*v) + if err != nil { + return err + } + rrp.RouteConfiguration = routeConfiguration + } + case "rulesEngine": + if v != nil { + var rulesEngine SubResource + err = json.Unmarshal(*v, &rulesEngine) + if err != nil { + return err + } + rrp.RulesEngine = &rulesEngine + } + case "webApplicationFirewallPolicyLink": + if v != nil { + var webApplicationFirewallPolicyLink RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink + err = json.Unmarshal(*v, &webApplicationFirewallPolicyLink) + if err != nil { + return err + } + rrp.WebApplicationFirewallPolicyLink = &webApplicationFirewallPolicyLink + } + } + } + + return nil +} + +// RoutingRuleUpdateParameters routing rules to apply to an endpoint +type RoutingRuleUpdateParameters struct { + // FrontendEndpoints - Frontend endpoints associated with this rule + FrontendEndpoints *[]SubResource `json:"frontendEndpoints,omitempty"` + // AcceptedProtocols - Protocol schemes to match for this rule + AcceptedProtocols *[]Protocol `json:"acceptedProtocols,omitempty"` + // PatternsToMatch - The route patterns of the rule. + PatternsToMatch *[]string `json:"patternsToMatch,omitempty"` + // EnabledState - Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'RoutingRuleEnabledStateEnabled', 'RoutingRuleEnabledStateDisabled' + EnabledState RoutingRuleEnabledState `json:"enabledState,omitempty"` + // RouteConfiguration - A reference to the routing configuration. + RouteConfiguration BasicRouteConfiguration `json:"routeConfiguration,omitempty"` + // RulesEngine - A reference to a specific Rules Engine Configuration to apply to this route. + RulesEngine *SubResource `json:"rulesEngine,omitempty"` + // WebApplicationFirewallPolicyLink - Defines the Web Application Firewall policy for each routing rule (if applicable) + WebApplicationFirewallPolicyLink *RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for RoutingRuleUpdateParameters struct. +func (rrup *RoutingRuleUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "frontendEndpoints": + if v != nil { + var frontendEndpoints []SubResource + err = json.Unmarshal(*v, &frontendEndpoints) + if err != nil { + return err + } + rrup.FrontendEndpoints = &frontendEndpoints + } + case "acceptedProtocols": + if v != nil { + var acceptedProtocols []Protocol + err = json.Unmarshal(*v, &acceptedProtocols) + if err != nil { + return err + } + rrup.AcceptedProtocols = &acceptedProtocols + } + case "patternsToMatch": + if v != nil { + var patternsToMatch []string + err = json.Unmarshal(*v, &patternsToMatch) + if err != nil { + return err + } + rrup.PatternsToMatch = &patternsToMatch + } + case "enabledState": + if v != nil { + var enabledState RoutingRuleEnabledState + err = json.Unmarshal(*v, &enabledState) + if err != nil { + return err + } + rrup.EnabledState = enabledState + } + case "routeConfiguration": + if v != nil { + routeConfiguration, err := unmarshalBasicRouteConfiguration(*v) + if err != nil { + return err + } + rrup.RouteConfiguration = routeConfiguration + } + case "rulesEngine": + if v != nil { + var rulesEngine SubResource + err = json.Unmarshal(*v, &rulesEngine) + if err != nil { + return err + } + rrup.RulesEngine = &rulesEngine + } + case "webApplicationFirewallPolicyLink": + if v != nil { + var webApplicationFirewallPolicyLink RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink + err = json.Unmarshal(*v, &webApplicationFirewallPolicyLink) + if err != nil { + return err + } + rrup.WebApplicationFirewallPolicyLink = &webApplicationFirewallPolicyLink + } + } + } + + return nil +} + +// RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink defines the Web Application Firewall policy +// for each routing rule (if applicable) +type RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// RulesEngine a rules engine configuration containing a list of rules that will run to modify the runtime +// behavior of the request and response. +type RulesEngine struct { + autorest.Response `json:"-"` + // RulesEngineProperties - Properties of the Rules Engine Configuration. + *RulesEngineProperties `json:"properties,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for RulesEngine. +func (re RulesEngine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if re.RulesEngineProperties != nil { + objectMap["properties"] = re.RulesEngineProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RulesEngine struct. +func (re *RulesEngine) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var rulesEngineProperties RulesEngineProperties + err = json.Unmarshal(*v, &rulesEngineProperties) + if err != nil { + return err + } + re.RulesEngineProperties = &rulesEngineProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + re.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + re.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + re.ID = &ID + } + } + } + + return nil +} + +// RulesEngineAction one or more actions that will execute, modifying the request and/or response. +type RulesEngineAction struct { + // RequestHeaderActions - A list of header actions to apply from the request from AFD to the origin. + RequestHeaderActions *[]HeaderAction `json:"requestHeaderActions,omitempty"` + // ResponseHeaderActions - A list of header actions to apply from the response from AFD to the client. + ResponseHeaderActions *[]HeaderAction `json:"responseHeaderActions,omitempty"` + // RouteConfigurationOverride - Override the route configuration. + RouteConfigurationOverride BasicRouteConfiguration `json:"routeConfigurationOverride,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for RulesEngineAction struct. +func (rea *RulesEngineAction) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "requestHeaderActions": + if v != nil { + var requestHeaderActions []HeaderAction + err = json.Unmarshal(*v, &requestHeaderActions) + if err != nil { + return err + } + rea.RequestHeaderActions = &requestHeaderActions + } + case "responseHeaderActions": + if v != nil { + var responseHeaderActions []HeaderAction + err = json.Unmarshal(*v, &responseHeaderActions) + if err != nil { + return err + } + rea.ResponseHeaderActions = &responseHeaderActions + } + case "routeConfigurationOverride": + if v != nil { + routeConfigurationOverride, err := unmarshalBasicRouteConfiguration(*v) + if err != nil { + return err + } + rea.RouteConfigurationOverride = routeConfigurationOverride + } + } + } + + return nil +} + +// RulesEngineListResult result of the request to list Rules Engine Configurations. It contains a list of +// RulesEngine objects and a URL link to get the next set of results. +type RulesEngineListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of rulesEngines within a Front Door. + Value *[]RulesEngine `json:"value,omitempty"` + // NextLink - URL to get the next set of RulesEngine objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for RulesEngineListResult. +func (relr RulesEngineListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if relr.NextLink != nil { + objectMap["nextLink"] = relr.NextLink + } + return json.Marshal(objectMap) +} + +// RulesEngineListResultIterator provides access to a complete listing of RulesEngine values. +type RulesEngineListResultIterator struct { + i int + page RulesEngineListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RulesEngineListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesEngineListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RulesEngineListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RulesEngineListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RulesEngineListResultIterator) Response() RulesEngineListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RulesEngineListResultIterator) Value() RulesEngine { + if !iter.page.NotDone() { + return RulesEngine{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RulesEngineListResultIterator type. +func NewRulesEngineListResultIterator(page RulesEngineListResultPage) RulesEngineListResultIterator { + return RulesEngineListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (relr RulesEngineListResult) IsEmpty() bool { + return relr.Value == nil || len(*relr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (relr RulesEngineListResult) hasNextLink() bool { + return relr.NextLink != nil && len(*relr.NextLink) != 0 +} + +// rulesEngineListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (relr RulesEngineListResult) rulesEngineListResultPreparer(ctx context.Context) (*http.Request, error) { + if !relr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(relr.NextLink))) +} + +// RulesEngineListResultPage contains a page of RulesEngine values. +type RulesEngineListResultPage struct { + fn func(context.Context, RulesEngineListResult) (RulesEngineListResult, error) + relr RulesEngineListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RulesEngineListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesEngineListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.relr) + if err != nil { + return err + } + page.relr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RulesEngineListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RulesEngineListResultPage) NotDone() bool { + return !page.relr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RulesEngineListResultPage) Response() RulesEngineListResult { + return page.relr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RulesEngineListResultPage) Values() []RulesEngine { + if page.relr.IsEmpty() { + return nil + } + return *page.relr.Value +} + +// Creates a new instance of the RulesEngineListResultPage type. +func NewRulesEngineListResultPage(cur RulesEngineListResult, getNextPage func(context.Context, RulesEngineListResult) (RulesEngineListResult, error)) RulesEngineListResultPage { + return RulesEngineListResultPage{ + fn: getNextPage, + relr: cur, + } +} + +// RulesEngineMatchCondition define a match condition +type RulesEngineMatchCondition struct { + // RulesEngineMatchVariable - Match Variable. Possible values include: 'RulesEngineMatchVariableIsMobile', 'RulesEngineMatchVariableRemoteAddr', 'RulesEngineMatchVariableRequestMethod', 'RulesEngineMatchVariableQueryString', 'RulesEngineMatchVariablePostArgs', 'RulesEngineMatchVariableRequestURI', 'RulesEngineMatchVariableRequestPath', 'RulesEngineMatchVariableRequestFilename', 'RulesEngineMatchVariableRequestFilenameExtension', 'RulesEngineMatchVariableRequestHeader', 'RulesEngineMatchVariableRequestBody', 'RulesEngineMatchVariableRequestScheme' + RulesEngineMatchVariable RulesEngineMatchVariable `json:"rulesEngineMatchVariable,omitempty"` + // Selector - Name of selector in RequestHeader or RequestBody to be matched + Selector *string `json:"selector,omitempty"` + // RulesEngineOperator - Describes operator to apply to the match condition. Possible values include: 'RulesEngineOperatorAny', 'RulesEngineOperatorIPMatch', 'RulesEngineOperatorGeoMatch', 'RulesEngineOperatorEqual', 'RulesEngineOperatorContains', 'RulesEngineOperatorLessThan', 'RulesEngineOperatorGreaterThan', 'RulesEngineOperatorLessThanOrEqual', 'RulesEngineOperatorGreaterThanOrEqual', 'RulesEngineOperatorBeginsWith', 'RulesEngineOperatorEndsWith' + RulesEngineOperator RulesEngineOperator `json:"rulesEngineOperator,omitempty"` + // NegateCondition - Describes if this is negate condition or not + NegateCondition *bool `json:"negateCondition,omitempty"` + // RulesEngineMatchValue - Match values to match against. The operator will apply to each value in here with OR semantics. If any of them match the variable with the given operator this match condition is considered a match. + RulesEngineMatchValue *[]string `json:"rulesEngineMatchValue,omitempty"` + // Transforms - List of transforms + Transforms *[]Transform `json:"transforms,omitempty"` +} + +// RulesEngineProperties the JSON object that contains the properties required to create a Rules Engine +// Configuration. +type RulesEngineProperties struct { + // ResourceState - Resource status. Possible values include: 'ResourceStateCreating', 'ResourceStateEnabling', 'ResourceStateEnabled', 'ResourceStateDisabling', 'ResourceStateDisabled', 'ResourceStateDeleting' + ResourceState ResourceState `json:"resourceState,omitempty"` + // Rules - A list of rules that define a particular Rules Engine Configuration. + Rules *[]RulesEngineRule `json:"rules,omitempty"` +} + +// RulesEngineRule contains a list of match conditions, and an action on how to modify the +// request/response. If multiple rules match, the actions from one rule that conflict with a previous rule +// overwrite for a singular action, or append in the case of headers manipulation. +type RulesEngineRule struct { + // Name - A name to refer to this specific rule. + Name *string `json:"name,omitempty"` + // Priority - A priority assigned to this rule. + Priority *int32 `json:"priority,omitempty"` + // Action - Actions to perform on the request and response if all of the match conditions are met. + Action *RulesEngineAction `json:"action,omitempty"` + // MatchConditions - A list of match conditions that must meet in order for the actions of this rule to run. Having no match conditions means the actions will always run. + MatchConditions *[]RulesEngineMatchCondition `json:"matchConditions,omitempty"` + // MatchProcessingBehavior - If this rule is a match should the rules engine continue running the remaining rules or stop. If not present, defaults to Continue. Possible values include: 'MatchProcessingBehaviorContinue', 'MatchProcessingBehaviorStop' + MatchProcessingBehavior MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` +} + +// RulesEnginesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type RulesEnginesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RulesEnginesClient) (RulesEngine, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RulesEnginesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RulesEnginesCreateOrUpdateFuture.Result. +func (future *RulesEnginesCreateOrUpdateFuture) result(client RulesEnginesClient) (re RulesEngine, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + re.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("frontdoor.RulesEnginesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if re.Response.Response, err = future.GetResult(sender); err == nil && re.Response.Response.StatusCode != http.StatusNoContent { + re, err = client.CreateOrUpdateResponder(re.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesCreateOrUpdateFuture", "Result", re.Response.Response, "Failure responding to request") + } + } + return +} + +// RulesEnginesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RulesEnginesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RulesEnginesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RulesEnginesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RulesEnginesDeleteFuture.Result. +func (future *RulesEnginesDeleteFuture) result(client RulesEnginesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("frontdoor.RulesEnginesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RulesEngineUpdateParameters rules Engine Configuration to apply to a Routing Rule. +type RulesEngineUpdateParameters struct { + // Rules - A list of rules that define a particular Rules Engine Configuration. + Rules *[]RulesEngineRule `json:"rules,omitempty"` +} + +// SecurityPolicyLink defines the Resource ID for a Security Policy. +type SecurityPolicyLink struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// Sku the pricing tier of the web application firewall policy. +type Sku struct { + // Name - Name of the pricing tier. Possible values include: 'SkuNameClassicAzureFrontDoor', 'SkuNameStandardAzureFrontDoor', 'SkuNamePremiumAzureFrontDoor' + Name SkuName `json:"name,omitempty"` +} + +// SubResource reference to another subresource. +type SubResource struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// TagsObject tags object for patch operations. +type TagsObject struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TagsObject. +func (toVar TagsObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if toVar.Tags != nil { + objectMap["tags"] = toVar.Tags + } + return json.Marshal(objectMap) +} + +// Timeseries defines the Timeseries +type Timeseries struct { + autorest.Response `json:"-"` + // TimeseriesProperties - The properties of a Timeseries + *TimeseriesProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Timeseries. +func (t Timeseries) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.TimeseriesProperties != nil { + objectMap["properties"] = t.TimeseriesProperties + } + if t.Location != nil { + objectMap["location"] = t.Location + } + if t.Tags != nil { + objectMap["tags"] = t.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Timeseries struct. +func (t *Timeseries) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var timeseriesProperties TimeseriesProperties + err = json.Unmarshal(*v, ×eriesProperties) + if err != nil { + return err + } + t.TimeseriesProperties = ×eriesProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + t.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + t.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + t.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + t.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + t.Tags = tags + } + } + } + + return nil +} + +// TimeseriesDataPoint defines a timeseries datapoint used in a timeseries +type TimeseriesDataPoint struct { + // DateTimeUTC - The DateTime of the Timeseries data point in UTC + DateTimeUTC *string `json:"dateTimeUTC,omitempty"` + // Value - The Value of the Timeseries data point + Value *float64 `json:"value,omitempty"` +} + +// TimeseriesProperties defines the properties of a timeseries +type TimeseriesProperties struct { + // Endpoint - The endpoint associated with the Timeseries data point + Endpoint *string `json:"endpoint,omitempty"` + // StartDateTimeUTC - The start DateTime of the Timeseries in UTC + StartDateTimeUTC *string `json:"startDateTimeUTC,omitempty"` + // EndDateTimeUTC - The end DateTime of the Timeseries in UTC + EndDateTimeUTC *string `json:"endDateTimeUTC,omitempty"` + // AggregationInterval - The aggregation interval of the Timeseries. Possible values include: 'AggregationIntervalHourly', 'AggregationIntervalDaily' + AggregationInterval AggregationInterval `json:"aggregationInterval,omitempty"` + // TimeseriesType - The type of Timeseries. Possible values include: 'TimeseriesTypeMeasurementCounts', 'TimeseriesTypeLatencyP50', 'TimeseriesTypeLatencyP75', 'TimeseriesTypeLatencyP95' + TimeseriesType TimeseriesType `json:"timeseriesType,omitempty"` + // Country - The country associated with the Timeseries. Values are country ISO codes as specified here- https://www.iso.org/iso-3166-country-codes.html + Country *string `json:"country,omitempty"` + // TimeseriesData - The set of data points for the timeseries + TimeseriesData *[]TimeseriesDataPoint `json:"timeseriesData,omitempty"` +} + +// UpdateParameters the properties needed to update a Front Door +type UpdateParameters struct { + // FriendlyName - A friendly name for the frontDoor + FriendlyName *string `json:"friendlyName,omitempty"` + // RoutingRules - Routing rules associated with this Front Door. + RoutingRules *[]RoutingRule `json:"routingRules,omitempty"` + // LoadBalancingSettings - Load balancing settings associated with this Front Door instance. + LoadBalancingSettings *[]LoadBalancingSettingsModel `json:"loadBalancingSettings,omitempty"` + // HealthProbeSettings - Health probe settings associated with this Front Door instance. + HealthProbeSettings *[]HealthProbeSettingsModel `json:"healthProbeSettings,omitempty"` + // BackendPools - Backend pools available to routing rules. + BackendPools *[]BackendPool `json:"backendPools,omitempty"` + // FrontendEndpoints - Frontend endpoints available to routing rules. + FrontendEndpoints *[]FrontendEndpoint `json:"frontendEndpoints,omitempty"` + // BackendPoolsSettings - Settings for all backendPools + BackendPoolsSettings *BackendPoolsSettings `json:"backendPoolsSettings,omitempty"` + // EnabledState - Operational status of the Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + EnabledState EnabledState `json:"enabledState,omitempty"` +} + +// ValidateCustomDomainInput input of the custom domain to be validated for DNS mapping. +type ValidateCustomDomainInput struct { + // HostName - The host name of the custom domain. Must be a domain name. + HostName *string `json:"hostName,omitempty"` +} + +// ValidateCustomDomainOutput output of custom domain validation. +type ValidateCustomDomainOutput struct { + autorest.Response `json:"-"` + // CustomDomainValidated - READ-ONLY; Indicates whether the custom domain is valid or not. + CustomDomainValidated *bool `json:"customDomainValidated,omitempty"` + // Reason - READ-ONLY; The reason why the custom domain is not valid. + Reason *string `json:"reason,omitempty"` + // Message - READ-ONLY; Error message describing why the custom domain is not valid. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for ValidateCustomDomainOutput. +func (vcdo ValidateCustomDomainOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// WebApplicationFirewallPolicy defines web application firewall policy. +type WebApplicationFirewallPolicy struct { + autorest.Response `json:"-"` + // WebApplicationFirewallPolicyProperties - Properties of the web application firewall policy. + *WebApplicationFirewallPolicyProperties `json:"properties,omitempty"` + // Etag - Gets a unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Sku - The pricing tier of web application firewall policy. Defaults to Classic_AzureFrontDoor if not specified. + Sku *Sku `json:"sku,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicy. +func (wafp WebApplicationFirewallPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafp.WebApplicationFirewallPolicyProperties != nil { + objectMap["properties"] = wafp.WebApplicationFirewallPolicyProperties + } + if wafp.Etag != nil { + objectMap["etag"] = wafp.Etag + } + if wafp.Sku != nil { + objectMap["sku"] = wafp.Sku + } + if wafp.Location != nil { + objectMap["location"] = wafp.Location + } + if wafp.Tags != nil { + objectMap["tags"] = wafp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WebApplicationFirewallPolicy struct. +func (wafp *WebApplicationFirewallPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var webApplicationFirewallPolicyProperties WebApplicationFirewallPolicyProperties + err = json.Unmarshal(*v, &webApplicationFirewallPolicyProperties) + if err != nil { + return err + } + wafp.WebApplicationFirewallPolicyProperties = &webApplicationFirewallPolicyProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + wafp.Etag = &etag + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + wafp.Sku = &sku + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + wafp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + wafp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + wafp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + wafp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + wafp.Tags = tags + } + } + } + + return nil +} + +// WebApplicationFirewallPolicyList defines a list of WebApplicationFirewallPolicies. It contains a list of +// WebApplicationFirewallPolicy objects and a URL link to get the next set of results. +type WebApplicationFirewallPolicyList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of WebApplicationFirewallPolicies within a resource group. + Value *[]WebApplicationFirewallPolicy `json:"value,omitempty"` + // NextLink - URL to get the next set of WebApplicationFirewallPolicy objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyList. +func (wafpl WebApplicationFirewallPolicyList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafpl.NextLink != nil { + objectMap["nextLink"] = wafpl.NextLink + } + return json.Marshal(objectMap) +} + +// WebApplicationFirewallPolicyListIterator provides access to a complete listing of +// WebApplicationFirewallPolicy values. +type WebApplicationFirewallPolicyListIterator struct { + i int + page WebApplicationFirewallPolicyListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *WebApplicationFirewallPolicyListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPolicyListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *WebApplicationFirewallPolicyListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WebApplicationFirewallPolicyListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter WebApplicationFirewallPolicyListIterator) Response() WebApplicationFirewallPolicyList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter WebApplicationFirewallPolicyListIterator) Value() WebApplicationFirewallPolicy { + if !iter.page.NotDone() { + return WebApplicationFirewallPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WebApplicationFirewallPolicyListIterator type. +func NewWebApplicationFirewallPolicyListIterator(page WebApplicationFirewallPolicyListPage) WebApplicationFirewallPolicyListIterator { + return WebApplicationFirewallPolicyListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wafpl WebApplicationFirewallPolicyList) IsEmpty() bool { + return wafpl.Value == nil || len(*wafpl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wafpl WebApplicationFirewallPolicyList) hasNextLink() bool { + return wafpl.NextLink != nil && len(*wafpl.NextLink) != 0 +} + +// webApplicationFirewallPolicyListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wafpl WebApplicationFirewallPolicyList) webApplicationFirewallPolicyListPreparer(ctx context.Context) (*http.Request, error) { + if !wafpl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wafpl.NextLink))) +} + +// WebApplicationFirewallPolicyListPage contains a page of WebApplicationFirewallPolicy values. +type WebApplicationFirewallPolicyListPage struct { + fn func(context.Context, WebApplicationFirewallPolicyList) (WebApplicationFirewallPolicyList, error) + wafpl WebApplicationFirewallPolicyList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *WebApplicationFirewallPolicyListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPolicyListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.wafpl) + if err != nil { + return err + } + page.wafpl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *WebApplicationFirewallPolicyListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WebApplicationFirewallPolicyListPage) NotDone() bool { + return !page.wafpl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WebApplicationFirewallPolicyListPage) Response() WebApplicationFirewallPolicyList { + return page.wafpl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WebApplicationFirewallPolicyListPage) Values() []WebApplicationFirewallPolicy { + if page.wafpl.IsEmpty() { + return nil + } + return *page.wafpl.Value +} + +// Creates a new instance of the WebApplicationFirewallPolicyListPage type. +func NewWebApplicationFirewallPolicyListPage(cur WebApplicationFirewallPolicyList, getNextPage func(context.Context, WebApplicationFirewallPolicyList) (WebApplicationFirewallPolicyList, error)) WebApplicationFirewallPolicyListPage { + return WebApplicationFirewallPolicyListPage{ + fn: getNextPage, + wafpl: cur, + } +} + +// WebApplicationFirewallPolicyProperties defines web application firewall policy properties. +type WebApplicationFirewallPolicyProperties struct { + // PolicySettings - Describes settings for the policy. + PolicySettings *PolicySettings `json:"policySettings,omitempty"` + // CustomRules - Describes custom rules inside the policy. + CustomRules *CustomRuleList `json:"customRules,omitempty"` + // ManagedRules - Describes managed rules inside the policy. + ManagedRules *ManagedRuleSetList `json:"managedRules,omitempty"` + // FrontendEndpointLinks - READ-ONLY; Describes Frontend Endpoints associated with this Web Application Firewall policy. + FrontendEndpointLinks *[]FrontendEndpointLink `json:"frontendEndpointLinks,omitempty"` + // RoutingRuleLinks - READ-ONLY; Describes Routing Rules associated with this Web Application Firewall policy. + RoutingRuleLinks *[]RoutingRuleLink `json:"routingRuleLinks,omitempty"` + // SecurityPolicyLinks - READ-ONLY; Describes Security Policy associated with this Web Application Firewall policy. + SecurityPolicyLinks *[]SecurityPolicyLink `json:"securityPolicyLinks,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the policy. + ProvisioningState *string `json:"provisioningState,omitempty"` + // ResourceState - READ-ONLY; Possible values include: 'PolicyResourceStateCreating', 'PolicyResourceStateEnabling', 'PolicyResourceStateEnabled', 'PolicyResourceStateDisabling', 'PolicyResourceStateDisabled', 'PolicyResourceStateDeleting' + ResourceState PolicyResourceState `json:"resourceState,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyProperties. +func (wafpp WebApplicationFirewallPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafpp.PolicySettings != nil { + objectMap["policySettings"] = wafpp.PolicySettings + } + if wafpp.CustomRules != nil { + objectMap["customRules"] = wafpp.CustomRules + } + if wafpp.ManagedRules != nil { + objectMap["managedRules"] = wafpp.ManagedRules + } + return json.Marshal(objectMap) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailability.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailability.go new file mode 100644 index 000000000000..22b2c5d9e9a0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailability.go @@ -0,0 +1,110 @@ +package frontdoor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// NameAvailabilityClient is the frontDoor Client +type NameAvailabilityClient struct { + BaseClient +} + +// NewNameAvailabilityClient creates an instance of the NameAvailabilityClient client. +func NewNameAvailabilityClient(subscriptionID string) NameAvailabilityClient { + return NewNameAvailabilityClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNameAvailabilityClientWithBaseURI creates an instance of the NameAvailabilityClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewNameAvailabilityClientWithBaseURI(baseURI string, subscriptionID string) NameAvailabilityClient { + return NameAvailabilityClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Check check the availability of a Front Door resource name. +// Parameters: +// checkFrontDoorNameAvailabilityInput - input to check. +func (client NameAvailabilityClient) Check(ctx context.Context, checkFrontDoorNameAvailabilityInput CheckNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NameAvailabilityClient.Check") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: checkFrontDoorNameAvailabilityInput, + Constraints: []validation.Constraint{{Target: "checkFrontDoorNameAvailabilityInput.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.NameAvailabilityClient", "Check", err.Error()) + } + + req, err := client.CheckPreparer(ctx, checkFrontDoorNameAvailabilityInput) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NameAvailabilityClient", "Check", nil, "Failure preparing request") + return + } + + resp, err := client.CheckSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.NameAvailabilityClient", "Check", resp, "Failure sending request") + return + } + + result, err = client.CheckResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NameAvailabilityClient", "Check", resp, "Failure responding to request") + return + } + + return +} + +// CheckPreparer prepares the Check request. +func (client NameAvailabilityClient) CheckPreparer(ctx context.Context, checkFrontDoorNameAvailabilityInput CheckNameAvailabilityInput) (*http.Request, error) { + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Network/checkFrontDoorNameAvailability"), + autorest.WithJSON(checkFrontDoorNameAvailabilityInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckSender sends the Check request. The method will close the +// http.Response Body if it receives an error. +func (client NameAvailabilityClient) CheckSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CheckResponder handles the response to the Check request. The method always +// closes the http.Response Body. +func (client NameAvailabilityClient) CheckResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailabilitywithsubscription.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailabilitywithsubscription.go new file mode 100644 index 000000000000..9a6a389f05e2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/nameavailabilitywithsubscription.go @@ -0,0 +1,114 @@ +package frontdoor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// NameAvailabilityWithSubscriptionClient is the frontDoor Client +type NameAvailabilityWithSubscriptionClient struct { + BaseClient +} + +// NewNameAvailabilityWithSubscriptionClient creates an instance of the NameAvailabilityWithSubscriptionClient client. +func NewNameAvailabilityWithSubscriptionClient(subscriptionID string) NameAvailabilityWithSubscriptionClient { + return NewNameAvailabilityWithSubscriptionClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNameAvailabilityWithSubscriptionClientWithBaseURI creates an instance of the +// NameAvailabilityWithSubscriptionClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewNameAvailabilityWithSubscriptionClientWithBaseURI(baseURI string, subscriptionID string) NameAvailabilityWithSubscriptionClient { + return NameAvailabilityWithSubscriptionClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Check check the availability of a Front Door subdomain. +// Parameters: +// checkFrontDoorNameAvailabilityInput - input to check. +func (client NameAvailabilityWithSubscriptionClient) Check(ctx context.Context, checkFrontDoorNameAvailabilityInput CheckNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NameAvailabilityWithSubscriptionClient.Check") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: checkFrontDoorNameAvailabilityInput, + Constraints: []validation.Constraint{{Target: "checkFrontDoorNameAvailabilityInput.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.NameAvailabilityWithSubscriptionClient", "Check", err.Error()) + } + + req, err := client.CheckPreparer(ctx, checkFrontDoorNameAvailabilityInput) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NameAvailabilityWithSubscriptionClient", "Check", nil, "Failure preparing request") + return + } + + resp, err := client.CheckSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.NameAvailabilityWithSubscriptionClient", "Check", resp, "Failure sending request") + return + } + + result, err = client.CheckResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NameAvailabilityWithSubscriptionClient", "Check", resp, "Failure responding to request") + return + } + + return +} + +// CheckPreparer prepares the Check request. +func (client NameAvailabilityWithSubscriptionClient) CheckPreparer(ctx context.Context, checkFrontDoorNameAvailabilityInput CheckNameAvailabilityInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/checkFrontDoorNameAvailability", pathParameters), + autorest.WithJSON(checkFrontDoorNameAvailabilityInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckSender sends the Check request. The method will close the +// http.Response Body if it receives an error. +func (client NameAvailabilityWithSubscriptionClient) CheckSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckResponder handles the response to the Check request. The method always +// closes the http.Response Body. +func (client NameAvailabilityWithSubscriptionClient) CheckResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/networkexperimentprofiles.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/networkexperimentprofiles.go new file mode 100644 index 000000000000..5624dbd4b6a2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/networkexperimentprofiles.go @@ -0,0 +1,628 @@ +package frontdoor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// NetworkExperimentProfilesClient is the frontDoor Client +type NetworkExperimentProfilesClient struct { + BaseClient +} + +// NewNetworkExperimentProfilesClient creates an instance of the NetworkExperimentProfilesClient client. +func NewNetworkExperimentProfilesClient(subscriptionID string) NetworkExperimentProfilesClient { + return NewNetworkExperimentProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNetworkExperimentProfilesClientWithBaseURI creates an instance of the NetworkExperimentProfilesClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewNetworkExperimentProfilesClientWithBaseURI(baseURI string, subscriptionID string) NetworkExperimentProfilesClient { + return NetworkExperimentProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// profileName - the Profile identifier associated with the Tenant and Partner +// resourceGroupName - name of the Resource group within the Azure subscription. +// parameters - an Network Experiment Profile +func (client NetworkExperimentProfilesClient) CreateOrUpdate(ctx context.Context, profileName string, resourceGroupName string, parameters Profile) (result NetworkExperimentProfilesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: profileName, + Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.NetworkExperimentProfilesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, profileName, resourceGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client NetworkExperimentProfilesClient) CreateOrUpdatePreparer(ctx context.Context, profileName string, resourceGroupName string, parameters Profile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkExperimentProfilesClient) CreateOrUpdateSender(req *http.Request) (future NetworkExperimentProfilesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client NetworkExperimentProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - the Profile identifier associated with the Tenant and Partner +func (client NetworkExperimentProfilesClient) Delete(ctx context.Context, resourceGroupName string, profileName string) (result NetworkExperimentProfilesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: profileName, + Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.NetworkExperimentProfilesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client NetworkExperimentProfilesClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkExperimentProfilesClient) DeleteSender(req *http.Request) (future NetworkExperimentProfilesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client NetworkExperimentProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - the Profile identifier associated with the Tenant and Partner +func (client NetworkExperimentProfilesClient) Get(ctx context.Context, resourceGroupName string, profileName string) (result Profile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: profileName, + Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.NetworkExperimentProfilesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client NetworkExperimentProfilesClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkExperimentProfilesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client NetworkExperimentProfilesClient) GetResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client NetworkExperimentProfilesClient) List(ctx context.Context) (result ProfileListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.List") + defer func() { + sc := -1 + if result.pl.Response.Response != nil { + sc = result.pl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "List", resp, "Failure sending request") + return + } + + result.pl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "List", resp, "Failure responding to request") + return + } + if result.pl.hasNextLink() && result.pl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client NetworkExperimentProfilesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/NetworkExperimentProfiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkExperimentProfilesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client NetworkExperimentProfilesClient) ListResponder(resp *http.Response) (result ProfileList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client NetworkExperimentProfilesClient) listNextResults(ctx context.Context, lastResults ProfileList) (result ProfileList, err error) { + req, err := lastResults.profileListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client NetworkExperimentProfilesClient) ListComplete(ctx context.Context) (result ProfileListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup sends the list by resource group request. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +func (client NetworkExperimentProfilesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ProfileListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.pl.Response.Response != nil { + sc = result.pl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.NetworkExperimentProfilesClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.pl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.pl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.pl.hasNextLink() && result.pl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client NetworkExperimentProfilesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkExperimentProfilesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client NetworkExperimentProfilesClient) ListByResourceGroupResponder(resp *http.Response) (result ProfileList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client NetworkExperimentProfilesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ProfileList) (result ProfileList, err error) { + req, err := lastResults.profileListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client NetworkExperimentProfilesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ProfileListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Update updates an NetworkExperimentProfiles +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - the Profile identifier associated with the Tenant and Partner +// parameters - the Profile Update Model +func (client NetworkExperimentProfilesClient) Update(ctx context.Context, resourceGroupName string, profileName string, parameters ProfileUpdateModel) (result NetworkExperimentProfilesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NetworkExperimentProfilesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: profileName, + Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.NetworkExperimentProfilesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.NetworkExperimentProfilesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client NetworkExperimentProfilesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, parameters ProfileUpdateModel) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkExperimentProfilesClient) UpdateSender(req *http.Request) (future NetworkExperimentProfilesUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client NetworkExperimentProfilesClient) UpdateResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/policies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/policies.go new file mode 100644 index 000000000000..10dfed377773 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/policies.go @@ -0,0 +1,429 @@ +package frontdoor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PoliciesClient is the frontDoor Client +type PoliciesClient struct { + BaseClient +} + +// NewPoliciesClient creates an instance of the PoliciesClient client. +func NewPoliciesClient(subscriptionID string) PoliciesClient { + return NewPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPoliciesClientWithBaseURI creates an instance of the PoliciesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewPoliciesClientWithBaseURI(baseURI string, subscriptionID string) PoliciesClient { + return PoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update policy with specified rule set name within a resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// policyName - the name of the Web Application Firewall Policy. +// parameters - policy to be created. +func (client PoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, policyName string, parameters WebApplicationFirewallPolicy) (result PoliciesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: policyName, + Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyProperties.PolicySettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyProperties.PolicySettings.CustomBlockResponseBody", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyProperties.PolicySettings.CustomBlockResponseBody", Name: validation.Pattern, Rule: `^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$`, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("frontdoor.PoliciesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, policyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, policyName string, parameters WebApplicationFirewallPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) CreateOrUpdateSender(req *http.Request) (future PoliciesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result WebApplicationFirewallPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes Policy +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// policyName - the name of the Web Application Firewall Policy. +func (client PoliciesClient) Delete(ctx context.Context, resourceGroupName string, policyName string) (result PoliciesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: policyName, + Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.PoliciesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, policyName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, policyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) DeleteSender(req *http.Request) (future PoliciesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve protection policy with specified name within a resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// policyName - the name of the Web Application Firewall Policy. +func (client PoliciesClient) Get(ctx context.Context, resourceGroupName string, policyName string) (result WebApplicationFirewallPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: policyName, + Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.PoliciesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, policyName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, policyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PoliciesClient) GetResponder(resp *http.Response) (result WebApplicationFirewallPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the protection policies within a resource group. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +func (client PoliciesClient) List(ctx context.Context, resourceGroupName string) (result WebApplicationFirewallPolicyListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.List") + defer func() { + sc := -1 + if result.wafpl.Response.Response != nil { + sc = result.wafpl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.PoliciesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.wafpl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "List", resp, "Failure sending request") + return + } + + result.wafpl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "List", resp, "Failure responding to request") + return + } + if result.wafpl.hasNextLink() && result.wafpl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PoliciesClient) ListResponder(resp *http.Response) (result WebApplicationFirewallPolicyList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PoliciesClient) listNextResults(ctx context.Context, lastResults WebApplicationFirewallPolicyList) (result WebApplicationFirewallPolicyList, err error) { + req, err := lastResults.webApplicationFirewallPolicyListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.PoliciesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PoliciesClient) ListComplete(ctx context.Context, resourceGroupName string) (result WebApplicationFirewallPolicyListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/preconfiguredendpoints.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/preconfiguredendpoints.go new file mode 100644 index 000000000000..d84ba2d8e6fd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/preconfiguredendpoints.go @@ -0,0 +1,161 @@ +package frontdoor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PreconfiguredEndpointsClient is the frontDoor Client +type PreconfiguredEndpointsClient struct { + BaseClient +} + +// NewPreconfiguredEndpointsClient creates an instance of the PreconfiguredEndpointsClient client. +func NewPreconfiguredEndpointsClient(subscriptionID string) PreconfiguredEndpointsClient { + return NewPreconfiguredEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPreconfiguredEndpointsClientWithBaseURI creates an instance of the PreconfiguredEndpointsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewPreconfiguredEndpointsClientWithBaseURI(baseURI string, subscriptionID string) PreconfiguredEndpointsClient { + return PreconfiguredEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List sends the list request. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - the Profile identifier associated with the Tenant and Partner +func (client PreconfiguredEndpointsClient) List(ctx context.Context, resourceGroupName string, profileName string) (result PreconfiguredEndpointListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PreconfiguredEndpointsClient.List") + defer func() { + sc := -1 + if result.pel.Response.Response != nil { + sc = result.pel.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: profileName, + Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.PreconfiguredEndpointsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.PreconfiguredEndpointsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pel.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.PreconfiguredEndpointsClient", "List", resp, "Failure sending request") + return + } + + result.pel, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.PreconfiguredEndpointsClient", "List", resp, "Failure responding to request") + return + } + if result.pel.hasNextLink() && result.pel.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PreconfiguredEndpointsClient) ListPreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/PreconfiguredEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PreconfiguredEndpointsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PreconfiguredEndpointsClient) ListResponder(resp *http.Response) (result PreconfiguredEndpointList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PreconfiguredEndpointsClient) listNextResults(ctx context.Context, lastResults PreconfiguredEndpointList) (result PreconfiguredEndpointList, err error) { + req, err := lastResults.preconfiguredEndpointListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "frontdoor.PreconfiguredEndpointsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "frontdoor.PreconfiguredEndpointsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.PreconfiguredEndpointsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PreconfiguredEndpointsClient) ListComplete(ctx context.Context, resourceGroupName string, profileName string) (result PreconfiguredEndpointListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PreconfiguredEndpointsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, profileName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/reports.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/reports.go new file mode 100644 index 000000000000..3a95b12e4389 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/reports.go @@ -0,0 +1,241 @@ +package frontdoor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ReportsClient is the frontDoor Client +type ReportsClient struct { + BaseClient +} + +// NewReportsClient creates an instance of the ReportsClient client. +func NewReportsClient(subscriptionID string) ReportsClient { + return NewReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewReportsClientWithBaseURI creates an instance of the ReportsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewReportsClientWithBaseURI(baseURI string, subscriptionID string) ReportsClient { + return ReportsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetLatencyScorecards sends the get latency scorecards request. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - the Profile identifier associated with the Tenant and Partner +// experimentName - the Experiment identifier associated with the Experiment +// aggregationInterval - the aggregation interval of the Latency Scorecard +// endDateTimeUTC - the end DateTime of the Latency Scorecard in UTC +// country - the country associated with the Latency Scorecard. Values are country ISO codes as specified here- +// https://www.iso.org/iso-3166-country-codes.html +func (client ReportsClient) GetLatencyScorecards(ctx context.Context, resourceGroupName string, profileName string, experimentName string, aggregationInterval LatencyScorecardAggregationInterval, endDateTimeUTC string, country string) (result LatencyScorecard, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.GetLatencyScorecards") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: profileName, + Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: experimentName, + Constraints: []validation.Constraint{{Target: "experimentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.ReportsClient", "GetLatencyScorecards", err.Error()) + } + + req, err := client.GetLatencyScorecardsPreparer(ctx, resourceGroupName, profileName, experimentName, aggregationInterval, endDateTimeUTC, country) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ReportsClient", "GetLatencyScorecards", nil, "Failure preparing request") + return + } + + resp, err := client.GetLatencyScorecardsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.ReportsClient", "GetLatencyScorecards", resp, "Failure sending request") + return + } + + result, err = client.GetLatencyScorecardsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ReportsClient", "GetLatencyScorecards", resp, "Failure responding to request") + return + } + + return +} + +// GetLatencyScorecardsPreparer prepares the GetLatencyScorecards request. +func (client ReportsClient) GetLatencyScorecardsPreparer(ctx context.Context, resourceGroupName string, profileName string, experimentName string, aggregationInterval LatencyScorecardAggregationInterval, endDateTimeUTC string, country string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "experimentName": autorest.Encode("path", experimentName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-11-01" + queryParameters := map[string]interface{}{ + "aggregationInterval": autorest.Encode("query", aggregationInterval), + "api-version": APIVersion, + } + if len(endDateTimeUTC) > 0 { + queryParameters["endDateTimeUTC"] = autorest.Encode("query", endDateTimeUTC) + } + if len(country) > 0 { + queryParameters["country"] = autorest.Encode("query", country) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}/LatencyScorecard", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLatencyScorecardsSender sends the GetLatencyScorecards request. The method will close the +// http.Response Body if it receives an error. +func (client ReportsClient) GetLatencyScorecardsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetLatencyScorecardsResponder handles the response to the GetLatencyScorecards request. The method always +// closes the http.Response Body. +func (client ReportsClient) GetLatencyScorecardsResponder(resp *http.Response) (result LatencyScorecard, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTimeseries sends the get timeseries request. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// profileName - the Profile identifier associated with the Tenant and Partner +// experimentName - the Experiment identifier associated with the Experiment +// startDateTimeUTC - the start DateTime of the Timeseries in UTC +// endDateTimeUTC - the end DateTime of the Timeseries in UTC +// aggregationInterval - the aggregation interval of the Timeseries +// timeseriesType - the type of Timeseries +// endpoint - the specific endpoint +// country - the country associated with the Timeseries. Values are country ISO codes as specified here- +// https://www.iso.org/iso-3166-country-codes.html +func (client ReportsClient) GetTimeseries(ctx context.Context, resourceGroupName string, profileName string, experimentName string, startDateTimeUTC date.Time, endDateTimeUTC date.Time, aggregationInterval TimeseriesAggregationInterval, timeseriesType TimeseriesType, endpoint string, country string) (result Timeseries, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.GetTimeseries") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: profileName, + Constraints: []validation.Constraint{{Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: experimentName, + Constraints: []validation.Constraint{{Target: "experimentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.ReportsClient", "GetTimeseries", err.Error()) + } + + req, err := client.GetTimeseriesPreparer(ctx, resourceGroupName, profileName, experimentName, startDateTimeUTC, endDateTimeUTC, aggregationInterval, timeseriesType, endpoint, country) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ReportsClient", "GetTimeseries", nil, "Failure preparing request") + return + } + + resp, err := client.GetTimeseriesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.ReportsClient", "GetTimeseries", resp, "Failure sending request") + return + } + + result, err = client.GetTimeseriesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.ReportsClient", "GetTimeseries", resp, "Failure responding to request") + return + } + + return +} + +// GetTimeseriesPreparer prepares the GetTimeseries request. +func (client ReportsClient) GetTimeseriesPreparer(ctx context.Context, resourceGroupName string, profileName string, experimentName string, startDateTimeUTC date.Time, endDateTimeUTC date.Time, aggregationInterval TimeseriesAggregationInterval, timeseriesType TimeseriesType, endpoint string, country string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "experimentName": autorest.Encode("path", experimentName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-11-01" + queryParameters := map[string]interface{}{ + "aggregationInterval": autorest.Encode("query", aggregationInterval), + "api-version": APIVersion, + "endDateTimeUTC": autorest.Encode("query", endDateTimeUTC), + "startDateTimeUTC": autorest.Encode("query", startDateTimeUTC), + "timeseriesType": autorest.Encode("query", timeseriesType), + } + if len(endpoint) > 0 { + queryParameters["endpoint"] = autorest.Encode("query", endpoint) + } + if len(country) > 0 { + queryParameters["country"] = autorest.Encode("query", country) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}/Timeseries", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetTimeseriesSender sends the GetTimeseries request. The method will close the +// http.Response Body if it receives an error. +func (client ReportsClient) GetTimeseriesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetTimeseriesResponder handles the response to the GetTimeseries request. The method always +// closes the http.Response Body. +func (client ReportsClient) GetTimeseriesResponder(resp *http.Response) (result Timeseries, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/rulesengines.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/rulesengines.go new file mode 100644 index 000000000000..e2dfce931a63 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/rulesengines.go @@ -0,0 +1,456 @@ +package frontdoor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RulesEnginesClient is the frontDoor Client +type RulesEnginesClient struct { + BaseClient +} + +// NewRulesEnginesClient creates an instance of the RulesEnginesClient client. +func NewRulesEnginesClient(subscriptionID string) RulesEnginesClient { + return NewRulesEnginesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRulesEnginesClientWithBaseURI creates an instance of the RulesEnginesClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewRulesEnginesClientWithBaseURI(baseURI string, subscriptionID string) RulesEnginesClient { + return RulesEnginesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a new Rules Engine Configuration with the specified name within the specified Front Door. +// Parameters: +// 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. +// rulesEngineParameters - rules Engine Configuration properties needed to create a new Rules Engine +// Configuration. +func (client RulesEnginesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, frontDoorName string, rulesEngineName string, rulesEngineParameters RulesEngine) (result RulesEnginesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesEnginesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: frontDoorName, + Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, + {TargetValue: rulesEngineName, + Constraints: []validation.Constraint{{Target: "rulesEngineName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "rulesEngineName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "rulesEngineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.RulesEnginesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, frontDoorName, rulesEngineName, rulesEngineParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RulesEnginesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, frontDoorName string, rulesEngineName string, rulesEngineParameters RulesEngine) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "frontDoorName": autorest.Encode("path", frontDoorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "rulesEngineName": autorest.Encode("path", rulesEngineName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + rulesEngineParameters.Name = nil + rulesEngineParameters.Type = nil + rulesEngineParameters.ID = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}", pathParameters), + autorest.WithJSON(rulesEngineParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RulesEnginesClient) CreateOrUpdateSender(req *http.Request) (future RulesEnginesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RulesEnginesClient) CreateOrUpdateResponder(resp *http.Response) (result RulesEngine, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing Rules Engine Configuration with the specified parameters. +// Parameters: +// 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. +func (client RulesEnginesClient) Delete(ctx context.Context, resourceGroupName string, frontDoorName string, rulesEngineName string) (result RulesEnginesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesEnginesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: frontDoorName, + Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, + {TargetValue: rulesEngineName, + Constraints: []validation.Constraint{{Target: "rulesEngineName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "rulesEngineName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "rulesEngineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.RulesEnginesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, frontDoorName, rulesEngineName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RulesEnginesClient) DeletePreparer(ctx context.Context, resourceGroupName string, frontDoorName string, rulesEngineName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "frontDoorName": autorest.Encode("path", frontDoorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "rulesEngineName": autorest.Encode("path", rulesEngineName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RulesEnginesClient) DeleteSender(req *http.Request) (future RulesEnginesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RulesEnginesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a Rules Engine Configuration with the specified name within the specified Front Door. +// Parameters: +// 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. +func (client RulesEnginesClient) Get(ctx context.Context, resourceGroupName string, frontDoorName string, rulesEngineName string) (result RulesEngine, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesEnginesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: frontDoorName, + Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}, + {TargetValue: rulesEngineName, + Constraints: []validation.Constraint{{Target: "rulesEngineName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "rulesEngineName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "rulesEngineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.RulesEnginesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, frontDoorName, rulesEngineName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RulesEnginesClient) GetPreparer(ctx context.Context, resourceGroupName string, frontDoorName string, rulesEngineName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "frontDoorName": autorest.Encode("path", frontDoorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "rulesEngineName": autorest.Encode("path", rulesEngineName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RulesEnginesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RulesEnginesClient) GetResponder(resp *http.Response) (result RulesEngine, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByFrontDoor lists all of the Rules Engine Configurations within a Front Door. +// Parameters: +// resourceGroupName - name of the Resource group within the Azure subscription. +// frontDoorName - name of the Front Door which is globally unique. +func (client RulesEnginesClient) ListByFrontDoor(ctx context.Context, resourceGroupName string, frontDoorName string) (result RulesEngineListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesEnginesClient.ListByFrontDoor") + defer func() { + sc := -1 + if result.relr.Response.Response != nil { + sc = result.relr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 80, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_\-\(\)\.]*[^\.]$`, Chain: nil}}}, + {TargetValue: frontDoorName, + Constraints: []validation.Constraint{{Target: "frontDoorName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "frontDoorName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "frontDoorName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("frontdoor.RulesEnginesClient", "ListByFrontDoor", err.Error()) + } + + result.fn = client.listByFrontDoorNextResults + req, err := client.ListByFrontDoorPreparer(ctx, resourceGroupName, frontDoorName) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "ListByFrontDoor", nil, "Failure preparing request") + return + } + + resp, err := client.ListByFrontDoorSender(req) + if err != nil { + result.relr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "ListByFrontDoor", resp, "Failure sending request") + return + } + + result.relr, err = client.ListByFrontDoorResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "ListByFrontDoor", resp, "Failure responding to request") + return + } + if result.relr.hasNextLink() && result.relr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByFrontDoorPreparer prepares the ListByFrontDoor request. +func (client RulesEnginesClient) ListByFrontDoorPreparer(ctx context.Context, resourceGroupName string, frontDoorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "frontDoorName": autorest.Encode("path", frontDoorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByFrontDoorSender sends the ListByFrontDoor request. The method will close the +// http.Response Body if it receives an error. +func (client RulesEnginesClient) ListByFrontDoorSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByFrontDoorResponder handles the response to the ListByFrontDoor request. The method always +// closes the http.Response Body. +func (client RulesEnginesClient) ListByFrontDoorResponder(resp *http.Response) (result RulesEngineListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByFrontDoorNextResults retrieves the next set of results, if any. +func (client RulesEnginesClient) listByFrontDoorNextResults(ctx context.Context, lastResults RulesEngineListResult) (result RulesEngineListResult, err error) { + req, err := lastResults.rulesEngineListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "listByFrontDoorNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByFrontDoorSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "listByFrontDoorNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByFrontDoorResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoor.RulesEnginesClient", "listByFrontDoorNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByFrontDoorComplete enumerates all values, automatically crossing page boundaries as required. +func (client RulesEnginesClient) ListByFrontDoorComplete(ctx context.Context, resourceGroupName string, frontDoorName string) (result RulesEngineListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RulesEnginesClient.ListByFrontDoor") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByFrontDoor(ctx, resourceGroupName, frontDoorName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/version.go new file mode 100644 index 000000000000..3a49dda71277 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor/version.go @@ -0,0 +1,19 @@ +package frontdoor + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " frontdoor/2020-11-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/vendor/modules.txt b/vendor/modules.txt index f0412294bc60..e1999faab671 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -11,6 +11,7 @@ github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurest github.com/Azure/azure-sdk-for-go/services/batch/2020-03-01.11.0/batch github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2021-06-01/batch github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn +github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute github.com/Azure/azure-sdk-for-go/services/consumption/mgmt/2019-10-01/consumption @@ -27,6 +28,7 @@ github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitalt github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2021-12-01/eventgrid +github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration github.com/Azure/azure-sdk-for-go/services/hdinsight/mgmt/2018-06-01/hdinsight From 755dffebbdf80d408105fd3994d781fcbbdd22b8 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Wed, 1 Jun 2022 18:01:04 +0200 Subject: [PATCH 3/7] New Resource: `azurerm_cdn_frontdoor_profile` Splitting out from #16671 Co-authored-by: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> --- .../cdn/cdn_frontdoor_profile_resource.go | 209 ++++++++++++++++ .../cdn_frontdoor_profile_resource_test.go | 180 ++++++++++++++ .../services/cdn/parse/front_door_profile.go | 113 +++++++++ .../cdn/parse/front_door_profile_test.go | 229 ++++++++++++++++++ internal/services/cdn/registration.go | 4 + internal/services/cdn/resourceids.go | 4 + .../services/cdn/validate/front_door_name.go | 15 ++ .../cdn/validate/front_door_profile_id.go | 23 ++ .../validate/front_door_profile_id_test.go | 76 ++++++ .../r/cdn_frontdoor_profile.html.markdown | 69 ++++++ 10 files changed, 922 insertions(+) create mode 100644 internal/services/cdn/cdn_frontdoor_profile_resource.go create mode 100644 internal/services/cdn/cdn_frontdoor_profile_resource_test.go create mode 100644 internal/services/cdn/parse/front_door_profile.go create mode 100644 internal/services/cdn/parse/front_door_profile_test.go create mode 100644 internal/services/cdn/validate/front_door_name.go create mode 100644 internal/services/cdn/validate/front_door_profile_id.go create mode 100644 internal/services/cdn/validate/front_door_profile_id_test.go create mode 100644 website/docs/r/cdn_frontdoor_profile.html.markdown diff --git a/internal/services/cdn/cdn_frontdoor_profile_resource.go b/internal/services/cdn/cdn_frontdoor_profile_resource.go new file mode 100644 index 000000000000..c7d2fdcac852 --- /dev/null +++ b/internal/services/cdn/cdn_frontdoor_profile_resource.go @@ -0,0 +1,209 @@ +package cdn + +import ( + "fmt" + "time" + + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tags" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceCdnFrontDoorProfile() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceCdnFrontDoorProfileCreate, + Read: resourceCdnFrontDoorProfileRead, + Update: resourceCdnFrontDoorProfileUpdate, + Delete: resourceCdnFrontDoorProfileDelete, + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Update: pluginsdk.DefaultTimeout(30 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.FrontDoorProfileID(id) + return err + }), + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.FrontDoorName, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "response_timeout_seconds": { + Type: pluginsdk.TypeInt, + Optional: true, + ForceNew: true, + Default: 120, + ValidateFunc: validation.IntBetween(16, 240), + }, + + "sku_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.SkuNamePremiumAzureFrontDoor), + string(cdn.SkuNameStandardAzureFrontDoor), + }, false), + }, + + "tags": commonschema.Tags(), + + "resource_guid": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + } +} + +func resourceCdnFrontDoorProfileCreate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorProfileClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id := parse.NewFrontDoorProfileID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + existing, err := client.Get(ctx, id.ResourceGroup, id.ProfileName) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + } + + if !utils.ResponseWasNotFound(existing.Response) { + return tf.ImportAsExistsError("azurerm_cdn_frontdoor_profile", id.ID()) + } + + props := cdn.Profile{ + Location: utils.String(location.Normalize("global")), + ProfileProperties: &cdn.ProfileProperties{ + OriginResponseTimeoutSeconds: utils.Int32(int32(d.Get("response_timeout_seconds").(int))), + }, + Sku: &cdn.Sku{ + Name: cdn.SkuName(d.Get("sku_name").(string)), + }, + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + } + + future, err := client.Create(ctx, id.ResourceGroup, id.ProfileName, props) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the creation of %s: %+v", id, err) + } + + d.SetId(id.ID()) + return resourceCdnFrontDoorProfileRead(d, meta) +} + +func resourceCdnFrontDoorProfileRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorProfileClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.FrontDoorProfileID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + d.SetId("") + return nil + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + d.Set("name", id.ProfileName) + d.Set("resource_group_name", id.ResourceGroup) + + if props := resp.ProfileProperties; props != nil { + d.Set("response_timeout_seconds", props.OriginResponseTimeoutSeconds) + + // whilst this is returned in the API as FrontDoorID other resources refer to + // this as the Resource GUID, so we will for consistency + d.Set("resource_guid", props.FrontDoorID) + } + + skuName := "" + if resp.Sku != nil { + skuName = string(resp.Sku.Name) + } + d.Set("sku_name", skuName) + + if err := tags.FlattenAndSet(d, resp.Tags); err != nil { + return err + } + + return nil +} + +func resourceCdnFrontDoorProfileUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorProfileClient + ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.FrontDoorProfileID(d.Id()) + if err != nil { + return err + } + + props := cdn.ProfileUpdateParameters{ + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + } + + future, err := client.Update(ctx, id.ResourceGroup, id.ProfileName, props) + if err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the update of %s: %+v", *id, err) + } + + return resourceCdnFrontDoorProfileRead(d, meta) +} + +func resourceCdnFrontDoorProfileDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorProfileClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.FrontDoorProfileID(d.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.ProfileName) + if err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) + } + + return nil +} diff --git a/internal/services/cdn/cdn_frontdoor_profile_resource_test.go b/internal/services/cdn/cdn_frontdoor_profile_resource_test.go new file mode 100644 index 000000000000..daaecca10c82 --- /dev/null +++ b/internal/services/cdn/cdn_frontdoor_profile_resource_test.go @@ -0,0 +1,180 @@ +package cdn_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type CdnFrontDoorProfileResource struct{} + +func TestAccCdnFrontDoorProfile_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_cdn_frontdoor_profile", "test") + r := CdnFrontDoorProfileResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccCdnFrontDoorProfile_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_cdn_frontdoor_profile", "test") + r := CdnFrontDoorProfileResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccCdnFrontDoorProfile_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_cdn_frontdoor_profile", "test") + r := CdnFrontDoorProfileResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccCdnFrontDoorProfile_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_cdn_frontdoor_profile", "test") + r := CdnFrontDoorProfileResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r CdnFrontDoorProfileResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := parse.FrontDoorProfileID(state.ID) + if err != nil { + return nil, err + } + + client := clients.Cdn.FrontDoorProfileClient + resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(true), nil +} + +func (r CdnFrontDoorProfileResource) basic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_cdn_frontdoor_profile" "test" { + name = "acctestprofile-%d" + resource_group_name = azurerm_resource_group.test.name + sku_name = "Standard_AzureFrontDoor" +} +`, template, data.RandomInteger) +} + +func (r CdnFrontDoorProfileResource) requiresImport(data acceptance.TestData) string { + config := r.basic(data) + return fmt.Sprintf(` +%s + +resource "azurerm_cdn_frontdoor_profile" "import" { + name = azurerm_cdn_frontdoor_profile.test.name + resource_group_name = azurerm_cdn_frontdoor_profile.test.resource_group_name + sku_name = azurerm_cdn_frontdoor_profile.test.sku_name +} +`, config) +} + +func (r CdnFrontDoorProfileResource) complete(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_cdn_frontdoor_profile" "test" { + name = "acctestprofile-%d" + resource_group_name = azurerm_resource_group.test.name + response_timeout_seconds = 240 + sku_name = "Premium_AzureFrontDoor" + + tags = { + ENV = "Test" + } +} +`, template, data.RandomInteger) +} + +func (r CdnFrontDoorProfileResource) update(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_cdn_frontdoor_profile" "test" { + name = "acctest-c-%d" + resource_group_name = azurerm_resource_group.test.name + + response_timeout_seconds = 120 + sku_name = "Premium_AzureFrontDoor" + + tags = { + ENV = "Production" + } +} +`, template, data.RandomInteger) +} + +func (CdnFrontDoorProfileResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-cdn-afdx-%d" + location = "%s" +} +`, data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/cdn/parse/front_door_profile.go b/internal/services/cdn/parse/front_door_profile.go new file mode 100644 index 000000000000..b60285e018f1 --- /dev/null +++ b/internal/services/cdn/parse/front_door_profile.go @@ -0,0 +1,113 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type FrontDoorProfileId struct { + SubscriptionId string + ResourceGroup string + ProfileName string +} + +func NewFrontDoorProfileID(subscriptionId, resourceGroup, profileName string) FrontDoorProfileId { + return FrontDoorProfileId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + ProfileName: profileName, + } +} + +func (id FrontDoorProfileId) String() string { + segments := []string{ + fmt.Sprintf("Profile Name %q", id.ProfileName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Front Door Profile", segmentsStr) +} + +func (id FrontDoorProfileId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ProfileName) +} + +// FrontDoorProfileID parses a FrontDoorProfile ID into an FrontDoorProfileId struct +func FrontDoorProfileID(input string) (*FrontDoorProfileId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FrontDoorProfileId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.ProfileName, err = id.PopSegment("profiles"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} + +// FrontDoorProfileIDInsensitively parses an FrontDoorProfile ID into an FrontDoorProfileId struct, insensitively +// This should only be used to parse an ID for rewriting, the FrontDoorProfileID +// method should be used instead for validation etc. +// +// Whilst this may seem strange, this enables Terraform have consistent casing +// which works around issues in Core, whilst handling broken API responses. +func FrontDoorProfileIDInsensitively(input string) (*FrontDoorProfileId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FrontDoorProfileId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + // find the correct casing for the 'profiles' segment + profilesKey := "profiles" + for key := range id.Path { + if strings.EqualFold(key, profilesKey) { + profilesKey = key + break + } + } + if resourceId.ProfileName, err = id.PopSegment(profilesKey); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/internal/services/cdn/parse/front_door_profile_test.go b/internal/services/cdn/parse/front_door_profile_test.go new file mode 100644 index 000000000000..a05a36dac453 --- /dev/null +++ b/internal/services/cdn/parse/front_door_profile_test.go @@ -0,0 +1,229 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.Id = FrontDoorProfileId{} + +func TestFrontDoorProfileIDFormatter(t *testing.T) { + actual := NewFrontDoorProfileID("12345678-1234-9876-4563-123456789012", "resourceGroup1", "profile1").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/profile1" + if actual != expected { + t.Fatalf("Expected %q but got %q", expected, actual) + } +} + +func TestFrontDoorProfileID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *FrontDoorProfileId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing ProfileName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/", + Error: true, + }, + + { + // missing value for ProfileName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/profile1", + Expected: &FrontDoorProfileId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resourceGroup1", + ProfileName: "profile1", + }, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESOURCEGROUP1/PROVIDERS/MICROSOFT.CDN/PROFILES/PROFILE1", + Error: true, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := FrontDoorProfileID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.ProfileName != v.Expected.ProfileName { + t.Fatalf("Expected %q but got %q for ProfileName", v.Expected.ProfileName, actual.ProfileName) + } + } +} + +func TestFrontDoorProfileIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *FrontDoorProfileId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing ProfileName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/", + Error: true, + }, + + { + // missing value for ProfileName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/profile1", + Expected: &FrontDoorProfileId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resourceGroup1", + ProfileName: "profile1", + }, + }, + + { + // lower-cased segment names + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/profile1", + Expected: &FrontDoorProfileId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resourceGroup1", + ProfileName: "profile1", + }, + }, + + { + // upper-cased segment names + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/PROFILES/profile1", + Expected: &FrontDoorProfileId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resourceGroup1", + ProfileName: "profile1", + }, + }, + + { + // mixed-cased segment names + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/PrOfIlEs/profile1", + Expected: &FrontDoorProfileId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resourceGroup1", + ProfileName: "profile1", + }, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := FrontDoorProfileIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.ProfileName != v.Expected.ProfileName { + t.Fatalf("Expected %q but got %q for ProfileName", v.Expected.ProfileName, actual.ProfileName) + } + } +} diff --git a/internal/services/cdn/registration.go b/internal/services/cdn/registration.go index 3b28d43da40e..a91dcb922962 100644 --- a/internal/services/cdn/registration.go +++ b/internal/services/cdn/registration.go @@ -35,8 +35,12 @@ func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { // SupportedResources returns the supported Resources supported by this Service func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ + // CDN "azurerm_cdn_endpoint": resourceCdnEndpoint(), "azurerm_cdn_endpoint_custom_domain": resourceArmCdnEndpointCustomDomain(), "azurerm_cdn_profile": resourceCdnProfile(), + + // FrontDoor + "azurerm_cdn_frontdoor_profile": resourceCdnFrontDoorProfile(), } } diff --git a/internal/services/cdn/resourceids.go b/internal/services/cdn/resourceids.go index c45d62d7bb4d..e0e4828eda51 100644 --- a/internal/services/cdn/resourceids.go +++ b/internal/services/cdn/resourceids.go @@ -1,5 +1,9 @@ package cdn +// CDN //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Endpoint -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/endpoints/endpoint1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Profile -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=CustomDomain -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/endpoints/endpoint1/customDomains/domain1 + +// CDN FrontDoor +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorProfile -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/profile1 -rewrite=true diff --git a/internal/services/cdn/validate/front_door_name.go b/internal/services/cdn/validate/front_door_name.go new file mode 100644 index 000000000000..8f4f191f6a3e --- /dev/null +++ b/internal/services/cdn/validate/front_door_name.go @@ -0,0 +1,15 @@ +package validate + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" +) + +func FrontDoorName(i interface{}, k string) (_ []string, errors []error) { + if m, regexErrs := validate.RegExHelper(i, k, `^[\da-zA-Z][-\da-zA-Z]{0,88}[\da-zA-Z]$`); !m { + return nil, append(regexErrs, fmt.Errorf(`%q must be between 2 and 90 characters in length, begin with a letter or number, end with a letter or number and may contain only letters, numbers and hyphens, got %q`, k, i)) + } + + return nil, nil +} diff --git a/internal/services/cdn/validate/front_door_profile_id.go b/internal/services/cdn/validate/front_door_profile_id.go new file mode 100644 index 000000000000..74a70cb7f85c --- /dev/null +++ b/internal/services/cdn/validate/front_door_profile_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" +) + +func FrontDoorProfileID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.FrontDoorProfileID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/internal/services/cdn/validate/front_door_profile_id_test.go b/internal/services/cdn/validate/front_door_profile_id_test.go new file mode 100644 index 000000000000..a4aa17075a03 --- /dev/null +++ b/internal/services/cdn/validate/front_door_profile_id_test.go @@ -0,0 +1,76 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import "testing" + +func TestFrontDoorProfileID(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + + { + // empty + Input: "", + Valid: false, + }, + + { + // missing SubscriptionId + Input: "/", + Valid: false, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Valid: false, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Valid: false, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Valid: false, + }, + + { + // missing ProfileName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/", + Valid: false, + }, + + { + // missing value for ProfileName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/", + Valid: false, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/profile1", + Valid: true, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESOURCEGROUP1/PROVIDERS/MICROSOFT.CDN/PROFILES/PROFILE1", + Valid: false, + }, + } + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := FrontDoorProfileID(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} diff --git a/website/docs/r/cdn_frontdoor_profile.html.markdown b/website/docs/r/cdn_frontdoor_profile.html.markdown new file mode 100644 index 000000000000..3daa377ae55f --- /dev/null +++ b/website/docs/r/cdn_frontdoor_profile.html.markdown @@ -0,0 +1,69 @@ +--- +subcategory: "CDN" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_cdn_frontdoor_profile" +description: |- + Manages a CDN FrontDoor Profile which contains a collection of CDN FrontDoor Endpoints. +--- + +# azurerm_cdn_frontdoor_profile + +Manages a CDN FrontDoor Profile which contains a collection of CDN FrontDoor Endpoints. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_cdn_frontdoor_profile" "example" { + name = "example-cdn-profile" + resource_group_name = azurerm_resource_group.example.name + sku_name = "Standard_AzureFrontDoor" + + tags = { + environment = "Production" + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name of the FrontDoor Profile. Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of the Resource Group where this FrontDoor Profile should exist. Changing this forces a new resource to be created. + +* `sku_name` - (Required) Specifies the SKU for this CDN FrontDoor Profile. Possible values include `Standard_AzureFrontDoor` and `Premium_AzureFrontDoor`. Changing this forces a new resource to be created. + +* `response_timeout_seconds` - Specifies the maximum response timeout in seconds. Possible values are between `16` and `240` seconds (inclusive). Defaults to `120` seconds. + +* `tags` - (Optional) Specifies a mapping of tags to assign to the resource. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The ID of this CDN FrontDoor Profile. + +* `resource_guid` - The UUID of this CDN FrontDoor Profile. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the CDN FrontDoor Profile. +* `update` - (Defaults to 30 minutes) Used when updating the CDN FrontDoor Profile. +* `read` - (Defaults to 5 minutes) Used when retrieving the CDN FrontDoor Profile. +* `delete` - (Defaults to 30 minutes) Used when deleting the CDN FrontDoor Profile. + +## Import + +CDN FrontDoor Profiles can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_cdn_frontdoor_profile.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Cdn/profiles/myprofile1 +``` From 9caf3de53768038f9ed25895de03c566141124eb Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Wed, 1 Jun 2022 18:17:03 +0200 Subject: [PATCH 4/7] New Data Source: `azurerm_cdn_frontdoor_profile` Co-authored-by: Jeffrey Cline <20408400+WodansSon@users.noreply.github.com> --- .../cdn/cdn_frontdoor_profile_data_source.go | 91 +++++++++++++++++++ .../cdn_frontdoor_profile_data_source_test.go | 36 ++++++++ internal/services/cdn/registration.go | 4 + .../d/cdn_frontdoor_profile.html.markdown | 48 ++++++++++ 4 files changed, 179 insertions(+) create mode 100644 internal/services/cdn/cdn_frontdoor_profile_data_source.go create mode 100644 internal/services/cdn/cdn_frontdoor_profile_data_source_test.go create mode 100644 website/docs/d/cdn_frontdoor_profile.html.markdown diff --git a/internal/services/cdn/cdn_frontdoor_profile_data_source.go b/internal/services/cdn/cdn_frontdoor_profile_data_source.go new file mode 100644 index 000000000000..96c7077c07df --- /dev/null +++ b/internal/services/cdn/cdn_frontdoor_profile_data_source.go @@ -0,0 +1,91 @@ +package cdn + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tags" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func dataSourceCdnFrontDoorProfile() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceCdnFrontDoorProfileRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.FrontDoorName, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "response_timeout_seconds": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "sku_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + + "resource_guid": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + } +} + +func dataSourceCdnFrontDoorProfileRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorProfileClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id := parse.NewFrontDoorProfileID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + d.Set("name", id.ProfileName) + d.Set("resource_group_name", id.ResourceGroup) + + if props := resp.ProfileProperties; props != nil { + d.Set("response_timeout_seconds", props.OriginResponseTimeoutSeconds) + + // whilst this is returned in the API as FrontDoorID other resources refer to + // this as the Resource GUID, so we will for consistency + d.Set("resource_guid", props.FrontDoorID) + } + + skuName := "" + if resp.Sku != nil { + skuName = string(resp.Sku.Name) + } + d.Set("sku_name", skuName) + + if err := tags.FlattenAndSet(d, resp.Tags); err != nil { + return err + } + + return nil +} diff --git a/internal/services/cdn/cdn_frontdoor_profile_data_source_test.go b/internal/services/cdn/cdn_frontdoor_profile_data_source_test.go new file mode 100644 index 000000000000..03d89d04cb3a --- /dev/null +++ b/internal/services/cdn/cdn_frontdoor_profile_data_source_test.go @@ -0,0 +1,36 @@ +package cdn_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type CdnFrontDoorProfileDataSource struct{} + +func TestAccCdnFrontDoorProfileDataSource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_cdn_frontdoor_profile", "test") + d := CdnFrontDoorProfileDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: d.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("sku_name").HasValue("Standard_AzureFrontDoor"), + ), + }, + }) +} + +func (CdnFrontDoorProfileDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +data "azurerm_cdn_frontdoor_profile" "test" { + name = azurerm_cdn_frontdoor_profile.test.name + resource_group_name = azurerm_cdn_frontdoor_profile.test.name +} +`, CdnFrontDoorProfileResource{}.complete(data)) +} diff --git a/internal/services/cdn/registration.go b/internal/services/cdn/registration.go index a91dcb922962..a4ee7cd316ed 100644 --- a/internal/services/cdn/registration.go +++ b/internal/services/cdn/registration.go @@ -28,7 +28,11 @@ func (r Registration) WebsiteCategories() []string { // SupportedDataSources returns the supported Data Sources supported by this Service func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ + // CDN "azurerm_cdn_profile": dataSourceCdnProfile(), + + // FrontDoor + "azurerm_cdn_frontdoor_profile": dataSourceCdnFrontDoorProfile(), } } diff --git a/website/docs/d/cdn_frontdoor_profile.html.markdown b/website/docs/d/cdn_frontdoor_profile.html.markdown new file mode 100644 index 000000000000..3b772f679c4c --- /dev/null +++ b/website/docs/d/cdn_frontdoor_profile.html.markdown @@ -0,0 +1,48 @@ +--- +subcategory: "CDN" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_cdn_frontdoor_profile" +description: |- + Gets information about an existing CDN FrontDoor Profile. +--- + +# Data Source: azurerm_cdn_frontdoor_profile + +Use this data source to access information about an existing CDN FrontDoor Profile. + +## Example Usage + +```hcl +data "azurerm_cdn_frontdoor_profile" "example" { + name = "existing-cdn-profile" + resource_group_name = "existing-resources" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name of the FrontDoor Profile. + +* `resource_group_name` - (Required) The name of the Resource Group where this FrontDoor Profile exists. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The ID of this CDN FrontDoor Profile. + +* `resource_guid` - The UUID of this CDN FrontDoor Profile. + +* `sku_name` - Specifies the SKU for this CDN FrontDoor Profile. + +* `response_timeout_seconds` - Specifies the maximum response timeout in seconds. + +* `tags` - Specifies a mapping of Tags assigned to this CDN FrontDoor Profile. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the CDN FrontDoor Profile. From 434a168efb7ec715b6b539bf410a9f495eb25911 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Wed, 1 Jun 2022 18:19:31 +0200 Subject: [PATCH 5/7] r/cdn_frontdoor_profile: clarifying attributes and arguments --- website/docs/r/cdn_frontdoor_profile.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/cdn_frontdoor_profile.html.markdown b/website/docs/r/cdn_frontdoor_profile.html.markdown index 3daa377ae55f..bdf171f2abac 100644 --- a/website/docs/r/cdn_frontdoor_profile.html.markdown +++ b/website/docs/r/cdn_frontdoor_profile.html.markdown @@ -45,7 +45,7 @@ The following arguments are supported: ## Attributes Reference -The following attributes are exported: +In addition to the Arguments listed above - the following Attributes are exported: * `id` - The ID of this CDN FrontDoor Profile. From 967d1bb953362193ffa35f9c013154292db066b3 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Wed, 1 Jun 2022 19:01:56 +0200 Subject: [PATCH 6/7] d/cdn_frontdoor_profile: fixing the test --- internal/services/cdn/cdn_frontdoor_profile_data_source.go | 1 + internal/services/cdn/cdn_frontdoor_profile_data_source_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/services/cdn/cdn_frontdoor_profile_data_source.go b/internal/services/cdn/cdn_frontdoor_profile_data_source.go index 96c7077c07df..3dca7a669820 100644 --- a/internal/services/cdn/cdn_frontdoor_profile_data_source.go +++ b/internal/services/cdn/cdn_frontdoor_profile_data_source.go @@ -66,6 +66,7 @@ func dataSourceCdnFrontDoorProfileRead(d *pluginsdk.ResourceData, meta interface return fmt.Errorf("retrieving %s: %+v", id, err) } + d.SetId(id.ID()) d.Set("name", id.ProfileName) d.Set("resource_group_name", id.ResourceGroup) diff --git a/internal/services/cdn/cdn_frontdoor_profile_data_source_test.go b/internal/services/cdn/cdn_frontdoor_profile_data_source_test.go index 03d89d04cb3a..ed4bf22fe193 100644 --- a/internal/services/cdn/cdn_frontdoor_profile_data_source_test.go +++ b/internal/services/cdn/cdn_frontdoor_profile_data_source_test.go @@ -30,7 +30,7 @@ func (CdnFrontDoorProfileDataSource) basic(data acceptance.TestData) string { data "azurerm_cdn_frontdoor_profile" "test" { name = azurerm_cdn_frontdoor_profile.test.name - resource_group_name = azurerm_cdn_frontdoor_profile.test.name + resource_group_name = azurerm_cdn_frontdoor_profile.test.resource_group_name } `, CdnFrontDoorProfileResource{}.complete(data)) } From 0f66652fc8e4e8ec68f465d8a1381a903df48b09 Mon Sep 17 00:00:00 2001 From: Tom Harvey Date: Thu, 2 Jun 2022 10:58:25 +0200 Subject: [PATCH 7/7] Update internal/services/cdn/cdn_frontdoor_profile_data_source_test.go Co-authored-by: Matthew Frahry --- internal/services/cdn/cdn_frontdoor_profile_data_source_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/cdn/cdn_frontdoor_profile_data_source_test.go b/internal/services/cdn/cdn_frontdoor_profile_data_source_test.go index ed4bf22fe193..07b74686acd7 100644 --- a/internal/services/cdn/cdn_frontdoor_profile_data_source_test.go +++ b/internal/services/cdn/cdn_frontdoor_profile_data_source_test.go @@ -18,7 +18,7 @@ func TestAccCdnFrontDoorProfileDataSource_basic(t *testing.T) { { Config: d.basic(data), Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).Key("sku_name").HasValue("Standard_AzureFrontDoor"), + check.That(data.ResourceName).Key("sku_name").HasValue("Premium_AzureFrontDoor"), ), }, })