com.google.cloud.managedidentities.v1.ManagedIdentitiesServiceClient Maven / Gradle / Ivy
Show all versions of google-cloud-managed-identities Show documentation
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.managedidentities.v1;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.managedidentities.v1.stub.ManagedIdentitiesServiceStub;
import com.google.cloud.managedidentities.v1.stub.ManagedIdentitiesServiceStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
import com.google.longrunning.OperationsClient;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Service Description: API Overview
*
* The `managedidentites.googleapis.com` service implements the Google Cloud Managed Identites
* API for identity services (e.g. Microsoft Active Directory).
*
*
The Managed Identities service provides methods to manage (create/read/update/delete) domains,
* reset managed identities admin password, add/remove domain controllers in GCP regions and
* add/remove VPC peering.
*
*
Data Model
*
*
The Managed Identities service exposes the following resources:
*
*
* - Locations as global, named as follows: `projects/{project_id}/locations/global`.
*
*
*
* - Domains, named as follows: `/projects/{project_id}/locations/global/domain/{domain_name}`.
*
*
* The `{domain_name}` refers to fully qualified domain name in the customer project e.g.
* mydomain.myorganization.com, with the following restrictions:
*
*
* Must contain only lowercase letters, numbers, periods and hyphens. * Must start with
* a letter. * Must contain between 2-64 characters. * Must end with a number or a letter.
* * Must not start with period. * First segement length (mydomain form example above)
* shouldn't exceed 15 chars. * The last segment cannot be fully numeric. * Must be unique
* within the customer project.
*
*
This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* DomainName name = DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]");
* ResetAdminPasswordResponse response = managedIdentitiesServiceClient.resetAdminPassword(name);
* }
* }
*
* Note: close() needs to be called on the ManagedIdentitiesServiceClient object to clean up
* resources such as threads. In the example above, try-with-resources is used, which automatically
* calls close().
*
*
The surface of this class includes several types of Java methods for each of the API's
* methods:
*
*
* - A "flattened" method. With this type of method, the fields of the request type have been
* converted into function parameters. It may be the case that not all fields are available as
* parameters, and not every API method will have a flattened method entry point.
*
- A "request object" method. This type of method only takes one parameter, a request object,
* which must be constructed before the call. Not every API method will have a request object
* method.
*
- A "callable" method. This type of method takes no parameters and returns an immutable API
* callable object, which can be used to initiate calls to the service.
*
*
* See the individual methods for example code.
*
*
Many parameters require resource names to be formatted in a particular way. To assist with
* these names, this class includes a format method for each type of name, and additionally a parse
* method to extract the individual identifiers contained within names that are returned.
*
*
This class can be customized by passing in a custom instance of
* ManagedIdentitiesServiceSettings to create(). For example:
*
*
To customize credentials:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* ManagedIdentitiesServiceSettings managedIdentitiesServiceSettings =
* ManagedIdentitiesServiceSettings.newBuilder()
* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
* .build();
* ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create(managedIdentitiesServiceSettings);
* }
*
* To customize the endpoint:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* ManagedIdentitiesServiceSettings managedIdentitiesServiceSettings =
* ManagedIdentitiesServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
* ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create(managedIdentitiesServiceSettings);
* }
*
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class ManagedIdentitiesServiceClient implements BackgroundResource {
private final ManagedIdentitiesServiceSettings settings;
private final ManagedIdentitiesServiceStub stub;
private final OperationsClient operationsClient;
/** Constructs an instance of ManagedIdentitiesServiceClient with default settings. */
public static final ManagedIdentitiesServiceClient create() throws IOException {
return create(ManagedIdentitiesServiceSettings.newBuilder().build());
}
/**
* Constructs an instance of ManagedIdentitiesServiceClient, using the given settings. The
* channels are created based on the settings passed in, or defaults for any settings that are not
* set.
*/
public static final ManagedIdentitiesServiceClient create(
ManagedIdentitiesServiceSettings settings) throws IOException {
return new ManagedIdentitiesServiceClient(settings);
}
/**
* Constructs an instance of ManagedIdentitiesServiceClient, using the given stub for making
* calls. This is for advanced usage - prefer using create(ManagedIdentitiesServiceSettings).
*/
public static final ManagedIdentitiesServiceClient create(ManagedIdentitiesServiceStub stub) {
return new ManagedIdentitiesServiceClient(stub);
}
/**
* Constructs an instance of ManagedIdentitiesServiceClient, using the given settings. This is
* protected so that it is easy to make a subclass, but otherwise, the static factory methods
* should be preferred.
*/
protected ManagedIdentitiesServiceClient(ManagedIdentitiesServiceSettings settings)
throws IOException {
this.settings = settings;
this.stub = ((ManagedIdentitiesServiceStubSettings) settings.getStubSettings()).createStub();
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
}
protected ManagedIdentitiesServiceClient(ManagedIdentitiesServiceStub stub) {
this.settings = null;
this.stub = stub;
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
}
public final ManagedIdentitiesServiceSettings getSettings() {
return settings;
}
public ManagedIdentitiesServiceStub getStub() {
return stub;
}
/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
public final OperationsClient getOperationsClient() {
return operationsClient;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a Microsoft AD domain.
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
* String domainName = "domainName-1244085905";
* Domain domain = Domain.newBuilder().build();
* Domain response =
* managedIdentitiesServiceClient
* .createMicrosoftAdDomainAsync(parent, domainName, domain)
* .get();
* }
* }
*
* @param parent Required. The resource project name and location using the form:
* `projects/{project_id}/locations/global`
* @param domainName Required. The fully qualified domain name. e.g. mydomain.myorganization.com,
* with the following restrictions:
* * Must contain only lowercase letters, numbers, periods and hyphens. * Must
* start with a letter. * Must contain between 2-64 characters. * Must end with a
* number or a letter. * Must not start with period. * First segement length (mydomain
* form example above) shouldn't exceed 15 chars. * The last segment cannot be fully
* numeric. * Must be unique within the customer project.
* @param domain Required. A Managed Identity domain resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createMicrosoftAdDomainAsync(
LocationName parent, String domainName, Domain domain) {
CreateMicrosoftAdDomainRequest request =
CreateMicrosoftAdDomainRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setDomainName(domainName)
.setDomain(domain)
.build();
return createMicrosoftAdDomainAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a Microsoft AD domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
* String domainName = "domainName-1244085905";
* Domain domain = Domain.newBuilder().build();
* Domain response =
* managedIdentitiesServiceClient
* .createMicrosoftAdDomainAsync(parent, domainName, domain)
* .get();
* }
* }
*
* @param parent Required. The resource project name and location using the form:
* `projects/{project_id}/locations/global`
* @param domainName Required. The fully qualified domain name. e.g. mydomain.myorganization.com,
* with the following restrictions:
* * Must contain only lowercase letters, numbers, periods and hyphens. * Must
* start with a letter. * Must contain between 2-64 characters. * Must end with a
* number or a letter. * Must not start with period. * First segement length (mydomain
* form example above) shouldn't exceed 15 chars. * The last segment cannot be fully
* numeric. * Must be unique within the customer project.
* @param domain Required. A Managed Identity domain resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createMicrosoftAdDomainAsync(
String parent, String domainName, Domain domain) {
CreateMicrosoftAdDomainRequest request =
CreateMicrosoftAdDomainRequest.newBuilder()
.setParent(parent)
.setDomainName(domainName)
.setDomain(domain)
.build();
return createMicrosoftAdDomainAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a Microsoft AD domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* CreateMicrosoftAdDomainRequest request =
* CreateMicrosoftAdDomainRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setDomainName("domainName-1244085905")
* .setDomain(Domain.newBuilder().build())
* .build();
* Domain response = managedIdentitiesServiceClient.createMicrosoftAdDomainAsync(request).get();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createMicrosoftAdDomainAsync(
CreateMicrosoftAdDomainRequest request) {
return createMicrosoftAdDomainOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a Microsoft AD domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* CreateMicrosoftAdDomainRequest request =
* CreateMicrosoftAdDomainRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setDomainName("domainName-1244085905")
* .setDomain(Domain.newBuilder().build())
* .build();
* OperationFuture future =
* managedIdentitiesServiceClient
* .createMicrosoftAdDomainOperationCallable()
* .futureCall(request);
* // Do something.
* Domain response = future.get();
* }
* }
*/
public final OperationCallable
createMicrosoftAdDomainOperationCallable() {
return stub.createMicrosoftAdDomainOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a Microsoft AD domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* CreateMicrosoftAdDomainRequest request =
* CreateMicrosoftAdDomainRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setDomainName("domainName-1244085905")
* .setDomain(Domain.newBuilder().build())
* .build();
* ApiFuture future =
* managedIdentitiesServiceClient.createMicrosoftAdDomainCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable
createMicrosoftAdDomainCallable() {
return stub.createMicrosoftAdDomainCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Resets a domain's administrator password.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* DomainName name = DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]");
* ResetAdminPasswordResponse response = managedIdentitiesServiceClient.resetAdminPassword(name);
* }
* }
*
* @param name Required. The domain resource name using the form:
* `projects/{project_id}/locations/global/domains/{domain_name}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ResetAdminPasswordResponse resetAdminPassword(DomainName name) {
ResetAdminPasswordRequest request =
ResetAdminPasswordRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return resetAdminPassword(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Resets a domain's administrator password.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* String name = DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString();
* ResetAdminPasswordResponse response = managedIdentitiesServiceClient.resetAdminPassword(name);
* }
* }
*
* @param name Required. The domain resource name using the form:
* `projects/{project_id}/locations/global/domains/{domain_name}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ResetAdminPasswordResponse resetAdminPassword(String name) {
ResetAdminPasswordRequest request =
ResetAdminPasswordRequest.newBuilder().setName(name).build();
return resetAdminPassword(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Resets a domain's administrator password.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* ResetAdminPasswordRequest request =
* ResetAdminPasswordRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .build();
* ResetAdminPasswordResponse response =
* managedIdentitiesServiceClient.resetAdminPassword(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ResetAdminPasswordResponse resetAdminPassword(ResetAdminPasswordRequest request) {
return resetAdminPasswordCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Resets a domain's administrator password.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* ResetAdminPasswordRequest request =
* ResetAdminPasswordRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .build();
* ApiFuture future =
* managedIdentitiesServiceClient.resetAdminPasswordCallable().futureCall(request);
* // Do something.
* ResetAdminPasswordResponse response = future.get();
* }
* }
*/
public final UnaryCallable
resetAdminPasswordCallable() {
return stub.resetAdminPasswordCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists domains in a project.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
* for (Domain element : managedIdentitiesServiceClient.listDomains(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The resource name of the domain location using the form:
* `projects/{project_id}/locations/global`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListDomainsPagedResponse listDomains(LocationName parent) {
ListDomainsRequest request =
ListDomainsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listDomains(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists domains in a project.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
* for (Domain element : managedIdentitiesServiceClient.listDomains(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The resource name of the domain location using the form:
* `projects/{project_id}/locations/global`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListDomainsPagedResponse listDomains(String parent) {
ListDomainsRequest request = ListDomainsRequest.newBuilder().setParent(parent).build();
return listDomains(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists domains in a project.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* ListDomainsRequest request =
* ListDomainsRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setFilter("filter-1274492040")
* .setOrderBy("orderBy-1207110587")
* .build();
* for (Domain element : managedIdentitiesServiceClient.listDomains(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListDomainsPagedResponse listDomains(ListDomainsRequest request) {
return listDomainsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists domains in a project.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* ListDomainsRequest request =
* ListDomainsRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setFilter("filter-1274492040")
* .setOrderBy("orderBy-1207110587")
* .build();
* ApiFuture future =
* managedIdentitiesServiceClient.listDomainsPagedCallable().futureCall(request);
* // Do something.
* for (Domain element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listDomainsPagedCallable() {
return stub.listDomainsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists domains in a project.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* ListDomainsRequest request =
* ListDomainsRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setFilter("filter-1274492040")
* .setOrderBy("orderBy-1207110587")
* .build();
* while (true) {
* ListDomainsResponse response =
* managedIdentitiesServiceClient.listDomainsCallable().call(request);
* for (Domain element : response.getDomainsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable listDomainsCallable() {
return stub.listDomainsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* DomainName name = DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]");
* Domain response = managedIdentitiesServiceClient.getDomain(name);
* }
* }
*
* @param name Required. The domain resource name using the form:
* `projects/{project_id}/locations/global/domains/{domain_name}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Domain getDomain(DomainName name) {
GetDomainRequest request =
GetDomainRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getDomain(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* String name = DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString();
* Domain response = managedIdentitiesServiceClient.getDomain(name);
* }
* }
*
* @param name Required. The domain resource name using the form:
* `projects/{project_id}/locations/global/domains/{domain_name}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Domain getDomain(String name) {
GetDomainRequest request = GetDomainRequest.newBuilder().setName(name).build();
return getDomain(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* GetDomainRequest request =
* GetDomainRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .build();
* Domain response = managedIdentitiesServiceClient.getDomain(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Domain getDomain(GetDomainRequest request) {
return getDomainCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* GetDomainRequest request =
* GetDomainRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .build();
* ApiFuture future =
* managedIdentitiesServiceClient.getDomainCallable().futureCall(request);
* // Do something.
* Domain response = future.get();
* }
* }
*/
public final UnaryCallable getDomainCallable() {
return stub.getDomainCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the metadata and configuration of a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* Domain domain = Domain.newBuilder().build();
* FieldMask updateMask = FieldMask.newBuilder().build();
* Domain response = managedIdentitiesServiceClient.updateDomainAsync(domain, updateMask).get();
* }
* }
*
* @param domain Required. Domain message with updated fields. Only supported fields specified in
* update_mask are updated.
* @param updateMask Required. Mask of fields to update. At least one path must be supplied in
* this field. The elements of the repeated paths field may only include fields from
* [Domain][google.cloud.managedidentities.v1.Domain]: * `labels` * `locations` *
* `authorized_networks`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture updateDomainAsync(
Domain domain, FieldMask updateMask) {
UpdateDomainRequest request =
UpdateDomainRequest.newBuilder().setDomain(domain).setUpdateMask(updateMask).build();
return updateDomainAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the metadata and configuration of a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* UpdateDomainRequest request =
* UpdateDomainRequest.newBuilder()
* .setUpdateMask(FieldMask.newBuilder().build())
* .setDomain(Domain.newBuilder().build())
* .build();
* Domain response = managedIdentitiesServiceClient.updateDomainAsync(request).get();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture updateDomainAsync(UpdateDomainRequest request) {
return updateDomainOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the metadata and configuration of a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* UpdateDomainRequest request =
* UpdateDomainRequest.newBuilder()
* .setUpdateMask(FieldMask.newBuilder().build())
* .setDomain(Domain.newBuilder().build())
* .build();
* OperationFuture future =
* managedIdentitiesServiceClient.updateDomainOperationCallable().futureCall(request);
* // Do something.
* Domain response = future.get();
* }
* }
*/
public final OperationCallable
updateDomainOperationCallable() {
return stub.updateDomainOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the metadata and configuration of a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* UpdateDomainRequest request =
* UpdateDomainRequest.newBuilder()
* .setUpdateMask(FieldMask.newBuilder().build())
* .setDomain(Domain.newBuilder().build())
* .build();
* ApiFuture future =
* managedIdentitiesServiceClient.updateDomainCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable updateDomainCallable() {
return stub.updateDomainCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* DomainName name = DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]");
* managedIdentitiesServiceClient.deleteDomainAsync(name).get();
* }
* }
*
* @param name Required. The domain resource name using the form:
* `projects/{project_id}/locations/global/domains/{domain_name}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteDomainAsync(DomainName name) {
DeleteDomainRequest request =
DeleteDomainRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return deleteDomainAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* String name = DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString();
* managedIdentitiesServiceClient.deleteDomainAsync(name).get();
* }
* }
*
* @param name Required. The domain resource name using the form:
* `projects/{project_id}/locations/global/domains/{domain_name}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteDomainAsync(String name) {
DeleteDomainRequest request = DeleteDomainRequest.newBuilder().setName(name).build();
return deleteDomainAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* DeleteDomainRequest request =
* DeleteDomainRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .build();
* managedIdentitiesServiceClient.deleteDomainAsync(request).get();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteDomainAsync(DeleteDomainRequest request) {
return deleteDomainOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* DeleteDomainRequest request =
* DeleteDomainRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .build();
* OperationFuture future =
* managedIdentitiesServiceClient.deleteDomainOperationCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final OperationCallable
deleteDomainOperationCallable() {
return stub.deleteDomainOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* DeleteDomainRequest request =
* DeleteDomainRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .build();
* ApiFuture future =
* managedIdentitiesServiceClient.deleteDomainCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable deleteDomainCallable() {
return stub.deleteDomainCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Adds an AD trust to a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* DomainName name = DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]");
* Trust trust = Trust.newBuilder().build();
* Domain response = managedIdentitiesServiceClient.attachTrustAsync(name, trust).get();
* }
* }
*
* @param name Required. The resource domain name, project name and location using the form:
* `projects/{project_id}/locations/global/domains/{domain_name}`
* @param trust Required. The domain trust resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture attachTrustAsync(DomainName name, Trust trust) {
AttachTrustRequest request =
AttachTrustRequest.newBuilder()
.setName(name == null ? null : name.toString())
.setTrust(trust)
.build();
return attachTrustAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Adds an AD trust to a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* String name = DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString();
* Trust trust = Trust.newBuilder().build();
* Domain response = managedIdentitiesServiceClient.attachTrustAsync(name, trust).get();
* }
* }
*
* @param name Required. The resource domain name, project name and location using the form:
* `projects/{project_id}/locations/global/domains/{domain_name}`
* @param trust Required. The domain trust resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture attachTrustAsync(String name, Trust trust) {
AttachTrustRequest request =
AttachTrustRequest.newBuilder().setName(name).setTrust(trust).build();
return attachTrustAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Adds an AD trust to a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* AttachTrustRequest request =
* AttachTrustRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .setTrust(Trust.newBuilder().build())
* .build();
* Domain response = managedIdentitiesServiceClient.attachTrustAsync(request).get();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture attachTrustAsync(AttachTrustRequest request) {
return attachTrustOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Adds an AD trust to a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* AttachTrustRequest request =
* AttachTrustRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .setTrust(Trust.newBuilder().build())
* .build();
* OperationFuture future =
* managedIdentitiesServiceClient.attachTrustOperationCallable().futureCall(request);
* // Do something.
* Domain response = future.get();
* }
* }
*/
public final OperationCallable
attachTrustOperationCallable() {
return stub.attachTrustOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Adds an AD trust to a domain.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* AttachTrustRequest request =
* AttachTrustRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .setTrust(Trust.newBuilder().build())
* .build();
* ApiFuture future =
* managedIdentitiesServiceClient.attachTrustCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable attachTrustCallable() {
return stub.attachTrustCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the DNS conditional forwarder.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* DomainName name = DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]");
* String targetDomainName = "targetDomainName2065239520";
* List targetDnsIpAddresses = new ArrayList<>();
* Domain response =
* managedIdentitiesServiceClient
* .reconfigureTrustAsync(name, targetDomainName, targetDnsIpAddresses)
* .get();
* }
* }
*
* @param name Required. The resource domain name, project name and location using the form:
* `projects/{project_id}/locations/global/domains/{domain_name}`
* @param targetDomainName Required. The fully-qualified target domain name which will be in trust
* with current domain.
* @param targetDnsIpAddresses Required. The target DNS server IP addresses to resolve the remote
* domain involved in the trust.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture reconfigureTrustAsync(
DomainName name, String targetDomainName, List targetDnsIpAddresses) {
ReconfigureTrustRequest request =
ReconfigureTrustRequest.newBuilder()
.setName(name == null ? null : name.toString())
.setTargetDomainName(targetDomainName)
.addAllTargetDnsIpAddresses(targetDnsIpAddresses)
.build();
return reconfigureTrustAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the DNS conditional forwarder.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* String name = DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString();
* String targetDomainName = "targetDomainName2065239520";
* List targetDnsIpAddresses = new ArrayList<>();
* Domain response =
* managedIdentitiesServiceClient
* .reconfigureTrustAsync(name, targetDomainName, targetDnsIpAddresses)
* .get();
* }
* }
*
* @param name Required. The resource domain name, project name and location using the form:
* `projects/{project_id}/locations/global/domains/{domain_name}`
* @param targetDomainName Required. The fully-qualified target domain name which will be in trust
* with current domain.
* @param targetDnsIpAddresses Required. The target DNS server IP addresses to resolve the remote
* domain involved in the trust.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture reconfigureTrustAsync(
String name, String targetDomainName, List targetDnsIpAddresses) {
ReconfigureTrustRequest request =
ReconfigureTrustRequest.newBuilder()
.setName(name)
.setTargetDomainName(targetDomainName)
.addAllTargetDnsIpAddresses(targetDnsIpAddresses)
.build();
return reconfigureTrustAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the DNS conditional forwarder.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* ReconfigureTrustRequest request =
* ReconfigureTrustRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .setTargetDomainName("targetDomainName2065239520")
* .addAllTargetDnsIpAddresses(new ArrayList())
* .build();
* Domain response = managedIdentitiesServiceClient.reconfigureTrustAsync(request).get();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture reconfigureTrustAsync(
ReconfigureTrustRequest request) {
return reconfigureTrustOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the DNS conditional forwarder.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* ReconfigureTrustRequest request =
* ReconfigureTrustRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .setTargetDomainName("targetDomainName2065239520")
* .addAllTargetDnsIpAddresses(new ArrayList())
* .build();
* OperationFuture future =
* managedIdentitiesServiceClient.reconfigureTrustOperationCallable().futureCall(request);
* // Do something.
* Domain response = future.get();
* }
* }
*/
public final OperationCallable
reconfigureTrustOperationCallable() {
return stub.reconfigureTrustOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the DNS conditional forwarder.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* ReconfigureTrustRequest request =
* ReconfigureTrustRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .setTargetDomainName("targetDomainName2065239520")
* .addAllTargetDnsIpAddresses(new ArrayList())
* .build();
* ApiFuture future =
* managedIdentitiesServiceClient.reconfigureTrustCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable reconfigureTrustCallable() {
return stub.reconfigureTrustCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Removes an AD trust.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* DomainName name = DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]");
* Trust trust = Trust.newBuilder().build();
* Domain response = managedIdentitiesServiceClient.detachTrustAsync(name, trust).get();
* }
* }
*
* @param name Required. The resource domain name, project name, and location using the form:
* `projects/{project_id}/locations/global/domains/{domain_name}`
* @param trust Required. The domain trust resource to removed.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture detachTrustAsync(DomainName name, Trust trust) {
DetachTrustRequest request =
DetachTrustRequest.newBuilder()
.setName(name == null ? null : name.toString())
.setTrust(trust)
.build();
return detachTrustAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Removes an AD trust.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* String name = DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString();
* Trust trust = Trust.newBuilder().build();
* Domain response = managedIdentitiesServiceClient.detachTrustAsync(name, trust).get();
* }
* }
*
* @param name Required. The resource domain name, project name, and location using the form:
* `projects/{project_id}/locations/global/domains/{domain_name}`
* @param trust Required. The domain trust resource to removed.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture detachTrustAsync(String name, Trust trust) {
DetachTrustRequest request =
DetachTrustRequest.newBuilder().setName(name).setTrust(trust).build();
return detachTrustAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Removes an AD trust.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* DetachTrustRequest request =
* DetachTrustRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .setTrust(Trust.newBuilder().build())
* .build();
* Domain response = managedIdentitiesServiceClient.detachTrustAsync(request).get();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture detachTrustAsync(DetachTrustRequest request) {
return detachTrustOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Removes an AD trust.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* DetachTrustRequest request =
* DetachTrustRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .setTrust(Trust.newBuilder().build())
* .build();
* OperationFuture future =
* managedIdentitiesServiceClient.detachTrustOperationCallable().futureCall(request);
* // Do something.
* Domain response = future.get();
* }
* }
*/
public final OperationCallable
detachTrustOperationCallable() {
return stub.detachTrustOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Removes an AD trust.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* DetachTrustRequest request =
* DetachTrustRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .setTrust(Trust.newBuilder().build())
* .build();
* ApiFuture future =
* managedIdentitiesServiceClient.detachTrustCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable detachTrustCallable() {
return stub.detachTrustCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Validates a trust state, that the target domain is reachable, and that the target domain is
* able to accept incoming trust requests.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* DomainName name = DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]");
* Trust trust = Trust.newBuilder().build();
* Domain response = managedIdentitiesServiceClient.validateTrustAsync(name, trust).get();
* }
* }
*
* @param name Required. The resource domain name, project name, and location using the form:
* `projects/{project_id}/locations/global/domains/{domain_name}`
* @param trust Required. The domain trust to validate trust state for.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture validateTrustAsync(
DomainName name, Trust trust) {
ValidateTrustRequest request =
ValidateTrustRequest.newBuilder()
.setName(name == null ? null : name.toString())
.setTrust(trust)
.build();
return validateTrustAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Validates a trust state, that the target domain is reachable, and that the target domain is
* able to accept incoming trust requests.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* String name = DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString();
* Trust trust = Trust.newBuilder().build();
* Domain response = managedIdentitiesServiceClient.validateTrustAsync(name, trust).get();
* }
* }
*
* @param name Required. The resource domain name, project name, and location using the form:
* `projects/{project_id}/locations/global/domains/{domain_name}`
* @param trust Required. The domain trust to validate trust state for.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture validateTrustAsync(String name, Trust trust) {
ValidateTrustRequest request =
ValidateTrustRequest.newBuilder().setName(name).setTrust(trust).build();
return validateTrustAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Validates a trust state, that the target domain is reachable, and that the target domain is
* able to accept incoming trust requests.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* ValidateTrustRequest request =
* ValidateTrustRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .setTrust(Trust.newBuilder().build())
* .build();
* Domain response = managedIdentitiesServiceClient.validateTrustAsync(request).get();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture validateTrustAsync(
ValidateTrustRequest request) {
return validateTrustOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Validates a trust state, that the target domain is reachable, and that the target domain is
* able to accept incoming trust requests.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* ValidateTrustRequest request =
* ValidateTrustRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .setTrust(Trust.newBuilder().build())
* .build();
* OperationFuture future =
* managedIdentitiesServiceClient.validateTrustOperationCallable().futureCall(request);
* // Do something.
* Domain response = future.get();
* }
* }
*/
public final OperationCallable
validateTrustOperationCallable() {
return stub.validateTrustOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Validates a trust state, that the target domain is reachable, and that the target domain is
* able to accept incoming trust requests.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ManagedIdentitiesServiceClient managedIdentitiesServiceClient =
* ManagedIdentitiesServiceClient.create()) {
* ValidateTrustRequest request =
* ValidateTrustRequest.newBuilder()
* .setName(DomainName.of("[PROJECT]", "[LOCATION]", "[DOMAIN]").toString())
* .setTrust(Trust.newBuilder().build())
* .build();
* ApiFuture future =
* managedIdentitiesServiceClient.validateTrustCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable validateTrustCallable() {
return stub.validateTrustCallable();
}
@Override
public final void close() {
stub.close();
}
@Override
public void shutdown() {
stub.shutdown();
}
@Override
public boolean isShutdown() {
return stub.isShutdown();
}
@Override
public boolean isTerminated() {
return stub.isTerminated();
}
@Override
public void shutdownNow() {
stub.shutdownNow();
}
@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return stub.awaitTermination(duration, unit);
}
public static class ListDomainsPagedResponse
extends AbstractPagedListResponse<
ListDomainsRequest,
ListDomainsResponse,
Domain,
ListDomainsPage,
ListDomainsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListDomainsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage, input -> new ListDomainsPagedResponse(input), MoreExecutors.directExecutor());
}
private ListDomainsPagedResponse(ListDomainsPage page) {
super(page, ListDomainsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListDomainsPage
extends AbstractPage {
private ListDomainsPage(
PageContext context,
ListDomainsResponse response) {
super(context, response);
}
private static ListDomainsPage createEmptyPage() {
return new ListDomainsPage(null, null);
}
@Override
protected ListDomainsPage createPage(
PageContext context,
ListDomainsResponse response) {
return new ListDomainsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListDomainsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListDomainsRequest,
ListDomainsResponse,
Domain,
ListDomainsPage,
ListDomainsFixedSizeCollection> {
private ListDomainsFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListDomainsFixedSizeCollection createEmptyCollection() {
return new ListDomainsFixedSizeCollection(null, 0);
}
@Override
protected ListDomainsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListDomainsFixedSizeCollection(pages, collectionSize);
}
}
}