Entity.SetLabelsAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
SetLabelsAsync(String, RequestContent, RequestContext) |
[Protocol Method] Set labels to a given entity.
|
SetLabelsAsync(String, IEnumerable<String>, CancellationToken) |
Set labels to a given entity. |
SetLabelsAsync(String, RequestContent, RequestContext)
- Source:
- Entity.cs
[Protocol Method] Set labels to a given entity.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler SetLabelsAsync(String, IEnumerable<String>, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> SetLabelsAsync (string guid, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member SetLabelsAsync : string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.SetLabelsAsync : string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function SetLabelsAsync (guid As String, content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)
Parameters
- guid
- String
The globally unique identifier of the entity.
- content
- RequestContent
The content to send as the body of the request.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
guid
is null.
guid
is an empty string, and was expected to be non-empty.
Service returned a non-success status code.
Examples
This sample shows how to call SetLabelsAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient();
using RequestContent content = null;
Response response = await client.SetLabelsAsync("<guid>", content);
Console.WriteLine(response.Status);
This sample shows how to call SetLabelsAsync with all parameters and request content.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient();
using RequestContent content = RequestContent.Create(new object[]
{
"<body>"
});
Response response = await client.SetLabelsAsync("<guid>", content);
Console.WriteLine(response.Status);
Applies to
SetLabelsAsync(String, IEnumerable<String>, CancellationToken)
- Source:
- Entity.cs
Set labels to a given entity.
public virtual System.Threading.Tasks.Task<Azure.Response> SetLabelsAsync (string guid, System.Collections.Generic.IEnumerable<string> body = default, System.Threading.CancellationToken cancellationToken = default);
abstract member SetLabelsAsync : string * seq<string> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
override this.SetLabelsAsync : string * seq<string> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function SetLabelsAsync (guid As String, Optional body As IEnumerable(Of String) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response)
Parameters
- guid
- String
The globally unique identifier of the entity.
- body
- IEnumerable<String>
set of labels to be set to the entity.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
guid
is null.
guid
is an empty string, and was expected to be non-empty.
Examples
This sample shows how to call SetLabelsAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient();
Response response = await client.SetLabelsAsync("<guid>");
This sample shows how to call SetLabelsAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient();
Response response = await client.SetLabelsAsync("<guid>", body: new string[] { "<body>" });
Applies to
Azure SDK for .NET