Skip to content
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

[AutoPR azure-mgmt-resource] Add Subscriptions Directive to prevent Operations List generation #6021

Draft
wants to merge 1 commit into
base: release/v3
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/resources/azure-mgmt-resource/_meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"autorest": "V2",
"use": "@microsoft.azure/autorest.python@~4.0.71",
"commit": "14d2ddf809ea5c8ce9d6017b5ab1aca96df05643",
"commit": "0eadabcd2f2536eb36df39cb979588c01714e226",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/resources/resource-manager/readme.md --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk [email protected]/autorest.python@~4.0.71 --version=V2",
"readme": "specification/resources/resource-manager/readme.md"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ResourceManagementClientConfiguration(AzureConfiguration):
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: The ID of the target subscription.
:param subscription_id: The Microsoft Azure subscription ID.
:type subscription_id: str
:param str base_url: Service URL
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def _export_template_initial(
url = self.export_template.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1)
}
url = self._client.format_url(url, **path_format_arguments)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def _export_template_initial(
url = self.export_template.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1)
}
url = self._client.format_url(url, **path_format_arguments)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def create_or_update(


def _delete_initial(
self, resource_group_name, force_deletion_resource_types=None, custom_headers=None, raw=False, **operation_config):
self, resource_group_name, force_deletion_types=None, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.delete.metadata['url']
path_format_arguments = {
Expand All @@ -179,8 +179,8 @@ def _delete_initial(

# Construct parameters
query_parameters = {}
if force_deletion_resource_types is not None:
query_parameters['forceDeletionResourceTypes'] = self._serialize.query("force_deletion_resource_types", force_deletion_resource_types, 'str')
if force_deletion_types is not None:
query_parameters['forceDeletionTypes'] = self._serialize.query("force_deletion_types", force_deletion_types, 'str')
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

# Construct headers
Expand All @@ -206,7 +206,7 @@ def _delete_initial(
return client_raw_response

def delete(
self, resource_group_name, force_deletion_resource_types=None, custom_headers=None, raw=False, polling=True, **operation_config):
self, resource_group_name, force_deletion_types=None, custom_headers=None, raw=False, polling=True, **operation_config):
"""Deletes a resource group.

When you delete a resource group, all of its resources are also
Expand All @@ -216,10 +216,10 @@ def delete(
:param resource_group_name: The name of the resource group to delete.
The name is case insensitive.
:type resource_group_name: str
:param force_deletion_resource_types: The resource types you want to
force delete. Currently, only the following is supported:
forceDeletionResourceTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets
:type force_deletion_resource_types: str
:param force_deletion_types: The resource types you want to force
delete. Currently, only the following is supported:
forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets
:type force_deletion_types: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: The poller return type is ClientRawResponse, the
direct response alongside the deserialized response
Expand All @@ -233,7 +233,7 @@ def delete(
"""
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
force_deletion_resource_types=force_deletion_resource_types,
force_deletion_types=force_deletion_types,
custom_headers=custom_headers,
raw=True,
**operation_config
Expand Down Expand Up @@ -394,7 +394,7 @@ def _export_template_initial(
url = self.export_template.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1)
}
url = self._client.format_url(url, **path_format_arguments)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def _export_template_initial(
url = self.export_template.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1)
}
url = self._client.format_url(url, **path_format_arguments)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def create_or_update(


def _delete_initial(
self, resource_group_name, custom_headers=None, raw=False, **operation_config):
self, resource_group_name, force_deletion_types=None, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.delete.metadata['url']
path_format_arguments = {
Expand All @@ -179,6 +179,8 @@ def _delete_initial(

# Construct parameters
query_parameters = {}
if force_deletion_types is not None:
query_parameters['forceDeletionTypes'] = self._serialize.query("force_deletion_types", force_deletion_types, 'str')
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

# Construct headers
Expand All @@ -204,7 +206,7 @@ def _delete_initial(
return client_raw_response

def delete(
self, resource_group_name, custom_headers=None, raw=False, polling=True, **operation_config):
self, resource_group_name, force_deletion_types=None, custom_headers=None, raw=False, polling=True, **operation_config):
"""Deletes a resource group.

When you delete a resource group, all of its resources are also
Expand All @@ -214,6 +216,10 @@ def delete(
:param resource_group_name: The name of the resource group to delete.
The name is case insensitive.
:type resource_group_name: str
:param force_deletion_types: The resource types you want to force
delete. Currently, only the following is supported:
forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets
:type force_deletion_types: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: The poller return type is ClientRawResponse, the
direct response alongside the deserialized response
Expand All @@ -227,6 +233,7 @@ def delete(
"""
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
force_deletion_types=force_deletion_types,
custom_headers=custom_headers,
raw=True,
**operation_config
Expand Down Expand Up @@ -387,7 +394,7 @@ def _export_template_initial(
url = self.export_template.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1)
}
url = self._client.format_url(url, **path_format_arguments)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ResourceManagementClientConfiguration(AzureConfiguration):
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: The ID of the target subscription.
:param subscription_id: The Microsoft Azure subscription ID.
:type subscription_id: str
:param str base_url: Service URL
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ResourceManagementClient(SDKClient):
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: The ID of the target subscription.
:param subscription_id: The Microsoft Azure subscription ID.
:type subscription_id: str
:param str base_url: Service URL
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def create_or_update(


def _delete_initial(
self, resource_group_name, custom_headers=None, raw=False, **operation_config):
self, resource_group_name, force_deletion_types=None, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.delete.metadata['url']
path_format_arguments = {
Expand All @@ -179,6 +179,8 @@ def _delete_initial(

# Construct parameters
query_parameters = {}
if force_deletion_types is not None:
query_parameters['forceDeletionTypes'] = self._serialize.query("force_deletion_types", force_deletion_types, 'str')
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

# Construct headers
Expand All @@ -204,7 +206,7 @@ def _delete_initial(
return client_raw_response

def delete(
self, resource_group_name, custom_headers=None, raw=False, polling=True, **operation_config):
self, resource_group_name, force_deletion_types=None, custom_headers=None, raw=False, polling=True, **operation_config):
"""Deletes a resource group.

When you delete a resource group, all of its resources are also
Expand All @@ -214,6 +216,10 @@ def delete(
:param resource_group_name: The name of the resource group to delete.
The name is case insensitive.
:type resource_group_name: str
:param force_deletion_types: The resource types you want to force
delete. Currently, only the following is supported:
forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets
:type force_deletion_types: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: The poller return type is ClientRawResponse, the
direct response alongside the deserialized response
Expand All @@ -227,6 +233,7 @@ def delete(
"""
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
force_deletion_types=force_deletion_types,
custom_headers=custom_headers,
raw=True,
**operation_config
Expand Down Expand Up @@ -387,7 +394,7 @@ def _export_template_initial(
url = self.export_template.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1)
}
url = self._client.format_url(url, **path_format_arguments)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,15 @@ def move_resources(
self, source_resource_group_name, resources=None, target_resource_group=None, custom_headers=None, raw=False, polling=True, **operation_config):
"""Moves resources from one resource group to another resource group.

The resources to move must be in the same source resource group. The
target resource group may be in a different subscription. When moving
resources, both the source group and the target group are locked for
the duration of the operation. Write and delete operations are blocked
on the groups until the move completes. .

:param source_resource_group_name: The name of the resource group
containing the resources to move.
The resources to be moved must be in the same source resource group in
the source subscription being used. The target resource group may be in
a different subscription. When moving resources, both the source group
and the target group are locked for the duration of the operation.
Write and delete operations are blocked on the groups until the move
completes. .

:param source_resource_group_name: The name of the resource group from
the source subscription containing the resources to be moved.
:type source_resource_group_name: str
:param resources: The IDs of the resources.
:type resources: list[str]
Expand Down Expand Up @@ -288,15 +289,17 @@ def validate_move_resources(
another resource group.

This operation checks whether the specified resources can be moved to
the target. The resources to move must be in the same source resource
group. The target resource group may be in a different subscription. If
validation succeeds, it returns HTTP response code 204 (no content). If
validation fails, it returns HTTP response code 409 (Conflict) with an
error message. Retrieve the URL in the Location header value to check
the result of the long-running operation.

:param source_resource_group_name: The name of the resource group
containing the resources to validate for move.
the target. The resources to be moved must be in the same source
resource group in the source subscription being used. The target
resource group may be in a different subscription. If validation
succeeds, it returns HTTP response code 204 (no content). If validation
fails, it returns HTTP response code 409 (Conflict) with an error
message. Retrieve the URL in the Location header value to check the
result of the long-running operation.

:param source_resource_group_name: The name of the resource group from
the source subscription containing the resources to be validated for
move.
:type source_resource_group_name: str
:param resources: The IDs of the resources.
:type resources: list[str]
Expand Down