Skip to content

Commit d13d0c9

Browse files
author
Srinivas Alluri
committed
addressed comments and added scenario tests
1 parent 9233ac5 commit d13d0c9

22 files changed

Lines changed: 1282 additions & 1899 deletions

File tree

src/neon/azext_neon/aaz/latest/neon/postgres/branch/_create.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Create(AAZCommand):
1818
"""Create a Branch
1919
2020
:example: Create a Branch
21-
az neon postgres branch create --resource-group rgneon --organization-name org-cli-test --project-name old-frost-16758796 --project-id old-frost-16758796 --branch-name test-branch --entity-name test-branch --role-name test_role --database-name testneondb
21+
az neon postgres branch create --resource-group rgneon --organization-name org-cli-test --project-name old-frost-16758796 --branch-name test-branch --entity-name test-branch --role-name test_role --database-name testneondb
2222
"""
2323

2424
_aaz_info = {
@@ -50,7 +50,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
5050
help="The name of the Branch",
5151
required=True,
5252
fmt=AAZStrArgFormat(
53-
pattern="^[a-zA-Z0-9-]{3,24}$",
53+
pattern="^\\S.{0,62}\\S$|^\\S$",
5454
),
5555
)
5656
_args_schema.organization_name = AAZStrArg(
@@ -68,7 +68,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
6868
help="The Id of the Neon Project.",
6969
required=True,
7070
fmt=AAZStrArgFormat(
71-
pattern="^[a-zA-Z0-9-]{3,24}$",
71+
pattern="^\\S.{0,62}\\S$|^\\S$",
7272
),
7373
)
7474
_args_schema.resource_group = AAZResourceGroupNameArg(

src/neon/azext_neon/aaz/latest/neon/postgres/branch/_delete.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
5151
required=True,
5252
id_part="child_name_2",
5353
fmt=AAZStrArgFormat(
54-
pattern="^[a-zA-Z0-9-]{3,24}$",
54+
pattern="^\\S.{0,62}\\S$|^\\S$",
5555
),
5656
)
5757
_args_schema.organization_name = AAZStrArg(
@@ -71,7 +71,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
7171
required=True,
7272
id_part="child_name_1",
7373
fmt=AAZStrArgFormat(
74-
pattern="^[a-zA-Z0-9-]{3,24}$",
74+
pattern="^\\S.{0,62}\\S$|^\\S$",
7575
),
7676
)
7777
_args_schema.resource_group = AAZResourceGroupNameArg(

src/neon/azext_neon/aaz/latest/neon/postgres/branch/_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
6060
help="The id of the Neon Project resource.",
6161
required=True,
6262
fmt=AAZStrArgFormat(
63-
pattern="^[a-zA-Z0-9-]{3,24}$",
63+
pattern="^\\S.{0,62}\\S$|^\\S$",
6464
),
6565
)
6666
_args_schema.resource_group = AAZResourceGroupNameArg(

src/neon/azext_neon/aaz/latest/neon/postgres/branch/_show.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
5050
required=True,
5151
id_part="child_name_2",
5252
fmt=AAZStrArgFormat(
53-
pattern="^[a-zA-Z0-9-]{3,24}$",
53+
pattern="^\\S.{0,62}\\S$|^\\S$",
5454
),
5555
)
5656
_args_schema.organization_name = AAZStrArg(
@@ -70,7 +70,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
7070
required=True,
7171
id_part="child_name_1",
7272
fmt=AAZStrArgFormat(
73-
pattern="^[a-zA-Z0-9-]{3,24}$",
73+
pattern="^\\S.{0,62}\\S$|^\\S$",
7474
),
7575
)
7676
_args_schema.resource_group = AAZResourceGroupNameArg(

src/neon/azext_neon/aaz/latest/neon/postgres/branch/_update.py

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
5353
required=True,
5454
id_part="child_name_2",
5555
fmt=AAZStrArgFormat(
56-
pattern="^[a-zA-Z0-9-]{3,24}$",
56+
pattern="^\\S.{0,62}\\S$|^\\S$",
5757
),
5858
)
5959
_args_schema.organization_name = AAZStrArg(
@@ -73,7 +73,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
7373
required=True,
7474
id_part="child_name_1",
7575
fmt=AAZStrArgFormat(
76-
pattern="^[a-zA-Z0-9-]{3,24}$",
76+
pattern="^\\S.{0,62}\\S$|^\\S$",
7777
),
7878
)
7979
_args_schema.resource_group = AAZResourceGroupNameArg(
@@ -259,7 +259,7 @@ def _build_schema_on_200(cls):
259259
return cls._schema_on_200
260260

261261
cls._schema_on_200 = AAZObjectType()
262-
_UpdateHelper._build_schema_branch_read(cls._schema_on_200)
262+
_UpdateHelper._build_schema_models_branch_read(cls._schema_on_200)
263263

264264
return cls._schema_on_200
265265

@@ -378,7 +378,7 @@ def _build_schema_on_200_201(cls):
378378
return cls._schema_on_200_201
379379

380380
cls._schema_on_200_201 = AAZObjectType()
381-
_UpdateHelper._build_schema_branch_read(cls._schema_on_200_201)
381+
_UpdateHelper._build_schema_models_branch_read(cls._schema_on_200_201)
382382

383383
return cls._schema_on_200_201
384384

@@ -423,37 +423,59 @@ def _build_schema_models_attributes_update(cls, _builder):
423423
_builder.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}})
424424
_builder.set_prop("value", AAZStrType, ".value", typ_kwargs={"flags": {"required": True}})
425425

