ResourcesOperations Class

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through

ResourceManagementClient's

<xref:resources> attribute.

Inheritance
builtins.object
ResourcesOperations

Constructor

ResourcesOperations(*args, **kwargs)

Methods

begin_create_or_update

Creates a resource.

begin_create_or_update_by_id

Create a resource by ID.

begin_delete

Deletes a resource.

begin_delete_by_id

Deletes a resource by ID.

begin_move_resources

Moves resources from one resource group to another resource group.

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.

begin_update

Updates a resource.

begin_update_by_id

Updates a resource by ID.

begin_validate_move_resources

Validates whether resources can be moved from one resource group to another resource group.

This operation checks whether the specified resources can be moved to 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.

check_existence

Checks whether a resource exists.

check_existence_by_id

Checks by ID whether a resource exists. This API currently works only for a limited set of Resource providers. In the event that a Resource provider does not implement this API, ARM will respond with a 405. The alternative then is to use the GET API to check for the existence of the resource.

get

Gets a resource.

get_by_id

Gets a resource by ID.

list

Get all the resources in a subscription.

list_by_resource_group

Get all the resources for a resource group.

begin_create_or_update

Creates a resource.

begin_create_or_update(resource_group_name: str, resource_provider_namespace: str, parent_resource_path: str, resource_type: str, resource_name: str, api_version: str, parameters: _models.GenericResource, *, content_type: str = 'application/json', **kwargs: Any) -> LROPoller[_models.GenericResource]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group for the resource. The name is case insensitive. Required.

resource_provider_namespace
Required
str

The namespace of the resource provider. Required.

parent_resource_path
Required
str

The parent resource identity. Required.

resource_type
Required
str

The resource type of the resource to create. Required.

resource_name
Required
str

The name of the resource to create. Required.

api_version
Required
str

The API version to use for the operation. Required.

parameters
Required

Parameters for creating or updating the resource. Is either a GenericResource type or a IO[bytes] type. Required.

Returns

Type Description

An instance of LROPoller that returns either GenericResource or the result of cls(response)

Exceptions

Type Description

begin_create_or_update_by_id

Create a resource by ID.

begin_create_or_update_by_id(resource_id: str, api_version: str, parameters: _models.GenericResource, *, content_type: str = 'application/json', **kwargs: Any) -> LROPoller[_models.GenericResource]

Parameters

Name Description
resource_id
Required
str

The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. Required.

api_version
Required
str

The API version to use for the operation. Required.

parameters
Required

Create or update resource parameters. Is either a GenericResource type or a IO[bytes] type. Required.

Returns

Type Description

An instance of LROPoller that returns either GenericResource or the result of cls(response)

Exceptions

Type Description

begin_delete

Deletes a resource.

begin_delete(resource_group_name: str, resource_provider_namespace: str, parent_resource_path: str, resource_type: str, resource_name: str, api_version: str, **kwargs: Any) -> LROPoller[None]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource to delete. The name is case insensitive. Required.

resource_provider_namespace
Required
str

The namespace of the resource provider. Required.

parent_resource_path
Required
str

The parent resource identity. Required.

resource_type
Required
str

The resource type. Required.

resource_name
Required
str

The name of the resource to delete. Required.

api_version
Required
str

The API version to use for the operation. Required.

Returns

Type Description

An instance of LROPoller that returns either None or the result of cls(response)

Exceptions

Type Description

begin_delete_by_id

Deletes a resource by ID.

begin_delete_by_id(resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]

Parameters

Name Description
resource_id
Required
str

The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. Required.

api_version
Required
str

The API version to use for the operation. Required.

Returns

Type Description

An instance of LROPoller that returns either None or the result of cls(response)

Exceptions

Type Description

begin_move_resources

Moves resources from one resource group to another resource group.

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.

begin_move_resources(source_resource_group_name: str, parameters: _models.ResourcesMoveInfo, *, content_type: str = 'application/json', **kwargs: Any) -> LROPoller[None]

