Skip to content
Draft
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
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(
"workload-orchestration artifcat",
)
class __CMDGroup(AAZCommandGroup):
"""workload-orchestration configuration helps to manage configurations
"""
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 ._generate import *
from ._simple_generate import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
# --------------------------------------------------------------------------------------------
# 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(
"workload-orchestration artifcat generate",
is_preview=False,
)
class ShowConfig(AAZCommand):
"""To get a configurations available at specified hierarchical entity
:example: Show a Configuration
az workload-orchestration configuration show -g rg1 --target-name target1 --solution-template-name solutionTemplate1
"""

_aaz_info = {
"version": "2024-08-01-preview",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/Microsoft.Edge/solutions/{}", "2024-08-01-preview"],
]
}

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.resource_group = AAZResourceGroupNameArg(
required=True,
)
_args_schema.solution_name = AAZStrArg(
options=["--solution-template-name"],
help="The name of the Solution, This is required only to get solution configurations",
# required=True,
id_part="name",
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]{3,24}$",
),
)

_args_schema = cls._args_schema
_args_schema.level_name = AAZStrArg(
options=["--target-name"],
help="The Target or Site name at which values needs to be set",

required = True,
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]{3,24}$",
),
)

# define Arg Group "Resource

#
# _args_schema.properties = AAZFreeFormDictArg(
# options=["--properties"],
# arg_group="Resource",
# help="The resource-specific properties for this resource.",
# nullable=True,
# )
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
config_name = str(self.ctx.args.level_name)
if len(config_name) > 18:
config_name = config_name[:18] + "Config"
else:
config_name = config_name + "Config"
self.ctx.args.level_name = config_name
self.SolutionsGet(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)
print(result["properties"]["values"])
pass

class SolutionsGet(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)
config = dict()
config["properties"] = dict()
config["properties"]["values"] = "{}"
# # config.config = AAZStrType()
# # config.config = "[]"
if session.http_response.status_code in [404]:
self.ctx.set_var(
"instance",
config,
schema_builder=self._build_schema_on_404
)
# return
else:
return self.on_error(session.http_response)


@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/configurations/{configName}/DynamicConfigurations/{solutionName}/versions/version1",
**self.url_parameters
)

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

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

@property
def url_parameters(self):
sol_name = "common"
if has_value(self.ctx.args.solution_name):
sol_name = self.ctx.args.solution_name

parameters = {
**self.serialize_url_param(
"resourceGroupName", self.ctx.args.resource_group,
required=True,
),
**self.serialize_url_param(
"solutionName", sol_name,
required=True,
),
**self.serialize_url_param(
"configName", self.ctx.args.level_name,
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", "2024-06-01-preview",
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_404(cls):
cls._schema_on_200 = AAZObjectType()
_schema_on_200 = cls._schema_on_200
_schema_on_200.properties = AAZFreeFormDictType()
return cls._schema_on_200


@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.id = AAZStrType(
flags={"read_only": True},
)
_schema_on_200.location = AAZStrType(
flags={"required": True},
)
_schema_on_200.name = AAZStrType(
flags={"read_only": True},
)
_schema_on_200.properties = AAZFreeFormDictType()
_schema_on_200.system_data = AAZObjectType(
serialized_name="systemData",
flags={"read_only": True},
)
_schema_on_200.tags = AAZDictType()
_schema_on_200.type = AAZStrType(
flags={"read_only": True},
)




system_data = cls._schema_on_200.system_data
system_data.created_at = AAZStrType(
serialized_name="createdAt",
)
system_data.created_by = AAZStrType(
serialized_name="createdBy",
)
system_data.created_by_type = AAZStrType(
serialized_name="createdByType",
)
system_data.last_modified_at = AAZStrType(
serialized_name="lastModifiedAt",
)
system_data.last_modified_by = AAZStrType(
serialized_name="lastModifiedBy",
)
system_data.last_modified_by_type = AAZStrType(
serialized_name="lastModifiedByType",
)

tags = cls._schema_on_200.tags
tags.Element = AAZStrType()

return cls._schema_on_200


class _ShowHelper:
"""Helper class for Show"""


__all__ = ["ShowConfig"]
Loading
Loading