426-
_schema_branch_read = None
426+
_schema_models_attributes_read = None
427+
428+
@classmethod
429+
def _build_schema_models_attributes_read(cls, _schema):
430+
if cls._schema_models_attributes_read is not None:
431+
_schema.name = cls._schema_models_attributes_read.name
432+
_schema.value = cls._schema_models_attributes_read.value
433+
return
434+
435+
cls._schema_models_attributes_read = _schema_models_attributes_read = AAZObjectType()
436+
437+
models_attributes_read = _schema_models_attributes_read
438+
models_attributes_read.name = AAZStrType(
439+
flags={"required": True},
440+
)
441+
models_attributes_read.value = AAZStrType(
442+
flags={"required": True},
443+
)
444+
445+
_schema.name = cls._schema_models_attributes_read.name
446+
_schema.value = cls._schema_models_attributes_read.value
447+
448+
_schema_models_branch_read = None
427449

428450
@classmethod
429-
def _build_schema_branch_read(cls, _schema):
430-
if cls._schema_branch_read is not None:
431-
_schema.id = cls._schema_branch_read.id
432-
_schema.name = cls._schema_branch_read.name
433-
_schema.properties = cls._schema_branch_read.properties
434-
_schema.system_data = cls._schema_branch_read.system_data
435-
_schema.type = cls._schema_branch_read.type
451+
def _build_schema_models_branch_read(cls, _schema):
452+
if cls._schema_models_branch_read is not None:
453+
_schema.id = cls._schema_models_branch_read.id
454+
_schema.name = cls._schema_models_branch_read.name
455+
_schema.properties = cls._schema_models_branch_read.properties
456+
_schema.system_data = cls._schema_models_branch_read.system_data
457+
_schema.type = cls._schema_models_branch_read.type
436458
return
437459

438-
cls._schema_branch_read = _schema_branch_read = AAZObjectType()
460+
cls._schema_models_branch_read = _schema_models_branch_read = AAZObjectType()
439461

