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
43 changes: 21 additions & 22 deletions src/containerapp/azext_containerapp/_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

logger = get_logger(__name__)

PREVIEW_API_VERSION = "2022-01-01-preview"
STABLE_API_VERSION = "2022-03-01"
POLLING_TIMEOUT = 60 # how many seconds before exiting
POLLING_SECONDS = 2 # how many seconds between requests
Expand Down Expand Up @@ -133,7 +132,7 @@ def update(cls, cmd, resource_group_name, name, container_app_envelope, no_wait=
@classmethod
def delete(cls, cmd, resource_group_name, name, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -167,7 +166,7 @@ def delete(cls, cmd, resource_group_name, name, no_wait=False):
@classmethod
def show(cls, cmd, resource_group_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}?api-version={}"
request_url = url_fmt.format(
Expand All @@ -185,7 +184,7 @@ def list_by_subscription(cls, cmd, formatter=lambda x: x):
app_list = []

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
request_url = "{}/subscriptions/{}/providers/Microsoft.App/containerApps?api-version={}".format(
management_hostname.strip('/'),
Expand Down Expand Up @@ -213,7 +212,7 @@ def list_by_resource_group(cls, cmd, resource_group_name, formatter=lambda x: x)
app_list = []

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -242,7 +241,7 @@ def list_by_resource_group(cls, cmd, resource_group_name, formatter=lambda x: x)
def list_secrets(cls, cmd, resource_group_name, name):

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/listSecrets?api-version={}"
request_url = url_fmt.format(
Expand All @@ -261,7 +260,7 @@ def list_revisions(cls, cmd, resource_group_name, name, formatter=lambda x: x):
revisions_list = []

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/revisions?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -290,7 +289,7 @@ def list_revisions(cls, cmd, resource_group_name, name, formatter=lambda x: x):
@classmethod
def show_revision(cls, cmd, resource_group_name, container_app_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/revisions/{}?api-version={}"
request_url = url_fmt.format(
Expand All @@ -307,7 +306,7 @@ def show_revision(cls, cmd, resource_group_name, container_app_name, name):
@classmethod
def restart_revision(cls, cmd, resource_group_name, container_app_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/revisions/{}/restart?api-version={}"
request_url = url_fmt.format(
Expand All @@ -324,7 +323,7 @@ def restart_revision(cls, cmd, resource_group_name, container_app_name, name):
@classmethod
def activate_revision(cls, cmd, resource_group_name, container_app_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/revisions/{}/activate?api-version={}"
request_url = url_fmt.format(
Expand All @@ -341,7 +340,7 @@ def activate_revision(cls, cmd, resource_group_name, container_app_name, name):
@classmethod
def deactivate_revision(cls, cmd, resource_group_name, container_app_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/revisions/{}/deactivate?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -421,7 +420,7 @@ class ManagedEnvironmentClient():
@classmethod
def create(cls, cmd, resource_group_name, name, managed_environment_envelope, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -450,7 +449,7 @@ def create(cls, cmd, resource_group_name, name, managed_environment_envelope, no
@classmethod
def update(cls, cmd, resource_group_name, name, managed_environment_envelope, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -479,7 +478,7 @@ def update(cls, cmd, resource_group_name, name, managed_environment_envelope, no
@classmethod
def delete(cls, cmd, resource_group_name, name, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -514,7 +513,7 @@ def delete(cls, cmd, resource_group_name, name, no_wait=False):
@classmethod
def show(cls, cmd, resource_group_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}?api-version={}"
request_url = url_fmt.format(
Expand All @@ -532,7 +531,7 @@ def list_by_subscription(cls, cmd, formatter=lambda x: x):
env_list = []

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
request_url = "{}/subscriptions/{}/providers/Microsoft.App/managedEnvironments?api-version={}".format(
management_hostname.strip('/'),
Expand Down Expand Up @@ -560,7 +559,7 @@ def list_by_resource_group(cls, cmd, resource_group_name, formatter=lambda x: x)
env_list = []

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -635,7 +634,7 @@ def show(cls, cmd, resource_group_name, name):
@classmethod
def delete(cls, cmd, resource_group_name, name, headers, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerApps/{}/sourcecontrols/current?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -673,7 +672,7 @@ class DaprComponentClient():
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
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}/daprComponents/{}?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -704,7 +703,7 @@ def create_or_update(cls, cmd, resource_group_name, environment_name, name, dapr
@classmethod
def delete(cls, cmd, resource_group_name, environment_name, name, no_wait=False):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}/daprComponents/{}?api-version={}"
request_url = url_fmt.format(
Expand Down Expand Up @@ -741,7 +740,7 @@ def delete(cls, cmd, resource_group_name, environment_name, name, no_wait=False)
@classmethod
def show(cls, cmd, resource_group_name, environment_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}/daprComponents/{}?api-version={}"
request_url = url_fmt.format(
Expand All @@ -760,7 +759,7 @@ def list(cls, cmd, resource_group_name, environment_name, formatter=lambda x: x)
app_list = []

management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
api_version = PREVIEW_API_VERSION
api_version = STABLE_API_VERSION
sub_id = get_subscription_id(cmd.cli_ctx)
request_url = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}/daprComponents?api-version={}".format(
management_hostname.strip('/'),
Expand Down
2 changes: 1 addition & 1 deletion src/containerapp/azext_containerapp/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def load_arguments(self, _):
c.argument('docker_bridge_cidr', options_list=['--docker-bridge-cidr'], help='CIDR notation IP range assigned to the Docker bridge. It must not overlap with any Subnet IP ranges or the IP range defined in Platform Reserved CIDR, if defined')
c.argument('platform_reserved_cidr', options_list=['--platform-reserved-cidr'], help='IP range in CIDR notation that can be reserved for environment infrastructure IP addresses. It must not overlap with any other Subnet IP ranges')
c.argument('platform_reserved_dns_ip', options_list=['--platform-reserved-dns-ip'], help='An IP address from the IP range defined by Platform Reserved CIDR that will be reserved for the internal DNS server.')
c.argument('internal_only', arg_type=get_three_state_flag(), options_list=['--internal-only'], help='Boolean indicating the environment only has an internal load balancer. These environments do not have a public static IP resource, therefore must provide infrastructureSubnetResourceId and appSubnetResourceId if enabling this property')
c.argument('internal_only', arg_type=get_three_state_flag(), options_list=['--internal-only'], help='Boolean indicating the environment only has an internal load balancer. These environments do not have a public static IP resource, therefore must provide infrastructureSubnetResourceId if enabling this property')

with self.argument_context('containerapp env update') as c:
c.argument('name', name_type, help='Name of the Container Apps environment.')
Expand Down
2 changes: 1 addition & 1 deletion src/containerapp/azext_containerapp/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def create_containerapp_yaml(cmd, name, resource_group_name, file_name, no_wait=

# Validate managed environment
if not containerapp_def["properties"].get('managedEnvironmentId'):
raise RequiredArgumentMissingError('managedEnvironmentId is required. Please see https://aka.ms/azure-container-apps-yaml for a valid containerapps YAML spec.')
raise RequiredArgumentMissingError('managedEnvironmentId is required. This can be retrieved using the `az containerapp env show -g MyResourceGroup -n MyContainerappEnvironment --query id` command. Please see https://aka.ms/azure-container-apps-yaml for a valid containerapps YAML spec.')

env_id = containerapp_def["properties"]['managedEnvironmentId']
env_name = None
Expand Down
Loading