Compute Engine v1 API - Class MachineImagesClient (2.3.0)

public abstract class MachineImagesClient

Reference documentation and code samples for the Compute Engine v1 API class MachineImagesClient.

MachineImages client wrapper, for convenient use.

Inheritance

Object > MachineImagesClient

Derived Types

Namespace

Google.Cloud.Compute.V1

Assembly

Google.Cloud.Compute.V1.dll

Remarks

The MachineImages API.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default MachineImages scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

DeleteOperationsClient

public virtual OperationsClient DeleteOperationsClient { get; }

The long-running operations client for Delete.

Property Value
TypeDescription
OperationsClient

GrpcClient

public virtual MachineImages.MachineImagesClient GrpcClient { get; }

The underlying gRPC MachineImages client

Property Value
TypeDescription
MachineImages.MachineImagesClient

InsertOperationsClient

public virtual OperationsClient InsertOperationsClient { get; }

The long-running operations client for Insert.

Property Value
TypeDescription
OperationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

Methods

Create()

public static MachineImagesClient Create()

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

Returns
TypeDescription
MachineImagesClient

The created MachineImagesClient.

CreateAsync(CancellationToken)

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

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<MachineImagesClient>

The task representing the created MachineImagesClient.

Delete(DeleteMachineImageRequest, CallSettings)

public virtual Operation<Operation, Operation> Delete(DeleteMachineImageRequest request, CallSettings callSettings = null)

Deletes the specified machine image. Deleting a machine image is permanent and cannot be undone.

Parameters
NameDescription
requestDeleteMachineImageRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Operation, Operation>

The RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = MachineImagesClient.Create();
// Initialize request argument(s)
DeleteMachineImageRequest request = new DeleteMachineImageRequest
{
    RequestId = "",
    MachineImage = "",
    Project = "",
};
// Make the request
lro::Operation<Operation, Operation> response = machineImagesClient.Delete(request);

// Poll until the returned long-running operation is complete
lro::Operation<Operation, Operation> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Operation 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
lro::Operation<Operation, Operation> retrievedResponse = machineImagesClient.PollOnceDelete(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Operation retrievedResult = retrievedResponse.Result;
}

Delete(String, String, CallSettings)

public virtual Operation<Operation, Operation> Delete(string project, string machineImage, CallSettings callSettings = null)

Deletes the specified machine image. Deleting a machine image is permanent and cannot be undone.

Parameters
NameDescription
projectString

Project ID for this request.

machineImageString

The name of the machine image to delete.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Operation, Operation>

The RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = MachineImagesClient.Create();
// Initialize request argument(s)
string project = "";
string machineImage = "";
// Make the request
lro::Operation<Operation, Operation> response = machineImagesClient.Delete(project, machineImage);

// Poll until the returned long-running operation is complete
lro::Operation<Operation, Operation> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Operation 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
lro::Operation<Operation, Operation> retrievedResponse = machineImagesClient.PollOnceDelete(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Operation retrievedResult = retrievedResponse.Result;
}

DeleteAsync(DeleteMachineImageRequest, CallSettings)

public virtual Task<Operation<Operation, Operation>> DeleteAsync(DeleteMachineImageRequest request, CallSettings callSettings = null)

Deletes the specified machine image. Deleting a machine image is permanent and cannot be undone.

Parameters
NameDescription
requestDeleteMachineImageRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Operation, Operation>>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
DeleteMachineImageRequest request = new DeleteMachineImageRequest
{
    RequestId = "",
    MachineImage = "",
    Project = "",
};
// Make the request
lro::Operation<Operation, Operation> response = await machineImagesClient.DeleteAsync(request);

// Poll until the returned long-running operation is complete
lro::Operation<Operation, Operation> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Operation 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
lro::Operation<Operation, Operation> retrievedResponse = await machineImagesClient.PollOnceDeleteAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Operation retrievedResult = retrievedResponse.Result;
}

DeleteAsync(DeleteMachineImageRequest, CancellationToken)

public virtual Task<Operation<Operation, Operation>> DeleteAsync(DeleteMachineImageRequest request, CancellationToken cancellationToken)

Deletes the specified machine image. Deleting a machine image is permanent and cannot be undone.

