Class IAMPolicyClient (2.4.0)

public abstract class IAMPolicyClient : object

IAMPolicy client wrapper, for convenient use.

Inheritance

Object > IAMPolicyClient

Derived Types

Namespace

Google.Cloud.Iam.V1

Assembly

Google.Cloud.Iam.V1.dll

Remarks

API Overview

Manages Identity and Access Management (IAM) policies.

Any implementation of an API that offers access control features implements the google.iam.v1.IAMPolicy interface.

Data model

Access control is applied when a principal (user or service account), takes some action on a resource exposed by a service. Resources, identified by URI-like names, are the unit of access control specification. Service implementations can choose the granularity of access control and the supported permissions for their resources. For example one database service may allow access control to be specified only at the Table level, whereas another might allow access control to also be specified at the Column level.

Policy Structure

See google.iam.v1.Policy

This is intentionally not a CRUD style API because access control policies are created and deleted implicitly with the resources to which they are attached.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the IAMPolicy service, which is a host of "iam-meta-api.googleapis.com" and a port of 443.

Property Value
TypeDescription
String

DefaultScopes

public static System.Collections.Generic.IReadOnlyList<string> DefaultScopes { get; }

The default IAMPolicy scopes.

Property Value
TypeDescription
System.Collections.Generic.IReadOnlyList<String>
Remarks

