Skip to content
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
40 changes: 40 additions & 0 deletions azure-mgmt-cdn/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,46 @@
Release History
===============

3.0.0 (2018-05-25)
++++++++++++++++++

**Features**

- Add client method check_name_availability_with_subscription
- Model EndpointUpdateParameters has a new parameter delivery_policy
- Model Endpoint has a new parameter delivery_policy
- Client class can be used as a context manager to keep the underlying HTTP session open for performance

**General Breaking changes**

This version uses a next-generation code generator that *might* introduce breaking changes.

- Model signatures now use only keyword-argument syntax. All positional arguments must be re-written as keyword-arguments.
To keep auto-completion in most cases, models are now generated for Python 2 and Python 3. Python 3 uses the "*" syntax for keyword-only arguments.
- Enum types now use the "str" mixin (class AzureEnum(str, Enum)) to improve the behavior when unrecognized enum values are encountered.
While this is not a breaking change, the distinctions are important, and are documented here:
https://docs.python.org/3/library/enum.html#others
At a glance:

- "is" should not be used at all.
- "format" will return the string value, where "%s" string formatting will return `NameOfEnum.stringvalue`. Format syntax should be prefered.

- New Long Running Operation:

- Return type changes from `msrestazure.azure_operation.AzureOperationPoller` to `msrest.polling.LROPoller`. External API is the same.
- Return type is now **always** a `msrest.polling.LROPoller`, regardless of the optional parameters used.
- The behavior has changed when using `raw=True`. Instead of returning the initial call result as `ClientRawResponse`,
without polling, now this returns an LROPoller. After polling, the final resource will be returned as a `ClientRawResponse`.
- New `polling` parameter. The default behavior is `Polling=True` which will poll using ARM algorithm. When `Polling=False`,
the response of the initial call will be returned without polling.
- `polling` parameter accepts instances of subclasses of `msrest.polling.PollingMethod`.
- `add_done_callback` will no longer raise if called after polling is finished, but will instead execute the callback right away.

**Bugfixes**

- Compatibility of the sdist with wheel 0.31.0


2.0.0 (2017-10-26)
++++++++++++++++++

Expand Down
8 changes: 4 additions & 4 deletions azure-mgmt-cdn/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.3, 3.4, 3.5 and 3.6.
This package has been tested with Python 2.7, 3.4, 3.5 and 3.6.

For the older Azure Service Management (ASM) libraries, see
`azure-servicemanagement-legacy <https://pypi.python.org/pypi/azure-servicemanagement-legacy>`__ library.
Expand Down Expand Up @@ -36,9 +36,9 @@ If you see azure==0.11.0 (or any version below 1.0), uninstall it first:
Usage
=====

For code examples, see `CDN Resource Management
<https://azure-sdk-for-python.readthedocs.org/en/latest/resourcemanagementcdn.html>`__
on readthedocs.org.
For code examples, see `CDN Management
<https://docs.microsoft.com/python/api/overview/azure/cdn>`__
on docs.microsoft.com.