Parameters
NameDescription
requestDeleteMachineImageRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Operation, Operation>>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
DeleteMachineImageRequest request = new DeleteMachineImageRequest
{
    RequestId = "",
    MachineImage = "",
    Project = "",
};
// Make the request
lro::Operation<Operation, Operation> response = await machineImagesClient.DeleteAsync(request);

// Poll until the returned long-running operation is complete
lro::Operation<Operation, Operation> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Operation 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
lro::Operation<Operation, Operation> retrievedResponse = await machineImagesClient.PollOnceDeleteAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Operation retrievedResult = retrievedResponse.Result;
}

DeleteAsync(String, String, CallSettings)

public virtual Task<Operation<Operation, Operation>> DeleteAsync(string project, string machineImage, CallSettings callSettings = null)

Deletes the specified machine image. Deleting a machine image is permanent and cannot be undone.

Parameters
NameDescription
projectString

Project ID for this request.

machineImageString

The name of the machine image to delete.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Operation, Operation>>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string machineImage = "";
// Make the request
lro::Operation<Operation, Operation> response = await machineImagesClient.DeleteAsync(project, machineImage);

// Poll until the returned long-running operation is complete
lro::Operation<Operation, Operation> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Operation 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
lro::Operation<Operation, Operation> retrievedResponse = await machineImagesClient.PollOnceDeleteAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Operation retrievedResult = retrievedResponse.Result;
}

DeleteAsync(String, String, CancellationToken)

public virtual Task<Operation<Operation, Operation>> DeleteAsync(string project, string machineImage, CancellationToken cancellationToken)

Deletes the specified machine image. Deleting a machine image is permanent and cannot be undone.

Parameters
NameDescription
projectString

Project ID for this request.

machineImageString

The name of the machine image to delete.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Operation, Operation>>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string machineImage = "";
// Make the request
lro::Operation<Operation, Operation> response = await machineImagesClient.DeleteAsync(project, machineImage);

// Poll until the returned long-running operation is complete
lro::Operation<Operation, Operation> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Operation 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
lro::Operation<Operation, Operation> retrievedResponse = await machineImagesClient.PollOnceDeleteAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Operation retrievedResult = retrievedResponse.Result;
}

Get(GetMachineImageRequest, CallSettings)

public virtual MachineImage Get(GetMachineImageRequest request, CallSettings callSettings = null)

Returns the specified machine image. Gets a list of available machine images by making a list() request.

Parameters
NameDescription
requestGetMachineImageRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
MachineImage

The RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = MachineImagesClient.Create();
// Initialize request argument(s)
GetMachineImageRequest request = new GetMachineImageRequest
{
    MachineImage = "",
    Project = "",
};
// Make the request
MachineImage response = machineImagesClient.Get(request);

Get(String, String, CallSettings)

public virtual MachineImage Get(string project, string machineImage, CallSettings callSettings = null)

Returns the specified machine image. Gets a list of available machine images by making a list() request.

Parameters
NameDescription
projectString

Project ID for this request.

machineImageString

The name of the machine image.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
MachineImage

The RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = MachineImagesClient.Create();
// Initialize request argument(s)
string project = "";
string machineImage = "";
// Make the request
MachineImage response = machineImagesClient.Get(project, machineImage);

GetAsync(GetMachineImageRequest, CallSettings)

public virtual Task<MachineImage> GetAsync(GetMachineImageRequest request, CallSettings callSettings = null)

Returns the specified machine image. Gets a list of available machine images by making a list() request.

Parameters
NameDescription
requestGetMachineImageRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<MachineImage>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
GetMachineImageRequest request = new GetMachineImageRequest
{
    MachineImage = "",
    Project = "",
};
// Make the request
MachineImage response = await machineImagesClient.GetAsync(request);

GetAsync(GetMachineImageRequest, CancellationToken)

public virtual Task<MachineImage> GetAsync(GetMachineImageRequest request, CancellationToken cancellationToken)

Returns the specified machine image. Gets a list of available machine images by making a list() request.

Parameters
NameDescription
requestGetMachineImageRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<MachineImage>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
GetMachineImageRequest request = new GetMachineImageRequest
{
    MachineImage = "",
    Project = "",
};
// Make the request
MachineImage response = await machineImagesClient.GetAsync(request);

