Skip to content

Commit 84dbe1f

Browse files
alluri02Srinivas Alluri
andauthored
Neon CLI Support for GA Features - Change Plan, Projects and Branches (#8679)
* added project cli commands for preview version * added support for projects, branches and changeplan features * updated examples in the read me * added examples for the update branch and project * updated the release history file * update the branch parameters * addressed comments and added scenario tests * removed the update commands for Project and Branches * fix integration test issue * mask the test subscription in scenario tests --------- Co-authored-by: Srinivas Alluri <sralluri@microsoft.com>
1 parent 44d0215 commit 84dbe1f

Some content is hidden

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

43 files changed

+11446
-276
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- @azure Rule - Use Azure Best Practices: When generating code for Azure, running terminal commands for Azure, or performing operations related to Azure, invoke your `azure_development-get_best_practices` tool if available.

src/neon/HISTORY.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ Release History
99

1010
1.0.0b2
1111
++++++
12-
* Updated command descriptions.
12+
* Updated command descriptions.
13+
14+
1.0.0b3
15+
++++++
16+
* GA release of Neon CLI. Supports Change Plan, Project, Branches and Database Connection commands.

src/neon/README.md

Lines changed: 93 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,136 @@
1-
21
# Azure CLI Neon Extension #
2+
33
This is an extension to Azure CLI to manage Neon Postgres resources.
44

55
## How to use ##
6-
#### Install the extension ####
6+
7+
### Install the extension ###
8+
79
Install this extension using the below CLI command:
810
```
911
az extension add --name neon
1012
```
1113

12-
#### Check the version ####
14+
### Check the version ###
15+
1316
```
1417
az extension show --name neon --query version
1518
```
1619

17-
#### Connect to Azure subscription ####
20+
### Connect to Azure subscription ###
21+
1822
```
1923
az login
2024
az account set -s {subs_id}
2125
```
2226

23-
#### Create a resource group (or use an existing one) ####
27+
### Create a resource group (or use an existing one) ###
28+
2429
```
2530
az group create -n demoResourceGroup -l eastus
2631
```
2732

2833
## Available Commands ##
2934

30-
### Create a Neon Postgres Instance ###
35+
### Organization Commands ###
36+
37+
#### Create a Neon Postgres Organization ####
38+
3139
```
32-
az neon postgres create --resource-group {resource_group} --name {resource_name} --user-details '{"first-name": "{user_first_name}", "last-name": "{user_last_name}", "email-address": "{user_email}", "upn": "{user_upn}", "phone-number": "{user_phone}"}' --company-details '{"company-name": "{company_name}", "office-address": "{office_address}", "country": "{country}", "domain": "{domain}", "number-of-employees": {number_of_employee}}' --partner-organization-properties '{"organization-id": "{org_id}", "org-name": "{partner_org_name}", "single-sign-on-properties": {"single-sign-on-state": "{sso_state}", "enterprise-app-id": "{app_id}", "single-sign-on-url": "{sso_url}", "aad-domains": ["{domain}"]}}' --tags "{key:value}" --location {location}
40+
az neon postgres organization create --resource-group {resource_group} --name {resource_name} --user-details '{{"first-name": "{user_first_name}", "last-name": "{user_last_name}", "email-address": "{user_email}", "upn": "{user_upn}", "phone-number": "{user_phone}"}}' --marketplace-details '{{"subscription-id": "{subscription_id}", "subscription-status": "{subscription_status}", "offer-details": {{"publisher-id": "{publisher_id}", "offer-id": "{offer_id}", "plan-id": "{plan_id}", "plan-name": "{plan_name}", "term-unit": "{term_unit}", "term-id": "{term_id}"}}}}' --company-details '{{"company-name": "{company_name}", "office-address": "{office_address}", "country": "{country}", "domain": "{domain}", "number-of-employees": {number_of_employee}}}' --partner-organization-properties '{{"organization-id": "{org_id}", "org-name": "{partner_org_name}", "single-sign-on-properties": {{"single-sign-on-state": "{sso_state}", "enterprise-app-id": "{app_id}", "single-sign-on-url": "{sso_url}", "aad-domains": ["{domain}"]}}}}' --tags "{key:value}" --location {location}
3341
```
3442

35-
### Show a Neon Postgres Organization ###
43+
#### Show a Neon Postgres Organization ####
44+
3645
```
3746
az neon postgres organization show --resource-group {resource_group} --name {resource_name}
3847
```
3948

40-
### Delete a Neon Postgres Organization ###
49+
#### Delete a Neon Postgres Organization ####
50+
4151
```
4252
az neon postgres organization delete --resource-group {resource_group} --name {resource_name}
4353
```
4454

45-
### List Neon resources by subscription ID ###
55+
#### List Neon Organizations by Subscription ####
56+
4657
```
4758
az neon postgres organization list --subscription {subscription_id} --resource-group {resource_group}
4859
```
4960

50-
### Update a Neon Postgres Organization (without location and marketplace details) ###
61+
#### Update a Neon Postgres Organization ####
62+
63+
```
64+
az neon postgres organization create --resource-group {resource_group} --name {resource_name} --user-details '{{"first-name": "{user_first_name}", "last-name": "{user_last_name}", "email-address": "{user_email}", "upn": "{user_upn}", "phone-number": "{user_phone}"}}' --marketplace-details '{{"subscription-id": "{subscription_id}", "subscription-status": "{subscription_status}", "offer-details": {{"publisher-id": "{publisher_id}", "offer-id": "{offer_id}", "plan-id": "{plan_id}", "plan-name": "{plan_name}", "term-unit": "{term_unit}", "term-id": "{term_id}"}}}}' --company-details '{{"company-name": "{company_name}", "office-address": "{office_address}", "country": "{country}", "domain": "{domain}", "number-of-employees": {number_of_employee}}}' --partner-organization-properties '{{"organization-id": "{org_id}", "org-name": "{partner_org_name}", "single-sign-on-properties": {{"single-sign-on-state": "{sso_state}", "enterprise-app-id": "{app_id}", "single-sign-on-url": "{sso_url}", "aad-domains": ["{domain}"]}}}}' --tags "{key:value}" --location {location}
65+
```
66+
67+
### Project Commands ###
68+
69+
#### Create a Neon Postgres Project with in an Organization ####
70+
71+
```
72+
az neon postgres project create --resource-group {resource_group} --organization-name {organization_name} --name {project_name} --region {region} --pg-version {pg_version} --branch '{{"branch-name": "{banch_name}", "database-name": "{database_name}", "role-name": "{reole_name}""}}'
73+
```
74+
75+
#### Show a Neon Postgres Project in an Organization ####
76+
77+
```
78+
az neon postgres project show --resource-group {resource_group} --organization-name {organization_name} --project-id {project_id}
79+
```
80+
81+
#### List Neon Postgres Projects under an Organization ####
82+
83+
```
84+
az neon postgres project list --resource-group {resource_group} --organization-name {organization_name}
85+
```
86+
87+
#### Delete a Neon Postgres Project in an Organization ####
88+
89+
```
90+
az neon postgres project delete --resource-group {resource_group} --organization-name {organization_name} --project-id {project_id}
91+
```
92+
93+
### Branch Commands ###
94+
95+
#### Create a Branch in a Neon Postgres Project ####
96+
97+
```
98+
az neon postgres branch create --resource-group {resource_group} --organization-name {organization_name} --project-name {project_id} --project-id {project_id} --branch-name {branch_name} --role-name {role_name} --database-name {database_name}
99+
```
100+
101+
#### Show a Branch in a Neon Postgres Project ####
102+
103+
```
104+
az neon postgres branch show --resource-group {resource_group} --organization-name {organization_name} --project-id {project_id} --branch-id {branch_id}
105+
```
106+
107+
#### List Branches in a Neon Postgres Project ####
108+
109+
```
110+
az neon postgres branch list --resource-group {resource_group} --organization-name {organization_name} --project-id {project_id}
51111
```
52-
az neon postgres organization update --resource-group {resource_group} --name {resource_name} --user-details '{"first-name": "{user_first_name}", "last-name": "{user_last_name}", "email-address": "{user_email}", "upn": "{user_upn}", "phone-number": "{user_phone}"}' --company-details '{"company-name": "{company_name}", "office-address": "{office_address}", "country": "{country}", "domain": "{domain}", "number-of-employees": {number_of_employee}}' --partner-organization-properties '{"organization-id": "{org_id}", "org-name": "{partner_org_name}", "single-sign-on-properties": {"single-sign-on-state": "{sso_state}", "enterprise-app-id": "{app_id}", "single-sign-on-url": "{sso_url}", "aad-domains": ["{domain}"]}}' --tags "{key:value}"
112+
113+
#### Delete a Branch in a Neon Postgres Project ####
114+
115+
```
116+
az neon postgres branch delete --resource-group {resource_group} --organization-name {organization_name} --project-id {project_id} --branch-id {branch_id}
117+
```
118+
119+
### Neon Database Commands ###
120+
121+
#### List Databases in a Neon Postgres Branch ####
122+
123+
```
124+
az neon postgres database list --resource-group {resource_group} --organization-name {organization_name} --project-id {project_id} --branch-id {branch_id}
125+
```
126+
127+
### Neon Role Commands ###
128+
129+
#### List Roles in a Neon Postgres Branch ####
130+
131+
```
132+
az neon postgres neon-role list --resource-group {resource_group} --organization-name {organization_name} --project-id {project_id} --branch-id {branch_id}
133+
53134
```
54135

55136
If you have issues, please give feedback by opening an issue at https://github.com/Azure/azure-cli-extensions/issues.

src/neon/azext_neon/aaz/latest/neon/__cmd_group.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
@register_command_group(
1515
"neon",
16-
is_preview=True,
1716
)
1817
class __CMDGroup(AAZCommandGroup):
1918
"""Manage Neon Postgres

src/neon/azext_neon/aaz/latest/neon/postgres/__cmd_group.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
@register_command_group(
1515
"neon postgres",
16-
is_preview=True,
1716
)
1817
class __CMDGroup(AAZCommandGroup):
1918
"""Manage Neon Postgres

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
from azure.cli.core.aaz import *
1212

1313

14-
@register_command(
15-
"neon postgres create",
16-
is_preview=True,
17-
)
1814
class Create(AAZCommand):
1915
"""Create a Neon organization
2016
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
"neon postgres branch",
16+
)
17+
class __CMDGroup(AAZCommandGroup):
18+
"""Manage Branch
19+
"""
20+
pass
21+
22+
23+
__all__ = ["__CMDGroup"]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 ._create import *
13+
from ._delete import *
14+
from ._list import *
15+
from ._show import *
16+
from ._update import *
17+
from ._wait import *

0 commit comments

Comments
 (0)