Class OrganizationsClient (2.0.0)

public abstract class OrganizationsClient

Organizations client wrapper, for convenient use.

Inheritance

Object > OrganizationsClient

Derived Types

Namespace

Google.Cloud.ResourceManager.V3

Assembly

Google.Cloud.ResourceManager.V3.dll

Remarks

Allows users to manage their organization resources.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the Organizations service, which is a host of "cloudresourcemanager.googleapis.com" and a port of 443.

Property Value
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default Organizations scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

GrpcClient

public virtual Organizations.OrganizationsClient GrpcClient { get; }

The underlying gRPC Organizations client

Property Value
TypeDescription
Organizations.OrganizationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

Methods

Create()

public static OrganizationsClient Create()

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

Returns
TypeDescription
OrganizationsClient

The created OrganizationsClient.

CreateAsync(CancellationToken)

public static Task<OrganizationsClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<OrganizationsClient>

The task representing the created OrganizationsClient.

GetIamPolicy(IResourceName, CallSettings)

public virtual Policy GetIamPolicy(IResourceName resource, CallSettings callSettings = null)

Gets the access control policy for an organization resource. The policy may be empty if no such policy or resource exists. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.getIamPolicy on the specified organization.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Example
// Create client
OrganizationsClient organizationsClient = OrganizationsClient.Create();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
// Make the request
Policy response = organizationsClient.GetIamPolicy(resource);

GetIamPolicy(GetIamPolicyRequest, CallSettings)

public virtual Policy GetIamPolicy(GetIamPolicyRequest request, CallSettings callSettings = null)

Gets the access control policy for an organization resource. The policy may be empty if no such policy or resource exists. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.getIamPolicy on the specified organization.

Parameters
NameDescription
requestGetIamPolicyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

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

GetIamPolicy(String, CallSettings)

public virtual Policy GetIamPolicy(string resource, CallSettings callSettings = null)

Gets the access control policy for an organization resource. The policy may be empty if no such policy or resource exists. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.getIamPolicy on the specified organization.

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Example
// Create client
OrganizationsClient organizationsClient = OrganizationsClient.Create();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
// Make the request
Policy response = organizationsClient.GetIamPolicy(resource);

GetIamPolicyAsync(IResourceName, CallSettings)

public virtual Task<Policy> GetIamPolicyAsync(IResourceName resource, CallSettings callSettings = null)

Gets the access control policy for an organization resource. The policy may be empty if no such policy or resource exists. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.getIamPolicy on the specified organization.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
// Make the request
Policy response = await organizationsClient.GetIamPolicyAsync(resource);

GetIamPolicyAsync(IResourceName, CancellationToken)

public virtual Task<Policy> GetIamPolicyAsync(IResourceName resource, CancellationToken cancellationToken)

Gets the access control policy for an organization resource. The policy may be empty if no such policy or resource exists. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.getIamPolicy on the specified organization.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
// Make the request
Policy response = await organizationsClient.GetIamPolicyAsync(resource);

GetIamPolicyAsync(GetIamPolicyRequest, CallSettings)

public virtual Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, CallSettings callSettings = null)

Gets the access control policy for an organization resource. The policy may be empty if no such policy or resource exists. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.getIamPolicy on the specified organization.

Parameters
NameDescription
requestGetIamPolicyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

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

GetIamPolicyAsync(GetIamPolicyRequest, CancellationToken)

public virtual Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, CancellationToken cancellationToken)

Gets the access control policy for an organization resource. The policy may be empty if no such policy or resource exists. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.getIamPolicy on the specified organization.

Parameters
NameDescription
requestGetIamPolicyRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

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

GetIamPolicyAsync(String, CallSettings)

public virtual Task<Policy> GetIamPolicyAsync(string resource, CallSettings callSettings = null)

Gets the access control policy for an organization resource. The policy may be empty if no such policy or resource exists. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.getIamPolicy on the specified organization.

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
// Make the request
Policy response = await organizationsClient.GetIamPolicyAsync(resource);

GetIamPolicyAsync(String, CancellationToken)

public virtual Task<Policy> GetIamPolicyAsync(string resource, CancellationToken cancellationToken)

Gets the access control policy for an organization resource. The policy may be empty if no such policy or resource exists. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.getIamPolicy on the specified organization.

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
// Make the request
Policy response = await organizationsClient.GetIamPolicyAsync(resource);

GetOrganization(OrganizationName, CallSettings)

public virtual Organization GetOrganization(OrganizationName name, CallSettings callSettings = null)