GetAsync(String, String, CallSettings)

public virtual Task<MachineImage> GetAsync(string project, string machineImage, CallSettings callSettings = null)

Returns the specified machine image. Gets a list of available machine images by making a list() request.

Parameters
NameDescription
projectString

Project ID for this request.

machineImageString

The name of the machine image.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<MachineImage>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string machineImage = "";
// Make the request
MachineImage response = await machineImagesClient.GetAsync(project, machineImage);

GetAsync(String, String, CancellationToken)

public virtual Task<MachineImage> GetAsync(string project, string machineImage, CancellationToken cancellationToken)

Returns the specified machine image. Gets a list of available machine images by making a list() request.

Parameters
NameDescription
projectString

Project ID for this request.

machineImageString

The name of the machine image.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<MachineImage>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string machineImage = "";
// Make the request
MachineImage response = await machineImagesClient.GetAsync(project, machineImage);

GetIamPolicy(GetIamPolicyMachineImageRequest, CallSettings)

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

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

Parameters
NameDescription
requestGetIamPolicyMachineImageRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = MachineImagesClient.Create();
// Initialize request argument(s)
GetIamPolicyMachineImageRequest request = new GetIamPolicyMachineImageRequest
{
    Resource = "",
    Project = "",
    OptionsRequestedPolicyVersion = 0,
};
// Make the request
Policy response = machineImagesClient.GetIamPolicy(request);

GetIamPolicy(String, String, CallSettings)

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

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

Parameters
NameDescription
projectString

Project ID for this request.

resourceString

Name or id of the resource for this request.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = MachineImagesClient.Create();
// Initialize request argument(s)
string project = "";
string resource = "";
// Make the request
Policy response = machineImagesClient.GetIamPolicy(project, resource);

GetIamPolicyAsync(GetIamPolicyMachineImageRequest, CallSettings)

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

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

Parameters
NameDescription
requestGetIamPolicyMachineImageRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
GetIamPolicyMachineImageRequest request = new GetIamPolicyMachineImageRequest
{
    Resource = "",
    Project = "",
    OptionsRequestedPolicyVersion = 0,
};
// Make the request
Policy response = await machineImagesClient.GetIamPolicyAsync(request);

GetIamPolicyAsync(GetIamPolicyMachineImageRequest, CancellationToken)

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

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

Parameters
NameDescription
requestGetIamPolicyMachineImageRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
GetIamPolicyMachineImageRequest request = new GetIamPolicyMachineImageRequest
{
    Resource = "",
    Project = "",
    OptionsRequestedPolicyVersion = 0,
};
// Make the request
Policy response = await machineImagesClient.GetIamPolicyAsync(request);

GetIamPolicyAsync(String, String, CallSettings)

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

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

Parameters
NameDescription
projectString

Project ID for this request.

resourceString

Name or id of the resource for this request.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string resource = "";
// Make the request
Policy response = await machineImagesClient.GetIamPolicyAsync(project, resource);

GetIamPolicyAsync(String, String, CancellationToken)

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

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

Parameters
NameDescription
projectString

Project ID for this request.

resourceString

Name or id of the resource for this request.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string resource = "";
// Make the request
Policy response = await machineImagesClient.GetIamPolicyAsync(project, resource);

Insert(InsertMachineImageRequest, CallSettings)

public virtual Operation<Operation, Operation> Insert(InsertMachineImageRequest request, CallSettings callSettings = null)

Creates a machine image in the specified project using the data that is included in the request. If you are creating a new machine image to update an existing instance, your new machine image should use the same network or, if applicable, the same subnetwork as the original instance.

Parameters
NameDescription
requestInsertMachineImageRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Operation, Operation>

The RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = MachineImagesClient.Create();
// Initialize request argument(s)
InsertMachineImageRequest request = new InsertMachineImageRequest
{
    RequestId = "",
    MachineImageResource = new MachineImage(),
    Project = "",
    SourceInstance = "",
};
// Make the request
lro::Operation<Operation, Operation> response = machineImagesClient.Insert(request);

