Skip to content
Merged
1 change: 1 addition & 0 deletions src/containerapp/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Release History
upcoming
++++++
* 'az containerapp create': Fix Role assignment error when the default Azure Container Registry could not be found
* Upgrade api-version to 2024-10-02-preview

1.0.0b4
++++++
Expand Down
40 changes: 27 additions & 13 deletions src/containerapp/azext_containerapp/_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

logger = get_logger(__name__)

PREVIEW_API_VERSION = "2024-02-02-preview"
AUG_PREVIEW_API_VERSION = "2024-08-02-preview"
PREVIEW_API_VERSION = "2024-10-02-preview"
SESSION_API_VERSION = "2024-02-02-preview"
POLLING_TIMEOUT = 1500 # how many seconds before exiting
POLLING_SECONDS = 2 # how many seconds between requests
POLLING_TIMEOUT_FOR_MANAGED_CERTIFICATE = 1500 # how many seconds before exiting
Expand Down Expand Up @@ -552,7 +552,7 @@ def list_certificates(cls, cmd, resource_group_name, name, formatter=lambda x: x
return certs_list

@classmethod
def create_or_update_certificate(cls, cmd, resource_group_name, name, certificate_name, certificate):
def create_or_update_certificate(cls, cmd, resource_group_name, name, certificate_name, certificate, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/connectedEnvironments/{}/certificates/{}?api-version={}"
Expand All @@ -565,6 +565,13 @@ def create_or_update_certificate(cls, cmd, resource_group_name, name, certificat
cls.api_version)

r = send_raw_request(cmd.cli_ctx, "PUT", request_url, body=json.dumps(certificate))
if no_wait:
return r.json()
elif r.status_code == 201:
operation_url = r.headers.get(HEADER_AZURE_ASYNC_OPERATION)
poll_status(cmd, operation_url)
r = send_raw_request(cmd.cli_ctx, "GET", request_url)

return r.json()

@classmethod
Expand Down Expand Up @@ -603,7 +610,7 @@ class ConnectedEnvDaprComponentClient():
api_version = PREVIEW_API_VERSION

@classmethod
def create_or_update(cls, cmd, resource_group_name, environment_name, name, dapr_component_envelope):
def create_or_update(cls, cmd, resource_group_name, environment_name, name, dapr_component_envelope, no_wait=False):

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
sub_id = get_subscription_id(cmd.cli_ctx)
Expand All @@ -618,6 +625,13 @@ def create_or_update(cls, cmd, resource_group_name, environment_name, name, dapr

r = send_raw_request(cmd.cli_ctx, "PUT", request_url, body=json.dumps(dapr_component_envelope))

if no_wait:
return r.json()
elif r.status_code == 201:
operation_url = r.headers.get(HEADER_AZURE_ASYNC_OPERATION)
poll_status(cmd, operation_url)
r = send_raw_request(cmd.cli_ctx, "GET", request_url)

return r.json()

@classmethod
Expand Down Expand Up @@ -887,7 +901,7 @@ def list_auth_token(cls, cmd, builder_name, build_name, resource_group_name, loc


class JavaComponentPreviewClient():
api_version = AUG_PREVIEW_API_VERSION
api_version = PREVIEW_API_VERSION

@classmethod
def create(cls, cmd, resource_group_name, environment_name, name, java_component_envelope, no_wait=False):
Expand Down Expand Up @@ -1004,7 +1018,7 @@ def list(cls, cmd, resource_group_name, environment_name):


class SessionPoolPreviewClient():
api_version = PREVIEW_API_VERSION
api_version = SESSION_API_VERSION

@classmethod
def create(cls, cmd, resource_group_name, name, session_pool_envelope, no_wait=False):
Expand Down Expand Up @@ -1143,15 +1157,15 @@ def list_by_subscription(cls, cmd, formatter=lambda x: x):


class SessionCodeInterpreterPreviewClient():
api_version = PREVIEW_API_VERSION
api_version = SESSION_API_VERSION

@classmethod
def execute(cls, cmd, identifier, code_interpreter_envelope, session_pool_endpoint, no_wait=False):
url_fmt = "{}/code/execute?identifier={}&api-version={}"
request_url = url_fmt.format(
session_pool_endpoint,
identifier,
PREVIEW_API_VERSION)
cls.api_version)
logger.warning(request_url)
logger.warning(code_interpreter_envelope)
r = send_raw_request(cmd.cli_ctx, "POST", request_url, body=json.dumps(code_interpreter_envelope), resource=SESSION_RESOURCE)
Expand All @@ -1171,7 +1185,7 @@ def upload(cls, cmd, identifier, filepath, session_pool_endpoint, no_wait=False)
request_url = url_fmt.format(
session_pool_endpoint,
identifier,
PREVIEW_API_VERSION)
cls.api_version)

from azure.cli.core._profile import Profile
profile = Profile(cli_ctx=cmd.cli_ctx)
Expand Down Expand Up @@ -1212,7 +1226,7 @@ def show_file_content(cls, cmd, identifier, filename, session_pool_endpoint):
session_pool_endpoint,
filename,
identifier,
PREVIEW_API_VERSION)
cls.api_version)

r = send_raw_request(cmd.cli_ctx, "GET", request_url, resource=SESSION_RESOURCE)
# print out the file content as bytes decoded as string
Expand All @@ -1227,7 +1241,7 @@ def show_file_metadata(cls, cmd, identifier, filename, session_pool_endpoint):
session_pool_endpoint,
filename,
identifier,
PREVIEW_API_VERSION)
cls.api_version)
logger.warning(request_url)
r = send_raw_request(cmd.cli_ctx, "GET", request_url, resource=SESSION_RESOURCE)

