Example #1
0
    def create_cdnprofile(self):
        '''
        Creates a Azure CDN profile.

        :return: deserialized Azure CDN profile instance state dictionary
        '''
        self.log("Creating the Azure CDN profile instance {0}".format(
            self.name))

        parameters = Profile(location=self.location,
                             sku=Sku(name=self.sku),
                             tags=self.tags)

        import uuid
        xid = str(uuid.uuid1())

        try:
            poller = self.cdn_client.profiles.create(
                self.resource_group,
                self.name,
                parameters,
                custom_headers={'x-ms-client-request-id': xid})
            response = self.get_poller_result(poller)
            return cdnprofile_to_dict(response)
        except ErrorResponseException as exc:
            self.log('Error attempting to create Azure CDN profile instance.')
            self.fail(
                "Error creating Azure CDN profile instance: {0}.\n Request id: {1}"
                .format(exc.message, xid))
Example #2
0
def create_profile(client, resource_group_name, name,
                   sku=SkuName.standard_akamai.value,
                   location=None, tags=None):
    # pylint: disable=too-many-arguments
    from azure.mgmt.cdn.models import (Profile, Sku)
    profile = Profile(location, Sku(name=sku), tags=tags)
    return client.profiles.create(resource_group_name, name, profile)
Example #3
0
def create_afd_profile(client: ProfilesOperations, resource_group_name, profile_name,
                       sku: SkuName,
                       tags=None):
    from azure.mgmt.cdn.models import (Profile, Sku)

    # Force location to global
    profile = Profile(location="global", sku=Sku(name=sku), tags=tags)
    return client.create(resource_group_name, profile_name, profile)
Example #4
0
def create_profile(client,
                   resource_group_name,
                   name,
                   sku=SkuName.standard_akamai.value,
                   location=None,
                   tags=None):
    from azure.mgmt.cdn.models import (Profile, Sku)
    profile = Profile(location=location, sku=Sku(name=sku), tags=tags)
    return client.profiles.begin_create(resource_group_name, name, profile)
Example #5
0
def create_afd_profile(client: ProfilesOperations,
                       resource_group_name,
                       profile_name,
                       sku: SkuName,
                       origin_response_timeout_seconds=30,
                       tags=None):
    from azure.mgmt.cdn.models import (Profile, Sku)

    # Force location to global
    profile = Profile(
        location="global",
        sku=Sku(name=sku),
        tags=tags,
        origin_response_timeout_seconds=origin_response_timeout_seconds)
    return client.begin_create(resource_group_name, profile_name, profile)