Fetches an organization resource identified by the specified resource name.

Parameters
NameDescription
nameOrganizationName

Required. The resource name of the Organization to fetch. This is the organization's relative path in the API, formatted as "organizations/[organizationId]". For example, "organizations/1234".

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Organization

The RPC response.

Example
// Create client
OrganizationsClient organizationsClient = OrganizationsClient.Create();
// Initialize request argument(s)
OrganizationName name = OrganizationName.FromOrganization("[ORGANIZATION]");
// Make the request
Organization response = organizationsClient.GetOrganization(name);

GetOrganization(GetOrganizationRequest, CallSettings)

public virtual Organization GetOrganization(GetOrganizationRequest request, CallSettings callSettings = null)

Fetches an organization resource identified by the specified resource name.

Parameters
NameDescription
requestGetOrganizationRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Organization

The RPC response.

Example
// Create client
OrganizationsClient organizationsClient = OrganizationsClient.Create();
// Initialize request argument(s)
GetOrganizationRequest request = new GetOrganizationRequest
{
    OrganizationName = OrganizationName.FromOrganization("[ORGANIZATION]"),
};
// Make the request
Organization response = organizationsClient.GetOrganization(request);

GetOrganization(String, CallSettings)

public virtual Organization GetOrganization(string name, CallSettings callSettings = null)

Fetches an organization resource identified by the specified resource name.

Parameters
NameDescription
nameString

Required. The resource name of the Organization to fetch. This is the organization's relative path in the API, formatted as "organizations/[organizationId]". For example, "organizations/1234".

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Organization

The RPC response.

Example
// Create client
OrganizationsClient organizationsClient = OrganizationsClient.Create();
// Initialize request argument(s)
string name = "organizations/[ORGANIZATION]";
// Make the request
Organization response = organizationsClient.GetOrganization(name);

GetOrganizationAsync(OrganizationName, CallSettings)

public virtual Task<Organization> GetOrganizationAsync(OrganizationName name, CallSettings callSettings = null)

Fetches an organization resource identified by the specified resource name.

Parameters
NameDescription
nameOrganizationName

Required. The resource name of the Organization to fetch. This is the organization's relative path in the API, formatted as "organizations/[organizationId]". For example, "organizations/1234".

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Organization>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
OrganizationName name = OrganizationName.FromOrganization("[ORGANIZATION]");
// Make the request
Organization response = await organizationsClient.GetOrganizationAsync(name);

GetOrganizationAsync(OrganizationName, CancellationToken)

public virtual Task<Organization> GetOrganizationAsync(OrganizationName name, CancellationToken cancellationToken)

Fetches an organization resource identified by the specified resource name.

Parameters
NameDescription
nameOrganizationName

Required. The resource name of the Organization to fetch. This is the organization's relative path in the API, formatted as "organizations/[organizationId]". For example, "organizations/1234".

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Organization>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
OrganizationName name = OrganizationName.FromOrganization("[ORGANIZATION]");
// Make the request
Organization response = await organizationsClient.GetOrganizationAsync(name);

GetOrganizationAsync(GetOrganizationRequest, CallSettings)

public virtual Task<Organization> GetOrganizationAsync(GetOrganizationRequest request, CallSettings callSettings = null)

Fetches an organization resource identified by the specified resource name.

Parameters
NameDescription
requestGetOrganizationRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Organization>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
GetOrganizationRequest request = new GetOrganizationRequest
{
    OrganizationName = OrganizationName.FromOrganization("[ORGANIZATION]"),
};
// Make the request
Organization response = await organizationsClient.GetOrganizationAsync(request);

GetOrganizationAsync(GetOrganizationRequest, CancellationToken)

public virtual Task<Organization> GetOrganizationAsync(GetOrganizationRequest request, CancellationToken cancellationToken)

Fetches an organization resource identified by the specified resource name.

Parameters
NameDescription
requestGetOrganizationRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Organization>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
GetOrganizationRequest request = new GetOrganizationRequest
{
    OrganizationName = OrganizationName.FromOrganization("[ORGANIZATION]"),
};
// Make the request
Organization response = await organizationsClient.GetOrganizationAsync(request);

GetOrganizationAsync(String, CallSettings)

public virtual Task<Organization> GetOrganizationAsync(string name, CallSettings callSettings = null)

Fetches an organization resource identified by the specified resource name.

Parameters
NameDescription
nameString

Required. The resource name of the Organization to fetch. This is the organization's relative path in the API, formatted as "organizations/[organizationId]". For example, "organizations/1234".

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Organization>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
string name = "organizations/[ORGANIZATION]";
// Make the request
Organization response = await organizationsClient.GetOrganizationAsync(name);

