diff --git a/sdk/cdn/azure-mgmt-cdn/HISTORY.rst b/sdk/cdn/azure-mgmt-cdn/HISTORY.rst index 22ea9198ff7e..fdfaff3f8eaf 100644 --- a/sdk/cdn/azure-mgmt-cdn/HISTORY.rst +++ b/sdk/cdn/azure-mgmt-cdn/HISTORY.rst @@ -3,6 +3,16 @@ Release History =============== +4.1.0rc1 (2020-01-18) ++++++++++++++++++++++ + +**Features** + +- Model Endpoint has a new parameter web_application_firewall_policy_link +- Model EndpointUpdateParameters has a new parameter web_application_firewall_policy_link +- Added operation group PoliciesOperations +- Added operation group ManagedRuleSetsOperations + 4.0.0 (2019-11-25) ++++++++++++++++++ diff --git a/sdk/cdn/azure-mgmt-cdn/README.rst b/sdk/cdn/azure-mgmt-cdn/README.rst index ef5eb136d1c6..585619faa1eb 100644 --- a/sdk/cdn/azure-mgmt-cdn/README.rst +++ b/sdk/cdn/azure-mgmt-cdn/README.rst @@ -6,7 +6,7 @@ This is the Microsoft Azure CDN Management Client Library. Azure Resource Manager (ARM) is the next generation of management APIs that replace the old Azure Service Management (ASM). -This package has been tested with Python 2.7, 3.5, 3.6 and 3.7. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. For the older Azure Service Management (ASM) libraries, see `azure-servicemanagement-legacy `__ library. 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 5d803354fec2..aadd85e922cd 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 @@ -21,6 +21,8 @@ from .operations import ResourceUsageOperations from .operations import Operations from .operations import EdgeNodesOperations +from .operations import PoliciesOperations +from .operations import ManagedRuleSetsOperations from . import models @@ -44,6 +46,10 @@ class CdnManagementClient(CdnManagementClientOperationsMixin, 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 @@ -60,7 +66,7 @@ def __init__( 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) @@ -78,3 +84,7 @@ 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) 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 02bcb78918bd..e841190e5841 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 @@ -13,7 +13,10 @@ from ._models_py3 import CacheExpirationActionParameters from ._models_py3 import CacheKeyQueryStringActionParameters from ._models_py3 import CdnCertificateSourceParameters + from ._models_py3 import CdnEndpoint from ._models_py3 import CdnManagedHttpsParameters + from ._models_py3 import CdnWebApplicationFirewallPolicy + from ._models_py3 import CdnWebApplicationFirewallPolicyPatchParameters from ._models_py3 import CheckNameAvailabilityInput from ._models_py3 import CheckNameAvailabilityOutput from ._models_py3 import CidrIpAddress @@ -21,6 +24,8 @@ from ._models_py3 import CustomDomain from ._models_py3 import CustomDomainHttpsParameters from ._models_py3 import CustomDomainParameters + from ._models_py3 import CustomRule + from ._models_py3 import CustomRuleList from ._models_py3 import DeepCreatedOrigin from ._models_py3 import DeliveryRule from ._models_py3 import DeliveryRuleAction @@ -46,6 +51,7 @@ from ._models_py3 import EdgeNode from ._models_py3 import Endpoint from ._models_py3 import EndpointPropertiesUpdateParametersDeliveryPolicy + from ._models_py3 import EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink from ._models_py3 import EndpointUpdateParameters from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import GeoFilter @@ -55,16 +61,27 @@ from ._models_py3 import IsDeviceMatchConditionParameters from ._models_py3 import KeyVaultCertificateSourceParameters from ._models_py3 import LoadParameters + from ._models_py3 import ManagedRuleDefinition + from ._models_py3 import ManagedRuleGroupDefinition + from ._models_py3 import ManagedRuleGroupOverride + from ._models_py3 import ManagedRuleOverride + from ._models_py3 import ManagedRuleSet + from ._models_py3 import ManagedRuleSetDefinition + from ._models_py3 import ManagedRuleSetList + from ._models_py3 import MatchCondition from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import Origin from ._models_py3 import OriginUpdateParameters + from ._models_py3 import PolicySettings from ._models_py3 import PostArgsMatchConditionParameters from ._models_py3 import Profile from ._models_py3 import ProfileUpdateParameters from ._models_py3 import ProxyResource from ._models_py3 import PurgeParameters from ._models_py3 import QueryStringMatchConditionParameters + from ._models_py3 import RateLimitRule + from ._models_py3 import RateLimitRuleList from ._models_py3 import RemoteAddressMatchConditionParameters from ._models_py3 import RequestBodyMatchConditionParameters from ._models_py3 import RequestHeaderMatchConditionParameters @@ -93,7 +110,10 @@ from ._models import CacheExpirationActionParameters from ._models import CacheKeyQueryStringActionParameters from ._models import CdnCertificateSourceParameters + from ._models import CdnEndpoint from ._models import CdnManagedHttpsParameters + from ._models import CdnWebApplicationFirewallPolicy + from ._models import CdnWebApplicationFirewallPolicyPatchParameters from ._models import CheckNameAvailabilityInput from ._models import CheckNameAvailabilityOutput from ._models import CidrIpAddress @@ -101,6 +121,8 @@ from ._models import CustomDomain from ._models import CustomDomainHttpsParameters from ._models import CustomDomainParameters + from ._models import CustomRule + from ._models import CustomRuleList from ._models import DeepCreatedOrigin from ._models import DeliveryRule from ._models import DeliveryRuleAction @@ -126,6 +148,7 @@ from ._models import EdgeNode from ._models import Endpoint from ._models import EndpointPropertiesUpdateParametersDeliveryPolicy + from ._models import EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink from ._models import EndpointUpdateParameters from ._models import ErrorResponse, ErrorResponseException from ._models import GeoFilter @@ -135,16 +158,27 @@ from ._models import IsDeviceMatchConditionParameters from ._models import KeyVaultCertificateSourceParameters from ._models import LoadParameters + from ._models import ManagedRuleDefinition + from ._models import ManagedRuleGroupDefinition + from ._models import ManagedRuleGroupOverride + from ._models import ManagedRuleOverride + from ._models import ManagedRuleSet + from ._models import ManagedRuleSetDefinition + from ._models import ManagedRuleSetList + from ._models import MatchCondition from ._models import Operation from ._models import OperationDisplay from ._models import Origin from ._models import OriginUpdateParameters + from ._models import PolicySettings from ._models import PostArgsMatchConditionParameters from ._models import Profile from ._models import ProfileUpdateParameters from ._models import ProxyResource from ._models import PurgeParameters from ._models import QueryStringMatchConditionParameters + from ._models import RateLimitRule + from ._models import RateLimitRuleList from ._models import RemoteAddressMatchConditionParameters from ._models import RequestBodyMatchConditionParameters from ._models import RequestHeaderMatchConditionParameters @@ -169,9 +203,11 @@ from ._models import ValidateCustomDomainOutput from ._models import ValidateProbeInput from ._models import ValidateProbeOutput +from ._paged_models import CdnWebApplicationFirewallPolicyPaged from ._paged_models import CustomDomainPaged from ._paged_models import EdgeNodePaged from ._paged_models import EndpointPaged +from ._paged_models import ManagedRuleSetDefinitionPaged from ._paged_models import OperationPaged from ._paged_models import OriginPaged from ._paged_models import ProfilePaged @@ -207,13 +243,26 @@ MinimumTlsVersion, CertificateType, ResourceType, + PolicyEnabledState, + PolicyMode, + CustomRuleEnabledState, + MatchVariable, + Operator, + TransformType, + ActionType, + ManagedRuleEnabledState, + ProvisioningState, + PolicyResourceState, ) __all__ = [ 'CacheExpirationActionParameters', 'CacheKeyQueryStringActionParameters', 'CdnCertificateSourceParameters', + 'CdnEndpoint', 'CdnManagedHttpsParameters', + 'CdnWebApplicationFirewallPolicy', + 'CdnWebApplicationFirewallPolicyPatchParameters', 'CheckNameAvailabilityInput', 'CheckNameAvailabilityOutput', 'CidrIpAddress', @@ -221,6 +270,8 @@ 'CustomDomain', 'CustomDomainHttpsParameters', 'CustomDomainParameters', + 'CustomRule', + 'CustomRuleList', 'DeepCreatedOrigin', 'DeliveryRule', 'DeliveryRuleAction', @@ -246,6 +297,7 @@ 'EdgeNode', 'Endpoint', 'EndpointPropertiesUpdateParametersDeliveryPolicy', + 'EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink', 'EndpointUpdateParameters', 'ErrorResponse', 'ErrorResponseException', 'GeoFilter', @@ -255,16 +307,27 @@ 'IsDeviceMatchConditionParameters', 'KeyVaultCertificateSourceParameters', 'LoadParameters', + 'ManagedRuleDefinition', + 'ManagedRuleGroupDefinition', + 'ManagedRuleGroupOverride', + 'ManagedRuleOverride', + 'ManagedRuleSet', + 'ManagedRuleSetDefinition', + 'ManagedRuleSetList', + 'MatchCondition', 'Operation', 'OperationDisplay', 'Origin', 'OriginUpdateParameters', + 'PolicySettings', 'PostArgsMatchConditionParameters', 'Profile', 'ProfileUpdateParameters', 'ProxyResource', 'PurgeParameters', 'QueryStringMatchConditionParameters', + 'RateLimitRule', + 'RateLimitRuleList', 'RemoteAddressMatchConditionParameters', 'RequestBodyMatchConditionParameters', 'RequestHeaderMatchConditionParameters', @@ -296,6 +359,8 @@ 'CustomDomainPaged', 'OperationPaged', 'EdgeNodePaged', + 'CdnWebApplicationFirewallPolicyPaged', + 'ManagedRuleSetDefinitionPaged', 'SkuName', 'ProfileResourceState', 'OptimizationType', @@ -326,4 +391,14 @@ 'MinimumTlsVersion', 'CertificateType', 'ResourceType', + 'PolicyEnabledState', + 'PolicyMode', + 'CustomRuleEnabledState', + 'MatchVariable', + 'Operator', + 'TransformType', + 'ActionType', + 'ManagedRuleEnabledState', + 'ProvisioningState', + 'PolicyResourceState', ] 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 ed40189f511e..b69fc68b6e47 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 @@ -291,3 +291,91 @@ 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 TransformType(str, Enum): + + lowercase = "Lowercase" + uppercase = "Uppercase" + trim = "Trim" + url_decode = "UrlDecode" + url_encode = "UrlEncode" + remove_nulls = "RemoveNulls" + + +class ActionType(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/_models.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_models.py index 1c3ce2f6eba4..940b401edd27 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_models.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_models.py @@ -133,6 +133,22 @@ def __init__(self, **kwargs): self.certificate_type = kwargs.get('certificate_type', None) +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) + + class CustomDomainHttpsParameters(Model): """The JSON object that contains the properties to secure a custom domain. @@ -214,6 +230,183 @@ def __init__(self, **kwargs): self.certificate_source = 'Cdn' +class Resource(Model): + """The core properties of ARM resources. + + 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 + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + 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] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'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}'}, + } + + def __init__(self, **kwargs): + super(TrackedResource, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +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 endpoint_links: Describes Azure CDN endpoints associated with this + Web Application Firewall policy. + :vartype 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}, + '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'}, + 'endpoint_links': {'key': 'properties.endpointLinks', '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.endpoint_links = None + self.provisioning_state = None + self.resource_state = None + self.etag = kwargs.get('etag', None) + self.sku = kwargs.get('sku', None) + + +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) + + class CheckNameAvailabilityInput(Model): """Input of CheckNameAvailability API. @@ -361,39 +554,6 @@ def __init__(self, **kwargs): self.transforms = kwargs.get('transforms', None) -class Resource(Model): - """The core properties of ARM resources. - - 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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - class ProxyResource(Resource): """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. @@ -533,6 +693,68 @@ def __init__(self, **kwargs): self.host_name = kwargs.get('host_name', None) +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. Possible values include: 'Allow', 'Block', 'Log', 'Redirect' + :type action: str or ~azure.mgmt.cdn.models.ActionType + """ + + _validation = { + 'name': {'required': True}, + 'priority': {'required': True, 'maximum': 1000, 'minimum': 0}, + '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': 'str'}, + } + + 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) + + +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) + + class DeepCreatedOrigin(Model): """The main origin of CDN content which is added when creating a CDN endpoint. @@ -1215,47 +1437,6 @@ def __init__(self, **kwargs): self.ip_address_groups = kwargs.get('ip_address_groups', None) -class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. - - 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] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'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}'}, - } - - def __init__(self, **kwargs): - super(TrackedResource, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - - class Endpoint(TrackedResource): """CDN endpoint is the entity within a CDN profile containing configuration information such as origin, protocol, content caching and delivery @@ -1329,6 +1510,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 @@ -1372,6 +1557,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'}, @@ -1391,6 +1577,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 @@ -1423,6 +1610,23 @@ def __init__(self, **kwargs): self.rules = kwargs.get('rules', None) +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) + + class EndpointUpdateParameters(Model): """Properties required to create or update an endpoint. @@ -1480,6 +1684,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 = { @@ -1495,6 +1703,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): @@ -1511,6 +1720,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) class ErrorResponse(Model): @@ -1842,6 +2052,292 @@ def __init__(self, **kwargs): self.content_paths = kwargs.get('content_paths', None) +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 + + +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 + + +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) + + +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. Possible values include: 'Allow', 'Block', 'Log', 'Redirect' + :type action: str or ~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': 'str'}, + } + + 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) + + +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) + + +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) + + +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) + + +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] + :param transforms: List of transforms. + :type transforms: list[str or ~azure.mgmt.cdn.models.TransformType] + """ + + _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]'}, + 'transforms': {'key': 'transforms', '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) + self.transforms = kwargs.get('transforms', None) + + class Operation(Model): """CDN REST API operation. @@ -2004,6 +2500,50 @@ def __init__(self, **kwargs): self.https_port = kwargs.get('https_port', None) +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) + + class PostArgsMatchConditionParameters(Model): """Defines the parameters for PostArgs match conditions. @@ -2202,6 +2742,73 @@ def __init__(self, **kwargs): self.transforms = kwargs.get('transforms', None) +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. Possible values include: 'Allow', 'Block', 'Log', 'Redirect' + :type action: str or ~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, 'maximum': 1000, 'minimum': 0}, + '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': 'str'}, + '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) + + +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) + + class RemoteAddressMatchConditionParameters(Model): """Defines the parameters for RemoteAddress match conditions. diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_models_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_models_py3.py index 1914de31686b..f544cd6f0a88 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_models_py3.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_models_py3.py @@ -133,6 +133,22 @@ def __init__(self, *, certificate_type, **kwargs) -> None: self.certificate_type = certificate_type +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 + + class CustomDomainHttpsParameters(Model): """The JSON object that contains the properties to secure a custom domain. @@ -214,6 +230,183 @@ def __init__(self, *, protocol_type, certificate_source_parameters, minimum_tls_ self.certificate_source = 'Cdn' +class Resource(Model): + """The core properties of ARM resources. + + 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 + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + 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] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'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}'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(TrackedResource, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +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 endpoint_links: Describes Azure CDN endpoints associated with this + Web Application Firewall policy. + :vartype 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}, + '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'}, + 'endpoint_links': {'key': 'properties.endpointLinks', '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.endpoint_links = None + self.provisioning_state = None + self.resource_state = None + self.etag = etag + self.sku = sku + + +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 + + class CheckNameAvailabilityInput(Model): """Input of CheckNameAvailability API. @@ -361,39 +554,6 @@ def __init__(self, *, selector: str, operator, match_values, negate_condition: b self.transforms = transforms -class Resource(Model): - """The core properties of ARM resources. - - 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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - class ProxyResource(Resource): """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. @@ -533,6 +693,68 @@ def __init__(self, *, host_name: str, **kwargs) -> None: self.host_name = host_name +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. Possible values include: 'Allow', 'Block', 'Log', 'Redirect' + :type action: str or ~azure.mgmt.cdn.models.ActionType + """ + + _validation = { + 'name': {'required': True}, + 'priority': {'required': True, 'maximum': 1000, 'minimum': 0}, + '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': 'str'}, + } + + 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 + + +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 + + class DeepCreatedOrigin(Model): """The main origin of CDN content which is added when creating a CDN endpoint. @@ -1215,47 +1437,6 @@ def __init__(self, *, ip_address_groups, **kwargs) -> None: self.ip_address_groups = ip_address_groups -class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. - - 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] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'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}'}, - } - - def __init__(self, *, location: str, tags=None, **kwargs) -> None: - super(TrackedResource, self).__init__(**kwargs) - self.location = location - self.tags = tags - - class Endpoint(TrackedResource): """CDN endpoint is the entity within a CDN profile containing configuration information such as origin, protocol, content caching and delivery @@ -1329,6 +1510,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 @@ -1372,13 +1557,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 @@ -1391,6 +1577,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 @@ -1423,6 +1610,23 @@ def __init__(self, *, rules, description: str=None, **kwargs) -> None: self.rules = rules +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 + + class EndpointUpdateParameters(Model): """Properties required to create or update an endpoint. @@ -1480,6 +1684,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 = { @@ -1495,9 +1703,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 @@ -1511,6 +1720,7 @@ 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 class ErrorResponse(Model): @@ -1842,6 +2052,292 @@ def __init__(self, *, content_paths, **kwargs) -> None: self.content_paths = content_paths +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 + + +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 + + +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 + + +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. Possible values include: 'Allow', 'Block', 'Log', 'Redirect' + :type action: str or ~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': 'str'}, + } + + 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 + + +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 + + +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 + + +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 + + +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] + :param transforms: List of transforms. + :type transforms: list[str or ~azure.mgmt.cdn.models.TransformType] + """ + + _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]'}, + 'transforms': {'key': 'transforms', 'type': '[str]'}, + } + + def __init__(self, *, match_variable, operator, match_value, selector: str=None, negate_condition: bool=None, transforms=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 + self.transforms = transforms + + class Operation(Model): """CDN REST API operation. @@ -2004,6 +2500,50 @@ def __init__(self, *, host_name: str=None, http_port: int=None, https_port: int= self.https_port = https_port +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 + + class PostArgsMatchConditionParameters(Model): """Defines the parameters for PostArgs match conditions. @@ -2202,6 +2742,73 @@ def __init__(self, *, operator, match_values, negate_condition: bool=None, trans self.transforms = transforms +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. Possible values include: 'Allow', 'Block', 'Log', 'Redirect' + :type action: str or ~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, 'maximum': 1000, 'minimum': 0}, + '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': 'str'}, + '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 + + +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 + + class RemoteAddressMatchConditionParameters(Model): """Defines the parameters for RemoteAddress match conditions. diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_paged_models.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_paged_models.py index c49540a423fe..fbfa32a6349a 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_paged_models.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_paged_models.py @@ -103,3 +103,29 @@ class EdgeNodePaged(Paged): def __init__(self, *args, **kwargs): super(EdgeNodePaged, self).__init__(*args, **kwargs) +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) +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/operations/__init__.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/__init__.py index 8d0dce780f5c..ccdc2d079741 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 from ._cdn_management_client_operations import CdnManagementClientOperationsMixin __all__ = [ @@ -26,5 +28,7 @@ 'ResourceUsageOperations', 'Operations', 'EdgeNodesOperations', + 'PoliciesOperations', + 'ManagedRuleSetsOperations', 'CdnManagementClientOperationsMixin', ] diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_cdn_management_client_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_cdn_management_client_operations.py index 76410352b69e..401b6401bc1c 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_cdn_management_client_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_cdn_management_client_operations.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- 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 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 98be04da015b..7062f3872b4d 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 @@ -26,7 +26,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 @@ -36,7 +36,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 856cb323bbd5..55813844da35 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 @@ -24,7 +24,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 @@ -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/_endpoints_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_endpoints_operations.py index 9e6f2ea36283..db2f79eeea3b 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 @@ -26,7 +26,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 @@ -36,7 +36,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..548d3c4e12f3 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_managed_rule_sets_operations.py @@ -0,0 +1,104 @@ +# 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. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :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 prepare_request(next_link=None): + 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + header_dict = None + if raw: + header_dict = {} + deserialized = models.ManagedRuleSetDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + 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 31ed79a06724..11d4db705f67 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 @@ -24,7 +24,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 @@ -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/_origins_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_origins_operations.py index 43a9b6c4b407..9e197af88faf 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 @@ -26,7 +26,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 @@ -36,7 +36,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..38877e1801b7 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_policies_operations.py @@ -0,0 +1,466 @@ +# 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. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :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 prepare_request(next_link=None): + 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + header_dict = None + if raw: + header_dict = {} + deserialized = models.CdnWebApplicationFirewallPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + + 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 746aa749836b..72fafc7245fe 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 @@ -26,7 +26,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 @@ -36,7 +36,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 478a4b93eb69..654a4f3a72b8 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 @@ -24,7 +24,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 @@ -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/version.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/version.py index 20cee28211d4..9dfe277f2a9c 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/version.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "4.1.0rc1" diff --git a/sdk/cdn/azure-mgmt-cdn/setup.py b/sdk/cdn/azure-mgmt-cdn/setup.py index c0e64112e92d..b44fae2f5900 100644 --- a/sdk/cdn/azure-mgmt-cdn/setup.py +++ b/sdk/cdn/azure-mgmt-cdn/setup.py @@ -67,6 +67,7 @@ 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'License :: OSI Approved :: MIT License', ], zip_safe=False, diff --git a/sdk/cdn/azure-mgmt-cdn/tests/recordings/test_mgmt_cdn.test_cdn.yaml b/sdk/cdn/azure-mgmt-cdn/tests/recordings/test_mgmt_cdn.test_cdn.yaml index 6e4ba094e804..23646f610d8f 100644 --- a/sdk/cdn/azure-mgmt-cdn/tests/recordings/test_mgmt_cdn.test_cdn.yaml +++ b/sdk/cdn/azure-mgmt-cdn/tests/recordings/test_mgmt_cdn.test_cdn.yaml @@ -13,12 +13,12 @@ interactions: Content-Type: - application/json; charset=utf-8 User-Agent: - - python/3.6.8 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.8 - msrest_azure/0.4.34 azure-mgmt-cdn/2.0.0 Azure-SDK-For-Python + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-cdn/4.1.0rc1 Azure-SDK-For-Python accept-language: - en-US method: POST - uri: https://management.azure.com/providers/Microsoft.Cdn/checkNameAvailability?api-version=2019-04-15 + uri: https://management.azure.com/providers/Microsoft.Cdn/checkNameAvailability?api-version=2019-06-15-preview response: body: string: "{\r\n \"nameAvailable\":true,\"reason\":null,\"message\":null\r\n}" @@ -30,7 +30,7 @@ interactions: content-type: - application/json; odata.metadata=minimal date: - - Mon, 25 Nov 2019 08:43:44 GMT + - Sat, 18 Jan 2020 12:31:33 GMT expires: - '-1' odata-version: