Class GenericResource
- Namespace
- Azure.ResourceManager.Resources
- Assembly
- Azure.ResourceManager.dll
A Class representing a GenericResource along with the instance operations that can be performed on it.
public class GenericResource : ArmResource
- Inheritance
-
GenericResource
- Inherited Members
Constructors
GenericResource()
Initializes a new instance of the GenericResource class for mocking.
protected GenericResource()
Properties
Data
Gets the data representing this Feature.
public virtual GenericResourceData 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.
public virtual Response<GenericResource> AddTag(string key, string value, CancellationToken cancellationToken = default)
Parameters
key
stringThe key for the tag.
value
stringThe value for the tag.
cancellationToken
CancellationTokenA token to allow the caller to cancel the call to the service. The default value is None.
Returns
- Response<GenericResource>
The updated resource with the tag added.
AddTagAsync(string, string, CancellationToken)
Add a tag to the current resource.
public virtual Task<Response<GenericResource>> AddTagAsync(string key, string value, CancellationToken cancellationToken = default)
Parameters
key
stringThe key for the tag.
value
stringThe value for the tag.
cancellationToken
CancellationTokenA token to allow the caller to cancel the call to the service. The default value is None.
Returns
- Task<Response<GenericResource>>
The updated resource with the tag added.
Delete(WaitUntil, CancellationToken)
Deletes a resource by ID.
public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntil"F:Azure.WaitUntil.Completed" if the method should wait to return until the long-running operation has completed on the service; "F: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.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
DeleteAsync(WaitUntil, CancellationToken)
Deletes a resource by ID.
public virtual Task<ArmOperation> DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntil"F:Azure.WaitUntil.Completed" if the method should wait to return until the long-running operation has completed on the service; "F: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.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
Get(CancellationToken)
Gets a resource by ID.
public virtual Response<GenericResource> Get(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Response<GenericResource>
GetAsync(CancellationToken)
Gets a resource by ID.
public virtual Task<Response<GenericResource>> GetAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
- Task<Response<GenericResource>>
RemoveTag(string, CancellationToken)
Removes a tag by key from the resource.
public virtual Response<GenericResource> RemoveTag(string key, CancellationToken cancellationToken = default)
Parameters
key
stringThe key of the tag to remove.
cancellationToken
CancellationTokenA token to allow the caller to cancel the call to the service. The default value is None.
Returns
- Response<GenericResource>
The updated resource with the tag removed.
RemoveTagAsync(string, CancellationToken)
Removes a tag by key from the resource.
public virtual Task<Response<GenericResource>> RemoveTagAsync(string key, CancellationToken cancellationToken = default)
Parameters
key
stringThe key of the tag to remove.
cancellationToken
CancellationTokenA token to allow the caller to cancel the call to the service. The default value is None.
Returns
- Task<Response<GenericResource>>
The updated resource with the tag removed.
SetTags(IDictionary<string, string>, CancellationToken)
Replace the tags on the resource with the given set.
public virtual Response<GenericResource> SetTags(IDictionary<string, string> tags, CancellationToken cancellationToken = default)
Parameters
tags
IDictionary<string, string>The set of tags to use as replacement.
cancellationToken
CancellationTokenA token to allow the caller to cancel the call to the service. The default value is None.
Returns
- Response<GenericResource>
The updated resource with the tags replaced.
SetTagsAsync(IDictionary<string, string>, CancellationToken)
Replace the tags on the resource with the given set.
public virtual Task<Response<GenericResource>> SetTagsAsync(IDictionary<string, string> tags, CancellationToken cancellationToken = default)
Parameters
tags
IDictionary<string, string>The set of tags to use as replacement.
cancellationToken
CancellationTokenA token to allow the caller to cancel the call to the service. The default value is None.
Returns
- Task<Response<GenericResource>>
The updated resource with the tags replaced.
Update(WaitUntil, GenericResourceData, CancellationToken)
Updates a resource by ID.
public virtual ArmOperation<GenericResource> Update(WaitUntil waitUntil, GenericResourceData data, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntil"F:Azure.WaitUntil.Completed" if the method should wait to return until the long-running operation has completed on the service; "F: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.
data
GenericResourceDataUpdate resource parameters.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
data
is null.
UpdateAsync(WaitUntil, GenericResourceData, CancellationToken)
Updates a resource by ID.
public virtual Task<ArmOperation<GenericResource>> UpdateAsync(WaitUntil waitUntil, GenericResourceData data, CancellationToken cancellationToken = default)
Parameters
waitUntil
WaitUntil"F:Azure.WaitUntil.Completed" if the method should wait to return until the long-running operation has completed on the service; "F: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.
data
GenericResourceDataUpdate resource parameters.
cancellationToken
CancellationTokenThe cancellation token to use.
Returns
Exceptions
- ArgumentNullException
data
is null.