Class ResourceGroupResource
- Namespace
- Azure.ResourceManager.Resources
- Assembly
- Azure.ResourceManager.dll
A Class representing a ResourceGroupResource along with the instance operations that can be performed on it.
public class ResourceGroupResource : ArmResource, IJsonModel<ResourceGroupData>, IPersistableModel<ResourceGroupData>
- Inheritance
-
ResourceGroupResource
- Implements
-
IJsonModel<ResourceGroupData>IPersistableModel<ResourceGroupData>
- Inherited Members
Constructors
ResourceGroupResource()
Initializes a new instance of the ResourceGroupResource class for mocking.
protected ResourceGroupResource()
Fields
ResourceType
Gets the resource type for the operations.
public static readonly ResourceType ResourceType
Field Value
- ResourceType
Properties
Data
Gets the data representing this Feature.
public virtual ResourceGroupData Data { get; }
Property Value
Exceptions
- InvalidOperationException
Throws if there is no data loaded in the current instance.
HasData
Gets whether or not the current instance has data.
public virtual bool HasData { get; }
Property Value
Methods
AddTag(string, string, CancellationToken)
Add a tag to the current resource.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
- Operation IdResourceGroups_Get
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual Response<ResourceGroupResource> AddTag(string key, string value, CancellationToken cancellationToken = default)
Parameters
key
stringThe key for the tag.
value
stringThe value for the tag.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Response<ResourceGroupResource>
Exceptions
- ArgumentNullException
key
orvalue
is null.
AddTagAsync(string, string, CancellationToken)
Add a tag to the current resource.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
- Operation IdResourceGroups_Get
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual Task<Response<ResourceGroupResource>> AddTagAsync(string key, string value, CancellationToken cancellationToken = default)
Parameters
key
stringThe key for the tag.
value
stringThe value for the tag.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Task<Response<ResourceGroupResource>>
Exceptions
- ArgumentNullException
key
orvalue
is null.
CreateResourceIdentifier(string, string)
Generate the resource identifier of a ResourceGroupResource instance.
public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName)
Parameters
Returns
- ResourceIdentifier
Delete(WaitUntil, string, CancellationToken)
When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
- Operation IdResourceGroups_Delete
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual ArmOperation Delete(WaitUntil waitUntil, string forceDeletionTypes = null, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
forceDeletionTypes
stringThe resource types you want to force delete. Currently, only the following is supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
DeleteAsync(WaitUntil, string, CancellationToken)
When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
- Operation IdResourceGroups_Delete
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual Task<ArmOperation> DeleteAsync(WaitUntil waitUntil, string forceDeletionTypes = null, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
forceDeletionTypes
stringThe resource types you want to force delete. Currently, only the following is supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
ExportTemplate(WaitUntil, ExportTemplate, CancellationToken)
Captures the specified resource group as a template.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate
- Operation IdResourceGroups_ExportTemplate
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual ArmOperation<ResourceGroupExportResult> ExportTemplate(WaitUntil waitUntil, ExportTemplate exportTemplate, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
exportTemplate
ExportTemplateParameters for exporting the template.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
exportTemplate
is null.
ExportTemplateAsync(WaitUntil, ExportTemplate, CancellationToken)
Captures the specified resource group as a template.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate
- Operation IdResourceGroups_ExportTemplate
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual Task<ArmOperation<ResourceGroupExportResult>> ExportTemplateAsync(WaitUntil waitUntil, ExportTemplate exportTemplate, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
exportTemplate
ExportTemplateParameters for exporting the template.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
exportTemplate
is null.
Get(CancellationToken)
Gets a resource group.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
- Operation IdResourceGroups_Get
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual Response<ResourceGroupResource> Get(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Response<ResourceGroupResource>
GetAsync(CancellationToken)
Gets a resource group.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
- Operation IdResourceGroups_Get
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual Task<Response<ResourceGroupResource>> GetAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Task<Response<ResourceGroupResource>>
GetGenericResources(string, string, int?, CancellationToken)
Get all the resources for a resource group.
public virtual Pageable<GenericResource> GetGenericResources(string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default)
Parameters
filter
stringThe filter to apply on the operation.<br><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.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<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.<br><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.
expand
stringComma-separated list of additional properties to be included in the response. Valid values include
createdTime
,changedTime
andprovisioningState
. For example,$expand=createdTime,changedTime
.top
int?The number of results to return. If null is passed, returns all resources.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Pageable<GenericResource>
A collection of GenericResource that may take multiple service requests to iterate over.
GetGenericResourcesAsync(string, string, int?, CancellationToken)
Get all the resources for a resource group.
public virtual AsyncPageable<GenericResource> GetGenericResourcesAsync(string filter = null, string expand = null, int? top = null, CancellationToken cancellationToken = default)
Parameters
filter
stringThe filter to apply on the operation.<br><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.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<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.<br><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.
expand
stringComma-separated list of additional properties to be included in the response. Valid values include
createdTime
,changedTime
andprovisioningState
. For example,$expand=createdTime,changedTime
.top
int?The number of results to return. If null is passed, returns all resources.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- AsyncPageable<GenericResource>
An async collection of GenericResource that may take multiple service requests to iterate over.
MoveResources(WaitUntil, ResourcesMoveContent, CancellationToken)
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.
- Request Path/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources
- Operation IdResources_MoveResources
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual ArmOperation MoveResources(WaitUntil waitUntil, ResourcesMoveContent content, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
content
ResourcesMoveContentParameters for moving resources.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
content
is null.
MoveResourcesAsync(WaitUntil, ResourcesMoveContent, CancellationToken)
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.
- Request Path/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources
- Operation IdResources_MoveResources
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual Task<ArmOperation> MoveResourcesAsync(WaitUntil waitUntil, ResourcesMoveContent content, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
content
ResourcesMoveContentParameters for moving resources.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
content
is null.
RemoveTag(string, CancellationToken)
Removes a tag by key from the resource.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
- Operation IdResourceGroups_Get
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual Response<ResourceGroupResource> RemoveTag(string key, CancellationToken cancellationToken = default)
Parameters
key
stringThe key for the tag.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Response<ResourceGroupResource>
Exceptions
- ArgumentNullException
key
is null.
RemoveTagAsync(string, CancellationToken)
Removes a tag by key from the resource.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
- Operation IdResourceGroups_Get
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual Task<Response<ResourceGroupResource>> RemoveTagAsync(string key, CancellationToken cancellationToken = default)
Parameters
key
stringThe key for the tag.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Task<Response<ResourceGroupResource>>
Exceptions
- ArgumentNullException
key
is null.
SetTags(IDictionary<string, string>, CancellationToken)
Replace the tags on the resource with the given set.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
- Operation IdResourceGroups_Get
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual Response<ResourceGroupResource> SetTags(IDictionary<string, string> tags, CancellationToken cancellationToken = default)
Parameters
tags
IDictionary<string, string>The set of tags to use as replacement.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Response<ResourceGroupResource>
Exceptions
- ArgumentNullException
tags
is null.
SetTagsAsync(IDictionary<string, string>, CancellationToken)
Replace the tags on the resource with the given set.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
- Operation IdResourceGroups_Get
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual Task<Response<ResourceGroupResource>> SetTagsAsync(IDictionary<string, string> tags, CancellationToken cancellationToken = default)
Parameters
tags
IDictionary<string, string>The set of tags to use as replacement.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Task<Response<ResourceGroupResource>>
Exceptions
- ArgumentNullException
tags
is null.
Update(ResourceGroupPatch, CancellationToken)
Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
- Operation IdResourceGroups_Update
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual Response<ResourceGroupResource> Update(ResourceGroupPatch patch, CancellationToken cancellationToken = default)
Parameters
patch
ResourceGroupPatchParameters supplied to update a resource group.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Response<ResourceGroupResource>
Exceptions
- ArgumentNullException
patch
is null.
UpdateAsync(ResourceGroupPatch, CancellationToken)
Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained.
- Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
- Operation IdResourceGroups_Update
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual Task<Response<ResourceGroupResource>> UpdateAsync(ResourceGroupPatch patch, CancellationToken cancellationToken = default)
Parameters
patch
ResourceGroupPatchParameters supplied to update a resource group.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Task<Response<ResourceGroupResource>>
Exceptions
- ArgumentNullException
patch
is null.
ValidateMoveResources(WaitUntil, ResourcesMoveContent, CancellationToken)
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.
- Request Path/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources
- Operation IdResources_ValidateMoveResources
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual ArmOperation ValidateMoveResources(WaitUntil waitUntil, ResourcesMoveContent content, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
content
ResourcesMoveContentParameters for moving resources.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
content
is null.
ValidateMoveResourcesAsync(WaitUntil, ResourcesMoveContent, CancellationToken)
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.
- Request Path/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources
- Operation IdResources_ValidateMoveResources
- Default Api Version2022-09-01
- ResourceResourceGroupResource
public virtual Task<ArmOperation> ValidateMoveResourcesAsync(WaitUntil waitUntil, ResourcesMoveContent content, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntilAzure.WaitUntil.Completed if the method should wait to return until the long-running operation has completed on the service; Azure.WaitUntil.Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
content
ResourcesMoveContentParameters for moving resources.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
content
is null.