Parameters

Name Description
source_resource_group_name
Required
str

The name of the resource group from the source subscription containing the resources to be moved. Required.

parameters
Required

Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO[bytes] type. Required.

Returns

Type Description

An instance of LROPoller that returns either None or the result of cls(response)

Exceptions

Type Description

begin_update

Updates a resource.

begin_update(resource_group_name: str, resource_provider_namespace: str, parent_resource_path: str, resource_type: str, resource_name: str, api_version: str, parameters: _models.GenericResource, *, content_type: str = 'application/json', **kwargs: Any) -> LROPoller[_models.GenericResource]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group for the resource. The name is case insensitive. Required.

resource_provider_namespace
Required
str

The namespace of the resource provider. Required.

parent_resource_path
Required
str

The parent resource identity. Required.

resource_type
Required
str

The resource type of the resource to update. Required.

resource_name
Required
str

The name of the resource to update. Required.

api_version
Required
str

The API version to use for the operation. Required.

parameters
Required

Parameters for updating the resource. Is either a GenericResource type or a IO[bytes] type. Required.

Returns

Type Description

An instance of LROPoller that returns either GenericResource or the result of cls(response)

Exceptions

Type Description

begin_update_by_id

Updates a resource by ID.

begin_update_by_id(resource_id: str, api_version: str, parameters: _models.GenericResource, *, content_type: str = 'application/json', **kwargs: Any) -> LROPoller[_models.GenericResource]

Parameters

Name Description
resource_id
Required
str

The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. Required.

api_version
Required
str

The API version to use for the operation. Required.

parameters
Required

Update resource parameters. Is either a GenericResource type or a IO[bytes] type. Required.

Returns

Type Description

An instance of LROPoller that returns either GenericResource or the result of cls(response)

Exceptions

Type Description

begin_validate_move_resources

Validates whether resources can be moved from one resource group to another resource group.

This operation checks whether the specified resources can be moved to 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.

begin_validate_move_resources(source_resource_group_name: str, parameters: _models.ResourcesMoveInfo, *, content_type: str = 'application/json', **kwargs: Any) -> LROPoller[None]

Parameters

Name Description
source_resource_group_name
Required
str

The name of the resource group from the source subscription containing the resources to be validated for move. Required.

parameters
Required

Parameters for moving resources. Is either a ResourcesMoveInfo type or a IO[bytes] type. Required.

Returns

Type Description

An instance of LROPoller that returns either None or the result of cls(response)

Exceptions

Type Description

check_existence

Checks whether a resource exists.

check_existence(resource_group_name: str, resource_provider_namespace: str, parent_resource_path: str, resource_type: str, resource_name: str, api_version: str, **kwargs: Any) -> bool

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group containing the resource to check. The name is case insensitive. Required.

resource_provider_namespace
Required
str

The resource provider of the resource to check. Required.

parent_resource_path
Required
str

The parent resource identity. Required.

resource_type
Required
str

The resource type. Required.

resource_name
Required
str

The name of the resource to check whether it exists. Required.

api_version
Required
str

The API version to use for the operation. Required.

Returns

Type Description

bool or the result of cls(response)

Exceptions

Type Description

check_existence_by_id

Checks by ID whether a resource exists. This API currently works only for a limited set of Resource providers. In the event that a Resource provider does not implement this API, ARM will respond with a 405. The alternative then is to use the GET API to check for the existence of the resource.

check_existence_by_id(resource_id: str, api_version: str, **kwargs: Any) -> bool

Parameters

Name Description
resource_id
Required
str

The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. Required.

api_version
Required
str

The API version to use for the operation. Required.

Returns

Type Description

bool or the result of cls(response)

Exceptions

Type Description

get

Gets a resource.

get(resource_group_name: str, resource_provider_namespace: str, parent_resource_path: str, resource_type: str, resource_name: str, api_version: str, **kwargs: Any) -> GenericResource

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group containing the resource to get. The name is case insensitive. Required.