The default IAMPolicy scopes are:

    GrpcClient

    public virtual IAMPolicy.IAMPolicyClient GrpcClient { get; }

    The underlying gRPC IAMPolicy client

    Property Value
    TypeDescription
    IAMPolicy.IAMPolicyClient

    Methods

    Create()

    public static IAMPolicyClient Create()

    Synchronously creates a IAMPolicyClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use IAMPolicyClientBuilder.

    Returns
    TypeDescription
    IAMPolicyClient

    The created IAMPolicyClient.

    CreateAsync(System.Threading.CancellationToken)

    public static System.Threading.Tasks.Task<IAMPolicyClient> CreateAsync(System.Threading.CancellationToken cancellationToken = null)

    Asynchronously creates a IAMPolicyClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use IAMPolicyClientBuilder.

    Parameter
    NameDescription
    cancellationTokenSystem.Threading.CancellationToken

    The to use while creating the client.

    Returns
    TypeDescription
    System.Threading.Tasks.Task<IAMPolicyClient>

    The task representing the created IAMPolicyClient.

    GetIamPolicy(GetIamPolicyRequest, Api.Gax.Grpc.CallSettings)

    public virtual Policy GetIamPolicy(GetIamPolicyRequest request, Api.Gax.Grpc.CallSettings callSettings = null)

    Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

    Parameters
    NameDescription
    requestGetIamPolicyRequest

    The request object containing all of the parameters for the API call.

    callSettingsApi.Gax.Grpc.CallSettings

    If not null, applies overrides to this RPC call.

    Returns
    TypeDescription
    Policy

    The RPC response.

    Example
    // Create client
    IAMPolicyClient iAMPolicyClient = IAMPolicyClient.Create();
    // Initialize request argument(s)
    GetIamPolicyRequest request = new GetIamPolicyRequest
    {
        ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
        Options = new GetPolicyOptions(),
    };
    // Make the request
    Policy response = iAMPolicyClient.GetIamPolicy(request);
    

    GetIamPolicyAsync(GetIamPolicyRequest, Api.Gax.Grpc.CallSettings)

    public virtual System.Threading.Tasks.Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, Api.Gax.Grpc.CallSettings callSettings = null)

    Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

    Parameters
    NameDescription
    requestGetIamPolicyRequest

    The request object containing all of the parameters for the API call.

    callSettingsApi.Gax.Grpc.CallSettings

    If not null, applies overrides to this RPC call.

    Returns
    TypeDescription
    System.Threading.Tasks.Task<Policy>

    A Task containing the RPC response.

    Example
    // Create client
    IAMPolicyClient iAMPolicyClient = await IAMPolicyClient.CreateAsync();
    // Initialize request argument(s)
    GetIamPolicyRequest request = new GetIamPolicyRequest
    {
        ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
        Options = new GetPolicyOptions(),
    };
    // Make the request
    Policy response = await iAMPolicyClient.GetIamPolicyAsync(request);
    

    GetIamPolicyAsync(GetIamPolicyRequest, System.Threading.CancellationToken)

    public virtual System.Threading.Tasks.Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, System.Threading.CancellationToken cancellationToken)

    Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

    Parameters
    NameDescription
    requestGetIamPolicyRequest

    The request object containing all of the parameters for the API call.

    cancellationTokenSystem.Threading.CancellationToken

    A to use for this RPC.

    Returns
    TypeDescription
    System.Threading.Tasks.Task<Policy>

    A Task containing the RPC response.

    Example
    // Create client
    IAMPolicyClient iAMPolicyClient = await IAMPolicyClient.CreateAsync();
    // Initialize request argument(s)
    GetIamPolicyRequest request = new GetIamPolicyRequest
    {
        ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
        Options = new GetPolicyOptions(),
    };
    // Make the request
    Policy response = await iAMPolicyClient.GetIamPolicyAsync(request);
    

    SetIamPolicy(SetIamPolicyRequest, Api.Gax.Grpc.CallSettings)

    public virtual Policy SetIamPolicy(SetIamPolicyRequest request, Api.Gax.Grpc.CallSettings callSettings = null)

    Sets the access control policy on the specified resource. Replaces any existing policy.

    Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.

    Parameters
    NameDescription
    requestSetIamPolicyRequest

    The request object containing all of the parameters for the API call.

    callSettingsApi.Gax.Grpc.CallSettings

    If not null, applies overrides to this RPC call.

    Returns
    TypeDescription
    Policy

    The RPC response.

    Example
    // Create client
    IAMPolicyClient iAMPolicyClient = IAMPolicyClient.Create();
    // Initialize request argument(s)
    SetIamPolicyRequest request = new SetIamPolicyRequest
    {
        ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
        Policy = new Policy(),
        UpdateMask = new FieldMask(),
    };
    // Make the request
    Policy response = iAMPolicyClient.SetIamPolicy(request);
    

    SetIamPolicyAsync(SetIamPolicyRequest, Api.Gax.Grpc.CallSettings)

    public virtual System.Threading.Tasks.Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, Api.Gax.Grpc.CallSettings callSettings = null)

    Sets the access control policy on the specified resource. Replaces any existing policy.

    Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.

    Parameters
    NameDescription
    requestSetIamPolicyRequest

    The request object containing all of the parameters for the API call.

    callSettingsApi.Gax.Grpc.CallSettings

    If not null, applies overrides to this RPC call.

    Returns
    TypeDescription
    System.Threading.Tasks.Task<Policy>

    A Task containing the RPC response.

    Example
    // Create client
    IAMPolicyClient iAMPolicyClient = await IAMPolicyClient.CreateAsync();
    // Initialize request argument(s)
    SetIamPolicyRequest request = new SetIamPolicyRequest
    {
        ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
        Policy = new Policy(),
        UpdateMask = new FieldMask(),
    };
    // Make the request
    Policy response = await iAMPolicyClient.SetIamPolicyAsync(request);
    

    SetIamPolicyAsync(SetIamPolicyRequest, System.Threading.CancellationToken)

    public virtual System.Threading.Tasks.Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, System.Threading.CancellationToken cancellationToken)

    Sets the access control policy on the specified resource. Replaces any existing policy.

    Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.

    Parameters
    NameDescription
    requestSetIamPolicyRequest

    The request object containing all of the parameters for the API call.

    cancellationTokenSystem.Threading.CancellationToken

    A to use for this RPC.

    Returns
    TypeDescription
    System.Threading.Tasks.Task<Policy>

    A Task containing the RPC response.

    Example
    // Create client
    IAMPolicyClient iAMPolicyClient = await IAMPolicyClient.CreateAsync();
    // Initialize request argument(s)
    SetIamPolicyRequest request = new SetIamPolicyRequest
    {
        ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
        Policy = new Policy(),
        UpdateMask = new FieldMask(),
    };
    // Make the request
    Policy response = await iAMPolicyClient.SetIamPolicyAsync(request);
    

    ShutdownDefaultChannelsAsync()

    public static System.Threading.Tasks.Task ShutdownDefaultChannelsAsync()

    Shuts down any channels automatically created by Create() and CreateAsync(System.Threading.CancellationToken). Channels which weren't automatically created are not affected.

    Returns
    TypeDescription
    System.Threading.Tasks.Task

    A task representing the asynchronous shutdown operation.

    Remarks

    After calling this method, further calls to Create() and CreateAsync(System.Threading.CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

    TestIamPermissions(TestIamPermissionsRequest, Api.Gax.Grpc.CallSettings)

    public virtual TestIamPermissionsResponse TestIamPermissions(TestIamPermissionsRequest request, Api.Gax.Grpc.CallSettings callSettings = null)

    Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

    Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

    Parameters
    NameDescription
    requestTestIamPermissionsRequest

    The request object containing all of the parameters for the API call.

    callSettingsApi.Gax.Grpc.CallSettings

    If not null, applies overrides to this RPC call.

    Returns
    TypeDescription
    TestIamPermissionsResponse

    The RPC response.

    Example
    // Create client
    IAMPolicyClient iAMPolicyClient = IAMPolicyClient.Create();
    // Initialize request argument(s)
    TestIamPermissionsRequest request = new TestIamPermissionsRequest
    {
        ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
        Permissions = { "", },
    };
    // Make the request
    TestIamPermissionsResponse response = iAMPolicyClient.TestIamPermissions(request);
    

    TestIamPermissionsAsync(TestIamPermissionsRequest, Api.Gax.Grpc.CallSettings)

    public virtual System.Threading.Tasks.Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, Api.Gax.Grpc.CallSettings callSettings = null)

    Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

    Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

    Parameters
    NameDescription
    requestTestIamPermissionsRequest

    The request object containing all of the parameters for the API call.

    callSettingsApi.Gax.Grpc.CallSettings

    If not null, applies overrides to this RPC call.

    Returns
    TypeDescription
    System.Threading.Tasks.Task<TestIamPermissionsResponse>

    A Task containing the RPC response.

    Example
    // Create client
    IAMPolicyClient iAMPolicyClient = await IAMPolicyClient.CreateAsync();
    // Initialize request argument(s)
    TestIamPermissionsRequest request = new TestIamPermissionsRequest
    {
        ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
        Permissions = { "", },
    };
    // Make the request
    TestIamPermissionsResponse response = await iAMPolicyClient.TestIamPermissionsAsync(request);
    

    TestIamPermissionsAsync(TestIamPermissionsRequest, System.Threading.CancellationToken)

    public virtual System.Threading.Tasks.Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, System.Threading.CancellationToken cancellationToken)

    Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

    Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

    Parameters
    NameDescription
    requestTestIamPermissionsRequest

    The request object containing all of the parameters for the API call.

    cancellationTokenSystem.Threading.CancellationToken

    A to use for this RPC.

    Returns
    TypeDescription
    System.Threading.Tasks.Task<TestIamPermissionsResponse>

    A Task containing the RPC response.

    Example
    // Create client
    IAMPolicyClient iAMPolicyClient = await IAMPolicyClient.CreateAsync();
    // Initialize request argument(s)
    TestIamPermissionsRequest request = new TestIamPermissionsRequest
    {
        ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
        Permissions = { "", },
    };
    // Make the request
    TestIamPermissionsResponse response = await iAMPolicyClient.TestIamPermissionsAsync(request);