def create_endpoint(client, resource_group_name, profile_name, name, origins, location=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, tags=None, no_wait=None): is_compression_enabled = False if is_compression_enabled is None else is_compression_enabled is_http_allowed = True if is_http_allowed is None else is_http_allowed is_https_allowed = True if is_https_allowed is None else is_https_allowed endpoint = Endpoint( location=location, origins=origins, origin_host_header=origin_host_header, origin_path=origin_path, content_types_to_compress=content_types_to_compress, is_compression_enabled=is_compression_enabled, is_http_allowed=is_http_allowed, is_https_allowed=is_https_allowed, query_string_caching_behavior=query_string_caching_behavior, tags=tags) if is_compression_enabled and not endpoint.content_types_to_compress: endpoint.content_types_to_compress = default_content_types() return sdk_no_wait(no_wait, client.endpoints.create, resource_group_name, profile_name, name, endpoint)
def create_endpoint(cmd, client, resource_group_name, profile_name, name, origins, location=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, tags=None): is_compression_enabled = False if is_compression_enabled is None else is_compression_enabled is_http_allowed = True if is_http_allowed is None else is_http_allowed is_https_allowed = True if is_https_allowed is None else is_https_allowed endpoint = Endpoint(location=location, origins=origins, origin_host_header=origin_host_header, origin_path=origin_path, content_types_to_compress=content_types_to_compress, is_compression_enabled=is_compression_enabled, is_http_allowed=is_http_allowed, is_https_allowed=is_https_allowed, query_string_caching_behavior=query_string_caching_behavior, tags=tags) if is_compression_enabled and not endpoint.content_types_to_compress: endpoint.content_types_to_compress = default_content_types() return client.endpoints.create(resource_group_name, profile_name, name, endpoint)
def create_endpoint(client, resource_group_name, profile_name, name, origins, location=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=QueryStringCachingBehavior.ignore_query_string. value, tags=None): # pylint: disable=too-many-arguments is_compression_enabled = False if is_compression_enabled is None else is_compression_enabled is_http_allowed = True if is_http_allowed is None else is_http_allowed is_https_allowed = True if is_https_allowed is None else is_https_allowed endpoint = Endpoint(location, origins, origin_host_header=origin_host_header, origin_path=origin_path, content_types_to_compress=content_types_to_compress, is_compression_enabled=is_compression_enabled, is_http_allowed=is_http_allowed, is_https_allowed=is_https_allowed, query_string_caching_behavior=query_string_caching_behavior, tags=tags) if is_compression_enabled and not endpoint.content_types_to_compress: endpoint.content_types_to_compress = default_content_types() return client.endpoints.create(resource_group_name, profile_name, name, endpoint)
def create_cdnendpoint(self): ''' Creates a Azure CDN endpoint. :return: deserialized Azure CDN endpoint instance state dictionary ''' self.log("Creating the Azure CDN endpoint instance {0}".format( self.name)) origins = [] for item in self.origins: origins.append( DeepCreatedOrigin(name=item['name'], host_name=item['host_name'], http_port=item['http_port'] if 'http_port' in item else None, https_port=item['https_port'] if 'https_port' in item else None)) parameters = Endpoint( origins=origins, location=self.location, tags=self.tags, origin_host_header=self.origin_host_header, origin_path=self.origin_path, content_types_to_compress=default_content_types() if self.is_compression_enabled and not self.content_types_to_compress else self.content_types_to_compress, is_compression_enabled=self.is_compression_enabled if self.is_compression_enabled is not None else False, is_http_allowed=self.is_http_allowed if self.is_http_allowed is not None else True, is_https_allowed=self.is_https_allowed if self.is_https_allowed is not None else True, query_string_caching_behavior=self.query_string_caching_behavior if self.query_string_caching_behavior else QueryStringCachingBehavior.ignore_query_string) try: poller = self.cdn_client.endpoints.create(self.resource_group, self.profile_name, self.name, parameters) response = self.get_poller_result(poller) return cdnendpoint_to_dict(response) except ErrorResponseException as exc: self.log('Error attempting to create Azure CDN endpoint instance.') self.fail("Error creating Azure CDN endpoint instance: {0}".format( exc.message))