AlloyDB v1alpha API - Class AlloyDBCSQLAdminClient (1.0.0-alpha11)

public abstract class AlloyDBCSQLAdminClient

Reference documentation and code samples for the AlloyDB v1alpha API class AlloyDBCSQLAdminClient.

AlloyDBCSQLAdmin client wrapper, for convenient use.

Inheritance

object > AlloyDBCSQLAdminClient

Namespace

Google.Cloud.AlloyDb.V1Alpha

Assembly

Google.Cloud.AlloyDb.V1Alpha.dll

Remarks

Service for interactions with CloudSQL.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default AlloyDBCSQLAdmin scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default AlloyDBCSQLAdmin scopes are:

GrpcClient

public virtual AlloyDBCSQLAdmin.AlloyDBCSQLAdminClient GrpcClient { get; }

The underlying gRPC AlloyDBCSQLAdmin client

Property Value
Type Description
AlloyDBCSQLAdminAlloyDBCSQLAdminClient

IAMPolicyClient

public virtual IAMPolicyClient IAMPolicyClient { get; }

The IAMPolicyClient associated with this client.

Property Value
Type Description
IAMPolicyClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

RestoreFromCloudSQLOperationsClient

public virtual OperationsClient RestoreFromCloudSQLOperationsClient { get; }

The long-running operations client for RestoreFromCloudSQL.

Property Value
Type Description
OperationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static AlloyDBCSQLAdminClient Create()

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

Returns
Type Description
AlloyDBCSQLAdminClient

The created AlloyDBCSQLAdminClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskAlloyDBCSQLAdminClient

The task representing the created AlloyDBCSQLAdminClient.

PollOnceRestoreFromCloudSQL(string, CallSettings)

public virtual Operation<Cluster, OperationMetadata> PollOnceRestoreFromCloudSQL(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of RestoreFromCloudSQL .

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationClusterOperationMetadata

The result of polling the operation.

PollOnceRestoreFromCloudSQLAsync(string, CallSettings)

public virtual Task<Operation<Cluster, OperationMetadata>> PollOnceRestoreFromCloudSQLAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of RestoreFromCloudSQL.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationClusterOperationMetadata

A task representing the result of polling the operation.

RestoreFromCloudSQL(LocationName, string, CallSettings)

public virtual Operation<Cluster, OperationMetadata> RestoreFromCloudSQL(LocationName parent, string clusterId, CallSettings callSettings = null)

Restores an AlloyDB cluster from a CloudSQL resource.

Parameters
Name Description
parent LocationName

Required. The location of the new cluster. For the required format, see the comment on Cluster.name field.

clusterId string

Required. ID of the requesting object.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationClusterOperationMetadata

The RPC response.

Example
// Create client
AlloyDBCSQLAdminClient alloyDBCSQLAdminClient = AlloyDBCSQLAdminClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string clusterId = "";
// Make the request
Operation<Cluster, OperationMetadata> response = alloyDBCSQLAdminClient.RestoreFromCloudSQL(parent, clusterId);

// Poll until the returned long-running operation is complete
Operation<Cluster, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Cluster result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Cluster, OperationMetadata> retrievedResponse = alloyDBCSQLAdminClient.PollOnceRestoreFromCloudSQL(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Cluster retrievedResult = retrievedResponse.Result;
}

RestoreFromCloudSQL(RestoreFromCloudSQLRequest, CallSettings)

public virtual Operation<Cluster, OperationMetadata> RestoreFromCloudSQL(RestoreFromCloudSQLRequest request, CallSettings callSettings = null)

Restores an AlloyDB cluster from a CloudSQL resource.

Parameters
Name Description
request RestoreFromCloudSQLRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationClusterOperationMetadata

The RPC response.

Example
// Create client
AlloyDBCSQLAdminClient alloyDBCSQLAdminClient = AlloyDBCSQLAdminClient.Create();
// Initialize request argument(s)
RestoreFromCloudSQLRequest request = new RestoreFromCloudSQLRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    ClusterId = "",
    Cluster = new Cluster(),
    CloudsqlBackupRunSource = new CloudSQLBackupRunSource(),
};
// Make the request
Operation<Cluster, OperationMetadata> response = alloyDBCSQLAdminClient.RestoreFromCloudSQL(request);

