def create_cross_site_access_policies(client_access_policy, cross_domain_policy): policies = CrossSiteAccessPolicies() if client_access_policy: policies.client_access_policy = client_access_policy if cross_domain_policy: policies.cross_domain_policy = cross_domain_policy return policies
def create_cross_site_access_policies(client_access_policy, cross_domain_policy): from azure.mgmt.media.models import CrossSiteAccessPolicies policies = CrossSiteAccessPolicies() if client_access_policy: policies.client_access_policy = client_access_policy if cross_domain_policy: policies.cross_domain_policy = cross_domain_policy return policies
def update_streaming_endpoint(instance, tags=None, cross_domain_policy=None, client_access_policy=None, description=None, max_cache_age=None, ips=None, disable_cdn=None, cdn_provider=None, cdn_profile=None, custom_host_names=None): if not instance: raise CLIError('The streaming endpoint resource was not found.') if ips is not None: is_ips_argument_empty = len(ips) == 1 and ips[0] == "" if is_ips_argument_empty: if instance.access_control is not None and instance.access_control.ip is not None: instance.access_control.ip = None else: if instance.access_control is None: instance.access_control = StreamingEndpointAccessControl() if instance.access_control.ip is None: instance.access_control.ip = IPAccessControl(allow=[]) for ip in ips: instance.access_control.ip.allow.append(create_ip_range(instance.name, ip)) if instance.cross_site_access_policies is None: instance.cross_site_access_policies = CrossSiteAccessPolicies() if client_access_policy is not None: if not client_access_policy: instance.cross_site_access_policies.client_access_policy = None else: instance.cross_site_access_policies.client_access_policy = client_access_policy if cross_domain_policy is not None: if not cross_domain_policy: instance.cross_site_access_policies.cross_domain_policy = None else: instance.cross_site_access_policies.cross_domain_policy = cross_domain_policy if max_cache_age is not None: instance.max_cache_age = max_cache_age if tags is not None: instance.tags = tags if description is not None: instance.description = description if custom_host_names is not None: is_custom_host_names_argument_empty = len(custom_host_names) == 1 and custom_host_names[0] == "" if is_custom_host_names_argument_empty: instance.custom_host_names = [] else: instance.custom_host_names = custom_host_names if cdn_provider is not None: instance.cdn_provider = cdn_provider if cdn_profile is not None: instance.cdn_profile = cdn_profile if cdn_provider is not None or cdn_profile is not None: if ips is None and instance.access_control is not None: instance.access_control = None instance.cdn_enabled = True if disable_cdn is not None: instance.cdn_enabled = not disable_cdn return instance