Skip to content

Commit

Permalink
{containerapp} az containerapp env update: Fix polling Url (#7254)
Browse files Browse the repository at this point in the history
  • Loading branch information
Greedygre authored Feb 5, 2024
1 parent 9547853 commit 07d9e3b
Show file tree
Hide file tree
Showing 3 changed files with 1,979 additions and 2,211 deletions.
26 changes: 26 additions & 0 deletions src/containerapp/azext_containerapp/_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,32 @@ class StoragePreviewClient(StorageClient):
class ManagedEnvironmentPreviewClient(ManagedEnvironmentClient):
api_version = PREVIEW_API_VERSION

@classmethod
def update(cls, cmd, resource_group_name, name, managed_environment_envelope, 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/managedEnvironments/{}?api-version={}"
request_url = url_fmt.format(
management_hostname.strip('/'),
sub_id,
resource_group_name,
name,
cls.api_version)

r = send_raw_request(cmd.cli_ctx, "PATCH", request_url, body=json.dumps(managed_environment_envelope))

if no_wait:
return
elif r.status_code == 202:
operation_url = r.headers.get(HEADER_LOCATION)
response = poll_results(cmd, operation_url)
if response is None:
raise ResourceNotFoundError("Could not find a container app")
else:
return response

return r.json()

@classmethod
def list_usages(cls, cmd, resource_group_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
Expand Down
Loading

0 comments on commit 07d9e3b

Please sign in to comment.