Provide Feedback
Expand Down
75 changes: 70 additions & 5 deletions azure-mgmt-cdn/azure/mgmt/cdn/cdn_management_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import ServiceClient
from msrest.service_client import SDKClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_operation import AzureOperationPoller
from msrest.polling import LROPoller, NoPolling
from msrestazure.polling.arm_polling import ARMPolling
import uuid
from .operations.profiles_operations import ProfilesOperations
from .operations.endpoints_operations import EndpointsOperations
Expand Down Expand Up @@ -58,7 +59,7 @@ def __init__(
self.subscription_id = subscription_id


class CdnManagementClient(object):
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.

:ivar config: Configuration for client.
Expand Down Expand Up @@ -91,10 +92,10 @@ def __init__(
self, credentials, subscription_id, base_url=None):

self.config = CdnManagementClientConfiguration(credentials, subscription_id, base_url)
self._client = ServiceClient(self.config.credentials, self.config)
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 = '2017-04-02'
self.api_version = '2017-10-12'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

Expand Down Expand Up @@ -173,6 +174,70 @@ def check_name_availability(
return deserialized
check_name_availability.metadata = {'url': '/providers/Microsoft.Cdn/checkNameAvailability'}

def check_name_availability_with_subscription(
self, name, custom_headers=None, raw=False, **operation_config):
"""Check the availability of a resource name. This is needed for resources
where name is globally unique, such as a CDN endpoint.

:param name: The resource name to validate.
:type 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<msrest:optionsforoperations>`.
:return: CheckNameAvailabilityOutput or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.cdn.models.ErrorResponseException>`
"""
check_name_availability_input = models.CheckNameAvailabilityInput(name=name)

# Construct URL
url = self.check_name_availability_with_subscription.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')

# Construct headers
header_parameters = {}
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(check_name_availability_input, 'CheckNameAvailabilityInput')

# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, 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('CheckNameAvailabilityOutput', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response

return deserialized
check_name_availability_with_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability'}

def validate_probe(
self, probe_url, custom_headers=None, raw=False, **operation_config):
"""Check if the probe path is a valid path and the file can be accessed.
Expand Down
125 changes: 94 additions & 31 deletions azure-mgmt-cdn/azure/mgmt/cdn/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,90 @@
# regenerated.
# --------------------------------------------------------------------------

from .sku import Sku
from .profile import Profile
from .profile_update_parameters import ProfileUpdateParameters
from .sso_uri import SsoUri
from .supported_optimization_types_list_result import SupportedOptimizationTypesListResult
from .deep_created_origin import DeepCreatedOrigin
from .endpoint import Endpoint
from .geo_filter import GeoFilter
from .endpoint_update_parameters import EndpointUpdateParameters
from .purge_parameters import PurgeParameters
from .load_parameters import LoadParameters
from .origin import Origin
from .origin_update_parameters import OriginUpdateParameters
from .custom_domain import CustomDomain
from .custom_domain_parameters import CustomDomainParameters
from .validate_custom_domain_input import ValidateCustomDomainInput
from .validate_custom_domain_output import ValidateCustomDomainOutput
from .check_name_availability_input import CheckNameAvailabilityInput
from .check_name_availability_output import CheckNameAvailabilityOutput
from .validate_probe_input import ValidateProbeInput
from .validate_probe_output import ValidateProbeOutput
from .resource_usage import ResourceUsage
from .operation_display import OperationDisplay
from .operation import Operation
from .cidr_ip_address import CidrIpAddress
from .ip_address_group import IpAddressGroup
from .edge_node import EdgeNode
from .resource import Resource
from .tracked_resource import TrackedResource
from .proxy_resource import ProxyResource
from .error_response import ErrorResponse, ErrorResponseException
try:
from .sku_py3 import Sku
from .profile_py3 import Profile
from .profile_update_parameters_py3 import ProfileUpdateParameters
from .sso_uri_py3 import SsoUri
from .supported_optimization_types_list_result_py3 import SupportedOptimizationTypesListResult
from .deep_created_origin_py3 import DeepCreatedOrigin
from .endpoint_py3 import Endpoint
from .geo_filter_py3 import GeoFilter
from .delivery_rule_action_py3 import DeliveryRuleAction
from .delivery_rule_condition_py3 import DeliveryRuleCondition
from .delivery_rule_py3 import DeliveryRule
from .endpoint_properties_update_parameters_delivery_policy_py3 import EndpointPropertiesUpdateParametersDeliveryPolicy
from .endpoint_update_parameters_py3 import EndpointUpdateParameters
from .url_path_condition_parameters_py3 import UrlPathConditionParameters
from .delivery_rule_url_path_condition_py3 import DeliveryRuleUrlPathCondition
from .url_file_extension_condition_parameters_py3 import UrlFileExtensionConditionParameters
from .delivery_rule_url_file_extension_condition_py3 import DeliveryRuleUrlFileExtensionCondition
from .cache_expiration_action_parameters_py3 import CacheExpirationActionParameters
from .delivery_rule_cache_expiration_action_py3 import DeliveryRuleCacheExpirationAction
from .purge_parameters_py3 import PurgeParameters
from .load_parameters_py3 import LoadParameters
from .origin_py3 import Origin
from .origin_update_parameters_py3 import OriginUpdateParameters
from .custom_domain_py3 import CustomDomain
from .custom_domain_parameters_py3 import CustomDomainParameters
from .validate_custom_domain_input_py3 import ValidateCustomDomainInput
from .validate_custom_domain_output_py3 import ValidateCustomDomainOutput
from .check_name_availability_input_py3 import CheckNameAvailabilityInput
from .check_name_availability_output_py3 import CheckNameAvailabilityOutput
from .validate_probe_input_py3 import ValidateProbeInput
from .validate_probe_output_py3 import ValidateProbeOutput
from .resource_usage_py3 import ResourceUsage
from .operation_display_py3 import OperationDisplay
from .operation_py3 import Operation
from .cidr_ip_address_py3 import CidrIpAddress
from .ip_address_group_py3 import IpAddressGroup
from .edge_node_py3 import EdgeNode
from .resource_py3 import Resource
from .tracked_resource_py3 import TrackedResource
from .proxy_resource_py3 import ProxyResource
from .error_response_py3 import ErrorResponse, ErrorResponseException
except (SyntaxError, ImportError):
from .sku import Sku
from .profile import Profile
from .profile_update_parameters import ProfileUpdateParameters
from .sso_uri import SsoUri
from .supported_optimization_types_list_result import SupportedOptimizationTypesListResult
from .deep_created_origin import DeepCreatedOrigin
from .endpoint import Endpoint
from .geo_filter import GeoFilter
from .delivery_rule_action import DeliveryRuleAction
from .delivery_rule_condition import DeliveryRuleCondition
from .delivery_rule import DeliveryRule
from .endpoint_properties_update_parameters_delivery_policy import EndpointPropertiesUpdateParametersDeliveryPolicy
from .endpoint_update_parameters import EndpointUpdateParameters
from .url_path_condition_parameters import UrlPathConditionParameters
from .delivery_rule_url_path_condition import DeliveryRuleUrlPathCondition
from .url_file_extension_condition_parameters import UrlFileExtensionConditionParameters
from .delivery_rule_url_file_extension_condition import DeliveryRuleUrlFileExtensionCondition
from .cache_expiration_action_parameters import CacheExpirationActionParameters
from .delivery_rule_cache_expiration_action import DeliveryRuleCacheExpirationAction
from .purge_parameters import PurgeParameters
from .load_parameters import LoadParameters
from .origin import Origin
from .origin_update_parameters import OriginUpdateParameters
from .custom_domain import CustomDomain
from .custom_domain_parameters import CustomDomainParameters
from .validate_custom_domain_input import ValidateCustomDomainInput
from .validate_custom_domain_output import ValidateCustomDomainOutput
from .check_name_availability_input import CheckNameAvailabilityInput
from .check_name_availability_output import CheckNameAvailabilityOutput
from .validate_probe_input import ValidateProbeInput
from .validate_probe_output import ValidateProbeOutput
from .resource_usage import ResourceUsage
from .operation_display import OperationDisplay
from .operation import Operation
from .cidr_ip_address import CidrIpAddress
from .ip_address_group import IpAddressGroup
from .edge_node import EdgeNode
from .resource import Resource
from .tracked_resource import TrackedResource
from .proxy_resource import ProxyResource
from .error_response import ErrorResponse, ErrorResponseException
from .profile_paged import ProfilePaged
from .resource_usage_paged import ResourceUsagePaged
from .endpoint_paged import EndpointPaged
Expand Down Expand Up @@ -70,7 +123,17 @@
'DeepCreatedOrigin',
'Endpoint',
'GeoFilter',
'DeliveryRuleAction',
'DeliveryRuleCondition',
'DeliveryRule',
'EndpointPropertiesUpdateParametersDeliveryPolicy',
'EndpointUpdateParameters',
'UrlPathConditionParameters',
'DeliveryRuleUrlPathCondition',
'UrlFileExtensionConditionParameters',
'DeliveryRuleUrlFileExtensionCondition',
'CacheExpirationActionParameters',
'DeliveryRuleCacheExpirationAction',
'PurgeParameters',
'LoadParameters',
'Origin',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class CacheExpirationActionParameters(Model):
"""Defines the parameters for the cache expiration action.

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 odatatype: Required. Default value:
"Microsoft.Azure.Cdn.Models.DeliveryRuleCacheExpirationActionParameters" .
:vartype odatatype: str
:param cache_behavior: Required. Caching behavior for the requests that
include query strings. Possible values include: 'BypassCache', 'Override',
'SetIfMissing'
:type cache_behavior: str or ~azure.mgmt.cdn.models.enum
:ivar cache_type: Required. The level at which the content needs to be
cached. Default value: "All" .
:vartype cache_type: str
:param cache_duration: The duration for which the the content needs to be
cached. Allowed format is [d.]hh:mm:ss
:type cache_duration: str
"""

_validation = {
'odatatype': {'required': True, 'constant': True},
'cache_behavior': {'required': True},
'cache_type': {'required': True, 'constant': True},
}

_attribute_map = {
'odatatype': {'key': '@odata\\.type', 'type': 'str'},
'cache_behavior': {'key': 'cacheBehavior', 'type': 'str'},
'cache_type': {'key': 'cacheType', 'type': 'str'},
'cache_duration': {'key': 'cacheDuration', 'type': 'str'},
}

odatatype = "Microsoft.Azure.Cdn.Models.DeliveryRuleCacheExpirationActionParameters"

cache_type = "All"

def __init__(self, **kwargs):
super(CacheExpirationActionParameters, self).__init__(**kwargs)
self.cache_behavior = kwargs.get('cache_behavior', None)
self.cache_duration = kwargs.get('cache_duration', None)
Loading