Share via


ConfidentialLedgerClient.CreateUserDefinedRoleAsync Method

Definition

[Protocol Method] Creates new roles and their actions

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual System.Threading.Tasks.Task<Azure.Response> CreateUserDefinedRoleAsync(Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateUserDefinedRoleAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.CreateUserDefinedRoleAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function CreateUserDefinedRoleAsync (content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameters

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

content is null.

Service returned a non-success status code.

Examples

This sample shows how to call CreateUserDefinedRoleAsync.

TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);

using RequestContent content = RequestContent.Create(new object[]
{
    new object()
});
Response response = await client.CreateUserDefinedRoleAsync(content);

Console.WriteLine(response.Status);

This sample shows how to call CreateUserDefinedRoleAsync with all request content.

TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);

using RequestContent content = RequestContent.Create(new object[]
{
    new
    {
        roleName = "<roleName>",
        roleActions = new object[]
        {
            "<roleActions>"
        },
    }
});
Response response = await client.CreateUserDefinedRoleAsync(content);

Console.WriteLine(response.Status);

Applies to