// Poll until the returned long-running operation is complete
lro::Operation<Operation, Operation> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Operation 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
lro::Operation<Operation, Operation> retrievedResponse = machineImagesClient.PollOnceInsert(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Operation retrievedResult = retrievedResponse.Result;
}

Insert(String, MachineImage, CallSettings)

public virtual Operation<Operation, Operation> Insert(string project, MachineImage machineImageResource, CallSettings callSettings = null)

Creates a machine image in the specified project using the data that is included in the request. If you are creating a new machine image to update an existing instance, your new machine image should use the same network or, if applicable, the same subnetwork as the original instance.

Parameters
NameDescription
projectString

Project ID for this request.

machineImageResourceMachineImage

The body resource for this request

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Operation, Operation>

The RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = MachineImagesClient.Create();
// Initialize request argument(s)
string project = "";
MachineImage machineImageResource = new MachineImage();
// Make the request
lro::Operation<Operation, Operation> response = machineImagesClient.Insert(project, machineImageResource);

// Poll until the returned long-running operation is complete
lro::Operation<Operation, Operation> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Operation 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
lro::Operation<Operation, Operation> retrievedResponse = machineImagesClient.PollOnceInsert(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Operation retrievedResult = retrievedResponse.Result;
}

InsertAsync(InsertMachineImageRequest, CallSettings)

public virtual Task<Operation<Operation, Operation>> InsertAsync(InsertMachineImageRequest request, CallSettings callSettings = null)

Creates a machine image in the specified project using the data that is included in the request. If you are creating a new machine image to update an existing instance, your new machine image should use the same network or, if applicable, the same subnetwork as the original instance.

Parameters
NameDescription
requestInsertMachineImageRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Operation, Operation>>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
InsertMachineImageRequest request = new InsertMachineImageRequest
{
    RequestId = "",
    MachineImageResource = new MachineImage(),
    Project = "",
    SourceInstance = "",
};
// Make the request
lro::Operation<Operation, Operation> response = await machineImagesClient.InsertAsync(request);

// Poll until the returned long-running operation is complete
lro::Operation<Operation, Operation> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Operation 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
lro::Operation<Operation, Operation> retrievedResponse = await machineImagesClient.PollOnceInsertAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Operation retrievedResult = retrievedResponse.Result;
}

InsertAsync(InsertMachineImageRequest, CancellationToken)

public virtual Task<Operation<Operation, Operation>> InsertAsync(InsertMachineImageRequest request, CancellationToken cancellationToken)

Creates a machine image in the specified project using the data that is included in the request. If you are creating a new machine image to update an existing instance, your new machine image should use the same network or, if applicable, the same subnetwork as the original instance.

Parameters
NameDescription
requestInsertMachineImageRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Operation, Operation>>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
InsertMachineImageRequest request = new InsertMachineImageRequest
{
    RequestId = "",
    MachineImageResource = new MachineImage(),
    Project = "",
    SourceInstance = "",
};
// Make the request
lro::Operation<Operation, Operation> response = await machineImagesClient.InsertAsync(request);

// Poll until the returned long-running operation is complete
lro::Operation<Operation, Operation> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Operation 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
lro::Operation<Operation, Operation> retrievedResponse = await machineImagesClient.PollOnceInsertAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Operation retrievedResult = retrievedResponse.Result;
}

InsertAsync(String, MachineImage, CallSettings)

public virtual Task<Operation<Operation, Operation>> InsertAsync(string project, MachineImage machineImageResource, CallSettings callSettings = null)

Creates a machine image in the specified project using the data that is included in the request. If you are creating a new machine image to update an existing instance, your new machine image should use the same network or, if applicable, the same subnetwork as the original instance.

Parameters
NameDescription
projectString

Project ID for this request.

machineImageResourceMachineImage

The body resource for this request

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Operation, Operation>>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
MachineImage machineImageResource = new MachineImage();
// Make the request
lro::Operation<Operation, Operation> response = await machineImagesClient.InsertAsync(project, machineImageResource);

// Poll until the returned long-running operation is complete
lro::Operation<Operation, Operation> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Operation 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
lro::Operation<Operation, Operation> retrievedResponse = await machineImagesClient.PollOnceInsertAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Operation retrievedResult = retrievedResponse.Result;
}

