Compute Engine v1 API - Class NetworkProfilesClient (3.2.0)

public abstract class NetworkProfilesClient

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

NetworkProfiles client wrapper, for convenient use.

Inheritance

object > NetworkProfilesClient

Namespace

Google.Cloud.Compute.V1

Assembly

Google.Cloud.Compute.V1.dll

Remarks

The NetworkProfiles API.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default NetworkProfiles scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

GrpcClient

public virtual NetworkProfiles.NetworkProfilesClient GrpcClient { get; }

The underlying gRPC NetworkProfiles client

Property Value
Type Description
NetworkProfilesNetworkProfilesClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static NetworkProfilesClient Create()

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

Returns
Type Description
NetworkProfilesClient

The created NetworkProfilesClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskNetworkProfilesClient

The task representing the created NetworkProfilesClient.

Get(GetNetworkProfileRequest, CallSettings)

public virtual NetworkProfile Get(GetNetworkProfileRequest request, CallSettings callSettings = null)

Returns the specified network profile.

Parameters
Name Description
request GetNetworkProfileRequest

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
NetworkProfile

The RPC response.

Example
// Create client
NetworkProfilesClient networkProfilesClient = NetworkProfilesClient.Create();
// Initialize request argument(s)
GetNetworkProfileRequest request = new GetNetworkProfileRequest
{
    NetworkProfile = "",
    Project = "",
};
// Make the request
NetworkProfile response = networkProfilesClient.Get(request);

Get(string, string, CallSettings)

public virtual NetworkProfile Get(string project, string networkProfile, CallSettings callSettings = null)

Returns the specified network profile.

Parameters
Name Description
project string

Project ID for this request.

networkProfile string

Name of the network profile to return.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
NetworkProfile

The RPC response.

Example
// Create client
NetworkProfilesClient networkProfilesClient = NetworkProfilesClient.Create();
// Initialize request argument(s)
string project = "";
string networkProfile = "";
// Make the request
NetworkProfile response = networkProfilesClient.Get(project, networkProfile);

GetAsync(GetNetworkProfileRequest, CallSettings)

public virtual Task<NetworkProfile> GetAsync(GetNetworkProfileRequest request, CallSettings callSettings = null)

Returns the specified network profile.

Parameters
Name Description
request GetNetworkProfileRequest

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
TaskNetworkProfile

A Task containing the RPC response.

Example
// Create client
NetworkProfilesClient networkProfilesClient = await NetworkProfilesClient.CreateAsync();
// Initialize request argument(s)
GetNetworkProfileRequest request = new GetNetworkProfileRequest
{
    NetworkProfile = "",
    Project = "",
};
// Make the request
NetworkProfile response = await networkProfilesClient.GetAsync(request);

GetAsync(GetNetworkProfileRequest, CancellationToken)

public virtual Task<NetworkProfile> GetAsync(GetNetworkProfileRequest request, CancellationToken cancellationToken)

Returns the specified network profile.

Parameters
Name Description
request GetNetworkProfileRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskNetworkProfile

A Task containing the RPC response.

Example
// Create client
NetworkProfilesClient networkProfilesClient = await NetworkProfilesClient.CreateAsync();
// Initialize request argument(s)
GetNetworkProfileRequest request = new GetNetworkProfileRequest
{
    NetworkProfile = "",
    Project = "",
};
// Make the request
NetworkProfile response = await networkProfilesClient.GetAsync(request);

GetAsync(string, string, CallSettings)

public virtual Task<NetworkProfile> GetAsync(string project, string networkProfile, CallSettings callSettings = null)

Returns the specified network profile.

Parameters
Name Description
project string

Project ID for this request.

networkProfile string

Name of the network profile to return.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskNetworkProfile

A Task containing the RPC response.

Example
// Create client
NetworkProfilesClient networkProfilesClient = await NetworkProfilesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string networkProfile = "";
// Make the request
NetworkProfile response = await networkProfilesClient.GetAsync(project, networkProfile);

GetAsync(string, string, CancellationToken)

