Skip to content

Commit e2f7057

Browse files
authored
Artifact signing extension added (#9533)
* Added a new extesion artifact signing * Updated history page and version and fixed styling * Updated the artifact signing setup to stable release * Reverting trusted signing extension changes * Reverted trustedsigning changes * ran azdev style
1 parent 1fba329 commit e2f7057

33 files changed

Lines changed: 5239 additions & 11 deletions

src/artifact-signing/HISTORY.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.. :changelog:
2+
3+
Release History
4+
===============
5+
6+
1.0.0
7+
++++++
8+
* Extension to support Artifact signing
9+
* Upgrade to stable api-version 2025-10-13

src/artifact-signing/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Azure CLI Artifactsigning Extension #
2+
This extension helps to manage Artifactsigning resources.
3+
4+
Artifact Signing is a Microsoft fully managed, end-to-end signing solution for partner developers.
5+
6+
7+
### How to use
8+
Install this extension using the below CLI command
9+
```
10+
az extension add --name artifactsigning
11+
```
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
from azure.cli.core import AzCommandsLoader
9+
from azext_artifact_signing._help import helps # pylint: disable=unused-import
10+
11+
12+
class ArtifactSigningCommandsLoader(AzCommandsLoader):
13+
14+
def __init__(self, cli_ctx=None):
15+
from azure.cli.core.commands import CliCommandType
16+
custom_command_type = CliCommandType(
17+
operations_tmpl='azext_artifact_signing.custom#{}')
18+
super().__init__(cli_ctx=cli_ctx,
19+
custom_command_type=custom_command_type)
20+
21+
def load_command_table(self, args):
22+
from azext_artifact_signing.commands import load_command_table
23+
from azure.cli.core.aaz import load_aaz_command_table
24+
try:
25+
from . import aaz
26+
except ImportError:
27+
aaz = None
28+
if aaz:
29+
load_aaz_command_table(
30+
loader=self,
31+
aaz_pkg_name=aaz.__name__,
32+
args=args
33+
)
34+
load_command_table(self, args)
35+
return self.command_table
36+
37+
def load_arguments(self, command):
38+
from azext_artifact_signing._params import load_arguments
39+
load_arguments(self, command)
40+
41+
42+
COMMAND_LOADER_CLS = ArtifactSigningCommandsLoader
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: disable=line-too-long
9+
# pylint: disable=too-many-lines
10+
11+
from knack.help_files import helps # pylint: disable=unused-import
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: disable=too-many-lines
9+
# pylint: disable=too-many-statements
10+
11+
12+
def load_arguments(self, _): # pylint: disable=unused-argument
13+
pass
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command_group(
15+
"artifact-signing",
16+
is_preview=True,
17+
)
18+
class __CMDGroup(AAZCommandGroup):
19+
"""Manage artifact signing account
20+
"""
21+
pass
22+
23+
24+
__all__ = ["__CMDGroup"]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from .__cmd_group import *
12+
from ._check_name_availability import *
13+
from ._create import *
14+
from ._delete import *
15+
from ._list import *
16+
from ._show import *
17+
from ._update import *
18+
from ._wait import *
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command(
15+
"artifact-signing check-name-availability",
16+
)
17+
class CheckNameAvailability(AAZCommand):
18+
"""Checks that the artifact signing account name is valid and is not already in use.
19+
20+
:example: Check if account name is available
21+
az artifact-signing check-name-availability --type Microsoft.CodeSigning/codeSigningAccounts --name MyAccount
22+
"""
23+
24+
_aaz_info = {
25+
"version": "2025-10-13",
26+
"resources": [
27+
["mgmt-plane", "/subscriptions/{}/providers/microsoft.codesigning/checknameavailability", "2025-10-13"],
28+
]
29+
}
30+
31+
def _handler(self, command_args):
32+
super()._handler(command_args)
33+
self._execute_operations()
34+
return self._output()
35+
36+
_args_schema = None
37+
38+
@classmethod
39+
def _build_arguments_schema(cls, *args, **kwargs):
40+
if cls._args_schema is not None:
41+
return cls._args_schema
42+
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)
43+
44+
# define Arg Group ""
45+
46+
# define Arg Group "Body"
47+
48+
_args_schema = cls._args_schema
49+
_args_schema.name = AAZStrArg(
50+
options=["-n", "--name"],
51+
arg_group="Body",
52+
help="Artifact signing account name.",
53+
required=True,
54+
)
55+
_args_schema.type = AAZStrArg(
56+
options=["--type"],
57+
arg_group="Body",
58+
help="The type of the resource, \"Microsoft.CodeSigning/codeSigningAccounts\".",
59+
required=True,
60+
)
61+
return cls._args_schema
62+
63+
def _execute_operations(self):
64+
self.pre_operations()
65+
self.CodeSigningAccountsCheckNameAvailability(ctx=self.ctx)()
66+
self.post_operations()
67+
68+
@register_callback
69+
def pre_operations(self):
70+
pass
71+
72+
@register_callback
73+
def post_operations(self):
74+
pass
75+
76+
def _output(self, *args, **kwargs):
77+
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
78+
return result
79+
80+
class CodeSigningAccountsCheckNameAvailability(AAZHttpOperation):
81+
CLIENT_TYPE = "MgmtClient"
82+
83+
def __call__(self, *args, **kwargs):
84+
request = self.make_request()
85+
session = self.client.send_request(request=request, stream=False, **kwargs)
86+
if session.http_response.status_code in [200]:
87+
return self.on_200(session)
88+
89+
return self.on_error(session.http_response)
90+
91+
@property
92+
def url(self):
93+
return self.client.format_url(
94+
"/subscriptions/{subscriptionId}/providers/Microsoft.CodeSigning/checkNameAvailability",
95+
**self.url_parameters
96+
)
97+
98+
@property
99+
def method(self):
100+
return "POST"
101+
102+
@property
103+
def error_format(self):
104+
return "MgmtErrorFormat"
105+
106+
@property
107+
def url_parameters(self):
108+
parameters = {
109+
**self.serialize_url_param(
110+
"subscriptionId", self.ctx.subscription_id,
111+
required=True,
112+
),
113+
}
114+
return parameters
115+
116+
@property
117+
def query_parameters(self):
118+
parameters = {
119+
**self.serialize_query_param(
120+
"api-version", "2025-10-13",
121+
required=True,
122+
),
123+
}
124+
return parameters
125+
126+
@property
127+
def header_parameters(self):
128+
parameters = {
129+
**self.serialize_header_param(
130+
"Content-Type", "application/json",
131+
),
132+
**self.serialize_header_param(
133+
"Accept", "application/json",
134+
),
135+
}
136+
return parameters
137+
138+
@property
139+
def content(self):
140+
_content_value, _builder = self.new_content_builder(
141+
self.ctx.args,
142+
typ=AAZObjectType,
143+
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
144+
)
145+
_builder.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}})
146+
_builder.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}})
147+
148+
return self.serialize_content(_content_value)
149+
150+
def on_200(self, session):
151+
data = self.deserialize_http_content(session)
152+
self.ctx.set_var(
153+
"instance",
154+
data,
155+
schema_builder=self._build_schema_on_200
156+
)
157+
158+
_schema_on_200 = None
159+
160+
@classmethod
161+
def _build_schema_on_200(cls):
162+
if cls._schema_on_200 is not None:
163+
return cls._schema_on_200
164+
165+
cls._schema_on_200 = AAZObjectType()
166+
167+
_schema_on_200 = cls._schema_on_200
168+
_schema_on_200.message = AAZStrType(
169+
flags={"read_only": True},
170+
)
171+
_schema_on_200.name_available = AAZBoolType(
172+
serialized_name="nameAvailable",
173+
flags={"read_only": True},
174+
)
175+
_schema_on_200.reason = AAZStrType(
176+
flags={"read_only": True},
177+
)
178+
179+
return cls._schema_on_200
180+
181+
182+
class _CheckNameAvailabilityHelper:
183+
"""Helper class for CheckNameAvailability"""
184+
185+
186+
__all__ = ["CheckNameAvailability"]

0 commit comments

Comments
 (0)