Skip to content

Commit

Permalink
[Automation] `automation account/configuration/runtime-environment/so…
Browse files Browse the repository at this point in the history
…urce-control`: Add support for some uncovered commands (#7184)

* add support for `automation configuration`, `automation runtime-environment`, `automation source-control` `automation hrwg hrw move`

* add support for `automation source-control sync-job`

* Fix linter problems

* Update api version in recording

* Update `HISTORY.rst`

* Add examples

* Add sync-job update example

* Fix style

* Update version number
  • Loading branch information
ReaNAiveD authored Feb 21, 2024
1 parent f7bdb83 commit 498b2d4
Show file tree
Hide file tree
Showing 61 changed files with 14,122 additions and 646 deletions.
9 changes: 9 additions & 0 deletions src/automation/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
Release History
===============
1.0.0b1
++++++
* `az automation account list-keys`: Add new command to retrieve the automation keys for an account.
* `az automation account show-linked-workspace`: Add new command to get the linked workspace.
* `az automation configuration`: Add new command group to support Dsc Configuration management.
* `az automation runtime-environment`: Add new command group to support managing runtime environment.
* `az automation runtime-environment package`: Add new command group to support managing runtime environment packages.
* `az automation source-control sync-job stream show/list`: Add new command to retrieve sync job stream.

0.2.2
++++++
* Updated create software update configuration cmdlet to address the bug to allow multiple values for classifications.
Expand Down
4 changes: 4 additions & 0 deletions src/automation/azext_automation/aaz/latest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"automation",
)
class __CMDGroup(AAZCommandGroup):
"""Manage Automation Account
"""Manage Automation Account.
"""
pass

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"automation account",
)
class __CMDGroup(AAZCommandGroup):
"""Automation Account.
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
from ._list_keys import *
from ._show_linked_workspace import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command(
"automation account list-keys",
)
class ListKeys(AAZCommand):
"""Retrieve the automation keys for an account.
:example: Retrieve the automation keys
az automation account list-keys --resource-group myResouceGroup --name myAutomationAccount
"""

_aaz_info = {
"version": "2023-11-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.automation/automationaccounts/{}/listkeys", "2023-11-01"],
]
}

def _handler(self, command_args):
super()._handler(command_args)
self._execute_operations()
return self._output()

_args_schema = None

@classmethod
def _build_arguments_schema(cls, *args, **kwargs):
if cls._args_schema is not None:
return cls._args_schema
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)

# define Arg Group ""

_args_schema = cls._args_schema
_args_schema.automation_account_name = AAZStrArg(
options=["-n", "--name", "--automation-account-name"],
help="The name of the automation account.",
required=True,
id_part="name",
)
_args_schema.resource_group = AAZResourceGroupNameArg(
required=True,
)
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
self.KeysListByAutomationAccount(ctx=self.ctx)()
self.post_operations()

@register_callback
def pre_operations(self):
pass

@register_callback
def post_operations(self):
pass

def _output(self, *args, **kwargs):
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
return result

class KeysListByAutomationAccount(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
request = self.make_request()
session = self.client.send_request(request=request, stream=False, **kwargs)
if session.http_response.status_code in [200]:
return self.on_200(session)

return self.on_error(session.http_response)

@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/listKeys",
**self.url_parameters
)

@property
def method(self):
return "POST"

@property
def error_format(self):
return "ODataV4Format"

@property
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"automationAccountName", self.ctx.args.automation_account_name,
required=True,
),
**self.serialize_url_param(
"resourceGroupName", self.ctx.args.resource_group,
required=True,
),
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
required=True,
),
}
return parameters

@property
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-11-01",
required=True,
),
}
return parameters

@property
def header_parameters(self):
parameters = {
**self.serialize_header_param(
"Accept", "application/json",
),
}
return parameters

def on_200(self, session):
data = self.deserialize_http_content(session)
self.ctx.set_var(
"instance",
data,
schema_builder=self._build_schema_on_200
)

_schema_on_200 = None

@classmethod
def _build_schema_on_200(cls):
if cls._schema_on_200 is not None:
return cls._schema_on_200

cls._schema_on_200 = AAZObjectType()

_schema_on_200 = cls._schema_on_200
_schema_on_200.keys = AAZListType()

keys = cls._schema_on_200.keys
keys.Element = AAZObjectType()

_element = cls._schema_on_200.keys.Element
_element.key_name = AAZStrType(
serialized_name="KeyName",
flags={"read_only": True},
)
_element.permissions = AAZStrType(
serialized_name="Permissions",
flags={"read_only": True},
)
_element.value = AAZStrType(
serialized_name="Value",
flags={"read_only": True},
)

return cls._schema_on_200


class _ListKeysHelper:
"""Helper class for ListKeys"""


__all__ = ["ListKeys"]
Loading

0 comments on commit 498b2d4

Please sign in to comment.