440-
branch_read = _schema_branch_read
441-
branch_read.id = AAZStrType(
462+
models_branch_read = _schema_models_branch_read
463+
models_branch_read.id = AAZStrType(
442464
flags={"read_only": True},
443465
)
444-
branch_read.name = AAZStrType(
466+
models_branch_read.name = AAZStrType(
445467
flags={"read_only": True},
446468
)
447-
branch_read.properties = AAZObjectType()
448-
branch_read.system_data = AAZObjectType(
469+
models_branch_read.properties = AAZObjectType()
470+
models_branch_read.system_data = AAZObjectType(
449471
serialized_name="systemData",
450472
flags={"read_only": True},
451473
)
452-
branch_read.type = AAZStrType(
474+
models_branch_read.type = AAZStrType(
453475
flags={"read_only": True},
454476
)
455477

456-
properties = _schema_branch_read.properties
478+
properties = _schema_models_branch_read.properties
457479
properties.attributes = AAZListType()
458480
properties.created_at = AAZStrType(
459481
serialized_name="createdAt",
@@ -486,14 +508,14 @@ def _build_schema_branch_read(cls, _schema):
486508
)
487509
properties.roles = AAZListType()
488510

489-
attributes = _schema_branch_read.properties.attributes
511+
attributes = _schema_models_branch_read.properties.attributes
490512
attributes.Element = AAZObjectType()
491513
cls._build_schema_models_attributes_read(attributes.Element)
492514

493-
databases = _schema_branch_read.properties.databases
515+
databases = _schema_models_branch_read.properties.databases
494516
databases.Element = AAZObjectType()
495517

496-
_element = _schema_branch_read.properties.databases.Element
518+
_element = _schema_models_branch_read.properties.databases.Element
497519
_element.attributes = AAZListType()
498520
_element.branch_id = AAZStrType(
499521
serialized_name="branchId",
@@ -517,14 +539,14 @@ def _build_schema_branch_read(cls, _schema):
517539
flags={"read_only": True},
518540
)
519541

520-
attributes = _schema_branch_read.properties.databases.Element.attributes
542+
attributes = _schema_models_branch_read.properties.databases.Element.attributes
521543
attributes.Element = AAZObjectType()
522544
cls._build_schema_models_attributes_read(attributes.Element)
523545

524-
endpoints = _schema_branch_read.properties.endpoints
546+
endpoints = _schema_models_branch_read.properties.endpoints
525547
endpoints.Element = AAZObjectType()
526548

527-
_element = _schema_branch_read.properties.endpoints.Element
549+
_element = _schema_models_branch_read.properties.endpoints.Element
528550
_element.attributes = AAZListType()
529551
_element.branch_id = AAZStrType(
530552
serialized_name="branchId",
@@ -551,14 +573,14 @@ def _build_schema_branch_read(cls, _schema):
551573
flags={"read_only": True},
552574
)
553575

554-
attributes = _schema_branch_read.properties.endpoints.Element.attributes
576+
attributes = _schema_models_branch_read.properties.endpoints.Element.attributes
555577
attributes.Element = AAZObjectType()
556578
cls._build_schema_models_attributes_read(attributes.Element)
557579

558-
roles = _schema_branch_read.properties.roles
580+
roles = _schema_models_branch_read.properties.roles
559581
roles.Element = AAZObjectType()
560582

561-
_element = _schema_branch_read.properties.roles.Element
583+
_element = _schema_models_branch_read.properties.roles.Element
562584
_element.attributes = AAZListType()
563585
_element.branch_id = AAZStrType(
564586
serialized_name="branchId",
@@ -583,14 +605,14 @@ def _build_schema_branch_read(cls, _schema):
583605
flags={"read_only": True},
584606
)
585607

586-
attributes = _schema_branch_read.properties.roles.Element.attributes
608+
attributes = _schema_models_branch_read.properties.roles.Element.attributes
587609
attributes.Element = AAZObjectType()
588610
cls._build_schema_models_attributes_read(attributes.Element)
589611

590-
permissions = _schema_branch_read.properties.roles.Element.permissions
612+
permissions = _schema_models_branch_read.properties.roles.Element.permissions
591613
permissions.Element = AAZStrType()
592614

593-
system_data = _schema_branch_read.system_data
615+
system_data = _schema_models_branch_read.system_data
594616
system_data.created_at = AAZStrType(
595617
serialized_name="createdAt",
596618
)
@@ -610,33 +632,11 @@ def _build_schema_branch_read(cls, _schema):
610632
serialized_name="lastModifiedByType",
611633
)
612634

613-
_schema.id = cls._schema_branch_read.id
614-
_schema.name = cls._schema_branch_read.name
615-
_schema.properties = cls._schema_branch_read.properties
616-
_schema.system_data = cls._schema_branch_read.system_data
617-
_schema.type = cls._schema_branch_read.type
618-
619-
_schema_models_attributes_read = None
620-
621-
@classmethod
622-
def _build_schema_models_attributes_read(cls, _schema):
623-
if cls._schema_models_attributes_read is not None:
624-
_schema.name = cls._schema_models_attributes_read.name
625-
_schema.value = cls._schema_models_attributes_read.value
626-
return
627-
628-
cls._schema_models_attributes_read = _schema_models_attributes_read = AAZObjectType()
629-
630-
models_attributes_read = _schema_models_attributes_read
631-
models_attributes_read.name = AAZStrType(
632-
flags={"required": True},
633-
)
634-
models_attributes_read.value = AAZStrType(
635-
flags={"required": True},
636-
)
637-
638-
_schema.name = cls._schema_models_attributes_read.name
639-
_schema.value = cls._schema_models_attributes_read.value
635+
_schema.id = cls._schema_models_branch_read.id
636+
_schema.name = cls._schema_models_branch_read.name
637+
_schema.properties = cls._schema_models_branch_read.properties
638+
_schema.system_data = cls._schema_models_branch_read.system_data
639+
_schema.type = cls._schema_models_branch_read.type
640640

641641

642642
__all__ = ["Update"]

src/neon/azext_neon/aaz/latest/neon/postgres/branch/_wait.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
4646
required=True,
4747
id_part="child_name_2",
4848
fmt=AAZStrArgFormat(
49-
pattern="^[a-zA-Z0-9-]{3,24}$",
49+
pattern="^\\S.{0,62}\\S$|^\\S$",
5050
),
5151
)
5252
_args_schema.organization_name = AAZStrArg(
@@ -66,7 +66,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
6666
required=True,
6767
id_part="child_name_1",
6868
fmt=AAZStrArgFormat(
69-
pattern="^[a-zA-Z0-9-]{3,24}$",
69+
pattern="^\\S.{0,62}\\S$|^\\S$",
7070
),
7171
)
7272
_args_schema.resource_group = AAZResourceGroupNameArg(

src/neon/azext_neon/aaz/latest/neon/postgres/neon_database/_list.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
5050
help="The id of the Neon Branch resource",
5151
required=True,
5252
fmt=AAZStrArgFormat(
53-
pattern="^[a-zA-Z0-9-]{3,24}$",
53+
pattern="^\\S.{0,62}\\S$|^\\S$",
5454
),
5555
)
5656
_args_schema.organization_name = AAZStrArg(
@@ -68,7 +68,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
6868
help="The id of the Neon Project resource.",
6969
required=True,
7070
fmt=AAZStrArgFormat(
71-
pattern="^[a-zA-Z0-9-]{3,24}$",
71+
pattern="^\\S.{0,62}\\S$|^\\S$",
7272
),
7373
)
7474
_args_schema.resource_group = AAZResourceGroupNameArg(
@@ -109,7 +109,7 @@ def __call__(self, *args, **kwargs):
109109
@property
110110
def url(self):
111111
return self.client.format_url(
112-
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonDatabases",
112+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neondatabases",
113113
**self.url_parameters
114114
)
115115

src/neon/azext_neon/aaz/latest/neon/postgres/neon_role/_list.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
5050
help="The id of the Neon Branch resource",
5151
required=True,
5252
fmt=AAZStrArgFormat(
53-
pattern="^[a-zA-Z0-9-]{3,24}$",
53+
pattern="^\\S.{0,62}\\S$|^\\S$",
5454
),
5555
)
5656
_args_schema.organization_name = AAZStrArg(
@@ -68,7 +68,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
6868
help="The id of the Neon Project resource.",
6969
required=True,
7070
fmt=AAZStrArgFormat(
71-
pattern="^[a-zA-Z0-9-]{3,24}$",
71+
pattern="^\\S.{0,62}\\S$|^\\S$",
7272
),
7373
)
7474
_args_schema.resource_group = AAZResourceGroupNameArg(
@@ -109,7 +109,7 @@ def __call__(self, *args, **kwargs):
109109
@property
110110
def url(self):
111111
return self.client.format_url(
112-
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonRoles",
112+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonroles",
113113
**self.url_parameters
114114
)
115115

src/neon/azext_neon/aaz/latest/neon/postgres/organization/_create.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313

1414
@register_command(
1515
"neon postgres organization create",
16-
is_preview=True,
1716
)
1817
class Create(AAZCommand):
1918
"""Create a Neon Postgres organization
2019
2120
:example: Create Neon Postgres Organization
2221
az az neon postgres organization create --resource-group sralluri_rg --name Org-cli-test --location "Central US EUAP" --subscription 68a546de-5736-48e8-a69a-5cc636794112 --marketplace-details "{subscription-id:329b25d9-168d-48d5-de4b-28b2324db159,subscription-status:Pending-fullfilment,offer-details:{publisher-id:neon1722366567200,offer-id:neon_serverless_postgres_azure_prod,plan-id:neon_serverless_postgres_azure_prod_free,plan-name:'Free Plan',term-unit:P1M,term-id:gmz7xq9ge3py}}" --user-details "{first-name:User,last-name:Conotoso,email-address:contoso@outlook.com,upn:contoso@outlook.com,phone-number:''}" --company-details "{company-name:'',country:'',business-phone:''}" --partner-organization-properties "{organization-name:Org-cli-test}" --project-properties "{region:'Central US EUAP',pgVersion:17,branch:{branch-name:main,database-name:neondb,role-name:owner_role},project-name:Org-cli-test-project}"
22+
az neon postgres create --resource-group sralluri_rg --name Org-cli-test --location "Central US EUAP" --subscription 68a546de-5736-48e8-a69a-5cc636794112 --marketplace-details "{subscription-id:329b25d9-168d-48d5-de4b-28b2324db159,subscription-status:Pending-fullfilment,offer-details:{publisher-id:neon1722366567200,offer-id:neon_serverless_postgres_azure_prod,plan-id:neon_serverless_postgres_azure_prod_free,plan-name:'Free Plan',term-unit:P1M,term-id:gmz7xq9ge3py}}" --user-details "{first-name:User,last-name:Conotoso,email-address:contoso@outlook.com,upn:contoso@outlook.com,phone-number:''}" --company-details "{company-name:'',country:'',business-phone:''}" --partner-organization-properties "{organization-name:Org-cli-test}" --project-properties "{region:'Central US EUAP',pgVersion:17,branch:{branch-name:main,database-name:neondb,role-name:owner_role},project-name:Org-cli-test-project}"
2323
"""
2424

2525
_aaz_info = {

0 commit comments

Comments
 (0)