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
3 changes: 2 additions & 1 deletion src/containerapp/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Release History
===============
Upcoming
+++++++
* 'az containerapp env update': Fix bugs in update environment.
* 'az containerapp create/update': --yaml support properties for api-version 2022-10-01 (e.g. exposedPort,clientCertificateMode,corsPolicy)
* 'az containerapp env update': fix bugs in update environment.
* Fix YAML create with user-assigned identity
* Fix polling logic for long running operations.

Expand Down
64 changes: 62 additions & 2 deletions src/containerapp/azext_containerapp/_sdk_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ class Configuration(Model):
'ingress': {'key': 'ingress', 'type': 'Ingress'},
'dapr': {'key': 'dapr', 'type': 'Dapr'},
'registries': {'key': 'registries', 'type': '[RegistryCredentials]'},
'max_inactive_revisions': {'key': 'maxInactiveRevisions', 'type': 'int'},
}

def __init__(self, **kwargs):
Expand All @@ -873,6 +874,7 @@ def __init__(self, **kwargs):
self.ingress = kwargs.get('ingress', None)
self.dapr = kwargs.get('dapr', None)
self.registries = kwargs.get('registries', None)
self.max_inactive_revisions = kwargs.get('max_inactive_revisions', None)


class Container(Model):
Expand Down Expand Up @@ -1515,6 +1517,10 @@ class Dapr(Model):
'app_id': {'key': 'appId', 'type': 'str'},
'app_protocol': {'key': 'appProtocol', 'type': 'str'},
'app_port': {'key': 'appPort', 'type': 'int'},
'http_read_buffer_size': {'key': 'httpReadBufferSize', 'type': 'int'},
'http_max_request_size': {'key': 'httpMaxRequestSize', 'type': 'int'},
'log_level': {'key': 'logLevel', 'type': 'str'},
'enable_api_logging': {'key': 'enableApiLogging', 'type': 'bool'},
}

def __init__(self, **kwargs):
Expand All @@ -1523,6 +1529,10 @@ def __init__(self, **kwargs):
self.app_id = kwargs.get('app_id', None)
self.app_protocol = kwargs.get('app_protocol', None)
self.app_port = kwargs.get('app_port', None)
self.http_read_buffer_size = kwargs.get('http_read_buffer_size', None)
self.http_max_request_size = kwargs.get('http_max_request_size', None)
self.log_level = kwargs.get('log_level', None)
self.enable_api_logging = kwargs.get('enable_api_logging', None)


class DaprComponent(ProxyResource):
Expand Down Expand Up @@ -2096,23 +2106,29 @@ class Ingress(Model):
'fqdn': {'key': 'fqdn', 'type': 'str'},
'external': {'key': 'external', 'type': 'bool'},
'target_port': {'key': 'targetPort', 'type': 'int'},
'exposed_port': {'key': 'exposedPort', 'type': 'int'},
'transport': {'key': 'transport', 'type': 'str'},
'traffic': {'key': 'traffic', 'type': '[TrafficWeight]'},
'custom_domains': {'key': 'customDomains', 'type': '[CustomDomain]'},
'allow_insecure': {'key': 'allowInsecure', 'type': 'bool'},
'ipSecurityRestrictions': {'key': 'ipSecurityRestrictions', 'type': '[IPSecurityRestrictions]'},
'ip_security_restrictions': {'key': 'ipSecurityRestrictions', 'type': '[IPSecurityRestrictions]'},
'client_certificate_mode': {'key': 'clientCertificateMode', 'type': 'str'},
'cors_policy': {'key': 'corsPolicy', 'type': 'CorsPolicy'},
}

def __init__(self, **kwargs):
super(Ingress, self).__init__(**kwargs)
self.fqdn = None
self.external = kwargs.get('external', False)
self.exposedPort = kwargs.get('exposed_port', None)
self.target_port = kwargs.get('target_port', None)
self.transport = kwargs.get('transport', None)
self.traffic = kwargs.get('traffic', None)
self.custom_domains = kwargs.get('custom_domains', None)
self.allow_insecure = kwargs.get('allow_insecure', None)
self.ipSecurityRestrictions = kwargs.get('ipSecurityRestrictions', None)
self.ipSecurityRestrictions = kwargs.get('ip_security_restrictions', None)
self.clientCertificateMode = kwargs.get('client_certificate_mode', None)
self.corsPolicy = kwargs.get('cors_policy', None)


class LegacyMicrosoftAccount(Model):
Expand Down Expand Up @@ -2697,13 +2713,15 @@ class RegistryCredentials(Model):
'server': {'key': 'server', 'type': 'str'},
'username': {'key': 'username', 'type': 'str'},
'password_secret_ref': {'key': 'passwordSecretRef', 'type': 'str'},
'identity': {'key': 'identity', 'type': 'str'},
}

def __init__(self, **kwargs):
super(RegistryCredentials, self).__init__(**kwargs)
self.server = kwargs.get('server', None)
self.username = kwargs.get('username', None)
self.password_secret_ref = kwargs.get('password_secret_ref', None)
self.identity = kwargs.get('identity', None)


class RegistryInfo(Model):
Expand Down Expand Up @@ -3426,3 +3444,45 @@ def __init__(self, **kwargs):
super(VolumeMount, self).__init__(**kwargs)
self.volume_name = kwargs.get('volume_name', None)
self.mount_path = kwargs.get('mount_path', None)


class CorsPolicy(Model):
"""Cross-Origin-Resource-Sharing policy.

All required parameters must be populated in order to send to Azure.

:param allowed_origins: allowed origins. Required.
:type allowed_origins: list[str]
:param allowed_methods: allowed HTTP methods.
:type allowed_methods: list[str]
:param allowed_headers: allowed HTTP headers.
:type allowed_headers: list[str]
:param expose_headers: expose HTTP headers.
:type expose_headers: list[str]
:param max_age: max time client can cache the result.
:type max_age: int
:param allow_credentials: allow credential or not.
:type allow_credentials: bool
"""

_validation = {
'allowed_origins': {'required': True},
}

_attribute_map = {
'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'},
'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'},
'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'},
'expose_headers': {'key': 'exposeHeaders', 'type': '[str]'},
'max_age': {'key': 'maxAge', 'type': 'int'},
'allow_credentials': {'key': 'allowCredentials', 'type': 'bool'},
}

def __init__(self, **kwargs):
super(CorsPolicy, self).__init__(**kwargs)
self.allowed_origins = kwargs.get('allowed_origins', None)
self.allowed_methods = kwargs.get('allowed_methods', None)
self.allowed_headers = kwargs.get('allowed_headers', None)
self.expose_headers = kwargs.get('expose_headers', None)
self.max_age = kwargs.get('max_age', None)
self.allow_credentials = kwargs.get('allow_credentials', None)
2 changes: 1 addition & 1 deletion src/containerapp/azext_containerapp/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ def update_managed_environment(cmd,
if logs_destination == "log-analytics":
safe_set(env_def, "properties", "appLogsConfiguration", "logAnalyticsConfiguration", "customerId", value=logs_customer_id)
safe_set(env_def, "properties", "appLogsConfiguration", "logAnalyticsConfiguration", "sharedKey", value=logs_key)
else:
elif logs_destination:
safe_set(env_def, "properties", "appLogsConfiguration", "logAnalyticsConfiguration", value=None)

# Custom domains
Expand Down
Loading