diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/cdn_management_client.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/cdn_management_client.py index 3dd0f0c223bf..140f999bb41e 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/cdn_management_client.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/cdn_management_client.py @@ -14,6 +14,7 @@ from msrestazure import AzureConfiguration from .version import VERSION from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError from msrest.polling import LROPoller, NoPolling from msrestazure.polling.arm_polling import ARMPolling import uuid @@ -24,6 +25,8 @@ from .operations.resource_usage_operations import ResourceUsageOperations from .operations.operations import Operations from .operations.edge_nodes_operations import EdgeNodesOperations +from .operations.policies_operations import PoliciesOperations +from .operations.managed_rule_sets_operations import ManagedRuleSetsOperations from . import models @@ -37,16 +40,25 @@ class CdnManagementClientConfiguration(AzureConfiguration): object` :param subscription_id: Azure Subscription ID. :type subscription_id: str + :param subscription_id1: Azure Subscription ID. + :type subscription_id1: str + :param api_version1: Version of the API to be used with the client + request. Current version is 2017-04-02. + :type api_version1: str :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): + self, credentials, subscription_id, subscription_id1, api_version1, base_url=None): if credentials is None: raise ValueError("Parameter 'credentials' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") + if subscription_id1 is None: + raise ValueError("Parameter 'subscription_id1' must not be None.") + if api_version1 is None: + raise ValueError("Parameter 'api_version1' must not be None.") if not base_url: base_url = 'https://management.azure.com' @@ -57,10 +69,12 @@ def __init__( self.credentials = credentials self.subscription_id = subscription_id + self.subscription_id1 = subscription_id1 + self.api_version1 = api_version1 class CdnManagementClient(SDKClient): - """Use these APIs to manage Azure CDN resources through the Azure Resource Manager. You must make sure that requests made to these resources are secure. + """Cdn Management Client :ivar config: Configuration for client. :vartype config: CdnManagementClientConfiguration @@ -79,23 +93,32 @@ class CdnManagementClient(SDKClient): :vartype operations: azure.mgmt.cdn.operations.Operations :ivar edge_nodes: EdgeNodes operations :vartype edge_nodes: azure.mgmt.cdn.operations.EdgeNodesOperations + :ivar policies: Policies operations + :vartype policies: azure.mgmt.cdn.operations.PoliciesOperations + :ivar managed_rule_sets: ManagedRuleSets operations + :vartype managed_rule_sets: azure.mgmt.cdn.operations.ManagedRuleSetsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials object` :param subscription_id: Azure Subscription ID. :type subscription_id: str + :param subscription_id1: Azure Subscription ID. + :type subscription_id1: str + :param api_version1: Version of the API to be used with the client + request. Current version is 2017-04-02. + :type api_version1: str :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): + self, credentials, subscription_id, subscription_id1, api_version1, base_url=None): - self.config = CdnManagementClientConfiguration(credentials, subscription_id, base_url) + self.config = CdnManagementClientConfiguration(credentials, subscription_id, subscription_id1, api_version1, base_url) super(CdnManagementClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2019-04-15' + self.api_version = '2019-06-15-preview' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) @@ -113,6 +136,10 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.edge_nodes = EdgeNodesOperations( self._client, self.config, self._serialize, self._deserialize) + self.policies = PoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.managed_rule_sets = ManagedRuleSetsOperations( + self._client, self.config, self._serialize, self._deserialize) def check_name_availability( self, name, custom_headers=None, raw=False, **operation_config): diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/__init__.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/__init__.py index 0cfff23f32c0..1544a032ce6c 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/__init__.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/__init__.py @@ -22,6 +22,7 @@ from .delivery_rule_action_py3 import DeliveryRuleAction from .delivery_rule_py3 import DeliveryRule from .endpoint_properties_update_parameters_delivery_policy_py3 import EndpointPropertiesUpdateParametersDeliveryPolicy + from .endpoint_properties_update_parameters_web_application_firewall_policy_link_py3 import EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink from .endpoint_update_parameters_py3 import EndpointUpdateParameters from .remote_address_match_condition_parameters_py3 import RemoteAddressMatchConditionParameters from .delivery_rule_remote_address_condition_py3 import DeliveryRuleRemoteAddressCondition @@ -81,6 +82,23 @@ from .tracked_resource_py3 import TrackedResource from .proxy_resource_py3 import ProxyResource from .error_response_py3 import ErrorResponse, ErrorResponseException + from .policy_settings_py3 import PolicySettings + from .rate_limit_rule_py3 import RateLimitRule + from .rate_limit_rule_list_py3 import RateLimitRuleList + from .match_condition_py3 import MatchCondition + from .action_type_py3 import ActionType + from .custom_rule_py3 import CustomRule + from .custom_rule_list_py3 import CustomRuleList + from .managed_rule_override_py3 import ManagedRuleOverride + from .managed_rule_group_override_py3 import ManagedRuleGroupOverride + from .managed_rule_set_py3 import ManagedRuleSet + from .managed_rule_set_list_py3 import ManagedRuleSetList + from .cdn_endpoint_py3 import CdnEndpoint + from .cdn_web_application_firewall_policy_py3 import CdnWebApplicationFirewallPolicy + from .cdn_web_application_firewall_policy_patch_parameters_py3 import CdnWebApplicationFirewallPolicyPatchParameters + from .managed_rule_definition_py3 import ManagedRuleDefinition + from .managed_rule_group_definition_py3 import ManagedRuleGroupDefinition + from .managed_rule_set_definition_py3 import ManagedRuleSetDefinition except (SyntaxError, ImportError): from .sku import Sku from .profile import Profile @@ -94,6 +112,7 @@ from .delivery_rule_action import DeliveryRuleAction from .delivery_rule import DeliveryRule from .endpoint_properties_update_parameters_delivery_policy import EndpointPropertiesUpdateParametersDeliveryPolicy + from .endpoint_properties_update_parameters_web_application_firewall_policy_link import EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink from .endpoint_update_parameters import EndpointUpdateParameters from .remote_address_match_condition_parameters import RemoteAddressMatchConditionParameters from .delivery_rule_remote_address_condition import DeliveryRuleRemoteAddressCondition @@ -153,6 +172,23 @@ from .tracked_resource import TrackedResource from .proxy_resource import ProxyResource from .error_response import ErrorResponse, ErrorResponseException + from .policy_settings import PolicySettings + from .rate_limit_rule import RateLimitRule + from .rate_limit_rule_list import RateLimitRuleList + from .match_condition import MatchCondition + from .action_type import ActionType + from .custom_rule import CustomRule + from .custom_rule_list import CustomRuleList + from .managed_rule_override import ManagedRuleOverride + from .managed_rule_group_override import ManagedRuleGroupOverride + from .managed_rule_set import ManagedRuleSet + from .managed_rule_set_list import ManagedRuleSetList + from .cdn_endpoint import CdnEndpoint + from .cdn_web_application_firewall_policy import CdnWebApplicationFirewallPolicy + from .cdn_web_application_firewall_policy_patch_parameters import CdnWebApplicationFirewallPolicyPatchParameters + from .managed_rule_definition import ManagedRuleDefinition + from .managed_rule_group_definition import ManagedRuleGroupDefinition + from .managed_rule_set_definition import ManagedRuleSetDefinition from .profile_paged import ProfilePaged from .resource_usage_paged import ResourceUsagePaged from .endpoint_paged import EndpointPaged @@ -160,6 +196,8 @@ from .custom_domain_paged import CustomDomainPaged from .operation_paged import OperationPaged from .edge_node_paged import EdgeNodePaged +from .cdn_web_application_firewall_policy_paged import CdnWebApplicationFirewallPolicyPaged +from .managed_rule_set_definition_paged import ManagedRuleSetDefinitionPaged from .cdn_management_client_enums import ( SkuName, ProfileResourceState, @@ -188,6 +226,15 @@ ProtocolType, CertificateType, ResourceType, + PolicyEnabledState, + PolicyMode, + CustomRuleEnabledState, + MatchVariable, + Operator, + Action, + ManagedRuleEnabledState, + ProvisioningState, + PolicyResourceState, ) __all__ = [ @@ -203,6 +250,7 @@ 'DeliveryRuleAction', 'DeliveryRule', 'EndpointPropertiesUpdateParametersDeliveryPolicy', + 'EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink', 'EndpointUpdateParameters', 'RemoteAddressMatchConditionParameters', 'DeliveryRuleRemoteAddressCondition', @@ -262,6 +310,23 @@ 'TrackedResource', 'ProxyResource', 'ErrorResponse', 'ErrorResponseException', + 'PolicySettings', + 'RateLimitRule', + 'RateLimitRuleList', + 'MatchCondition', + 'ActionType', + 'CustomRule', + 'CustomRuleList', + 'ManagedRuleOverride', + 'ManagedRuleGroupOverride', + 'ManagedRuleSet', + 'ManagedRuleSetList', + 'CdnEndpoint', + 'CdnWebApplicationFirewallPolicy', + 'CdnWebApplicationFirewallPolicyPatchParameters', + 'ManagedRuleDefinition', + 'ManagedRuleGroupDefinition', + 'ManagedRuleSetDefinition', 'ProfilePaged', 'ResourceUsagePaged', 'EndpointPaged', @@ -269,6 +334,8 @@ 'CustomDomainPaged', 'OperationPaged', 'EdgeNodePaged', + 'CdnWebApplicationFirewallPolicyPaged', + 'ManagedRuleSetDefinitionPaged', 'SkuName', 'ProfileResourceState', 'OptimizationType', @@ -296,4 +363,13 @@ 'ProtocolType', 'CertificateType', 'ResourceType', + 'PolicyEnabledState', + 'PolicyMode', + 'CustomRuleEnabledState', + 'MatchVariable', + 'Operator', + 'Action', + 'ManagedRuleEnabledState', + 'ProvisioningState', + 'PolicyResourceState', ] diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/action_type.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/action_type.py new file mode 100644 index 000000000000..55691ad83e73 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/action_type.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ActionType(Model): + """Defines the action to take on rule match. + + All required parameters must be populated in order to send to Azure. + + :param action_type: Required. Describes type of action. Possible values + include: 'Allow', 'Block', 'Log', 'Redirect' + :type action_type: str or ~azure.mgmt.cdn.models.Action + :param redirect_url: If action type is redirect, this field represents URL + to be re-directed. + :type redirect_url: str + :param custom_block_response_status_code: If the action type is block, + customer can override the response status code. + :type custom_block_response_status_code: int + :param custom_block_response_body: If the action type is block, customer + can override the response body. The body must be specified in base64 + encoding. + :type custom_block_response_body: str + """ + + _validation = { + 'action_type': {'required': True}, + 'custom_block_response_status_code': {'maximum': 599, 'minimum': 200}, + 'custom_block_response_body': {'pattern': r'^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$'}, + } + + _attribute_map = { + 'action_type': {'key': 'actionType', 'type': 'str'}, + 'redirect_url': {'key': 'redirectUrl', 'type': 'str'}, + 'custom_block_response_status_code': {'key': 'customBlockResponseStatusCode', 'type': 'int'}, + 'custom_block_response_body': {'key': 'customBlockResponseBody', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ActionType, self).__init__(**kwargs) + self.action_type = kwargs.get('action_type', None) + self.redirect_url = kwargs.get('redirect_url', None) + self.custom_block_response_status_code = kwargs.get('custom_block_response_status_code', None) + self.custom_block_response_body = kwargs.get('custom_block_response_body', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/action_type_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/action_type_py3.py new file mode 100644 index 000000000000..7093f88a0e15 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/action_type_py3.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ActionType(Model): + """Defines the action to take on rule match. + + All required parameters must be populated in order to send to Azure. + + :param action_type: Required. Describes type of action. Possible values + include: 'Allow', 'Block', 'Log', 'Redirect' + :type action_type: str or ~azure.mgmt.cdn.models.Action + :param redirect_url: If action type is redirect, this field represents URL + to be re-directed. + :type redirect_url: str + :param custom_block_response_status_code: If the action type is block, + customer can override the response status code. + :type custom_block_response_status_code: int + :param custom_block_response_body: If the action type is block, customer + can override the response body. The body must be specified in base64 + encoding. + :type custom_block_response_body: str + """ + + _validation = { + 'action_type': {'required': True}, + 'custom_block_response_status_code': {'maximum': 599, 'minimum': 200}, + 'custom_block_response_body': {'pattern': r'^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$'}, + } + + _attribute_map = { + 'action_type': {'key': 'actionType', 'type': 'str'}, + 'redirect_url': {'key': 'redirectUrl', 'type': 'str'}, + 'custom_block_response_status_code': {'key': 'customBlockResponseStatusCode', 'type': 'int'}, + 'custom_block_response_body': {'key': 'customBlockResponseBody', 'type': 'str'}, + } + + def __init__(self, *, action_type, redirect_url: str=None, custom_block_response_status_code: int=None, custom_block_response_body: str=None, **kwargs) -> None: + super(ActionType, self).__init__(**kwargs) + self.action_type = action_type + self.redirect_url = redirect_url + self.custom_block_response_status_code = custom_block_response_status_code + self.custom_block_response_body = custom_block_response_body diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_endpoint.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_endpoint.py new file mode 100644 index 000000000000..67d331da5e7c --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_endpoint.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CdnEndpoint(Model): + """Defines the ARM Resource ID for the linked endpoints. + + :param id: ARM Resource ID string. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CdnEndpoint, self).__init__(**kwargs) + self.id = kwargs.get('id', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_endpoint_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_endpoint_py3.py new file mode 100644 index 000000000000..ec35e4ddfefa --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_endpoint_py3.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CdnEndpoint(Model): + """Defines the ARM Resource ID for the linked endpoints. + + :param id: ARM Resource ID string. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, **kwargs) -> None: + super(CdnEndpoint, self).__init__(**kwargs) + self.id = id diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_management_client_enums.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_management_client_enums.py index 29653a791dc2..c96bfff945d9 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_management_client_enums.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_management_client_enums.py @@ -20,7 +20,6 @@ class SkuName(str, Enum): standard_akamai = "Standard_Akamai" standard_china_cdn = "Standard_ChinaCdn" standard_microsoft = "Standard_Microsoft" - premium_china_cdn = "Premium_ChinaCdn" class ProfileResourceState(str, Enum): @@ -263,3 +262,81 @@ class CertificateType(str, Enum): class ResourceType(str, Enum): microsoft_cdn_profiles_endpoints = "Microsoft.Cdn/Profiles/Endpoints" + + +class PolicyEnabledState(str, Enum): + + disabled = "Disabled" + enabled = "Enabled" + + +class PolicyMode(str, Enum): + + prevention = "Prevention" + detection = "Detection" + + +class CustomRuleEnabledState(str, Enum): + + disabled = "Disabled" + enabled = "Enabled" + + +class MatchVariable(str, Enum): + + remote_addr = "RemoteAddr" + country = "Country" + request_method = "RequestMethod" + request_header = "RequestHeader" + request_uri = "RequestUri" + query_string = "QueryString" + request_body = "RequestBody" + cookies = "Cookies" + post_args = "PostArgs" + + +class Operator(str, Enum): + + any = "Any" + ip_match = "IPMatch" + geo_match = "GeoMatch" + equal = "Equal" + contains = "Contains" + less_than = "LessThan" + greater_than = "GreaterThan" + less_than_or_equal = "LessThanOrEqual" + greater_than_or_equal = "GreaterThanOrEqual" + begins_with = "BeginsWith" + ends_with = "EndsWith" + reg_ex = "RegEx" + + +class Action(str, Enum): + + allow = "Allow" + block = "Block" + log = "Log" + redirect = "Redirect" + + +class ManagedRuleEnabledState(str, Enum): + + disabled = "Disabled" + enabled = "Enabled" + + +class ProvisioningState(str, Enum): + + creating = "Creating" + succeeded = "Succeeded" + failed = "Failed" + + +class PolicyResourceState(str, Enum): + + creating = "Creating" + enabling = "Enabling" + enabled = "Enabled" + disabling = "Disabling" + disabled = "Disabled" + deleting = "Deleting" diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_web_application_firewall_policy.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_web_application_firewall_policy.py new file mode 100644 index 000000000000..6f800610cf02 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_web_application_firewall_policy.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from .tracked_resource import TrackedResource + + +class CdnWebApplicationFirewallPolicy(TrackedResource): + """Defines web application firewall policy for Azure CDN. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param policy_settings: Describes policySettings for policy + :type policy_settings: ~azure.mgmt.cdn.models.PolicySettings + :param rate_limit_rules: Describes rate limit rules inside the policy. + :type rate_limit_rules: ~azure.mgmt.cdn.models.RateLimitRuleList + :param custom_rules: Describes custom rules inside the policy. + :type custom_rules: ~azure.mgmt.cdn.models.CustomRuleList + :param managed_rules: Describes managed rules inside the policy. + :type managed_rules: ~azure.mgmt.cdn.models.ManagedRuleSetList + :ivar cdn_endpoint_links: Describes Azure CDN endpoints associated with + this Web Application Firewall policy. + :vartype cdn_endpoint_links: list[~azure.mgmt.cdn.models.CdnEndpoint] + :ivar provisioning_state: Provisioning state of the + WebApplicationFirewallPolicy. Possible values include: 'Creating', + 'Succeeded', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.cdn.models.ProvisioningState + :ivar resource_state: Resource status of the policy. Possible values + include: 'Creating', 'Enabling', 'Enabled', 'Disabling', 'Disabled', + 'Deleting' + :vartype resource_state: str or ~azure.mgmt.cdn.models.PolicyResourceState + :param etag: Gets a unique read-only string that changes whenever the + resource is updated. + :type etag: str + :param sku: Required. The pricing tier (defines a CDN provider, feature + list and rate) of the CdnWebApplicationFirewallPolicy. + :type sku: ~azure.mgmt.cdn.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'cdn_endpoint_links': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'resource_state': {'readonly': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'policy_settings': {'key': 'properties.policySettings', 'type': 'PolicySettings'}, + 'rate_limit_rules': {'key': 'properties.rateLimitRules', 'type': 'RateLimitRuleList'}, + 'custom_rules': {'key': 'properties.customRules', 'type': 'CustomRuleList'}, + 'managed_rules': {'key': 'properties.managedRules', 'type': 'ManagedRuleSetList'}, + 'cdn_endpoint_links': {'key': 'properties.cdnEndpointLinks', 'type': '[CdnEndpoint]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__(self, **kwargs): + super(CdnWebApplicationFirewallPolicy, self).__init__(**kwargs) + self.policy_settings = kwargs.get('policy_settings', None) + self.rate_limit_rules = kwargs.get('rate_limit_rules', None) + self.custom_rules = kwargs.get('custom_rules', None) + self.managed_rules = kwargs.get('managed_rules', None) + self.cdn_endpoint_links = None + self.provisioning_state = None + self.resource_state = None + self.etag = kwargs.get('etag', None) + self.sku = kwargs.get('sku', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_web_application_firewall_policy_paged.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_web_application_firewall_policy_paged.py new file mode 100644 index 000000000000..95a3a24f0c74 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_web_application_firewall_policy_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class CdnWebApplicationFirewallPolicyPaged(Paged): + """ + A paging container for iterating over a list of :class:`CdnWebApplicationFirewallPolicy ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[CdnWebApplicationFirewallPolicy]'} + } + + def __init__(self, *args, **kwargs): + + super(CdnWebApplicationFirewallPolicyPaged, self).__init__(*args, **kwargs) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_web_application_firewall_policy_patch_parameters.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_web_application_firewall_policy_patch_parameters.py new file mode 100644 index 000000000000..139fa341bc7b --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_web_application_firewall_policy_patch_parameters.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CdnWebApplicationFirewallPolicyPatchParameters(Model): + """Properties required to update a CdnWebApplicationFirewallPolicy. + + :param tags: CdnWebApplicationFirewallPolicy tags + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(CdnWebApplicationFirewallPolicyPatchParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_web_application_firewall_policy_patch_parameters_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_web_application_firewall_policy_patch_parameters_py3.py new file mode 100644 index 000000000000..551cebec0955 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_web_application_firewall_policy_patch_parameters_py3.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CdnWebApplicationFirewallPolicyPatchParameters(Model): + """Properties required to update a CdnWebApplicationFirewallPolicy. + + :param tags: CdnWebApplicationFirewallPolicy tags + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(CdnWebApplicationFirewallPolicyPatchParameters, self).__init__(**kwargs) + self.tags = tags diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_web_application_firewall_policy_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_web_application_firewall_policy_py3.py new file mode 100644 index 000000000000..d7ebe1cc5fb1 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_web_application_firewall_policy_py3.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from .tracked_resource_py3 import TrackedResource + + +class CdnWebApplicationFirewallPolicy(TrackedResource): + """Defines web application firewall policy for Azure CDN. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param policy_settings: Describes policySettings for policy + :type policy_settings: ~azure.mgmt.cdn.models.PolicySettings + :param rate_limit_rules: Describes rate limit rules inside the policy. + :type rate_limit_rules: ~azure.mgmt.cdn.models.RateLimitRuleList + :param custom_rules: Describes custom rules inside the policy. + :type custom_rules: ~azure.mgmt.cdn.models.CustomRuleList + :param managed_rules: Describes managed rules inside the policy. + :type managed_rules: ~azure.mgmt.cdn.models.ManagedRuleSetList + :ivar cdn_endpoint_links: Describes Azure CDN endpoints associated with + this Web Application Firewall policy. + :vartype cdn_endpoint_links: list[~azure.mgmt.cdn.models.CdnEndpoint] + :ivar provisioning_state: Provisioning state of the + WebApplicationFirewallPolicy. Possible values include: 'Creating', + 'Succeeded', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.cdn.models.ProvisioningState + :ivar resource_state: Resource status of the policy. Possible values + include: 'Creating', 'Enabling', 'Enabled', 'Disabling', 'Disabled', + 'Deleting' + :vartype resource_state: str or ~azure.mgmt.cdn.models.PolicyResourceState + :param etag: Gets a unique read-only string that changes whenever the + resource is updated. + :type etag: str + :param sku: Required. The pricing tier (defines a CDN provider, feature + list and rate) of the CdnWebApplicationFirewallPolicy. + :type sku: ~azure.mgmt.cdn.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'cdn_endpoint_links': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'resource_state': {'readonly': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'policy_settings': {'key': 'properties.policySettings', 'type': 'PolicySettings'}, + 'rate_limit_rules': {'key': 'properties.rateLimitRules', 'type': 'RateLimitRuleList'}, + 'custom_rules': {'key': 'properties.customRules', 'type': 'CustomRuleList'}, + 'managed_rules': {'key': 'properties.managedRules', 'type': 'ManagedRuleSetList'}, + 'cdn_endpoint_links': {'key': 'properties.cdnEndpointLinks', 'type': '[CdnEndpoint]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__(self, *, location: str, sku, tags=None, policy_settings=None, rate_limit_rules=None, custom_rules=None, managed_rules=None, etag: str=None, **kwargs) -> None: + super(CdnWebApplicationFirewallPolicy, self).__init__(location=location, tags=tags, **kwargs) + self.policy_settings = policy_settings + self.rate_limit_rules = rate_limit_rules + self.custom_rules = custom_rules + self.managed_rules = managed_rules + self.cdn_endpoint_links = None + self.provisioning_state = None + self.resource_state = None + self.etag = etag + self.sku = sku diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/custom_rule.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/custom_rule.py new file mode 100644 index 000000000000..3726991e9279 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/custom_rule.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CustomRule(Model): + """Defines the common attributes for a custom rule that can be included in a + waf policy. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Defines the name of the custom rule + :type name: str + :param enabled_state: Describes if the custom rule is in enabled or + disabled state. Defaults to Enabled if not specified. Possible values + include: 'Disabled', 'Enabled' + :type enabled_state: str or ~azure.mgmt.cdn.models.CustomRuleEnabledState + :param priority: Required. Defines in what order this rule be evaluated in + the overall list of custom rules + :type priority: int + :param match_conditions: Required. List of match conditions. + :type match_conditions: list[~azure.mgmt.cdn.models.MatchCondition] + :param action: Required. Describes what action to be applied when rule + matches + :type action: ~azure.mgmt.cdn.models.ActionType + """ + + _validation = { + 'name': {'required': True}, + 'priority': {'required': True}, + 'match_conditions': {'required': True}, + 'action': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'enabled_state': {'key': 'enabledState', 'type': 'str'}, + 'priority': {'key': 'priority', 'type': 'int'}, + 'match_conditions': {'key': 'matchConditions', 'type': '[MatchCondition]'}, + 'action': {'key': 'action', 'type': 'ActionType'}, + } + + def __init__(self, **kwargs): + super(CustomRule, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.enabled_state = kwargs.get('enabled_state', None) + self.priority = kwargs.get('priority', None) + self.match_conditions = kwargs.get('match_conditions', None) + self.action = kwargs.get('action', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/custom_rule_list.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/custom_rule_list.py new file mode 100644 index 000000000000..2b182df6b43b --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/custom_rule_list.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CustomRuleList(Model): + """Defines contents of custom rules. + + :param rules: List of rules + :type rules: list[~azure.mgmt.cdn.models.CustomRule] + """ + + _attribute_map = { + 'rules': {'key': 'rules', 'type': '[CustomRule]'}, + } + + def __init__(self, **kwargs): + super(CustomRuleList, self).__init__(**kwargs) + self.rules = kwargs.get('rules', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/custom_rule_list_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/custom_rule_list_py3.py new file mode 100644 index 000000000000..7cb1d8b59d4b --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/custom_rule_list_py3.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CustomRuleList(Model): + """Defines contents of custom rules. + + :param rules: List of rules + :type rules: list[~azure.mgmt.cdn.models.CustomRule] + """ + + _attribute_map = { + 'rules': {'key': 'rules', 'type': '[CustomRule]'}, + } + + def __init__(self, *, rules=None, **kwargs) -> None: + super(CustomRuleList, self).__init__(**kwargs) + self.rules = rules diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/custom_rule_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/custom_rule_py3.py new file mode 100644 index 000000000000..73fd6284b311 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/custom_rule_py3.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CustomRule(Model): + """Defines the common attributes for a custom rule that can be included in a + waf policy. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Defines the name of the custom rule + :type name: str + :param enabled_state: Describes if the custom rule is in enabled or + disabled state. Defaults to Enabled if not specified. Possible values + include: 'Disabled', 'Enabled' + :type enabled_state: str or ~azure.mgmt.cdn.models.CustomRuleEnabledState + :param priority: Required. Defines in what order this rule be evaluated in + the overall list of custom rules + :type priority: int + :param match_conditions: Required. List of match conditions. + :type match_conditions: list[~azure.mgmt.cdn.models.MatchCondition] + :param action: Required. Describes what action to be applied when rule + matches + :type action: ~azure.mgmt.cdn.models.ActionType + """ + + _validation = { + 'name': {'required': True}, + 'priority': {'required': True}, + 'match_conditions': {'required': True}, + 'action': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'enabled_state': {'key': 'enabledState', 'type': 'str'}, + 'priority': {'key': 'priority', 'type': 'int'}, + 'match_conditions': {'key': 'matchConditions', 'type': '[MatchCondition]'}, + 'action': {'key': 'action', 'type': 'ActionType'}, + } + + def __init__(self, *, name: str, priority: int, match_conditions, action, enabled_state=None, **kwargs) -> None: + super(CustomRule, self).__init__(**kwargs) + self.name = name + self.enabled_state = enabled_state + self.priority = priority + self.match_conditions = match_conditions + self.action = action diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/delivery_rule.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/delivery_rule.py index 52fe9f00905b..b51ecd9710de 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/delivery_rule.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/delivery_rule.py @@ -17,7 +17,7 @@ class DeliveryRule(Model): All required parameters must be populated in order to send to Azure. - :param name: Name of the rule + :param name: Required. Name of the rule :type name: str :param order: Required. The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will @@ -34,6 +34,7 @@ class DeliveryRule(Model): """ _validation = { + 'name': {'required': True}, 'order': {'required': True}, 'actions': {'required': True}, } diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/delivery_rule_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/delivery_rule_py3.py index 04a68bf60e00..25aff003d3da 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/delivery_rule_py3.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/delivery_rule_py3.py @@ -17,7 +17,7 @@ class DeliveryRule(Model): All required parameters must be populated in order to send to Azure. - :param name: Name of the rule + :param name: Required. Name of the rule :type name: str :param order: Required. The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will @@ -34,6 +34,7 @@ class DeliveryRule(Model): """ _validation = { + 'name': {'required': True}, 'order': {'required': True}, 'actions': {'required': True}, } @@ -45,7 +46,7 @@ class DeliveryRule(Model): 'actions': {'key': 'actions', 'type': '[DeliveryRuleAction]'}, } - def __init__(self, *, order: int, actions, name: str=None, conditions=None, **kwargs) -> None: + def __init__(self, *, name: str, order: int, actions, conditions=None, **kwargs) -> None: super(DeliveryRule, self).__init__(**kwargs) self.name = name self.order = order diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint.py index 3c4db7a3272e..b274521dce05 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint.py @@ -85,6 +85,10 @@ class Endpoint(TrackedResource): used for an endpoint. :type delivery_policy: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy + :param web_application_firewall_policy_link: Defines the Web Application + Firewall policy for the endpoint (if applicable) + :type web_application_firewall_policy_link: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink :ivar host_name: The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. contoso.azureedge.net :vartype host_name: str @@ -128,6 +132,7 @@ class Endpoint(TrackedResource): 'probe_path': {'key': 'properties.probePath', 'type': 'str'}, 'geo_filters': {'key': 'properties.geoFilters', 'type': '[GeoFilter]'}, 'delivery_policy': {'key': 'properties.deliveryPolicy', 'type': 'EndpointPropertiesUpdateParametersDeliveryPolicy'}, + 'web_application_firewall_policy_link': {'key': 'properties.webApplicationFirewallPolicyLink', 'type': 'EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink'}, 'host_name': {'key': 'properties.hostName', 'type': 'str'}, 'origins': {'key': 'properties.origins', 'type': '[DeepCreatedOrigin]'}, 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, @@ -147,6 +152,7 @@ def __init__(self, **kwargs): self.probe_path = kwargs.get('probe_path', None) self.geo_filters = kwargs.get('geo_filters', None) self.delivery_policy = kwargs.get('delivery_policy', None) + self.web_application_firewall_policy_link = kwargs.get('web_application_firewall_policy_link', None) self.host_name = None self.origins = kwargs.get('origins', None) self.resource_state = None diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_properties_update_parameters_web_application_firewall_policy_link.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_properties_update_parameters_web_application_firewall_policy_link.py new file mode 100644 index 000000000000..a24b9b679730 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_properties_update_parameters_web_application_firewall_policy_link.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(Model): + """Defines the Web Application Firewall policy for the endpoint (if + applicable). + + :param id: Resource ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink, self).__init__(**kwargs) + self.id = kwargs.get('id', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_properties_update_parameters_web_application_firewall_policy_link_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_properties_update_parameters_web_application_firewall_policy_link_py3.py new file mode 100644 index 000000000000..71f56ad5887c --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_properties_update_parameters_web_application_firewall_policy_link_py3.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(Model): + """Defines the Web Application Firewall policy for the endpoint (if + applicable). + + :param id: Resource ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, **kwargs) -> None: + super(EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink, self).__init__(**kwargs) + self.id = id diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_py3.py index 9c6a32cc6bd9..3728c33cd2b4 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_py3.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_py3.py @@ -85,6 +85,10 @@ class Endpoint(TrackedResource): used for an endpoint. :type delivery_policy: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy + :param web_application_firewall_policy_link: Defines the Web Application + Firewall policy for the endpoint (if applicable) + :type web_application_firewall_policy_link: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink :ivar host_name: The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. contoso.azureedge.net :vartype host_name: str @@ -128,13 +132,14 @@ class Endpoint(TrackedResource): 'probe_path': {'key': 'properties.probePath', 'type': 'str'}, 'geo_filters': {'key': 'properties.geoFilters', 'type': '[GeoFilter]'}, 'delivery_policy': {'key': 'properties.deliveryPolicy', 'type': 'EndpointPropertiesUpdateParametersDeliveryPolicy'}, + 'web_application_firewall_policy_link': {'key': 'properties.webApplicationFirewallPolicyLink', 'type': 'EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink'}, 'host_name': {'key': 'properties.hostName', 'type': 'str'}, 'origins': {'key': 'properties.origins', 'type': '[DeepCreatedOrigin]'}, 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, location: str, origins, tags=None, origin_host_header: str=None, origin_path: str=None, content_types_to_compress=None, is_compression_enabled: bool=None, is_http_allowed: bool=None, is_https_allowed: bool=None, query_string_caching_behavior=None, optimization_type=None, probe_path: str=None, geo_filters=None, delivery_policy=None, **kwargs) -> None: + def __init__(self, *, location: str, origins, tags=None, origin_host_header: str=None, origin_path: str=None, content_types_to_compress=None, is_compression_enabled: bool=None, is_http_allowed: bool=None, is_https_allowed: bool=None, query_string_caching_behavior=None, optimization_type=None, probe_path: str=None, geo_filters=None, delivery_policy=None, web_application_firewall_policy_link=None, **kwargs) -> None: super(Endpoint, self).__init__(location=location, tags=tags, **kwargs) self.origin_host_header = origin_host_header self.origin_path = origin_path @@ -147,6 +152,7 @@ def __init__(self, *, location: str, origins, tags=None, origin_host_header: str self.probe_path = probe_path self.geo_filters = geo_filters self.delivery_policy = delivery_policy + self.web_application_firewall_policy_link = web_application_firewall_policy_link self.host_name = None self.origins = origins self.resource_state = None diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_update_parameters.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_update_parameters.py index 0a1ed8c7706d..206cd28316c5 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_update_parameters.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_update_parameters.py @@ -69,6 +69,10 @@ class EndpointUpdateParameters(Model): used for an endpoint. :type delivery_policy: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy + :param web_application_firewall_policy_link: Defines the Web Application + Firewall policy for the endpoint (if applicable) + :type web_application_firewall_policy_link: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink """ _attribute_map = { @@ -84,6 +88,7 @@ class EndpointUpdateParameters(Model): 'probe_path': {'key': 'properties.probePath', 'type': 'str'}, 'geo_filters': {'key': 'properties.geoFilters', 'type': '[GeoFilter]'}, 'delivery_policy': {'key': 'properties.deliveryPolicy', 'type': 'EndpointPropertiesUpdateParametersDeliveryPolicy'}, + 'web_application_firewall_policy_link': {'key': 'properties.webApplicationFirewallPolicyLink', 'type': 'EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink'}, } def __init__(self, **kwargs): @@ -100,3 +105,4 @@ def __init__(self, **kwargs): self.probe_path = kwargs.get('probe_path', None) self.geo_filters = kwargs.get('geo_filters', None) self.delivery_policy = kwargs.get('delivery_policy', None) + self.web_application_firewall_policy_link = kwargs.get('web_application_firewall_policy_link', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_update_parameters_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_update_parameters_py3.py index e18452cae71f..fd88f19ac7a2 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_update_parameters_py3.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint_update_parameters_py3.py @@ -69,6 +69,10 @@ class EndpointUpdateParameters(Model): used for an endpoint. :type delivery_policy: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy + :param web_application_firewall_policy_link: Defines the Web Application + Firewall policy for the endpoint (if applicable) + :type web_application_firewall_policy_link: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink """ _attribute_map = { @@ -84,9 +88,10 @@ class EndpointUpdateParameters(Model): 'probe_path': {'key': 'properties.probePath', 'type': 'str'}, 'geo_filters': {'key': 'properties.geoFilters', 'type': '[GeoFilter]'}, 'delivery_policy': {'key': 'properties.deliveryPolicy', 'type': 'EndpointPropertiesUpdateParametersDeliveryPolicy'}, + 'web_application_firewall_policy_link': {'key': 'properties.webApplicationFirewallPolicyLink', 'type': 'EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink'}, } - def __init__(self, *, tags=None, origin_host_header: str=None, origin_path: str=None, content_types_to_compress=None, is_compression_enabled: bool=None, is_http_allowed: bool=None, is_https_allowed: bool=None, query_string_caching_behavior=None, optimization_type=None, probe_path: str=None, geo_filters=None, delivery_policy=None, **kwargs) -> None: + def __init__(self, *, tags=None, origin_host_header: str=None, origin_path: str=None, content_types_to_compress=None, is_compression_enabled: bool=None, is_http_allowed: bool=None, is_https_allowed: bool=None, query_string_caching_behavior=None, optimization_type=None, probe_path: str=None, geo_filters=None, delivery_policy=None, web_application_firewall_policy_link=None, **kwargs) -> None: super(EndpointUpdateParameters, self).__init__(**kwargs) self.tags = tags self.origin_host_header = origin_host_header @@ -100,3 +105,4 @@ def __init__(self, *, tags=None, origin_host_header: str=None, origin_path: str= self.probe_path = probe_path self.geo_filters = geo_filters self.delivery_policy = delivery_policy + self.web_application_firewall_policy_link = web_application_firewall_policy_link diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_definition.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_definition.py new file mode 100644 index 000000000000..36a5110ead68 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_definition.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ManagedRuleDefinition(Model): + """Describes a managed rule definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar rule_id: Identifier for the managed rule. + :vartype rule_id: str + :ivar description: Describes the functionality of the managed rule. + :vartype description: str + """ + + _validation = { + 'rule_id': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'rule_id': {'key': 'ruleId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ManagedRuleDefinition, self).__init__(**kwargs) + self.rule_id = None + self.description = None diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_definition_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_definition_py3.py new file mode 100644 index 000000000000..458fec2d0b6c --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_definition_py3.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ManagedRuleDefinition(Model): + """Describes a managed rule definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar rule_id: Identifier for the managed rule. + :vartype rule_id: str + :ivar description: Describes the functionality of the managed rule. + :vartype description: str + """ + + _validation = { + 'rule_id': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'rule_id': {'key': 'ruleId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ManagedRuleDefinition, self).__init__(**kwargs) + self.rule_id = None + self.description = None diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_group_definition.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_group_definition.py new file mode 100644 index 000000000000..d65aa8ed00c5 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_group_definition.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ManagedRuleGroupDefinition(Model): + """Describes a managed rule group. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar rule_group_name: Name of the managed rule group. + :vartype rule_group_name: str + :ivar description: Description of the managed rule group. + :vartype description: str + :ivar rules: List of rules within the managed rule group. + :vartype rules: list[~azure.mgmt.cdn.models.ManagedRuleDefinition] + """ + + _validation = { + 'rule_group_name': {'readonly': True}, + 'description': {'readonly': True}, + 'rules': {'readonly': True}, + } + + _attribute_map = { + 'rule_group_name': {'key': 'ruleGroupName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[ManagedRuleDefinition]'}, + } + + def __init__(self, **kwargs): + super(ManagedRuleGroupDefinition, self).__init__(**kwargs) + self.rule_group_name = None + self.description = None + self.rules = None diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_group_definition_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_group_definition_py3.py new file mode 100644 index 000000000000..8c5c9bfdde68 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_group_definition_py3.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ManagedRuleGroupDefinition(Model): + """Describes a managed rule group. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar rule_group_name: Name of the managed rule group. + :vartype rule_group_name: str + :ivar description: Description of the managed rule group. + :vartype description: str + :ivar rules: List of rules within the managed rule group. + :vartype rules: list[~azure.mgmt.cdn.models.ManagedRuleDefinition] + """ + + _validation = { + 'rule_group_name': {'readonly': True}, + 'description': {'readonly': True}, + 'rules': {'readonly': True}, + } + + _attribute_map = { + 'rule_group_name': {'key': 'ruleGroupName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[ManagedRuleDefinition]'}, + } + + def __init__(self, **kwargs) -> None: + super(ManagedRuleGroupDefinition, self).__init__(**kwargs) + self.rule_group_name = None + self.description = None + self.rules = None diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_group_override.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_group_override.py new file mode 100644 index 000000000000..62ab1d7ba96b --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_group_override.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ManagedRuleGroupOverride(Model): + """Defines a managed rule group override setting. + + All required parameters must be populated in order to send to Azure. + + :param rule_group_name: Required. Describes the managed rule group within + the rule set to override + :type rule_group_name: str + :param rules: List of rules that will be disabled. If none specified, all + rules in the group will be disabled. + :type rules: list[~azure.mgmt.cdn.models.ManagedRuleOverride] + """ + + _validation = { + 'rule_group_name': {'required': True}, + } + + _attribute_map = { + 'rule_group_name': {'key': 'ruleGroupName', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[ManagedRuleOverride]'}, + } + + def __init__(self, **kwargs): + super(ManagedRuleGroupOverride, self).__init__(**kwargs) + self.rule_group_name = kwargs.get('rule_group_name', None) + self.rules = kwargs.get('rules', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_group_override_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_group_override_py3.py new file mode 100644 index 000000000000..b8a99354fc61 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_group_override_py3.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ManagedRuleGroupOverride(Model): + """Defines a managed rule group override setting. + + All required parameters must be populated in order to send to Azure. + + :param rule_group_name: Required. Describes the managed rule group within + the rule set to override + :type rule_group_name: str + :param rules: List of rules that will be disabled. If none specified, all + rules in the group will be disabled. + :type rules: list[~azure.mgmt.cdn.models.ManagedRuleOverride] + """ + + _validation = { + 'rule_group_name': {'required': True}, + } + + _attribute_map = { + 'rule_group_name': {'key': 'ruleGroupName', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[ManagedRuleOverride]'}, + } + + def __init__(self, *, rule_group_name: str, rules=None, **kwargs) -> None: + super(ManagedRuleGroupOverride, self).__init__(**kwargs) + self.rule_group_name = rule_group_name + self.rules = rules diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_override.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_override.py new file mode 100644 index 000000000000..6240d30edf06 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_override.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ManagedRuleOverride(Model): + """Defines a managed rule group override setting. + + All required parameters must be populated in order to send to Azure. + + :param rule_id: Required. Identifier for the managed rule. + :type rule_id: str + :param enabled_state: Describes if the managed rule is in enabled or + disabled state. Defaults to Disabled if not specified. Possible values + include: 'Disabled', 'Enabled' + :type enabled_state: str or ~azure.mgmt.cdn.models.ManagedRuleEnabledState + :param action: Describes the override action to be applied when rule + matches. + :type action: ~azure.mgmt.cdn.models.ActionType + """ + + _validation = { + 'rule_id': {'required': True}, + } + + _attribute_map = { + 'rule_id': {'key': 'ruleId', 'type': 'str'}, + 'enabled_state': {'key': 'enabledState', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'ActionType'}, + } + + def __init__(self, **kwargs): + super(ManagedRuleOverride, self).__init__(**kwargs) + self.rule_id = kwargs.get('rule_id', None) + self.enabled_state = kwargs.get('enabled_state', None) + self.action = kwargs.get('action', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_override_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_override_py3.py new file mode 100644 index 000000000000..9113d6e8848e --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_override_py3.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ManagedRuleOverride(Model): + """Defines a managed rule group override setting. + + All required parameters must be populated in order to send to Azure. + + :param rule_id: Required. Identifier for the managed rule. + :type rule_id: str + :param enabled_state: Describes if the managed rule is in enabled or + disabled state. Defaults to Disabled if not specified. Possible values + include: 'Disabled', 'Enabled' + :type enabled_state: str or ~azure.mgmt.cdn.models.ManagedRuleEnabledState + :param action: Describes the override action to be applied when rule + matches. + :type action: ~azure.mgmt.cdn.models.ActionType + """ + + _validation = { + 'rule_id': {'required': True}, + } + + _attribute_map = { + 'rule_id': {'key': 'ruleId', 'type': 'str'}, + 'enabled_state': {'key': 'enabledState', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'ActionType'}, + } + + def __init__(self, *, rule_id: str, enabled_state=None, action=None, **kwargs) -> None: + super(ManagedRuleOverride, self).__init__(**kwargs) + self.rule_id = rule_id + self.enabled_state = enabled_state + self.action = action diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set.py new file mode 100644 index 000000000000..1424f0140c1f --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ManagedRuleSet(Model): + """Defines a managed rule set. + + All required parameters must be populated in order to send to Azure. + + :param rule_set_type: Required. Defines the rule set type to use. + :type rule_set_type: str + :param rule_set_version: Required. Defines the version of the rule set to + use. + :type rule_set_version: str + :param anomaly_score: Verizon only : If the rule set supports anomaly + detection mode, this describes the threshold for blocking requests. + :type anomaly_score: int + :param rule_group_overrides: Defines the rule overrides to apply to the + rule set. + :type rule_group_overrides: + list[~azure.mgmt.cdn.models.ManagedRuleGroupOverride] + """ + + _validation = { + 'rule_set_type': {'required': True}, + 'rule_set_version': {'required': True}, + 'anomaly_score': {'maximum': 20, 'minimum': 0}, + } + + _attribute_map = { + 'rule_set_type': {'key': 'ruleSetType', 'type': 'str'}, + 'rule_set_version': {'key': 'ruleSetVersion', 'type': 'str'}, + 'anomaly_score': {'key': 'anomalyScore', 'type': 'int'}, + 'rule_group_overrides': {'key': 'ruleGroupOverrides', 'type': '[ManagedRuleGroupOverride]'}, + } + + def __init__(self, **kwargs): + super(ManagedRuleSet, self).__init__(**kwargs) + self.rule_set_type = kwargs.get('rule_set_type', None) + self.rule_set_version = kwargs.get('rule_set_version', None) + self.anomaly_score = kwargs.get('anomaly_score', None) + self.rule_group_overrides = kwargs.get('rule_group_overrides', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_definition.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_definition.py new file mode 100644 index 000000000000..b1607cde9968 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_definition.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class ManagedRuleSetDefinition(Resource): + """Describes a managed rule set definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: Provisioning state of the managed rule set. + :vartype provisioning_state: str + :ivar rule_set_type: Type of the managed rule set. + :vartype rule_set_type: str + :ivar rule_set_version: Version of the managed rule set type. + :vartype rule_set_version: str + :ivar rule_groups: Rule groups of the managed rule set. + :vartype rule_groups: + list[~azure.mgmt.cdn.models.ManagedRuleGroupDefinition] + :param sku: The pricing tier (defines a CDN provider, feature list and + rate) of the CdnWebApplicationFirewallPolicy. + :type sku: ~azure.mgmt.cdn.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'rule_set_type': {'readonly': True}, + 'rule_set_version': {'readonly': True}, + 'rule_groups': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'rule_set_type': {'key': 'properties.ruleSetType', 'type': 'str'}, + 'rule_set_version': {'key': 'properties.ruleSetVersion', 'type': 'str'}, + 'rule_groups': {'key': 'properties.ruleGroups', 'type': '[ManagedRuleGroupDefinition]'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__(self, **kwargs): + super(ManagedRuleSetDefinition, self).__init__(**kwargs) + self.provisioning_state = None + self.rule_set_type = None + self.rule_set_version = None + self.rule_groups = None + self.sku = kwargs.get('sku', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_definition_paged.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_definition_paged.py new file mode 100644 index 000000000000..e91db12893e7 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_definition_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ManagedRuleSetDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`ManagedRuleSetDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ManagedRuleSetDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(ManagedRuleSetDefinitionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_definition_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_definition_py3.py new file mode 100644 index 000000000000..7a2d2ad7b623 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_definition_py3.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from .resource_py3 import Resource + + +class ManagedRuleSetDefinition(Resource): + """Describes a managed rule set definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: Provisioning state of the managed rule set. + :vartype provisioning_state: str + :ivar rule_set_type: Type of the managed rule set. + :vartype rule_set_type: str + :ivar rule_set_version: Version of the managed rule set type. + :vartype rule_set_version: str + :ivar rule_groups: Rule groups of the managed rule set. + :vartype rule_groups: + list[~azure.mgmt.cdn.models.ManagedRuleGroupDefinition] + :param sku: The pricing tier (defines a CDN provider, feature list and + rate) of the CdnWebApplicationFirewallPolicy. + :type sku: ~azure.mgmt.cdn.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'rule_set_type': {'readonly': True}, + 'rule_set_version': {'readonly': True}, + 'rule_groups': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'rule_set_type': {'key': 'properties.ruleSetType', 'type': 'str'}, + 'rule_set_version': {'key': 'properties.ruleSetVersion', 'type': 'str'}, + 'rule_groups': {'key': 'properties.ruleGroups', 'type': '[ManagedRuleGroupDefinition]'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__(self, *, sku=None, **kwargs) -> None: + super(ManagedRuleSetDefinition, self).__init__(**kwargs) + self.provisioning_state = None + self.rule_set_type = None + self.rule_set_version = None + self.rule_groups = None + self.sku = sku diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_list.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_list.py new file mode 100644 index 000000000000..6cb9604ddf3a --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_list.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ManagedRuleSetList(Model): + """Defines the list of managed rule sets for the policy. + + :param managed_rule_sets: List of rule sets. + :type managed_rule_sets: list[~azure.mgmt.cdn.models.ManagedRuleSet] + """ + + _attribute_map = { + 'managed_rule_sets': {'key': 'managedRuleSets', 'type': '[ManagedRuleSet]'}, + } + + def __init__(self, **kwargs): + super(ManagedRuleSetList, self).__init__(**kwargs) + self.managed_rule_sets = kwargs.get('managed_rule_sets', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_list_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_list_py3.py new file mode 100644 index 000000000000..34236ae6d509 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_list_py3.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ManagedRuleSetList(Model): + """Defines the list of managed rule sets for the policy. + + :param managed_rule_sets: List of rule sets. + :type managed_rule_sets: list[~azure.mgmt.cdn.models.ManagedRuleSet] + """ + + _attribute_map = { + 'managed_rule_sets': {'key': 'managedRuleSets', 'type': '[ManagedRuleSet]'}, + } + + def __init__(self, *, managed_rule_sets=None, **kwargs) -> None: + super(ManagedRuleSetList, self).__init__(**kwargs) + self.managed_rule_sets = managed_rule_sets diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_py3.py new file mode 100644 index 000000000000..f6a126aa1b2a --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/managed_rule_set_py3.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ManagedRuleSet(Model): + """Defines a managed rule set. + + All required parameters must be populated in order to send to Azure. + + :param rule_set_type: Required. Defines the rule set type to use. + :type rule_set_type: str + :param rule_set_version: Required. Defines the version of the rule set to + use. + :type rule_set_version: str + :param anomaly_score: Verizon only : If the rule set supports anomaly + detection mode, this describes the threshold for blocking requests. + :type anomaly_score: int + :param rule_group_overrides: Defines the rule overrides to apply to the + rule set. + :type rule_group_overrides: + list[~azure.mgmt.cdn.models.ManagedRuleGroupOverride] + """ + + _validation = { + 'rule_set_type': {'required': True}, + 'rule_set_version': {'required': True}, + 'anomaly_score': {'maximum': 20, 'minimum': 0}, + } + + _attribute_map = { + 'rule_set_type': {'key': 'ruleSetType', 'type': 'str'}, + 'rule_set_version': {'key': 'ruleSetVersion', 'type': 'str'}, + 'anomaly_score': {'key': 'anomalyScore', 'type': 'int'}, + 'rule_group_overrides': {'key': 'ruleGroupOverrides', 'type': '[ManagedRuleGroupOverride]'}, + } + + def __init__(self, *, rule_set_type: str, rule_set_version: str, anomaly_score: int=None, rule_group_overrides=None, **kwargs) -> None: + super(ManagedRuleSet, self).__init__(**kwargs) + self.rule_set_type = rule_set_type + self.rule_set_version = rule_set_version + self.anomaly_score = anomaly_score + self.rule_group_overrides = rule_group_overrides diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/match_condition.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/match_condition.py new file mode 100644 index 000000000000..b2d14edebc4d --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/match_condition.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MatchCondition(Model): + """Define match conditions. + + All required parameters must be populated in order to send to Azure. + + :param match_variable: Required. Match variable to compare against. + Possible values include: 'RemoteAddr', 'Country', 'RequestMethod', + 'RequestHeader', 'RequestUri', 'QueryString', 'RequestBody', 'Cookies', + 'PostArgs' + :type match_variable: str or ~azure.mgmt.cdn.models.MatchVariable + :param selector: Selector can used to match a specific key for + QueryString, RequestUri, RequestHeaders or RequestBody. + :type selector: str + :param operator: Required. Describes operator to be matched. Possible + values include: 'Any', 'IPMatch', 'GeoMatch', 'Equal', 'Contains', + 'LessThan', 'GreaterThan', 'LessThanOrEqual', 'GreaterThanOrEqual', + 'BeginsWith', 'EndsWith', 'RegEx' + :type operator: str or ~azure.mgmt.cdn.models.Operator + :param negate_condition: Describes if the result of this condition should + be negated. + :type negate_condition: bool + :param match_value: Required. List of possible match values. + :type match_value: list[str] + """ + + _validation = { + 'match_variable': {'required': True}, + 'operator': {'required': True}, + 'match_value': {'required': True}, + } + + _attribute_map = { + 'match_variable': {'key': 'matchVariable', 'type': 'str'}, + 'selector': {'key': 'selector', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, + 'match_value': {'key': 'matchValue', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MatchCondition, self).__init__(**kwargs) + self.match_variable = kwargs.get('match_variable', None) + self.selector = kwargs.get('selector', None) + self.operator = kwargs.get('operator', None) + self.negate_condition = kwargs.get('negate_condition', None) + self.match_value = kwargs.get('match_value', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/match_condition_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/match_condition_py3.py new file mode 100644 index 000000000000..0339178a5c95 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/match_condition_py3.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MatchCondition(Model): + """Define match conditions. + + All required parameters must be populated in order to send to Azure. + + :param match_variable: Required. Match variable to compare against. + Possible values include: 'RemoteAddr', 'Country', 'RequestMethod', + 'RequestHeader', 'RequestUri', 'QueryString', 'RequestBody', 'Cookies', + 'PostArgs' + :type match_variable: str or ~azure.mgmt.cdn.models.MatchVariable + :param selector: Selector can used to match a specific key for + QueryString, RequestUri, RequestHeaders or RequestBody. + :type selector: str + :param operator: Required. Describes operator to be matched. Possible + values include: 'Any', 'IPMatch', 'GeoMatch', 'Equal', 'Contains', + 'LessThan', 'GreaterThan', 'LessThanOrEqual', 'GreaterThanOrEqual', + 'BeginsWith', 'EndsWith', 'RegEx' + :type operator: str or ~azure.mgmt.cdn.models.Operator + :param negate_condition: Describes if the result of this condition should + be negated. + :type negate_condition: bool + :param match_value: Required. List of possible match values. + :type match_value: list[str] + """ + + _validation = { + 'match_variable': {'required': True}, + 'operator': {'required': True}, + 'match_value': {'required': True}, + } + + _attribute_map = { + 'match_variable': {'key': 'matchVariable', 'type': 'str'}, + 'selector': {'key': 'selector', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, + 'match_value': {'key': 'matchValue', 'type': '[str]'}, + } + + def __init__(self, *, match_variable, operator, match_value, selector: str=None, negate_condition: bool=None, **kwargs) -> None: + super(MatchCondition, self).__init__(**kwargs) + self.match_variable = match_variable + self.selector = selector + self.operator = operator + self.negate_condition = negate_condition + self.match_value = match_value diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/policy_settings.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/policy_settings.py new file mode 100644 index 000000000000..df024d03c9ad --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/policy_settings.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class PolicySettings(Model): + """Defines contents of a web application firewall global configuration. + + :param enabled_state: describes if the policy is in enabled state or + disabled state. Possible values include: 'Disabled', 'Enabled' + :type enabled_state: str or ~azure.mgmt.cdn.models.PolicyEnabledState + :param mode: Describes if it is in detection mode or prevention mode at + policy level. Possible values include: 'Prevention', 'Detection' + :type mode: str or ~azure.mgmt.cdn.models.PolicyMode + :param default_redirect_url: If action type is redirect, this field + represents the default redirect URL for the client. + :type default_redirect_url: str + :param default_custom_block_response_status_code: If the action type is + block, this field defines the default customer overridable http response + status code. + :type default_custom_block_response_status_code: int + :param default_custom_block_response_body: If the action type is block, + customer can override the response body. The body must be specified in + base64 encoding. + :type default_custom_block_response_body: str + """ + + _validation = { + 'default_custom_block_response_status_code': {'maximum': 599, 'minimum': 200}, + 'default_custom_block_response_body': {'pattern': r'^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$'}, + } + + _attribute_map = { + 'enabled_state': {'key': 'enabledState', 'type': 'str'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'default_redirect_url': {'key': 'defaultRedirectUrl', 'type': 'str'}, + 'default_custom_block_response_status_code': {'key': 'defaultCustomBlockResponseStatusCode', 'type': 'int'}, + 'default_custom_block_response_body': {'key': 'defaultCustomBlockResponseBody', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PolicySettings, self).__init__(**kwargs) + self.enabled_state = kwargs.get('enabled_state', None) + self.mode = kwargs.get('mode', None) + self.default_redirect_url = kwargs.get('default_redirect_url', None) + self.default_custom_block_response_status_code = kwargs.get('default_custom_block_response_status_code', None) + self.default_custom_block_response_body = kwargs.get('default_custom_block_response_body', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/policy_settings_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/policy_settings_py3.py new file mode 100644 index 000000000000..388ff85ca510 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/policy_settings_py3.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class PolicySettings(Model): + """Defines contents of a web application firewall global configuration. + + :param enabled_state: describes if the policy is in enabled state or + disabled state. Possible values include: 'Disabled', 'Enabled' + :type enabled_state: str or ~azure.mgmt.cdn.models.PolicyEnabledState + :param mode: Describes if it is in detection mode or prevention mode at + policy level. Possible values include: 'Prevention', 'Detection' + :type mode: str or ~azure.mgmt.cdn.models.PolicyMode + :param default_redirect_url: If action type is redirect, this field + represents the default redirect URL for the client. + :type default_redirect_url: str + :param default_custom_block_response_status_code: If the action type is + block, this field defines the default customer overridable http response + status code. + :type default_custom_block_response_status_code: int + :param default_custom_block_response_body: If the action type is block, + customer can override the response body. The body must be specified in + base64 encoding. + :type default_custom_block_response_body: str + """ + + _validation = { + 'default_custom_block_response_status_code': {'maximum': 599, 'minimum': 200}, + 'default_custom_block_response_body': {'pattern': r'^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$'}, + } + + _attribute_map = { + 'enabled_state': {'key': 'enabledState', 'type': 'str'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'default_redirect_url': {'key': 'defaultRedirectUrl', 'type': 'str'}, + 'default_custom_block_response_status_code': {'key': 'defaultCustomBlockResponseStatusCode', 'type': 'int'}, + 'default_custom_block_response_body': {'key': 'defaultCustomBlockResponseBody', 'type': 'str'}, + } + + def __init__(self, *, enabled_state=None, mode=None, default_redirect_url: str=None, default_custom_block_response_status_code: int=None, default_custom_block_response_body: str=None, **kwargs) -> None: + super(PolicySettings, self).__init__(**kwargs) + self.enabled_state = enabled_state + self.mode = mode + self.default_redirect_url = default_redirect_url + self.default_custom_block_response_status_code = default_custom_block_response_status_code + self.default_custom_block_response_body = default_custom_block_response_body diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/rate_limit_rule.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/rate_limit_rule.py new file mode 100644 index 000000000000..96eb1e3559b8 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/rate_limit_rule.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from .custom_rule import CustomRule + + +class RateLimitRule(CustomRule): + """Defines a rate limiting rule that can be included in a waf policy. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Defines the name of the custom rule + :type name: str + :param enabled_state: Describes if the custom rule is in enabled or + disabled state. Defaults to Enabled if not specified. Possible values + include: 'Disabled', 'Enabled' + :type enabled_state: str or ~azure.mgmt.cdn.models.CustomRuleEnabledState + :param priority: Required. Defines in what order this rule be evaluated in + the overall list of custom rules + :type priority: int + :param match_conditions: Required. List of match conditions. + :type match_conditions: list[~azure.mgmt.cdn.models.MatchCondition] + :param action: Required. Describes what action to be applied when rule + matches + :type action: ~azure.mgmt.cdn.models.ActionType + :param rate_limit_threshold: Required. Defines rate limit threshold. + :type rate_limit_threshold: int + :param rate_limit_duration_in_minutes: Required. Defines rate limit + duration. Default is 1 minute. + :type rate_limit_duration_in_minutes: int + """ + + _validation = { + 'name': {'required': True}, + 'priority': {'required': True}, + 'match_conditions': {'required': True}, + 'action': {'required': True}, + 'rate_limit_threshold': {'required': True, 'minimum': 0}, + 'rate_limit_duration_in_minutes': {'required': True, 'maximum': 60, 'minimum': 0}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'enabled_state': {'key': 'enabledState', 'type': 'str'}, + 'priority': {'key': 'priority', 'type': 'int'}, + 'match_conditions': {'key': 'matchConditions', 'type': '[MatchCondition]'}, + 'action': {'key': 'action', 'type': 'ActionType'}, + 'rate_limit_threshold': {'key': 'rateLimitThreshold', 'type': 'int'}, + 'rate_limit_duration_in_minutes': {'key': 'rateLimitDurationInMinutes', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(RateLimitRule, self).__init__(**kwargs) + self.rate_limit_threshold = kwargs.get('rate_limit_threshold', None) + self.rate_limit_duration_in_minutes = kwargs.get('rate_limit_duration_in_minutes', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/rate_limit_rule_list.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/rate_limit_rule_list.py new file mode 100644 index 000000000000..6fce6a537c21 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/rate_limit_rule_list.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RateLimitRuleList(Model): + """Defines contents of rate limit rules. + + :param rules: List of rules + :type rules: list[~azure.mgmt.cdn.models.RateLimitRule] + """ + + _attribute_map = { + 'rules': {'key': 'rules', 'type': '[RateLimitRule]'}, + } + + def __init__(self, **kwargs): + super(RateLimitRuleList, self).__init__(**kwargs) + self.rules = kwargs.get('rules', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/rate_limit_rule_list_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/rate_limit_rule_list_py3.py new file mode 100644 index 000000000000..690886310616 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/rate_limit_rule_list_py3.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RateLimitRuleList(Model): + """Defines contents of rate limit rules. + + :param rules: List of rules + :type rules: list[~azure.mgmt.cdn.models.RateLimitRule] + """ + + _attribute_map = { + 'rules': {'key': 'rules', 'type': '[RateLimitRule]'}, + } + + def __init__(self, *, rules=None, **kwargs) -> None: + super(RateLimitRuleList, self).__init__(**kwargs) + self.rules = rules diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/rate_limit_rule_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/rate_limit_rule_py3.py new file mode 100644 index 000000000000..7b286b0168e1 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/rate_limit_rule_py3.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +from .custom_rule_py3 import CustomRule + + +class RateLimitRule(CustomRule): + """Defines a rate limiting rule that can be included in a waf policy. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Defines the name of the custom rule + :type name: str + :param enabled_state: Describes if the custom rule is in enabled or + disabled state. Defaults to Enabled if not specified. Possible values + include: 'Disabled', 'Enabled' + :type enabled_state: str or ~azure.mgmt.cdn.models.CustomRuleEnabledState + :param priority: Required. Defines in what order this rule be evaluated in + the overall list of custom rules + :type priority: int + :param match_conditions: Required. List of match conditions. + :type match_conditions: list[~azure.mgmt.cdn.models.MatchCondition] + :param action: Required. Describes what action to be applied when rule + matches + :type action: ~azure.mgmt.cdn.models.ActionType + :param rate_limit_threshold: Required. Defines rate limit threshold. + :type rate_limit_threshold: int + :param rate_limit_duration_in_minutes: Required. Defines rate limit + duration. Default is 1 minute. + :type rate_limit_duration_in_minutes: int + """ + + _validation = { + 'name': {'required': True}, + 'priority': {'required': True}, + 'match_conditions': {'required': True}, + 'action': {'required': True}, + 'rate_limit_threshold': {'required': True, 'minimum': 0}, + 'rate_limit_duration_in_minutes': {'required': True, 'maximum': 60, 'minimum': 0}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'enabled_state': {'key': 'enabledState', 'type': 'str'}, + 'priority': {'key': 'priority', 'type': 'int'}, + 'match_conditions': {'key': 'matchConditions', 'type': '[MatchCondition]'}, + 'action': {'key': 'action', 'type': 'ActionType'}, + 'rate_limit_threshold': {'key': 'rateLimitThreshold', 'type': 'int'}, + 'rate_limit_duration_in_minutes': {'key': 'rateLimitDurationInMinutes', 'type': 'int'}, + } + + def __init__(self, *, name: str, priority: int, match_conditions, action, rate_limit_threshold: int, rate_limit_duration_in_minutes: int, enabled_state=None, **kwargs) -> None: + super(RateLimitRule, self).__init__(name=name, enabled_state=enabled_state, priority=priority, match_conditions=match_conditions, action=action, **kwargs) + self.rate_limit_threshold = rate_limit_threshold + self.rate_limit_duration_in_minutes = rate_limit_duration_in_minutes diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/sku.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/sku.py index 967d48334237..d230e2949fe8 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/sku.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/sku.py @@ -18,8 +18,7 @@ class Sku(Model): :param name: Name of the pricing tier. Possible values include: 'Standard_Verizon', 'Premium_Verizon', 'Custom_Verizon', - 'Standard_Akamai', 'Standard_ChinaCdn', 'Standard_Microsoft', - 'Premium_ChinaCdn' + 'Standard_Akamai', 'Standard_ChinaCdn', 'Standard_Microsoft' :type name: str or ~azure.mgmt.cdn.models.SkuName """ diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/sku_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/sku_py3.py index de502036ba68..f85c50c65e00 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/sku_py3.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/sku_py3.py @@ -18,8 +18,7 @@ class Sku(Model): :param name: Name of the pricing tier. Possible values include: 'Standard_Verizon', 'Premium_Verizon', 'Custom_Verizon', - 'Standard_Akamai', 'Standard_ChinaCdn', 'Standard_Microsoft', - 'Premium_ChinaCdn' + 'Standard_Akamai', 'Standard_ChinaCdn', 'Standard_Microsoft' :type name: str or ~azure.mgmt.cdn.models.SkuName """ diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/url_redirect_action_parameters.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/url_redirect_action_parameters.py index b9157296cf5a..08404fea3de7 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/url_redirect_action_parameters.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/url_redirect_action_parameters.py @@ -36,8 +36,8 @@ class UrlRedirectActionParameters(Model): must start with /. Leave empty to use the incoming path as destination path. :type custom_path: str - :param custom_hostname: Host to redirect. Leave empty to use the incoming - host as the destination host. + :param custom_hostname: Host to redirect. Leave empty to use use the + incoming host as the destination host. :type custom_hostname: str :param custom_query_string: The set of query strings to be placed in the redirect URL. Setting this value would replace any existing query string; diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/url_redirect_action_parameters_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/url_redirect_action_parameters_py3.py index a69c266ef374..23f596c2701d 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/url_redirect_action_parameters_py3.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/url_redirect_action_parameters_py3.py @@ -36,8 +36,8 @@ class UrlRedirectActionParameters(Model): must start with /. Leave empty to use the incoming path as destination path. :type custom_path: str - :param custom_hostname: Host to redirect. Leave empty to use the incoming - host as the destination host. + :param custom_hostname: Host to redirect. Leave empty to use use the + incoming host as the destination host. :type custom_hostname: str :param custom_query_string: The set of query strings to be placed in the redirect URL. Setting this value would replace any existing query string; diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/__init__.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/__init__.py index 4a59e48a8459..8bb1753186ab 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/__init__.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/__init__.py @@ -16,6 +16,8 @@ from .resource_usage_operations import ResourceUsageOperations from .operations import Operations from .edge_nodes_operations import EdgeNodesOperations +from .policies_operations import PoliciesOperations +from .managed_rule_sets_operations import ManagedRuleSetsOperations __all__ = [ 'ProfilesOperations', @@ -25,4 +27,6 @@ 'ResourceUsageOperations', 'Operations', 'EdgeNodesOperations', + 'PoliciesOperations', + 'ManagedRuleSetsOperations', ] diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/custom_domains_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/custom_domains_operations.py index f24572ef6125..df80d9883d8c 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/custom_domains_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/custom_domains_operations.py @@ -24,7 +24,7 @@ class CustomDomainsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-04-15". + :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-06-15-preview". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-04-15" + self.api_version = "2019-06-15-preview" self.config = config diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/edge_nodes_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/edge_nodes_operations.py index 0cd4485594d5..ae02978ae8a2 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/edge_nodes_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/edge_nodes_operations.py @@ -22,7 +22,7 @@ class EdgeNodesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-04-15". + :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-06-15-preview". """ models = models @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-04-15" + self.api_version = "2019-06-15-preview" self.config = config diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/endpoints_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/endpoints_operations.py index 73acbe5a525e..a1bb0a06d879 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/endpoints_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/endpoints_operations.py @@ -24,7 +24,7 @@ class EndpointsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-04-15". + :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-06-15-preview". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-04-15" + self.api_version = "2019-06-15-preview" self.config = config diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/managed_rule_sets_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/managed_rule_sets_operations.py new file mode 100644 index 000000000000..83cf94fc335b --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/managed_rule_sets_operations.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ManagedRuleSetsOperations(object): + """ManagedRuleSetsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-06-15-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-15-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all available managed rule sets. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ManagedRuleSetDefinition + :rtype: + ~azure.mgmt.cdn.models.ManagedRuleSetDefinitionPaged[~azure.mgmt.cdn.models.ManagedRuleSetDefinition] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.ManagedRuleSetDefinitionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ManagedRuleSetDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/CdnWebApplicationFirewallManagedRuleSets'} diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/operations.py index 52b4c6870266..7ece1f016816 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/operations.py @@ -22,7 +22,7 @@ class Operations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-04-15". + :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-06-15-preview". """ models = models @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-04-15" + self.api_version = "2019-06-15-preview" self.config = config diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/origins_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/origins_operations.py index cfaa0fff394b..c90604d5a795 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/origins_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/origins_operations.py @@ -24,7 +24,7 @@ class OriginsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-04-15". + :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-06-15-preview". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-04-15" + self.api_version = "2019-06-15-preview" self.config = config diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/policies_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/policies_operations.py new file mode 100644 index 000000000000..9d4474307c5a --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/policies_operations.py @@ -0,0 +1,463 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class PoliciesOperations(object): + """PoliciesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-06-15-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-15-preview" + + self.config = config + + def list( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists all of the protection policies within a resource group. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of CdnWebApplicationFirewallPolicy + :rtype: + ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyPaged[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.CdnWebApplicationFirewallPolicyPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.CdnWebApplicationFirewallPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/CdnWebApplicationFirewallPolicies'} + + def get( + self, resource_group_name, policy_name, custom_headers=None, raw=False, **operation_config): + """Retrieve protection policy with specified name within a resource group. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. + :type policy_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CdnWebApplicationFirewallPolicy or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + 'policyName': self._serialize.url("policy_name", policy_name, 'str', max_length=128), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} + + + def _create_or_update_initial( + self, resource_group_name, policy_name, cdn_web_application_firewall_policy, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + 'policyName': self._serialize.url("policy_name", policy_name, 'str', max_length=128), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(cdn_web_application_firewall_policy, 'CdnWebApplicationFirewallPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', response) + if response.status_code == 201: + deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', response) + if response.status_code == 202: + deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, policy_name, cdn_web_application_firewall_policy, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update policy with specified rule set name within a resource + group. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. + :type policy_name: str + :param cdn_web_application_firewall_policy: Policy to be created. + :type cdn_web_application_firewall_policy: + ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + CdnWebApplicationFirewallPolicy or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + policy_name=policy_name, + cdn_web_application_firewall_policy=cdn_web_application_firewall_policy, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} + + + def _update_initial( + self, resource_group_name, policy_name, tags=None, custom_headers=None, raw=False, **operation_config): + cdn_web_application_firewall_policy_patch_parameters = models.CdnWebApplicationFirewallPolicyPatchParameters(tags=tags) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + 'policyName': self._serialize.url("policy_name", policy_name, 'str', max_length=128), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(cdn_web_application_firewall_policy_patch_parameters, 'CdnWebApplicationFirewallPolicyPatchParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', response) + if response.status_code == 202: + deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, policy_name, tags=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Update an existing CdnWebApplicationFirewallPolicy with the specified + policy name under the specified subscription and resource group. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. + :type policy_name: str + :param tags: CdnWebApplicationFirewallPolicy tags + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + CdnWebApplicationFirewallPolicy or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + policy_name=policy_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} + + + def _delete_initial( + self, resource_group_name, policy_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + 'policyName': self._serialize.url("policy_name", policy_name, 'str', max_length=128), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, policy_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes Policy. + + :param resource_group_name: Name of the Resource group within the + Azure subscription. + :type resource_group_name: str + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. + :type policy_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + policy_name=policy_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/profiles_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/profiles_operations.py index 4083cbd2d8e9..b0ae94ab4b8f 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/profiles_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/profiles_operations.py @@ -24,7 +24,7 @@ class ProfilesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-04-15". + :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-06-15-preview". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-04-15" + self.api_version = "2019-06-15-preview" self.config = config diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/resource_usage_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/resource_usage_operations.py index db649c9ceedb..0e552d9fa07b 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/resource_usage_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/resource_usage_operations.py @@ -22,7 +22,7 @@ class ResourceUsageOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-04-15". + :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-02. Constant value: "2019-06-15-preview". """ models = models @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-04-15" + self.api_version = "2019-06-15-preview" self.config = config