GetOrganizationAsync(String, CancellationToken)

public virtual Task<Organization> GetOrganizationAsync(string name, CancellationToken cancellationToken)

Fetches an organization resource identified by the specified resource name.

Parameters
NameDescription
nameString

Required. The resource name of the Organization to fetch. This is the organization's relative path in the API, formatted as "organizations/[organizationId]". For example, "organizations/1234".

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Organization>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
string name = "organizations/[ORGANIZATION]";
// Make the request
Organization response = await organizationsClient.GetOrganizationAsync(name);

SearchOrganizations(SearchOrganizationsRequest, CallSettings)

public virtual PagedEnumerable<SearchOrganizationsResponse, Organization> SearchOrganizations(SearchOrganizationsRequest request, CallSettings callSettings = null)

Searches organization resources that are visible to the user and satisfy the specified filter. This method returns organizations in an unspecified order. New organizations do not necessarily appear at the end of the results, and may take a small amount of time to appear.

Search will only return organizations on which the user has the permission resourcemanager.organizations.get

Parameters
NameDescription
requestSearchOrganizationsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<SearchOrganizationsResponse, Organization>

A pageable sequence of Organization resources.

Example
// Create client
OrganizationsClient organizationsClient = OrganizationsClient.Create();
// Initialize request argument(s)
SearchOrganizationsRequest request = new SearchOrganizationsRequest { Query = "", };
// Make the request
PagedEnumerable<SearchOrganizationsResponse, Organization> response = organizationsClient.SearchOrganizations(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Organization item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (SearchOrganizationsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Organization item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Organization> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Organization item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

SearchOrganizations(String, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<SearchOrganizationsResponse, Organization> SearchOrganizations(string query, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Searches organization resources that are visible to the user and satisfy the specified filter. This method returns organizations in an unspecified order. New organizations do not necessarily appear at the end of the results, and may take a small amount of time to appear.

Search will only return organizations on which the user has the permission resourcemanager.organizations.get

Parameters
NameDescription
queryString

Optional. An optional query string used to filter the Organizations to return in the response. Query rules are case-insensitive.

| Field            | Description                                |
|------------------|--------------------------------------------|
| directoryCustomerId, owner.directoryCustomerId | Filters by directory
customer id. |
| domain           | Filters by domain.                         |

Organizations may be queried by directoryCustomerId or by domain, where the domain is a G Suite domain, for example:

  • Query directorycustomerid:123456789 returns Organization resources with owner.directory_customer_id equal to 123456789.
  • Query domain:google.com returns Organization resources corresponding to the domain google.com.
pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<SearchOrganizationsResponse, Organization>

A pageable sequence of Organization resources.

Example
// Create client
OrganizationsClient organizationsClient = OrganizationsClient.Create();
// Initialize request argument(s)
string query = "";
// Make the request
PagedEnumerable<SearchOrganizationsResponse, Organization> response = organizationsClient.SearchOrganizations(query);

// Iterate over all response items, lazily performing RPCs as required
foreach (Organization item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (SearchOrganizationsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Organization item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Organization> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Organization item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

SearchOrganizationsAsync(SearchOrganizationsRequest, CallSettings)

public virtual PagedAsyncEnumerable<SearchOrganizationsResponse, Organization> SearchOrganizationsAsync(SearchOrganizationsRequest request, CallSettings callSettings = null)

Searches organization resources that are visible to the user and satisfy the specified filter. This method returns organizations in an unspecified order. New organizations do not necessarily appear at the end of the results, and may take a small amount of time to appear.

Search will only return organizations on which the user has the permission resourcemanager.organizations.get

Parameters
NameDescription
requestSearchOrganizationsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<SearchOrganizationsResponse, Organization>

A pageable asynchronous sequence of Organization resources.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
SearchOrganizationsRequest request = new SearchOrganizationsRequest { Query = "", };
// Make the request
PagedAsyncEnumerable<SearchOrganizationsResponse, Organization> response = organizationsClient.SearchOrganizationsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Organization item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((SearchOrganizationsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Organization item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Organization> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Organization item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

SearchOrganizationsAsync(String, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<SearchOrganizationsResponse, Organization> SearchOrganizationsAsync(string query, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Searches organization resources that are visible to the user and satisfy the specified filter. This method returns organizations in an unspecified order. New organizations do not necessarily appear at the end of the results, and may take a small amount of time to appear.

Search will only return organizations on which the user has the permission resourcemanager.organizations.get

Parameters
NameDescription
queryString

Optional. An optional query string used to filter the Organizations to return in the response. Query rules are case-insensitive.

| Field            | Description                                |
|------------------|--------------------------------------------|
| directoryCustomerId, owner.directoryCustomerId | Filters by directory
customer id. |
| domain           | Filters by domain.                         |

Organizations may be queried by directoryCustomerId or by domain, where the domain is a G Suite domain, for example:

  • Query directorycustomerid:123456789 returns Organization resources with owner.directory_customer_id equal to 123456789.
  • Query domain:google.com returns Organization resources corresponding to the domain google.com.
pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<SearchOrganizationsResponse, Organization>

A pageable asynchronous sequence of Organization resources.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
string query = "";
// Make the request
PagedAsyncEnumerable<SearchOrganizationsResponse, Organization> response = organizationsClient.SearchOrganizationsAsync(query);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Organization item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((SearchOrganizationsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Organization item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Organization> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Organization item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

SetIamPolicy(IResourceName, CallSettings)

public virtual Policy SetIamPolicy(IResourceName resource, CallSettings callSettings = null)

Sets the access control policy on an organization resource. Replaces any existing policy. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.setIamPolicy on the specified organization.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Example
// Create client
OrganizationsClient organizationsClient = OrganizationsClient.Create();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
// Make the request
Policy response = organizationsClient.SetIamPolicy(resource);

SetIamPolicy(SetIamPolicyRequest, CallSettings)

public virtual Policy SetIamPolicy(SetIamPolicyRequest request, CallSettings callSettings = null)

Sets the access control policy on an organization resource. Replaces any existing policy. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.setIamPolicy on the specified organization.

Parameters
NameDescription
requestSetIamPolicyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Example
// Create client
OrganizationsClient organizationsClient = OrganizationsClient.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 = organizationsClient.SetIamPolicy(request);

SetIamPolicy(String, CallSettings)

public virtual Policy SetIamPolicy(string resource, CallSettings callSettings = null)

Sets the access control policy on an organization resource. Replaces any existing policy. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.setIamPolicy on the specified organization.

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Example
// Create client
OrganizationsClient organizationsClient = OrganizationsClient.Create();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
// Make the request
Policy response = organizationsClient.SetIamPolicy(resource);

SetIamPolicyAsync(IResourceName, CallSettings)

public virtual Task<Policy> SetIamPolicyAsync(IResourceName resource, CallSettings callSettings = null)

Sets the access control policy on an organization resource. Replaces any existing policy. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.setIamPolicy on the specified organization.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
// Make the request
Policy response = await organizationsClient.SetIamPolicyAsync(resource);

SetIamPolicyAsync(IResourceName, CancellationToken)

public virtual Task<Policy> SetIamPolicyAsync(IResourceName resource, CancellationToken cancellationToken)

Sets the access control policy on an organization resource. Replaces any existing policy. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.setIamPolicy on the specified organization.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
// Make the request
Policy response = await organizationsClient.SetIamPolicyAsync(resource);

SetIamPolicyAsync(SetIamPolicyRequest, CallSettings)

public virtual Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, CallSettings callSettings = null)

Sets the access control policy on an organization resource. Replaces any existing policy. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.setIamPolicy on the specified organization.

Parameters
NameDescription
requestSetIamPolicyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.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 organizationsClient.SetIamPolicyAsync(request);

SetIamPolicyAsync(SetIamPolicyRequest, CancellationToken)

public virtual Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, CancellationToken cancellationToken)

Sets the access control policy on an organization resource. Replaces any existing policy. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.setIamPolicy on the specified organization.

Parameters
NameDescription
requestSetIamPolicyRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.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 organizationsClient.SetIamPolicyAsync(request);

SetIamPolicyAsync(String, CallSettings)

public virtual Task<Policy> SetIamPolicyAsync(string resource, CallSettings callSettings = null)

Sets the access control policy on an organization resource. Replaces any existing policy. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.setIamPolicy on the specified organization.

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
// Make the request
Policy response = await organizationsClient.SetIamPolicyAsync(resource);

SetIamPolicyAsync(String, CancellationToken)

public virtual Task<Policy> SetIamPolicyAsync(string resource, CancellationToken cancellationToken)

Sets the access control policy on an organization resource. Replaces any existing policy. The resource field should be the organization's resource name, for example: "organizations/123".

Authorization requires the IAM permission resourcemanager.organizations.setIamPolicy on the specified organization.

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
// Make the request
Policy response = await organizationsClient.SetIamPolicyAsync(resource);

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

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

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

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

TestIamPermissions(IResourceName, IEnumerable<String>, CallSettings)

public virtual TestIamPermissionsResponse TestIamPermissions(IResourceName resource, IEnumerable<string> permissions, CallSettings callSettings = null)

Returns the permissions that a caller has on the specified organization. The resource field should be the organization's resource name, for example: "organizations/123".

There are no permissions required for making this API call.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TestIamPermissionsResponse

The RPC response.

Example
// Create client
OrganizationsClient organizationsClient = OrganizationsClient.Create();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
IEnumerable<string> permissions = new string[] { "", };
// Make the request
TestIamPermissionsResponse response = organizationsClient.TestIamPermissions(resource, permissions);

TestIamPermissions(TestIamPermissionsRequest, CallSettings)

public virtual TestIamPermissionsResponse TestIamPermissions(TestIamPermissionsRequest request, CallSettings callSettings = null)

Returns the permissions that a caller has on the specified organization. The resource field should be the organization's resource name, for example: "organizations/123".

There are no permissions required for making this API call.

Parameters
NameDescription
requestTestIamPermissionsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TestIamPermissionsResponse

The RPC response.

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

TestIamPermissions(String, IEnumerable<String>, CallSettings)

public virtual TestIamPermissionsResponse TestIamPermissions(string resource, IEnumerable<string> permissions, CallSettings callSettings = null)

Returns the permissions that a caller has on the specified organization. The resource field should be the organization's resource name, for example: "organizations/123".

There are no permissions required for making this API call.

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TestIamPermissionsResponse

The RPC response.

Example
// Create client
OrganizationsClient organizationsClient = OrganizationsClient.Create();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
IEnumerable<string> permissions = new string[] { "", };
// Make the request
TestIamPermissionsResponse response = organizationsClient.TestIamPermissions(resource, permissions);

TestIamPermissionsAsync(IResourceName, IEnumerable<String>, CallSettings)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(IResourceName resource, IEnumerable<string> permissions, CallSettings callSettings = null)

Returns the permissions that a caller has on the specified organization. The resource field should be the organization's resource name, for example: "organizations/123".

There are no permissions required for making this API call.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
IEnumerable<string> permissions = new string[] { "", };
// Make the request
TestIamPermissionsResponse response = await organizationsClient.TestIamPermissionsAsync(resource, permissions);

TestIamPermissionsAsync(IResourceName, IEnumerable<String>, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(IResourceName resource, IEnumerable<string> permissions, CancellationToken cancellationToken)

Returns the permissions that a caller has on the specified organization. The resource field should be the organization's resource name, for example: "organizations/123".

There are no permissions required for making this API call.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
IEnumerable<string> permissions = new string[] { "", };
// Make the request
TestIamPermissionsResponse response = await organizationsClient.TestIamPermissionsAsync(resource, permissions);

TestIamPermissionsAsync(TestIamPermissionsRequest, CallSettings)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, CallSettings callSettings = null)

Returns the permissions that a caller has on the specified organization. The resource field should be the organization's resource name, for example: "organizations/123".

There are no permissions required for making this API call.

Parameters
NameDescription
requestTestIamPermissionsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

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

TestIamPermissionsAsync(TestIamPermissionsRequest, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, CancellationToken cancellationToken)

Returns the permissions that a caller has on the specified organization. The resource field should be the organization's resource name, for example: "organizations/123".

There are no permissions required for making this API call.

Parameters
NameDescription
requestTestIamPermissionsRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

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

TestIamPermissionsAsync(String, IEnumerable<String>, CallSettings)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(string resource, IEnumerable<string> permissions, CallSettings callSettings = null)

Returns the permissions that a caller has on the specified organization. The resource field should be the organization's resource name, for example: "organizations/123".

There are no permissions required for making this API call.

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
IEnumerable<string> permissions = new string[] { "", };
// Make the request
TestIamPermissionsResponse response = await organizationsClient.TestIamPermissionsAsync(resource, permissions);

TestIamPermissionsAsync(String, IEnumerable<String>, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(string resource, IEnumerable<string> permissions, CancellationToken cancellationToken)

Returns the permissions that a caller has on the specified organization. The resource field should be the organization's resource name, for example: "organizations/123".

There are no permissions required for making this API call.

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

Example
// Create client
OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
IEnumerable<string> permissions = new string[] { "", };
// Make the request
TestIamPermissionsResponse response = await organizationsClient.TestIamPermissionsAsync(resource, permissions);