Skip to content

Commit 617cd7d

Browse files
Client Parity: CLI Refresh for Dynatrace API version 2024-04-24 (#9389)
* Client Parity: CLI Refresh for Dynatrace API version 2024-04-24 * Applying changes for adding examples and mainting length of args < 22 as a result of PR workflow runs * Applying review comments * Fixing assertion errors for ITs
1 parent 79e8d2d commit 617cd7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+6783
-788
lines changed

src/dynatrace/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
Release History
44
===============
55

6+
2.0.0
7+
++++++
8+
* CLI refresh for swagger version 2024-04-24
9+
610
1.1.1
711
++++++
812
* Update the CLI command documentation

src/dynatrace/azext_dynatrace/aaz/latest/dynatrace/_get_marketplace_saas_resource_detail.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class GetMarketplaceSaasResourceDetail(AAZCommand):
2222
"""
2323

2424
_aaz_info = {
25-
"version": "2023-04-27",
25+
"version": "2024-04-24",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/providers/dynatrace.observability/getmarketplacesaasresourcedetails", "2023-04-27"],
27+
["mgmt-plane", "/subscriptions/{}/providers/dynatrace.observability/getmarketplacesaasresourcedetails", "2024-04-24"],
2828
]
2929
}
3030

@@ -111,7 +111,7 @@ def url_parameters(self):
111111
def query_parameters(self):
112112
parameters = {
113113
**self.serialize_query_param(
114-
"api-version", "2023-04-27",
114+
"api-version", "2024-04-24",
115115
required=True,
116116
),
117117
}
@@ -161,6 +161,9 @@ def _build_schema_on_200(cls):
161161
_schema_on_200.marketplace_saa_s_resource_id = AAZStrType(
162162
serialized_name="marketplaceSaaSResourceId",
163163
)
164+
_schema_on_200.marketplace_saa_s_resource_name = AAZStrType(
165+
serialized_name="marketplaceSaaSResourceName",
166+
)
164167
_schema_on_200.marketplace_subscription_status = AAZStrType(
165168
serialized_name="marketplaceSubscriptionStatus",
166169
)

src/dynatrace/azext_dynatrace/aaz/latest/dynatrace/monitor/_create.py

Lines changed: 59 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class Create(AAZCommand):
2222
"""
2323

2424
_aaz_info = {
25-
"version": "2023-04-27",
25+
"version": "2024-04-24",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/dynatrace.observability/monitors/{}", "2023-04-27"],
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/dynatrace.observability/monitors/{}", "2024-04-24"],
2828
]
2929
}
3030

@@ -49,6 +49,9 @@ def _build_arguments_schema(cls, *args, **kwargs):
4949
options=["-n", "--name", "--monitor-name"],
5050
help="Monitor resource name",
5151
required=True,
52+
fmt=AAZStrArgFormat(
53+
pattern="^[a-zA-Z0-9_-]*$",
54+
),
5255
)
5356
_args_schema.resource_group = AAZResourceGroupNameArg(
5457
required=True,
@@ -62,11 +65,17 @@ def _build_arguments_schema(cls, *args, **kwargs):
6265
arg_group="Properties",
6366
help="Properties of the Dynatrace environment.",
6467
)
68+
_args_schema.mp_saas_auto_renew = AAZStrArg(
69+
options=["--mp-saas-auto-renew"],
70+
arg_group="Properties",
71+
help="Marketplace resource autorenew flag",
72+
enum={"Off": "Off", "On": "On"},
73+
)
6574
_args_schema.subscription_status = AAZStrArg(
6675
options=["--subscription-status"],
6776
arg_group="Properties",
6877
help="Marketplace subscription status.",
69-
enum={"Active": "Active", "Suspended": "Suspended"},
78+
enum={"Active": "Active", "Suspended": "Suspended", "Unsubscribed": "Unsubscribed"},
7079
)
7180
_args_schema.monitoring_status = AAZStrArg(
7281
options=["--monitoring-status"],
@@ -78,13 +87,11 @@ def _build_arguments_schema(cls, *args, **kwargs):
7887
options=["--plan-data"],
7988
arg_group="Properties",
8089
help="Billing plan information.",
81-
required=True,
8290
)
8391
_args_schema.user_info = AAZObjectArg(
8492
options=["--user-info"],
8593
arg_group="Properties",
8694
help="User info.",
87-
required=True,
8895
)
8996