// Poll until the returned long-running operation is complete
Operation<Cluster, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Cluster result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Cluster, OperationMetadata> retrievedResponse = alloyDBCSQLAdminClient.PollOnceRestoreFromCloudSQL(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Cluster retrievedResult = retrievedResponse.Result;
}

RestoreFromCloudSQL(string, string, CallSettings)

public virtual Operation<Cluster, OperationMetadata> RestoreFromCloudSQL(string parent, string clusterId, CallSettings callSettings = null)

Restores an AlloyDB cluster from a CloudSQL resource.

Parameters
Name Description
parent string

Required. The location of the new cluster. For the required format, see the comment on Cluster.name field.

clusterId string

Required. ID of the requesting object.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationClusterOperationMetadata

The RPC response.

Example
// Create client
AlloyDBCSQLAdminClient alloyDBCSQLAdminClient = AlloyDBCSQLAdminClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string clusterId = "";
// Make the request
Operation<Cluster, OperationMetadata> response = alloyDBCSQLAdminClient.RestoreFromCloudSQL(parent, clusterId);

// Poll until the returned long-running operation is complete
Operation<Cluster, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Cluster result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Cluster, OperationMetadata> retrievedResponse = alloyDBCSQLAdminClient.PollOnceRestoreFromCloudSQL(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Cluster retrievedResult = retrievedResponse.Result;
}

RestoreFromCloudSQLAsync(LocationName, string, CallSettings)

public virtual Task<Operation<Cluster, OperationMetadata>> RestoreFromCloudSQLAsync(LocationName parent, string clusterId, CallSettings callSettings = null)

Restores an AlloyDB cluster from a CloudSQL resource.

Parameters
Name Description
parent LocationName

Required. The location of the new cluster. For the required format, see the comment on Cluster.name field.

clusterId string

Required. ID of the requesting object.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationClusterOperationMetadata

A Task containing the RPC response.

Example
// Create client
AlloyDBCSQLAdminClient alloyDBCSQLAdminClient = await AlloyDBCSQLAdminClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string clusterId = "";
// Make the request
Operation<Cluster, OperationMetadata> response = await alloyDBCSQLAdminClient.RestoreFromCloudSQLAsync(parent, clusterId);

// Poll until the returned long-running operation is complete
Operation<Cluster, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Cluster result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Cluster, OperationMetadata> retrievedResponse = await alloyDBCSQLAdminClient.PollOnceRestoreFromCloudSQLAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Cluster retrievedResult = retrievedResponse.Result;
}

RestoreFromCloudSQLAsync(LocationName, string, CancellationToken)

public virtual Task<Operation<Cluster, OperationMetadata>> RestoreFromCloudSQLAsync(LocationName parent, string clusterId, CancellationToken cancellationToken)

Restores an AlloyDB cluster from a CloudSQL resource.

Parameters
Name Description
parent LocationName

Required. The location of the new cluster. For the required format, see the comment on Cluster.name field.

clusterId string

Required. ID of the requesting object.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationClusterOperationMetadata

A Task containing the RPC response.

Example
// Create client
AlloyDBCSQLAdminClient alloyDBCSQLAdminClient = await AlloyDBCSQLAdminClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string clusterId = "";
// Make the request
Operation<Cluster, OperationMetadata> response = await alloyDBCSQLAdminClient.RestoreFromCloudSQLAsync(parent, clusterId);

// Poll until the returned long-running operation is complete
Operation<Cluster, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Cluster result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Cluster, OperationMetadata> retrievedResponse = await alloyDBCSQLAdminClient.PollOnceRestoreFromCloudSQLAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Cluster retrievedResult = retrievedResponse.Result;
}

RestoreFromCloudSQLAsync(RestoreFromCloudSQLRequest, CallSettings)

public virtual Task<Operation<Cluster, OperationMetadata>> RestoreFromCloudSQLAsync(RestoreFromCloudSQLRequest request, CallSettings callSettings = null)

Restores an AlloyDB cluster from a CloudSQL resource.

Parameters
Name Description
request RestoreFromCloudSQLRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationClusterOperationMetadata

A Task containing the RPC response.