InsertAsync(String, MachineImage, CancellationToken)

public virtual Task<Operation<Operation, Operation>> InsertAsync(string project, MachineImage machineImageResource, CancellationToken cancellationToken)

Creates a machine image in the specified project using the data that is included in the request. If you are creating a new machine image to update an existing instance, your new machine image should use the same network or, if applicable, the same subnetwork as the original instance.

Parameters
NameDescription
projectString

Project ID for this request.

machineImageResourceMachineImage

The body resource for this request

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Operation, Operation>>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
MachineImage machineImageResource = new MachineImage();
// Make the request
lro::Operation<Operation, Operation> response = await machineImagesClient.InsertAsync(project, machineImageResource);

// Poll until the returned long-running operation is complete
lro::Operation<Operation, Operation> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Operation 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
lro::Operation<Operation, Operation> retrievedResponse = await machineImagesClient.PollOnceInsertAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Operation retrievedResult = retrievedResponse.Result;
}

List(ListMachineImagesRequest, CallSettings)

public virtual PagedEnumerable<MachineImageList, MachineImage> List(ListMachineImagesRequest request, CallSettings callSettings = null)

Retrieves a list of machine images that are contained within the specified project.

Parameters
NameDescription
requestListMachineImagesRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<MachineImageList, MachineImage>

A pageable sequence of MachineImage resources.

Example
// Create client
MachineImagesClient machineImagesClient = MachineImagesClient.Create();
// Initialize request argument(s)
ListMachineImagesRequest request = new ListMachineImagesRequest
{
    OrderBy = "",
    Project = "",
    Filter = "",
    ReturnPartialSuccess = false,
};
// Make the request
PagedEnumerable<MachineImageList, MachineImage> response = machineImagesClient.List(request);

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

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

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

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