9097
environment = cls._args_schema.environment
@@ -110,6 +117,10 @@ def _build_arguments_schema(cls, *args, **kwargs):
110117
options=["account-id"],
111118
help="Account Id of the account this environment is linked to",
112119
)
120+
account_info.company_name = AAZStrArg(
121+
options=["company-name"],
122+
help="Name of the customer account / company",
123+
)
113124
account_info.region_id = AAZStrArg(
114125
options=["region-id"],
115126
help="Region in which the account is created",
@@ -159,22 +170,21 @@ def _build_arguments_schema(cls, *args, **kwargs):
159170
plan_data.billing_cycle = AAZStrArg(
160171
options=["billing-cycle"],
161172
help="different billing cycles like MONTHLY/WEEKLY. this could be enum",
162-
required=True,
163173
)
164174
plan_data.effective_date = AAZDateTimeArg(
165175
options=["effective-date"],
166176
help="date when plan was applied",
167-
required=True,
177+
fmt=AAZDateTimeFormat(
178+
protocol="iso",
179+
),
168180
)
169181
plan_data.plan_details = AAZStrArg(
170182
options=["plan-details"],
171183
help="plan id as published by Dynatrace",
172-
required=True,
173184
)
174185
plan_data.usage_type = AAZStrArg(
175186
options=["usage-type"],
176187
help="different usage type like PAYG/COMMITTED. this could be enum",
177-
required=True,
178188
)
179189

180190
user_info = cls._args_schema.user_info
@@ -185,20 +195,17 @@ def _build_arguments_schema(cls, *args, **kwargs):
185195
user_info.email_address = AAZStrArg(
186196
options=["email-address"],
187197
help="Email of the user used by Dynatrace for contacting them if needed",
188-
required=True,
189198
fmt=AAZStrArgFormat(
190199
pattern="^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$",
191200
),
192201
)
193202
user_info.first_name = AAZStrArg(
194203
options=["first-name"],
195204
help="First Name of the user",
196-
required=True,
197205
)
198206
user_info.last_name = AAZStrArg(
199207
options=["last-name"],
200208
help="Last Name of the user",
201-
required=True,
202209
)
203210
user_info.phone_number = AAZStrArg(
204211
options=["phone-number"],
@@ -231,30 +238,33 @@ def _build_arguments_schema(cls, *args, **kwargs):
231238
)
232239

233240
identity = cls._args_schema.identity
241+
identity.mi_system_assigned = AAZStrArg(
242+
options=["system-assigned", "mi-system-assigned"],
243+
help="Set the system managed identity.",
244+
blank="True",
245+
)
234246
identity.type = AAZStrArg(
235247
options=["type"],
236248
help="The type of managed identity assigned to this resource.",
237249
required=True,
238250
enum={"SystemAndUserAssigned": "SystemAndUserAssigned", "SystemAssigned": "SystemAssigned", "UserAssigned": "UserAssigned"},
239251
)
252+
identity.mi_user_assigned = AAZListArg(
253+
options=["user-assigned", "mi-user-assigned"],
254+
help="Set the user managed identities.",
255+
blank=[],
256+
)
240257
identity.user_assigned_identities = AAZDictArg(
241258
options=["user-assigned-identities"],
242259
help="The identities assigned to this resource by the user.",
243260
)
244261

245-
user_assigned_identities = cls._args_schema.identity.user_assigned_identities
246-
user_assigned_identities.Element = AAZObjectArg()
262+
mi_user_assigned = cls._args_schema.identity.mi_user_assigned
263+
mi_user_assigned.Element = AAZStrArg()
247264

248-
_element = cls._args_schema.identity.user_assigned_identities.Element
249-
_element.client_id = AAZStrArg(
250-
options=["client-id"],
251-
help="The active directory client identifier for this principal.",
252-
required=True,
253-
)
254-
_element.principal_id = AAZStrArg(
255-
options=["principal-id"],
256-
help="The active directory identifier for this principal.",
257-
required=True,
265+
user_assigned_identities = cls._args_schema.identity.user_assigned_identities
266+
user_assigned_identities.Element = AAZObjectArg(
267+
blank={},
258268
)
259269

260270
tags = cls._args_schema.tags
@@ -342,7 +352,7 @@ def url_parameters(self):
342352
def query_parameters(self):
343353
parameters = {
344354
**self.serialize_query_param(
345-
"api-version", "2023-04-27",
355+
"api-version", "2024-04-24",
346356
required=True,
347357
),
348358
}
@@ -376,23 +386,25 @@ def content(self):
376386
if identity is not None:
377387
identity.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}})
378388
identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities")
389+
identity.set_prop("userAssigned", AAZListType, ".mi_user_assigned", typ_kwargs={"flags": {"action": "create"}})
390+
identity.set_prop("systemAssigned", AAZStrType, ".mi_system_assigned", typ_kwargs={"flags": {"action": "create"}})
379391

