Skip to content
Closed
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
15 changes: 12 additions & 3 deletions azure-mgmt-cdn/azure/mgmt/cdn/cdn_management_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,21 @@ class CdnManagementClientConfiguration(AzureConfiguration):
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:param resource_group_name: Name of the Resource group within the Azure
subscription.
:type resource_group_name: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):
self, credentials, subscription_id, resource_group_name, 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 resource_group_name is None:
raise ValueError("Parameter 'resource_group_name' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'

Expand All @@ -56,6 +61,7 @@ def __init__(

self.credentials = credentials
self.subscription_id = subscription_id
self.resource_group_name = resource_group_name


class CdnManagementClient(object):
Expand Down Expand Up @@ -84,13 +90,16 @@ class CdnManagementClient(object):
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:param resource_group_name: Name of the Resource group within the Azure
subscription.
:type resource_group_name: str
:param str base_url: Service URL
"""

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

self.config = CdnManagementClientConfiguration(credentials, subscription_id, base_url)
self.config = CdnManagementClientConfiguration(credentials, subscription_id, resource_group_name, base_url)
self._client = ServiceClient(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
Expand Down
2 changes: 0 additions & 2 deletions azure-mgmt-cdn/azure/mgmt/cdn/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
OptimizationType,
EndpointResourceState,
QueryStringCachingBehavior,
GeoFilterActions,
OriginResourceState,
CustomDomainResourceState,
CustomHttpsProvisioningState,
Expand Down Expand Up @@ -125,7 +124,6 @@
'OptimizationType',
'EndpointResourceState',
'QueryStringCachingBehavior',
'GeoFilterActions',
'OriginResourceState',
'CustomDomainResourceState',
'CustomHttpsProvisioningState',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ class QueryStringCachingBehavior(Enum):
not_set = "NotSet"


class GeoFilterActions(Enum):

block = "Block"
allow = "Allow"


class OriginResourceState(Enum):

creating = "Creating"
Expand Down
10 changes: 5 additions & 5 deletions azure-mgmt-cdn/azure/mgmt/cdn/models/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class Endpoint(TrackedResource):
:ivar host_name: The host name of the endpoint structured as
{endpointName}.{DNSZone}, e.g. consoto.azureedge.net
:vartype host_name: str
:param origins: The source of the content being delivered via CDN.
:type origins: list[~azure.mgmt.cdn.models.DeepCreatedOrigin]
:ivar origins: The source of the content being delivered via CDN.
:vartype origins: list[~azure.mgmt.cdn.models.DeepCreatedOrigin]
:ivar resource_state: Resource status of the endpoint. Possible values
include: 'Creating', 'Deleting', 'Running', 'Starting', 'Stopped',
'Stopping'
Expand All @@ -103,7 +103,7 @@ class Endpoint(TrackedResource):
'type': {'readonly': True},
'location': {'required': True},
'host_name': {'readonly': True},
'origins': {'required': True},
'origins': {'required': True, 'readonly': True},
'resource_state': {'readonly': True},
'provisioning_state': {'readonly': True},
}
Expand Down Expand Up @@ -131,7 +131,7 @@ class Endpoint(TrackedResource):
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
}

def __init__(self, location, origins, tags=None, origin_host_header=None, origin_path=None, content_types_to_compress=None, is_compression_enabled=None, is_http_allowed=None, is_https_allowed=None, query_string_caching_behavior=None, optimization_type=None, probe_path=None, geo_filters=None, delivery_policy=None):
def __init__(self, location, tags=None, origin_host_header=None, origin_path=None, content_types_to_compress=None, is_compression_enabled=None, is_http_allowed=None, is_https_allowed=None, query_string_caching_behavior=None, optimization_type=None, probe_path=None, geo_filters=None, delivery_policy=None):
super(Endpoint, self).__init__(location=location, tags=tags)
self.origin_host_header = origin_host_header
self.origin_path = origin_path
Expand All @@ -145,6 +145,6 @@ def __init__(self, location, origins, tags=None, origin_host_header=None, origin
self.geo_filters = geo_filters
self.delivery_policy = delivery_policy
self.host_name = None
self.origins = origins
self.origins = None
self.resource_state = None
self.provisioning_state = None
4 changes: 2 additions & 2 deletions azure-mgmt-cdn/azure/mgmt/cdn/models/geo_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GeoFilter(Model):
:type relative_path: str
:param action: Action of the geo filter, i.e. allow or block access.
Possible values include: 'Block', 'Allow'
:type action: str or ~azure.mgmt.cdn.models.GeoFilterActions
:type action: str or ~azure.mgmt.cdn.models.enum
:param country_codes: Two letter country codes defining user country
access in a geo filter, e.g. AU, MX, US.
:type country_codes: list[str]
Expand All @@ -34,7 +34,7 @@ class GeoFilter(Model):

_attribute_map = {
'relative_path': {'key': 'relativePath', 'type': 'str'},
'action': {'key': 'action', 'type': 'GeoFilterActions'},
'action': {'key': 'action', 'type': 'str'},
'country_codes': {'key': 'countryCodes', 'type': '[str]'},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,9 @@ def __init__(self, client, config, serializer, deserializer):
self.config = config

def list_by_endpoint(
self, resource_group_name, profile_name, endpoint_name, custom_headers=None, raw=False, **operation_config):
self, profile_name, endpoint_name, custom_headers=None, raw=False, **operation_config):
"""Lists all of the existing custom domains within an endpoint.

:param resource_group_name: Name of the Resource group within the
Azure subscription.
:type resource_group_name: str
:param profile_name: Name of the CDN profile which is unique within
the resource group.
:type profile_name: str
Expand All @@ -68,7 +65,7 @@ def internal_paging(next_link=None, raw=False):
# Construct URL
url = self.list_by_endpoint.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'profileName': self._serialize.url("profile_name", profile_name, 'str'),
'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
Expand Down Expand Up @@ -115,12 +112,9 @@ def internal_paging(next_link=None, raw=False):
list_by_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains'}

def get(
self, resource_group_name, profile_name, endpoint_name, custom_domain_name, custom_headers=None, raw=False, **operation_config):
self, profile_name, endpoint_name, custom_domain_name, custom_headers=None, raw=False, **operation_config):
"""Gets an exisitng custom domain within an endpoint.

:param resource_group_name: Name of the Resource group within the
Azure subscription.
:type resource_group_name: str
:param profile_name: Name of the CDN profile which is unique within
the resource group.
:type profile_name: str
Expand All @@ -144,7 +138,7 @@ def get(
# Construct URL
url = self.get.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'profileName': self._serialize.url("profile_name", profile_name, 'str'),
'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'),
'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'),
Expand Down Expand Up @@ -187,13 +181,13 @@ def get(


def _create_initial(
self, resource_group_name, profile_name, endpoint_name, custom_domain_name, host_name, custom_headers=None, raw=False, **operation_config):
self, profile_name, endpoint_name, custom_domain_name, host_name, custom_headers=None, raw=False, **operation_config):
custom_domain_properties = models.CustomDomainParameters(host_name=host_name)

# Construct URL
url = self.create.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'profileName': self._serialize.url("profile_name", profile_name, 'str'),
'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'),
'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'),
Expand Down Expand Up @@ -242,12 +236,9 @@ def _create_initial(
return deserialized

def create(
self, resource_group_name, profile_name, endpoint_name, custom_domain_name, host_name, custom_headers=None, raw=False, **operation_config):
self, profile_name, endpoint_name, custom_domain_name, host_name, custom_headers=None, raw=False, **operation_config):
"""Creates a new custom domain within an endpoint.

:param resource_group_name: Name of the Resource group within the
Azure subscription.
:type resource_group_name: str
:param profile_name: Name of the CDN profile which is unique within
the resource group.
:type profile_name: str
Expand All @@ -272,7 +263,6 @@ def create(
:class:`ErrorResponseException<azure.mgmt.cdn.models.ErrorResponseException>`
"""
raw_result = self._create_initial(
resource_group_name=resource_group_name,
profile_name=profile_name,
endpoint_name=endpoint_name,
custom_domain_name=custom_domain_name,
Expand Down Expand Up @@ -321,11 +311,11 @@ def get_long_running_output(response):


def _delete_initial(
self, resource_group_name, profile_name, endpoint_name, custom_domain_name, custom_headers=None, raw=False, **operation_config):
self, profile_name, endpoint_name, custom_domain_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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'profileName': self._serialize.url("profile_name", profile_name, 'str'),
'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'),
'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'),
Expand Down Expand Up @@ -366,12 +356,9 @@ def _delete_initial(
return deserialized

def delete(
self, resource_group_name, profile_name, endpoint_name, custom_domain_name, custom_headers=None, raw=False, **operation_config):
self, profile_name, endpoint_name, custom_domain_name, custom_headers=None, raw=False, **operation_config):
"""Deletes an existing custom domain within an endpoint.

:param resource_group_name: Name of the Resource group within the
Azure subscription.
:type resource_group_name: str
:param profile_name: Name of the CDN profile which is unique within
the resource group.
:type profile_name: str
Expand All @@ -393,7 +380,6 @@ def delete(
:class:`ErrorResponseException<azure.mgmt.cdn.models.ErrorResponseException>`
"""
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
profile_name=profile_name,
endpoint_name=endpoint_name,
custom_domain_name=custom_domain_name,
Expand Down Expand Up @@ -440,12 +426,9 @@ def get_long_running_output(response):
delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}'}

def disable_custom_https(
self, resource_group_name, profile_name, endpoint_name, custom_domain_name, custom_headers=None, raw=False, **operation_config):
self, profile_name, endpoint_name, custom_domain_name, custom_headers=None, raw=False, **operation_config):
"""Disable https delivery of the custom domain.

:param resource_group_name: Name of the Resource group within the
Azure subscription.
:type resource_group_name: str
:param profile_name: Name of the CDN profile which is unique within
the resource group.
:type profile_name: str
Expand All @@ -469,7 +452,7 @@ def disable_custom_https(
# Construct URL
url = self.disable_custom_https.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'profileName': self._serialize.url("profile_name", profile_name, 'str'),
'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'),
'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'),
Expand Down Expand Up @@ -511,12 +494,9 @@ def disable_custom_https(
disable_custom_https.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps'}

def enable_custom_https(
self, resource_group_name, profile_name, endpoint_name, custom_domain_name, custom_headers=None, raw=False, **operation_config):
self, profile_name, endpoint_name, custom_domain_name, custom_headers=None, raw=False, **operation_config):
"""Enable https delivery of the custom domain.

:param resource_group_name: Name of the Resource group within the
Azure subscription.
:type resource_group_name: str
:param profile_name: Name of the CDN profile which is unique within
the resource group.
:type profile_name: str
Expand All @@ -540,7 +520,7 @@ def enable_custom_https(
# Construct URL
url = self.enable_custom_https.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'profileName': self._serialize.url("profile_name", profile_name, 'str'),
'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'),
'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'),
Expand Down
Loading