public virtual PagedEnumerable<MachineImageList, MachineImage> List(string project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieves a list of machine images that are contained within the specified project.

Parameters
NameDescription
projectString

Project ID for this request.

pageTokenString

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

pageSizeNullable<Int32>

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<MachineImageList, MachineImage>

A pageable sequence of MachineImage resources.

Example
// Create client
MachineImagesClient machineImagesClient = MachineImagesClient.Create();
// Initialize request argument(s)
string project = "";
// Make the request
PagedEnumerable<MachineImageList, MachineImage> response = machineImagesClient.List(project);

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

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

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

ListAsync(ListMachineImagesRequest, CallSettings)

public virtual PagedAsyncEnumerable<MachineImageList, MachineImage> ListAsync(ListMachineImagesRequest request, CallSettings callSettings = null)

Retrieves a list of machine images that are contained within the specified project.

Parameters
NameDescription
requestListMachineImagesRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<MachineImageList, MachineImage>

A pageable asynchronous sequence of MachineImage resources.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
ListMachineImagesRequest request = new ListMachineImagesRequest
{
    OrderBy = "",
    Project = "",
    Filter = "",
    ReturnPartialSuccess = false,
};
// Make the request
PagedAsyncEnumerable<MachineImageList, MachineImage> response = machineImagesClient.ListAsync(request);

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

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

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

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

public virtual PagedAsyncEnumerable<MachineImageList, MachineImage> ListAsync(string project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieves a list of machine images that are contained within the specified project.

Parameters
NameDescription
projectString

Project ID for this request.

pageTokenString

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

pageSizeNullable<Int32>

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<MachineImageList, MachineImage>

A pageable asynchronous sequence of MachineImage resources.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
// Make the request
PagedAsyncEnumerable<MachineImageList, MachineImage> response = machineImagesClient.ListAsync(project);

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

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

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

PollOnceDelete(String, CallSettings)

public virtual Operation<Operation, Operation> PollOnceDelete(string operationName, CallSettings callSettings = null)

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

Parameters
NameDescription
operationNameString

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Operation, Operation>

The result of polling the operation.

PollOnceDeleteAsync(String, CallSettings)

public virtual Task<Operation<Operation, Operation>> PollOnceDeleteAsync(string operationName, CallSettings callSettings = null)

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

Parameters
NameDescription
operationNameString

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Operation, Operation>>

A task representing the result of polling the operation.

PollOnceInsert(String, CallSettings)

public virtual Operation<Operation, Operation> PollOnceInsert(string operationName, CallSettings callSettings = null)

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

Parameters
NameDescription
operationNameString

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Operation, Operation>

The result of polling the operation.

PollOnceInsertAsync(String, CallSettings)

public virtual Task<Operation<Operation, Operation>> PollOnceInsertAsync(string operationName, CallSettings callSettings = null)

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

Parameters
NameDescription
operationNameString

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Operation, Operation>>

A task representing the result of polling the operation.

SetIamPolicy(SetIamPolicyMachineImageRequest, CallSettings)

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

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

Parameters
NameDescription
requestSetIamPolicyMachineImageRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = MachineImagesClient.Create();
// Initialize request argument(s)
SetIamPolicyMachineImageRequest request = new SetIamPolicyMachineImageRequest
{
    Resource = "",
    Project = "",
    GlobalSetPolicyRequestResource = new GlobalSetPolicyRequest(),
};
// Make the request
Policy response = machineImagesClient.SetIamPolicy(request);

SetIamPolicy(String, String, GlobalSetPolicyRequest, CallSettings)

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

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

Parameters
NameDescription
projectString

Project ID for this request.

resourceString

Name or id of the resource for this request.

globalSetPolicyRequestResourceGlobalSetPolicyRequest

The body resource for this request

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = MachineImagesClient.Create();
// Initialize request argument(s)
string project = "";
string resource = "";
GlobalSetPolicyRequest globalSetPolicyRequestResource = new GlobalSetPolicyRequest();
// Make the request
Policy response = machineImagesClient.SetIamPolicy(project, resource, globalSetPolicyRequestResource);

SetIamPolicyAsync(SetIamPolicyMachineImageRequest, CallSettings)

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

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

Parameters
NameDescription
requestSetIamPolicyMachineImageRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
SetIamPolicyMachineImageRequest request = new SetIamPolicyMachineImageRequest
{
    Resource = "",
    Project = "",
    GlobalSetPolicyRequestResource = new GlobalSetPolicyRequest(),
};
// Make the request
Policy response = await machineImagesClient.SetIamPolicyAsync(request);

SetIamPolicyAsync(SetIamPolicyMachineImageRequest, CancellationToken)

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

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

Parameters
NameDescription
requestSetIamPolicyMachineImageRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
SetIamPolicyMachineImageRequest request = new SetIamPolicyMachineImageRequest
{
    Resource = "",
    Project = "",
    GlobalSetPolicyRequestResource = new GlobalSetPolicyRequest(),
};
// Make the request
Policy response = await machineImagesClient.SetIamPolicyAsync(request);

SetIamPolicyAsync(String, String, GlobalSetPolicyRequest, CallSettings)

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

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

Parameters
NameDescription
projectString

Project ID for this request.

resourceString

Name or id of the resource for this request.

globalSetPolicyRequestResourceGlobalSetPolicyRequest

The body resource for this request

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string resource = "";
GlobalSetPolicyRequest globalSetPolicyRequestResource = new GlobalSetPolicyRequest();
// Make the request
Policy response = await machineImagesClient.SetIamPolicyAsync(project, resource, globalSetPolicyRequestResource);

SetIamPolicyAsync(String, String, GlobalSetPolicyRequest, CancellationToken)

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

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

Parameters
NameDescription
projectString

Project ID for this request.

resourceString

Name or id of the resource for this request.

globalSetPolicyRequestResourceGlobalSetPolicyRequest

The body resource for this request

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string resource = "";
GlobalSetPolicyRequest globalSetPolicyRequestResource = new GlobalSetPolicyRequest();
// Make the request
Policy response = await machineImagesClient.SetIamPolicyAsync(project, resource, globalSetPolicyRequestResource);

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

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

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

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

TestIamPermissions(TestIamPermissionsMachineImageRequest, CallSettings)

public virtual TestPermissionsResponse TestIamPermissions(TestIamPermissionsMachineImageRequest request, CallSettings callSettings = null)

Returns permissions that a caller has on the specified resource.

Parameters
NameDescription
requestTestIamPermissionsMachineImageRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TestPermissionsResponse

The RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = MachineImagesClient.Create();
// Initialize request argument(s)
TestIamPermissionsMachineImageRequest request = new TestIamPermissionsMachineImageRequest
{
    Resource = "",
    Project = "",
    TestPermissionsRequestResource = new TestPermissionsRequest(),
};
// Make the request
TestPermissionsResponse response = machineImagesClient.TestIamPermissions(request);

TestIamPermissions(String, String, TestPermissionsRequest, CallSettings)

public virtual TestPermissionsResponse TestIamPermissions(string project, string resource, TestPermissionsRequest testPermissionsRequestResource, CallSettings callSettings = null)

Returns permissions that a caller has on the specified resource.

Parameters
NameDescription
projectString

Project ID for this request.

resourceString

Name or id of the resource for this request.

testPermissionsRequestResourceTestPermissionsRequest

The body resource for this request

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TestPermissionsResponse

The RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = MachineImagesClient.Create();
// Initialize request argument(s)
string project = "";
string resource = "";
TestPermissionsRequest testPermissionsRequestResource = new TestPermissionsRequest();
// Make the request
TestPermissionsResponse response = machineImagesClient.TestIamPermissions(project, resource, testPermissionsRequestResource);

TestIamPermissionsAsync(TestIamPermissionsMachineImageRequest, CallSettings)

public virtual Task<TestPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsMachineImageRequest request, CallSettings callSettings = null)

Returns permissions that a caller has on the specified resource.

Parameters
NameDescription
requestTestIamPermissionsMachineImageRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TestPermissionsResponse>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
TestIamPermissionsMachineImageRequest request = new TestIamPermissionsMachineImageRequest
{
    Resource = "",
    Project = "",
    TestPermissionsRequestResource = new TestPermissionsRequest(),
};
// Make the request
TestPermissionsResponse response = await machineImagesClient.TestIamPermissionsAsync(request);

TestIamPermissionsAsync(TestIamPermissionsMachineImageRequest, CancellationToken)

public virtual Task<TestPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsMachineImageRequest request, CancellationToken cancellationToken)