Expand All @@ -1240,7 +1254,7 @@ def delete_file(cls, cmd, identifier, filename, session_pool_endpoint, no_wait=F
session_pool_endpoint,
filename,
identifier,
PREVIEW_API_VERSION)
cls.api_version)

r = send_raw_request(cmd.cli_ctx, "DELETE", request_url, resource=SESSION_RESOURCE)

Expand All @@ -1262,7 +1276,7 @@ def list_files(cls, cmd, identifier, path, session_pool_endpoint):
session_pool_endpoint,
identifier,
path,
PREVIEW_API_VERSION)
cls.api_version)

r = send_raw_request(cmd.cli_ctx, "GET", request_url, resource=SESSION_RESOURCE)
return r.json()
Expand Down
4 changes: 3 additions & 1 deletion src/containerapp/azext_containerapp/_decorator_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ def process_loaded_yaml(yaml_containerapp):
"outboundIPAddresses",
"workloadProfileName",
"latestReadyRevisionName",
"eventStreamEndpoint"]
"eventStreamEndpoint",
"runningStatus",
"deploymentErrors"]
for nested_property in nested_properties:
tmp = yaml_containerapp.get(nested_property)
if nested_property in yaml_containerapp:
Expand Down
77 changes: 74 additions & 3 deletions src/containerapp/azext_containerapp/_sdk_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ class ActiveRevisionsMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):

.. raw:: html

<list><item>Multiple: multiple revisions can be active.</item><item>Single: Only one
revision can be active at a time. Revision weights can not be used in this mode. If no value if
provided, this is the default.</item></list>.
<list><item>Single: Only one revision can be active at a time. Traffic weights cannot be
used. This is the default.</item><item>Multiple: Multiple revisions can be active, including
optional traffic weights and labels.</item><item>Labels: Only revisions with labels are active.
Traffic weights can be applied to labels.</item></list>.
"""

MULTIPLE = "Multiple"
SINGLE = "Single"
LABELS = "Labels"


class Affinity(str, Enum, metaclass=CaseInsensitiveEnumMeta):
Expand Down Expand Up @@ -69,6 +71,7 @@ class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta):

DISABLED = "Disabled"
SNI_ENABLED = "SniEnabled"
AUTO = "Auto"


class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
Expand Down Expand Up @@ -129,6 +132,15 @@ class CheckNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta):
ALREADY_EXISTS = "AlreadyExists"


class ConnectedEnvironmentDaprComponentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Provisioning state of the Connected Environment Dapr Component."""

SUCCEEDED = "Succeeded"
FAILED = "Failed"
CANCELED = "Canceled"
IN_PROGRESS = "InProgress"


class ConnectedEnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Provisioning state of the Kubernetes Environment."""

Expand All @@ -142,6 +154,15 @@ class ConnectedEnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitive
SCHEDULED_FOR_DELETE = "ScheduledForDelete"


class ConnectedEnvironmentStorageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Provisioning state of the storage."""

SUCCEEDED = "Succeeded"
FAILED = "Failed"
CANCELED = "Canceled"
IN_PROGRESS = "InProgress"


class ContainerAppContainerRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Current running state of the container."""

Expand All @@ -168,6 +189,21 @@ class ContainerAppReplicaRunningState(str, Enum, metaclass=CaseInsensitiveEnumMe
UNKNOWN = "Unknown"


class ContainerAppRunningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Running status of the Container App."""

PROGRESSING = "Progressing"
"""Container App is transitioning between Stopped and Running states."""
RUNNING = "Running"
"""Container App is in Running state."""
STOPPED = "Stopped"
"""Container App is in Stopped state."""
SUSPENDED = "Suspended"
"""Container App Job is in Suspended state."""
READY = "Ready"
"""Container App Job is in Ready state."""


class ContainerType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The container type of the sessions."""

Expand Down Expand Up @@ -258,6 +294,18 @@ class ForwardProxyConvention(str, Enum, metaclass=CaseInsensitiveEnumMeta):
CUSTOM = "Custom"


class HttpRouteProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The current provisioning state."""

SUCCEEDED = "Succeeded"
FAILED = "Failed"
CANCELED = "Canceled"
WAITING = "Waiting"
UPDATING = "Updating"
DELETING = "Deleting"
PENDING = "Pending"


class IdentitySettingsLifeCycle(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Use to select the lifecycle stages of a Container App during which the Managed Identity should
be available.
Expand Down Expand Up @@ -321,6 +369,7 @@ class JavaComponentType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
SPRING_BOOT_ADMIN = "SpringBootAdmin"
SPRING_CLOUD_EUREKA = "SpringCloudEureka"
SPRING_CLOUD_CONFIG = "SpringCloudConfig"
SPRING_CLOUD_GATEWAY = "SpringCloudGateway"
NACOS = "Nacos"


Expand All @@ -346,6 +395,14 @@ class JobProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
DELETING = "Deleting"


class JobRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Current running state of the job."""

READY = "Ready"
PROGRESSING = "Progressing"
SUSPENDED = "Suspended"


class Kind(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Metadata used to render different experiences for resources of the same type; e.g. WorkflowApp
is a kind of Microsoft.App/ContainerApps type. If supported, the resource provider must
Expand Down Expand Up @@ -535,6 +592,20 @@ class UnauthenticatedClientActionV2(str, Enum, metaclass=CaseInsensitiveEnumMeta
RETURN403 = "Return403"


class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Day of the week when a managed environment can be patched."""

MONDAY = "Monday"
TUESDAY = "Tuesday"
WEDNESDAY = "Wednesday"
THURSDAY = "Thursday"
FRIDAY = "Friday"
SATURDAY = "Saturday"
SUNDAY = "Sunday"
EVERYDAY = "Everyday"
WEEKEND = "Weekend"


class WorkflowHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the workflow health state."""

Expand Down
Loading