Table of Contents

Class ResourceGroupCollection

Namespace
Azure.ResourceManager.Resources
Assembly
Azure.ResourceManager.dll

A class representing collection of ResourceGroupResource and their operations over its parent.

public class ResourceGroupCollection : ArmCollection, IEnumerable<ResourceGroupResource>, IEnumerable, IAsyncEnumerable<ResourceGroupResource>
Inheritance
ResourceGroupCollection
Implements
IAsyncEnumerable<ResourceGroupResource>
Inherited Members

Constructors

ResourceGroupCollection()

Initializes a new instance of the ResourceGroupCollection class for mocking.

protected ResourceGroupCollection()

Methods

CreateOrUpdate(WaitUntil, string, ResourceGroupData, CancellationToken)

Creates or updates a resource group.

  • Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
  • Operation IdResourceGroups_CreateOrUpdate
  • Default Api Version2022-09-01
  • ResourceResourceGroupResource
public virtual ArmOperation<ResourceGroupResource> CreateOrUpdate(WaitUntil waitUntil, string resourceGroupName, ResourceGroupData data, CancellationToken cancellationToken = default)

Parameters

waitUntil WaitUntil

Azure.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.

resourceGroupName string

The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters.

data ResourceGroupData

Parameters supplied to the create or update a resource group.

cancellationToken CancellationToken

The cancellation token to use.

Returns

ArmOperation<ResourceGroupResource>

Exceptions

ArgumentException

resourceGroupName is an empty string, and was expected to be non-empty.

ArgumentNullException

resourceGroupName or data is null.

CreateOrUpdateAsync(WaitUntil, string, ResourceGroupData, CancellationToken)

Creates or updates a resource group.

  • Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
  • Operation IdResourceGroups_CreateOrUpdate
  • Default Api Version2022-09-01
  • ResourceResourceGroupResource
public virtual Task<ArmOperation<ResourceGroupResource>> CreateOrUpdateAsync(WaitUntil waitUntil, string resourceGroupName, ResourceGroupData data, CancellationToken cancellationToken = default)

Parameters

waitUntil WaitUntil

Azure.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.

resourceGroupName string

The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters.

data ResourceGroupData

Parameters supplied to the create or update a resource group.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<ArmOperation<ResourceGroupResource>>

Exceptions

ArgumentException

resourceGroupName is an empty string, and was expected to be non-empty.

ArgumentNullException

resourceGroupName or data is null.

Exists(string, CancellationToken)

Checks to see if the resource exists in azure.

  • Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
  • Operation IdResourceGroups_Get
  • Default Api Version2022-09-01
  • ResourceResourceGroupResource
public virtual Response<bool> Exists(string resourceGroupName, CancellationToken cancellationToken = default)

Parameters

resourceGroupName string

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

cancellationToken CancellationToken

The cancellation token to use.

Returns

Response<bool>

Exceptions

ArgumentException

resourceGroupName is an empty string, and was expected to be non-empty.

ArgumentNullException

resourceGroupName is null.

ExistsAsync(string, CancellationToken)

Checks to see if the resource exists in azure.

  • Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
  • Operation IdResourceGroups_Get
  • Default Api Version2022-09-01
  • ResourceResourceGroupResource
public virtual Task<Response<bool>> ExistsAsync(string resourceGroupName, CancellationToken cancellationToken = default)

Parameters

resourceGroupName string

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

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<Response<bool>>

Exceptions

ArgumentException

resourceGroupName is an empty string, and was expected to be non-empty.

ArgumentNullException

resourceGroupName is null.

Get(string, 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(string resourceGroupName, CancellationToken cancellationToken = default)

Parameters

resourceGroupName string

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

cancellationToken CancellationToken

The cancellation token to use.

Returns

Response<ResourceGroupResource>

Exceptions

ArgumentException

resourceGroupName is an empty string, and was expected to be non-empty.

ArgumentNullException

resourceGroupName is null.

GetAll(string, int?, CancellationToken)

Gets all the resource groups for a subscription.

  • Request Path/subscriptions/{subscriptionId}/resourcegroups
  • Operation IdResourceGroups_List
  • Default Api Version2022-09-01
  • ResourceResourceGroupResource
public virtual Pageable<ResourceGroupResource> GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default)

Parameters

filter string

The filter to apply on the operation.<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'.

top int?

The number of results to return. If null is passed, returns all resource groups.

cancellationToken CancellationToken

The cancellation token to use.

Returns

Pageable<ResourceGroupResource>

A collection of ResourceGroupResource that may take multiple service requests to iterate over.

GetAllAsync(string, int?, CancellationToken)

Gets all the resource groups for a subscription.

  • Request Path/subscriptions/{subscriptionId}/resourcegroups
  • Operation IdResourceGroups_List
  • Default Api Version2022-09-01
  • ResourceResourceGroupResource
public virtual AsyncPageable<ResourceGroupResource> GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default)

Parameters

filter string

The filter to apply on the operation.<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'.

top int?

The number of results to return. If null is passed, returns all resource groups.

cancellationToken CancellationToken

The cancellation token to use.

Returns

AsyncPageable<ResourceGroupResource>

An async collection of ResourceGroupResource that may take multiple service requests to iterate over.

GetAsync(string, 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(string resourceGroupName, CancellationToken cancellationToken = default)

Parameters

resourceGroupName string

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

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<Response<ResourceGroupResource>>

Exceptions

ArgumentException

resourceGroupName is an empty string, and was expected to be non-empty.

ArgumentNullException

resourceGroupName is null.

GetIfExists(string, CancellationToken)

Tries to get details for this resource from the service.

  • Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
  • Operation IdResourceGroups_Get
  • Default Api Version2022-09-01
  • ResourceResourceGroupResource
public virtual NullableResponse<ResourceGroupResource> GetIfExists(string resourceGroupName, CancellationToken cancellationToken = default)

Parameters

resourceGroupName string

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

cancellationToken CancellationToken

The cancellation token to use.

Returns

NullableResponse<ResourceGroupResource>

Exceptions

ArgumentException

resourceGroupName is an empty string, and was expected to be non-empty.

ArgumentNullException

resourceGroupName is null.

GetIfExistsAsync(string, CancellationToken)

Tries to get details for this resource from the service.

  • Request Path/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}
  • Operation IdResourceGroups_Get
  • Default Api Version2022-09-01
  • ResourceResourceGroupResource
public virtual Task<NullableResponse<ResourceGroupResource>> GetIfExistsAsync(string resourceGroupName, CancellationToken cancellationToken = default)

Parameters

resourceGroupName string

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

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task<NullableResponse<ResourceGroupResource>>

Exceptions

ArgumentException

resourceGroupName is an empty string, and was expected to be non-empty.

ArgumentNullException

resourceGroupName is null.