Returns permissions that a caller has on the specified resource.

Parameters
NameDescription
requestTestIamPermissionsMachineImageRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TestPermissionsResponse>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
TestIamPermissionsMachineImageRequest request = new TestIamPermissionsMachineImageRequest
{
    Resource = "",
    Project = "",
    TestPermissionsRequestResource = new TestPermissionsRequest(),
};
// Make the request
TestPermissionsResponse response = await machineImagesClient.TestIamPermissionsAsync(request);

TestIamPermissionsAsync(String, String, TestPermissionsRequest, CallSettings)

public virtual Task<TestPermissionsResponse> TestIamPermissionsAsync(string project, string resource, TestPermissionsRequest testPermissionsRequestResource, CallSettings callSettings = null)

Returns permissions that a caller has on the specified resource.

Parameters
NameDescription
projectString

Project ID for this request.

resourceString

Name or id of the resource for this request.

testPermissionsRequestResourceTestPermissionsRequest

The body resource for this request

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TestPermissionsResponse>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string resource = "";
TestPermissionsRequest testPermissionsRequestResource = new TestPermissionsRequest();
// Make the request
TestPermissionsResponse response = await machineImagesClient.TestIamPermissionsAsync(project, resource, testPermissionsRequestResource);

TestIamPermissionsAsync(String, String, TestPermissionsRequest, CancellationToken)

public virtual Task<TestPermissionsResponse> TestIamPermissionsAsync(string project, string resource, TestPermissionsRequest testPermissionsRequestResource, CancellationToken cancellationToken)

Returns permissions that a caller has on the specified resource.

Parameters
NameDescription
projectString

Project ID for this request.

resourceString

Name or id of the resource for this request.

testPermissionsRequestResourceTestPermissionsRequest

The body resource for this request

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TestPermissionsResponse>

A Task containing the RPC response.

Example
// Create client
MachineImagesClient machineImagesClient = await MachineImagesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string resource = "";
TestPermissionsRequest testPermissionsRequestResource = new TestPermissionsRequest();
// Make the request
TestPermissionsResponse response = await machineImagesClient.TestIamPermissionsAsync(project, resource, testPermissionsRequestResource);