380392
user_assigned_identities = _builder.get(".identity.userAssignedIdentities")
381393
if user_assigned_identities is not None:
382394
user_assigned_identities.set_elements(AAZObjectType, ".")
383395

384-
_elements = _builder.get(".identity.userAssignedIdentities{}")
385-
if _elements is not None:
386-
_elements.set_prop("clientId", AAZStrType, ".client_id", typ_kwargs={"flags": {"required": True}})
387-
_elements.set_prop("principalId", AAZStrType, ".principal_id", typ_kwargs={"flags": {"required": True}})
396+
user_assigned = _builder.get(".identity.userAssigned")
397+
if user_assigned is not None:
398+
user_assigned.set_elements(AAZStrType, ".")
388399

389400
properties = _builder.get(".properties")
390401
if properties is not None:
391402
properties.set_prop("dynatraceEnvironmentProperties", AAZObjectType, ".environment")
403+
properties.set_prop("marketplaceSaasAutoRenew", AAZStrType, ".mp_saas_auto_renew")
392404
properties.set_prop("marketplaceSubscriptionStatus", AAZStrType, ".subscription_status")
393405
properties.set_prop("monitoringStatus", AAZStrType, ".monitoring_status")
394-
properties.set_prop("planData", AAZObjectType, ".plan_data", typ_kwargs={"flags": {"required": True}})
395-
properties.set_prop("userInfo", AAZObjectType, ".user_info", typ_kwargs={"flags": {"required": True}})
406+
properties.set_prop("planData", AAZObjectType, ".plan_data")
407+
properties.set_prop("userInfo", AAZObjectType, ".user_info")
396408

397409
dynatrace_environment_properties = _builder.get(".properties.dynatraceEnvironmentProperties")
398410
if dynatrace_environment_properties is not None:
@@ -404,6 +416,7 @@ def content(self):
404416
account_info = _builder.get(".properties.dynatraceEnvironmentProperties.accountInfo")
405417
if account_info is not None:
406418
account_info.set_prop("accountId", AAZStrType, ".account_id")
419+
account_info.set_prop("companyName", AAZStrType, ".company_name")
407420
account_info.set_prop("regionId", AAZStrType, ".region_id")
408421

409422
environment_info = _builder.get(".properties.dynatraceEnvironmentProperties.environmentInfo")
@@ -426,17 +439,17 @@ def content(self):
426439

427440
plan_data = _builder.get(".properties.planData")
428441
if plan_data is not None:
429-
plan_data.set_prop("billingCycle", AAZStrType, ".billing_cycle", typ_kwargs={"flags": {"required": True}})
430-
plan_data.set_prop("effectiveDate", AAZStrType, ".effective_date", typ_kwargs={"flags": {"required": True}})
431-
plan_data.set_prop("planDetails", AAZStrType, ".plan_details", typ_kwargs={"flags": {"required": True}})
432-
plan_data.set_prop("usageType", AAZStrType, ".usage_type", typ_kwargs={"flags": {"required": True}})
442+
plan_data.set_prop("billingCycle", AAZStrType, ".billing_cycle")
443+
plan_data.set_prop("effectiveDate", AAZStrType, ".effective_date")
444+
plan_data.set_prop("planDetails", AAZStrType, ".plan_details")
445+
plan_data.set_prop("usageType", AAZStrType, ".usage_type")
433446