resource_provider_namespace
Required
str

The namespace of the resource provider. Required.

parent_resource_path
Required
str

The parent resource identity. Required.

resource_type
Required
str

The resource type of the resource. Required.

resource_name
Required
str

The name of the resource to get. Required.

api_version
Required
str

The API version to use for the operation. Required.

Returns

Type Description

GenericResource or the result of cls(response)

Exceptions

Type Description

get_by_id

Gets a resource by ID.

get_by_id(resource_id: str, api_version: str, **kwargs: Any) -> GenericResource

Parameters

Name Description
resource_id
Required
str

The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. Required.

api_version
Required
str

The API version to use for the operation. Required.

Returns

Type Description

GenericResource or the result of cls(response)

Exceptions

Type Description

list

Get all the resources in a subscription.

list(filter: str | None = None, expand: str | None = None, top: int | None = None, **kwargs: Any) -> Iterable[GenericResourceExpanded]

Parameters

Name Description
filter
Required
str

The filter to apply on the operation.:code:
<br>Filter comparison operators include eq (equals) and ne (not equals) and may be used with the following properties: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.:code:
<br>For example, to filter by a resource type, use $filter=resourceType eq 'Microsoft.Network/virtualNetworks'```<br>
<br>substringof(value, property)can be used to filter for substrings of the following currently-supported properties:nameandresourceGroup<br>
For example, to get all resources with 'demo' anywhere in the resource name, use ``$filter=substringof('demo', name)```<br>``<br>Multiple substring operations can also be combined using and/or operators.:code:
<br>Note that any truncated number of results queried via $top may also not be compatible when using a filter.:code:
<br>``<br>Resources can be filtered by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. Note that when resources are filtered by tag name and value, <b>the original tags for each resource will not be returned in the results.</b> Any list of additional properties queried via $expand may also not be compatible when filtering by tag names/values. <br>``<br>For tag names only, resources can be filtered by prefix using the following syntax: $filter=startswith(tagName, 'depart'). This query will return all resources with a tag name prefixed by the phrase depart (i.e.department, departureDate, departureTime, etc.):code:
<br>``<br>Note that some properties can be combined when filtering resources, which include the following: substringof() and/or resourceType, plan and plan/publisher and plan/name, and identity and identity/principalId. Default value is None.

expand
Required
str

Comma-separated list of additional properties to be included in the response. Valid values include createdTime, changedTime and provisioningState. For example, $expand=createdTime,changedTime. Default value is None.

top
Required
int

The number of recommendations per page if a paged version of this API is being used. Default value is None.

Returns

Type Description

An iterator like instance of either GenericResourceExpanded or the result of cls(response)

Exceptions

Type Description

list_by_resource_group

Get all the resources for a resource group.

list_by_resource_group(resource_group_name: str, filter: str | None = None, expand: str | None = None, top: int | None = None, **kwargs: Any) -> Iterable[GenericResourceExpanded]

Parameters

Name Description
resource_group_name
Required
str

The resource group with the resources to get. Required.

filter
Required
str

The filter to apply on the operation.:code:
<br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.:code:<br>``<br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks':code:<br>``<br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.:code:<br>``<br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name):code:<br>``<br>You can link more than one substringof together by adding and/or operators.:code:<br>``<br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.:code:<br>:code:>><<<br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. Default value is None.

expand
Required
str

Comma-separated list of additional properties to be included in the response. Valid values include createdTime, changedTime and provisioningState. For example, $expand=createdTime,changedTime. Default value is None.

top
Required
int

The number of results to return. If null is passed, returns all resources. Default value is None.

Returns

Type Description

An iterator like instance of either GenericResourceExpanded or the result of cls(response)

Exceptions

Type Description

Attributes

models

models = <module 'azure.mgmt.resource.resources.v2022_09_01.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.11.9\\x64\\Lib\\site-packages\\azure\\mgmt\\resource\\resources\\v2022_09_01\\models\\__init__.py'>