Example
// Create client
AlloyDBCSQLAdminClient alloyDBCSQLAdminClient = await AlloyDBCSQLAdminClient.CreateAsync();
// Initialize request argument(s)
RestoreFromCloudSQLRequest request = new RestoreFromCloudSQLRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    ClusterId = "",
    Cluster = new Cluster(),
    CloudsqlBackupRunSource = new CloudSQLBackupRunSource(),
};
// Make the request
Operation<Cluster, OperationMetadata> response = await alloyDBCSQLAdminClient.RestoreFromCloudSQLAsync(request);

// Poll until the returned long-running operation is complete
Operation<Cluster, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Cluster result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Cluster, OperationMetadata> retrievedResponse = await alloyDBCSQLAdminClient.PollOnceRestoreFromCloudSQLAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Cluster retrievedResult = retrievedResponse.Result;
}

RestoreFromCloudSQLAsync(RestoreFromCloudSQLRequest, CancellationToken)

public virtual Task<Operation<Cluster, OperationMetadata>> RestoreFromCloudSQLAsync(RestoreFromCloudSQLRequest request, CancellationToken cancellationToken)

Restores an AlloyDB cluster from a CloudSQL resource.

Parameters
Name Description
request RestoreFromCloudSQLRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationClusterOperationMetadata

A Task containing the RPC response.

Example
// Create client
AlloyDBCSQLAdminClient alloyDBCSQLAdminClient = await AlloyDBCSQLAdminClient.CreateAsync();
// Initialize request argument(s)
RestoreFromCloudSQLRequest request = new RestoreFromCloudSQLRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    ClusterId = "",
    Cluster = new Cluster(),
    CloudsqlBackupRunSource = new CloudSQLBackupRunSource(),
};
// Make the request
Operation<Cluster, OperationMetadata> response = await alloyDBCSQLAdminClient.RestoreFromCloudSQLAsync(request);

// Poll until the returned long-running operation is complete
Operation<Cluster, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Cluster result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Cluster, OperationMetadata> retrievedResponse = await alloyDBCSQLAdminClient.PollOnceRestoreFromCloudSQLAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Cluster retrievedResult = retrievedResponse.Result;
}

RestoreFromCloudSQLAsync(string, string, CallSettings)

public virtual Task<Operation<Cluster, OperationMetadata>> RestoreFromCloudSQLAsync(string parent, string clusterId, CallSettings callSettings = null)

Restores an AlloyDB cluster from a CloudSQL resource.

Parameters
Name Description
parent string

Required. The location of the new cluster. For the required format, see the comment on Cluster.name field.

clusterId string

Required. ID of the requesting object.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationClusterOperationMetadata

A Task containing the RPC response.

Example
// Create client
AlloyDBCSQLAdminClient alloyDBCSQLAdminClient = await AlloyDBCSQLAdminClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string clusterId = "";
// Make the request
Operation<Cluster, OperationMetadata> response = await alloyDBCSQLAdminClient.RestoreFromCloudSQLAsync(parent, clusterId);

// Poll until the returned long-running operation is complete
Operation<Cluster, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Cluster result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Cluster, OperationMetadata> retrievedResponse = await alloyDBCSQLAdminClient.PollOnceRestoreFromCloudSQLAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Cluster retrievedResult = retrievedResponse.Result;
}

RestoreFromCloudSQLAsync(string, string, CancellationToken)

public virtual Task<Operation<Cluster, OperationMetadata>> RestoreFromCloudSQLAsync(string parent, string clusterId, CancellationToken cancellationToken)

Restores an AlloyDB cluster from a CloudSQL resource.

Parameters
Name Description
parent string

Required. The location of the new cluster. For the required format, see the comment on Cluster.name field.

clusterId string

Required. ID of the requesting object.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationClusterOperationMetadata

A Task containing the RPC response.

Example
// Create client
AlloyDBCSQLAdminClient alloyDBCSQLAdminClient = await AlloyDBCSQLAdminClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string clusterId = "";
// Make the request
Operation<Cluster, OperationMetadata> response = await alloyDBCSQLAdminClient.RestoreFromCloudSQLAsync(parent, clusterId);

// Poll until the returned long-running operation is complete
Operation<Cluster, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Cluster result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Cluster, OperationMetadata> retrievedResponse = await alloyDBCSQLAdminClient.PollOnceRestoreFromCloudSQLAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Cluster retrievedResult = retrievedResponse.Result;
}

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
Type Description
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.