-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[SQL] az sql server create/update: Add --enable-public-network to support PublicNetworkAccess #12382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SQL] az sql server create/update: Add --enable-public-network to support PublicNetworkAccess #12382
Changes from 7 commits
5d752a9
9c0c2c7
0e8a1e5
67e14af
5f7020a
edae27d
de7d89c
ed08b39
cf0ec55
33e6acb
835d9dc
7402c18
b11fbb0
99f273f
3d1aab3
2640f91
4178389
b1c319e
7e39fb9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,7 +37,8 @@ | |
| ManagedInstancePairInfo, | ||
| PartnerRegionInfo, | ||
| InstanceFailoverGroupReadOnlyEndpoint, | ||
| InstanceFailoverGroupReadWriteEndpoint | ||
| InstanceFailoverGroupReadWriteEndpoint, | ||
| ServerPublicNetworkAccess | ||
| ) | ||
|
|
||
| from knack.log import get_logger | ||
|
|
@@ -1909,6 +1910,7 @@ def server_create( | |
| server_name, | ||
| assign_identity=False, | ||
| no_wait=False, | ||
| enable_public_network=None, | ||
| **kwargs): | ||
| ''' | ||
| Creates a server. | ||
|
|
@@ -1917,6 +1919,12 @@ def server_create( | |
| if assign_identity: | ||
| kwargs['identity'] = ResourceIdentity(type=IdentityType.system_assigned.value) | ||
|
|
||
| if enable_public_network is not None: | ||
| if enable_public_network: | ||
| kwargs['public_network_access'] = ServerPublicNetworkAccess.enabled | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similar below
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, |
||
| else: | ||
| kwargs['public_network_access'] = ServerPublicNetworkAccess.disabled | ||
|
|
||
| # Create | ||
| return sdk_no_wait(no_wait, client.create_or_update, | ||
| server_name=server_name, | ||
|
|
@@ -1942,7 +1950,8 @@ def server_list( | |
| def server_update( | ||
| instance, | ||
| administrator_login_password=None, | ||
| assign_identity=False): | ||
| assign_identity=False, | ||
| enable_public_network=None): | ||
| ''' | ||
| Updates a server. Custom update function to apply parameters to instance. | ||
| ''' | ||
|
|
@@ -1955,6 +1964,12 @@ def server_update( | |
| instance.administrator_login_password = ( | ||
| administrator_login_password or instance.administrator_login_password) | ||
|
|
||
| if enable_public_network is not None: | ||
| if enable_public_network: | ||
| instance.public_network_access = ServerPublicNetworkAccess.enabled | ||
| else: | ||
| instance.public_network_access = ServerPublicNetworkAccess.disabled | ||
|
|
||
| return instance | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-eshortcut