Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR cdn/resource-manager] Swagger API for Azure CDN WebApplicationFirewallPolicy resource #5680

Merged
merged 4 commits into from
Jun 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/cdn_management_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from msrestazure import AzureConfiguration
from .version import VERSION
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from msrest.polling import LROPoller, NoPolling
from msrestazure.polling.arm_polling import ARMPolling
import uuid
Expand All @@ -24,6 +25,8 @@
from .operations.resource_usage_operations import ResourceUsageOperations
from .operations.operations import Operations
from .operations.edge_nodes_operations import EdgeNodesOperations
from .operations.policies_operations import PoliciesOperations
from .operations.managed_rule_sets_operations import ManagedRuleSetsOperations
from . import models


Expand All @@ -37,16 +40,25 @@ class CdnManagementClientConfiguration(AzureConfiguration):
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:param subscription_id1: Azure Subscription ID.
:type subscription_id1: str
:param api_version1: Version of the API to be used with the client
request. Current version is 2017-04-02.
:type api_version1: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):
self, credentials, subscription_id, subscription_id1, api_version1, base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if subscription_id1 is None:
raise ValueError("Parameter 'subscription_id1' must not be None.")
if api_version1 is None:
raise ValueError("Parameter 'api_version1' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'

Expand All @@ -57,10 +69,12 @@ def __init__(

self.credentials = credentials
self.subscription_id = subscription_id
self.subscription_id1 = subscription_id1
self.api_version1 = api_version1


class CdnManagementClient(SDKClient):
"""Use these APIs to manage Azure CDN resources through the Azure Resource Manager. You must make sure that requests made to these resources are secure.
"""Cdn Management Client

:ivar config: Configuration for client.
:vartype config: CdnManagementClientConfiguration
Expand All @@ -79,23 +93,32 @@ class CdnManagementClient(SDKClient):
:vartype operations: azure.mgmt.cdn.operations.Operations
:ivar edge_nodes: EdgeNodes operations
:vartype edge_nodes: azure.mgmt.cdn.operations.EdgeNodesOperations
:ivar policies: Policies operations
:vartype policies: azure.mgmt.cdn.operations.PoliciesOperations
:ivar managed_rule_sets: ManagedRuleSets operations
:vartype managed_rule_sets: azure.mgmt.cdn.operations.ManagedRuleSetsOperations

:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:param subscription_id1: Azure Subscription ID.
:type subscription_id1: str
:param api_version1: Version of the API to be used with the client
request. Current version is 2017-04-02.
:type api_version1: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):
self, credentials, subscription_id, subscription_id1, api_version1, base_url=None):