434447
user_info = _builder.get(".properties.userInfo")
435448
if user_info is not None:
436449
user_info.set_prop("country", AAZStrType, ".country")
437-
user_info.set_prop("emailAddress", AAZStrType, ".email_address", typ_kwargs={"flags": {"required": True}})
438-
user_info.set_prop("firstName", AAZStrType, ".first_name", typ_kwargs={"flags": {"required": True}})
439-
user_info.set_prop("lastName", AAZStrType, ".last_name", typ_kwargs={"flags": {"required": True}})
450+
user_info.set_prop("emailAddress", AAZStrType, ".email_address")
451+
user_info.set_prop("firstName", AAZStrType, ".first_name")
452+
user_info.set_prop("lastName", AAZStrType, ".last_name")
440453
user_info.set_prop("phoneNumber", AAZStrType, ".phone_number")
441454

442455
tags = _builder.get(".tags")
@@ -507,11 +520,11 @@ def _build_schema_on_200_201(cls):
507520
_element = cls._schema_on_200_201.identity.user_assigned_identities.Element
508521
_element.client_id = AAZStrType(
509522
serialized_name="clientId",
510-
flags={"required": True},
523+
flags={"read_only": True},
511524
)
512525
_element.principal_id = AAZStrType(
513526
serialized_name="principalId",
514-
flags={"required": True},
527+
flags={"read_only": True},
515528
)
516529

517530
properties = cls._schema_on_200_201.properties
@@ -526,6 +539,9 @@ def _build_schema_on_200_201(cls):
526539
serialized_name="liftrResourcePreference",
527540
flags={"read_only": True},
528541
)
542+
properties.marketplace_saas_auto_renew = AAZStrType(
543+
serialized_name="marketplaceSaasAutoRenew",
544+
)
529545
properties.marketplace_subscription_status = AAZStrType(
530546
serialized_name="marketplaceSubscriptionStatus",
531547
)
@@ -534,15 +550,13 @@ def _build_schema_on_200_201(cls):
534550
)
535551
properties.plan_data = AAZObjectType(
536552
serialized_name="planData",
537-
flags={"required": True},
538553
)
539554
properties.provisioning_state = AAZStrType(
540555
serialized_name="provisioningState",
541556
flags={"read_only": True},
542557
)
543558
properties.user_info = AAZObjectType(
544559
serialized_name="userInfo",
545-
flags={"required": True},
546560
)
547561

548562
dynatrace_environment_properties = cls._schema_on_200_201.properties.dynatrace_environment_properties
@@ -563,6 +577,9 @@ def _build_schema_on_200_201(cls):
563577
account_info.account_id = AAZStrType(
564578
serialized_name="accountId",
565579
)
580+
account_info.company_name = AAZStrType(
581+
serialized_name="companyName",
582+
)
566583
account_info.region_id = AAZStrType(
567584
serialized_name="regionId",
568585
)
@@ -605,34 +622,27 @@ def _build_schema_on_200_201(cls):
605622
plan_data = cls._schema_on_200_201.properties.plan_data
606623
plan_data.billing_cycle = AAZStrType(
607624
serialized_name="billingCycle",
608-
flags={"required": True},
609625
)
610626
plan_data.effective_date = AAZStrType(
611627
serialized_name="effectiveDate",
612-
flags={"required": True},
613628
)
614629
plan_data.plan_details = AAZStrType(
615630
serialized_name="planDetails",
616-
flags={"required": True},
617631
)
618632
plan_data.usage_type = AAZStrType(
619633
serialized_name="usageType",
620-
flags={"required": True},
621634
)
622635

623636
user_info = cls._schema_on_200_201.properties.user_info
624637
user_info.country = AAZStrType()
625638
user_info.email_address = AAZStrType(
626639
serialized_name="emailAddress",
627-
flags={"required": True},
628640
)
629641
user_info.first_name = AAZStrType(
630642
serialized_name="firstName",
631-
flags={"required": True},
632643
)
633644
user_info.last_name = AAZStrType(
634645
serialized_name="lastName",
635-
flags={"required": True},
636646
)
637647
user_info.phone_number = AAZStrType(
638648
serialized_name="phoneNumber",

0 commit comments

Comments
 (0)