public virtual Task<NetworkProfile> GetAsync(string project, string networkProfile, CancellationToken cancellationToken)

Returns the specified network profile.

Parameters
Name Description
project string

Project ID for this request.

networkProfile string

Name of the network profile to return.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskNetworkProfile

A Task containing the RPC response.

Example
// Create client
NetworkProfilesClient networkProfilesClient = await NetworkProfilesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string networkProfile = "";
// Make the request
NetworkProfile response = await networkProfilesClient.GetAsync(project, networkProfile);

List(ListNetworkProfilesRequest, CallSettings)

public virtual PagedEnumerable<NetworkProfilesListResponse, NetworkProfile> List(ListNetworkProfilesRequest request, CallSettings callSettings = null)

Retrieves a list of network profiles available to the specified project.

Parameters
Name Description
request ListNetworkProfilesRequest

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
PagedEnumerableNetworkProfilesListResponseNetworkProfile

A pageable sequence of NetworkProfile resources.

Example
// Create client
NetworkProfilesClient networkProfilesClient = NetworkProfilesClient.Create();
// Initialize request argument(s)
ListNetworkProfilesRequest request = new ListNetworkProfilesRequest
{
    OrderBy = "",
    Project = "",
    Filter = "",
    ReturnPartialSuccess = false,
};
// Make the request
PagedEnumerable<NetworkProfilesListResponse, NetworkProfile> response = networkProfilesClient.List(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (NetworkProfile 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 (NetworkProfilesListResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (NetworkProfile 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<NetworkProfile> 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 (NetworkProfile 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, int?, CallSettings)

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

Retrieves a list of network profiles available to the specified project.

Parameters
Name Description
project string

Project ID for this request.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableNetworkProfilesListResponseNetworkProfile

A pageable sequence of NetworkProfile resources.

Example
// Create client
NetworkProfilesClient networkProfilesClient = NetworkProfilesClient.Create();
// Initialize request argument(s)
string project = "";
// Make the request
PagedEnumerable<NetworkProfilesListResponse, NetworkProfile> response = networkProfilesClient.List(project);

// Iterate over all response items, lazily performing RPCs as required
foreach (NetworkProfile 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 (NetworkProfilesListResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (NetworkProfile 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<NetworkProfile> 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 (NetworkProfile 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(ListNetworkProfilesRequest, CallSettings)

public virtual PagedAsyncEnumerable<NetworkProfilesListResponse, NetworkProfile> ListAsync(ListNetworkProfilesRequest request, CallSettings callSettings = null)

Retrieves a list of network profiles available to the specified project.

Parameters
Name Description
request ListNetworkProfilesRequest

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
PagedAsyncEnumerableNetworkProfilesListResponseNetworkProfile

A pageable asynchronous sequence of NetworkProfile resources.

Example
// Create client
NetworkProfilesClient networkProfilesClient = await NetworkProfilesClient.CreateAsync();
// Initialize request argument(s)
ListNetworkProfilesRequest request = new ListNetworkProfilesRequest
{
    OrderBy = "",
    Project = "",
    Filter = "",
    ReturnPartialSuccess = false,
};
// Make the request
PagedAsyncEnumerable<NetworkProfilesListResponse, NetworkProfile> response = networkProfilesClient.ListAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((NetworkProfile 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((NetworkProfilesListResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (NetworkProfile 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<NetworkProfile> 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 (NetworkProfile 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, int?, CallSettings)

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

Retrieves a list of network profiles available to the specified project.

Parameters
Name Description
project string

Project ID for this request.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableNetworkProfilesListResponseNetworkProfile

A pageable asynchronous sequence of NetworkProfile resources.

Example
// Create client
NetworkProfilesClient networkProfilesClient = await NetworkProfilesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
// Make the request
PagedAsyncEnumerable<NetworkProfilesListResponse, NetworkProfile> response = networkProfilesClient.ListAsync(project);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((NetworkProfile 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((NetworkProfilesListResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (NetworkProfile 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<NetworkProfile> 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 (NetworkProfile 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;

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.