self.config = CdnManagementClientConfiguration(credentials, subscription_id, base_url)
self.config = CdnManagementClientConfiguration(credentials, subscription_id, subscription_id1, api_version1, base_url)
super(CdnManagementClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2019-04-15'
self.api_version = '2019-06-15-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

Expand All @@ -113,6 +136,10 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.edge_nodes = EdgeNodesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.policies = PoliciesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.managed_rule_sets = ManagedRuleSetsOperations(
self._client, self.config, self._serialize, self._deserialize)

def check_name_availability(
self, name, custom_headers=None, raw=False, **operation_config):
Expand Down
76 changes: 76 additions & 0 deletions sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from .delivery_rule_action_py3 import DeliveryRuleAction
from .delivery_rule_py3 import DeliveryRule
from .endpoint_properties_update_parameters_delivery_policy_py3 import EndpointPropertiesUpdateParametersDeliveryPolicy
from .endpoint_properties_update_parameters_web_application_firewall_policy_link_py3 import EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink
from .endpoint_update_parameters_py3 import EndpointUpdateParameters
from .remote_address_match_condition_parameters_py3 import RemoteAddressMatchConditionParameters
from .delivery_rule_remote_address_condition_py3 import DeliveryRuleRemoteAddressCondition
Expand Down Expand Up @@ -81,6 +82,23 @@
from .tracked_resource_py3 import TrackedResource
from .proxy_resource_py3 import ProxyResource
from .error_response_py3 import ErrorResponse, ErrorResponseException
from .policy_settings_py3 import PolicySettings
from .rate_limit_rule_py3 import RateLimitRule
from .rate_limit_rule_list_py3 import RateLimitRuleList
from .match_condition_py3 import MatchCondition
from .action_type_py3 import ActionType
from .custom_rule_py3 import CustomRule
from .custom_rule_list_py3 import CustomRuleList
from .managed_rule_override_py3 import ManagedRuleOverride
from .managed_rule_group_override_py3 import ManagedRuleGroupOverride
from .managed_rule_set_py3 import ManagedRuleSet
from .managed_rule_set_list_py3 import ManagedRuleSetList
from .cdn_endpoint_py3 import CdnEndpoint
from .cdn_web_application_firewall_policy_py3 import CdnWebApplicationFirewallPolicy
from .cdn_web_application_firewall_policy_patch_parameters_py3 import CdnWebApplicationFirewallPolicyPatchParameters
from .managed_rule_definition_py3 import ManagedRuleDefinition
from .managed_rule_group_definition_py3 import ManagedRuleGroupDefinition
from .managed_rule_set_definition_py3 import ManagedRuleSetDefinition
except (SyntaxError, ImportError):
from .sku import Sku
from .profile import Profile
Expand All @@ -94,6 +112,7 @@
from .delivery_rule_action import DeliveryRuleAction
from .delivery_rule import DeliveryRule
from .endpoint_properties_update_parameters_delivery_policy import EndpointPropertiesUpdateParametersDeliveryPolicy
from .endpoint_properties_update_parameters_web_application_firewall_policy_link import EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink
from .endpoint_update_parameters import EndpointUpdateParameters
from .remote_address_match_condition_parameters import RemoteAddressMatchConditionParameters
from .delivery_rule_remote_address_condition import DeliveryRuleRemoteAddressCondition
Expand Down Expand Up @@ -153,13 +172,32 @@
from .tracked_resource import TrackedResource
from .proxy_resource import ProxyResource
from .error_response import ErrorResponse, ErrorResponseException
from .policy_settings import PolicySettings
from .rate_limit_rule import RateLimitRule
from .rate_limit_rule_list import RateLimitRuleList
from .match_condition import MatchCondition
from .action_type import ActionType
from .custom_rule import CustomRule
from .custom_rule_list import CustomRuleList
from .managed_rule_override import ManagedRuleOverride
from .managed_rule_group_override import ManagedRuleGroupOverride
from .managed_rule_set import ManagedRuleSet
from .managed_rule_set_list import ManagedRuleSetList
from .cdn_endpoint import CdnEndpoint
from .cdn_web_application_firewall_policy import CdnWebApplicationFirewallPolicy
from .cdn_web_application_firewall_policy_patch_parameters import CdnWebApplicationFirewallPolicyPatchParameters
from .managed_rule_definition import ManagedRuleDefinition
from .managed_rule_group_definition import ManagedRuleGroupDefinition
from .managed_rule_set_definition import ManagedRuleSetDefinition
from .profile_paged import ProfilePaged
from .resource_usage_paged import ResourceUsagePaged
from .endpoint_paged import EndpointPaged
from .origin_paged import OriginPaged
from .custom_domain_paged import CustomDomainPaged
from .operation_paged import OperationPaged
from .edge_node_paged import EdgeNodePaged
from .cdn_web_application_firewall_policy_paged import CdnWebApplicationFirewallPolicyPaged
from .managed_rule_set_definition_paged import ManagedRuleSetDefinitionPaged
from .cdn_management_client_enums import (
SkuName,
ProfileResourceState,
Expand Down Expand Up @@ -188,6 +226,15 @@
ProtocolType,
CertificateType,
ResourceType,
PolicyEnabledState,
PolicyMode,
CustomRuleEnabledState,
MatchVariable,
Operator,
Action,
ManagedRuleEnabledState,
ProvisioningState,
PolicyResourceState,
)

__all__ = [
Expand All @@ -203,6 +250,7 @@
'DeliveryRuleAction',
'DeliveryRule',
'EndpointPropertiesUpdateParametersDeliveryPolicy',
'EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink',
'EndpointUpdateParameters',
'RemoteAddressMatchConditionParameters',
'DeliveryRuleRemoteAddressCondition',
Expand Down Expand Up @@ -262,13 +310,32 @@
'TrackedResource',
'ProxyResource',
'ErrorResponse', 'ErrorResponseException',
'PolicySettings',
'RateLimitRule',
'RateLimitRuleList',
'MatchCondition',
'ActionType',
'CustomRule',
'CustomRuleList',
'ManagedRuleOverride',
'ManagedRuleGroupOverride',
'ManagedRuleSet',
'ManagedRuleSetList',
'CdnEndpoint',
'CdnWebApplicationFirewallPolicy',
'CdnWebApplicationFirewallPolicyPatchParameters',
'ManagedRuleDefinition',
'ManagedRuleGroupDefinition',
'ManagedRuleSetDefinition',
'ProfilePaged',
'ResourceUsagePaged',
'EndpointPaged',
'OriginPaged',
'CustomDomainPaged',
'OperationPaged',
'EdgeNodePaged',
'CdnWebApplicationFirewallPolicyPaged',
'ManagedRuleSetDefinitionPaged',
'SkuName',
'ProfileResourceState',
'OptimizationType',
Expand Down Expand Up @@ -296,4 +363,13 @@
'ProtocolType',
'CertificateType',
'ResourceType',
'PolicyEnabledState',
'PolicyMode',
'CustomRuleEnabledState',
'MatchVariable',
'Operator',
'Action',
'ManagedRuleEnabledState',
'ProvisioningState',
'PolicyResourceState',
]
53 changes: 53 additions & 0 deletions sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/action_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class ActionType(Model):
"""Defines the action to take on rule match.

All required parameters must be populated in order to send to Azure.

:param action_type: Required. Describes type of action. Possible values
include: 'Allow', 'Block', 'Log', 'Redirect'
:type action_type: str or ~azure.mgmt.cdn.models.Action
:param redirect_url: If action type is redirect, this field represents URL
to be re-directed.
:type redirect_url: str
:param custom_block_response_status_code: If the action type is block,
customer can override the response status code.
:type custom_block_response_status_code: int
:param custom_block_response_body: If the action type is block, customer
can override the response body. The body must be specified in base64
encoding.
:type custom_block_response_body: str
"""

_validation = {
'action_type': {'required': True},
'custom_block_response_status_code': {'maximum': 599, 'minimum': 200},
'custom_block_response_body': {'pattern': r'^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$'},
}

_attribute_map = {
'action_type': {'key': 'actionType', 'type': 'str'},
'redirect_url': {'key': 'redirectUrl', 'type': 'str'},
'custom_block_response_status_code': {'key': 'customBlockResponseStatusCode', 'type': 'int'},
'custom_block_response_body': {'key': 'customBlockResponseBody', 'type': 'str'},
}

def __init__(self, **kwargs):
super(ActionType, self).__init__(**kwargs)
self.action_type = kwargs.get('action_type', None)
self.redirect_url = kwargs.get('redirect_url', None)
self.custom_block_response_status_code = kwargs.get('custom_block_response_status_code', None)
self.custom_block_response_body = kwargs.get('custom_block_response_body', None)
53 changes: 53 additions & 0 deletions sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/action_type_py3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class ActionType(Model):
"""Defines the action to take on rule match.

All required parameters must be populated in order to send to Azure.

:param action_type: Required. Describes type of action. Possible values
include: 'Allow', 'Block', 'Log', 'Redirect'
:type action_type: str or ~azure.mgmt.cdn.models.Action
:param redirect_url: If action type is redirect, this field represents URL
to be re-directed.
:type redirect_url: str
:param custom_block_response_status_code: If the action type is block,
customer can override the response status code.
:type custom_block_response_status_code: int
:param custom_block_response_body: If the action type is block, customer
can override the response body. The body must be specified in base64
encoding.
:type custom_block_response_body: str
"""

_validation = {
'action_type': {'required': True},
'custom_block_response_status_code': {'maximum': 599, 'minimum': 200},
'custom_block_response_body': {'pattern': r'^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$'},
}

_attribute_map = {
'action_type': {'key': 'actionType', 'type': 'str'},
'redirect_url': {'key': 'redirectUrl', 'type': 'str'},
'custom_block_response_status_code': {'key': 'customBlockResponseStatusCode', 'type': 'int'},
'custom_block_response_body': {'key': 'customBlockResponseBody', 'type': 'str'},
}

def __init__(self, *, action_type, redirect_url: str=None, custom_block_response_status_code: int=None, custom_block_response_body: str=None, **kwargs) -> None:
super(ActionType, self).__init__(**kwargs)
self.action_type = action_type
self.redirect_url = redirect_url
self.custom_block_response_status_code = custom_block_response_status_code
self.custom_block_response_body = custom_block_response_body
28 changes: 28 additions & 0 deletions sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/cdn_endpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class CdnEndpoint(Model):
"""Defines the ARM Resource ID for the linked endpoints.

:param id: ARM Resource ID string.
:type id: str
"""

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
}

def __init__(self, **kwargs):
super(CdnEndpoint, self).__init__(**kwargs)
self.id = kwargs.get('id', None)
Loading