Advisory Notifications v1 API - Class AdvisoryNotificationsServiceClient (1.0.0)

public abstract class AdvisoryNotificationsServiceClient

Reference documentation and code samples for the Advisory Notifications v1 API class AdvisoryNotificationsServiceClient.

AdvisoryNotificationsService client wrapper, for convenient use.

Inheritance

object > AdvisoryNotificationsServiceClient

Namespace

Google.Cloud.AdvisoryNotifications.V1

Assembly

Google.Cloud.AdvisoryNotifications.V1.dll

Remarks

Service to manage Security and Privacy Notifications.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default AdvisoryNotificationsService scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

The default AdvisoryNotificationsService scopes are:

GrpcClient

public virtual AdvisoryNotificationsService.AdvisoryNotificationsServiceClient GrpcClient { get; }

The underlying gRPC AdvisoryNotificationsService client

Property Value
TypeDescription
AdvisoryNotificationsServiceAdvisoryNotificationsServiceClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

Methods

Create()

public static AdvisoryNotificationsServiceClient Create()

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

Returns
TypeDescription
AdvisoryNotificationsServiceClient

The created AdvisoryNotificationsServiceClient.

CreateAsync(CancellationToken)

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

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
TaskAdvisoryNotificationsServiceClient

The task representing the created AdvisoryNotificationsServiceClient.

GetNotification(GetNotificationRequest, CallSettings)

public virtual Notification GetNotification(GetNotificationRequest request, CallSettings callSettings = null)

Gets a notification.

Parameters
NameDescription
requestGetNotificationRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Notification

The RPC response.

Example
// Create client
AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient = AdvisoryNotificationsServiceClient.Create();
// Initialize request argument(s)
GetNotificationRequest request = new GetNotificationRequest
{
    NotificationName = NotificationName.FromOrganizationLocationNotification("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]"),
    LanguageCode = "",
};
// Make the request
Notification response = advisoryNotificationsServiceClient.GetNotification(request);

GetNotification(NotificationName, CallSettings)

public virtual Notification GetNotification(NotificationName name, CallSettings callSettings = null)

Gets a notification.

Parameters
NameDescription
nameNotificationName

Required. A name of the notification to retrieve. Format: organizations/{organization}/locations/{location}/notifications/{notification}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Notification

The RPC response.

Example
// Create client
AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient = AdvisoryNotificationsServiceClient.Create();
// Initialize request argument(s)
NotificationName name = NotificationName.FromOrganizationLocationNotification("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
// Make the request
Notification response = advisoryNotificationsServiceClient.GetNotification(name);

GetNotification(string, CallSettings)

public virtual Notification GetNotification(string name, CallSettings callSettings = null)

Gets a notification.

Parameters
NameDescription
namestring

Required. A name of the notification to retrieve. Format: organizations/{organization}/locations/{location}/notifications/{notification}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Notification

The RPC response.

Example
// Create client
AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient = AdvisoryNotificationsServiceClient.Create();
// Initialize request argument(s)
string name = "organizations/[ORGANIZATION]/locations/[LOCATION]/notifications/[NOTIFICATION]";
// Make the request
Notification response = advisoryNotificationsServiceClient.GetNotification(name);

GetNotificationAsync(GetNotificationRequest, CallSettings)

public virtual Task<Notification> GetNotificationAsync(GetNotificationRequest request, CallSettings callSettings = null)

Gets a notification.

Parameters
NameDescription
requestGetNotificationRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskNotification

A Task containing the RPC response.

Example
// Create client
AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient = await AdvisoryNotificationsServiceClient.CreateAsync();
// Initialize request argument(s)
GetNotificationRequest request = new GetNotificationRequest
{
    NotificationName = NotificationName.FromOrganizationLocationNotification("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]"),
    LanguageCode = "",
};
// Make the request
Notification response = await advisoryNotificationsServiceClient.GetNotificationAsync(request);

GetNotificationAsync(GetNotificationRequest, CancellationToken)

public virtual Task<Notification> GetNotificationAsync(GetNotificationRequest request, CancellationToken cancellationToken)

Gets a notification.

Parameters
NameDescription
requestGetNotificationRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskNotification

A Task containing the RPC response.

Example
// Create client
AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient = await AdvisoryNotificationsServiceClient.CreateAsync();
// Initialize request argument(s)
GetNotificationRequest request = new GetNotificationRequest
{
    NotificationName = NotificationName.FromOrganizationLocationNotification("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]"),
    LanguageCode = "",
};
// Make the request
Notification response = await advisoryNotificationsServiceClient.GetNotificationAsync(request);

GetNotificationAsync(NotificationName, CallSettings)

public virtual Task<Notification> GetNotificationAsync(NotificationName name, CallSettings callSettings = null)

Gets a notification.

Parameters
NameDescription
nameNotificationName

Required. A name of the notification to retrieve. Format: organizations/{organization}/locations/{location}/notifications/{notification}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskNotification

A Task containing the RPC response.

Example
// Create client
AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient = await AdvisoryNotificationsServiceClient.CreateAsync();
// Initialize request argument(s)
NotificationName name = NotificationName.FromOrganizationLocationNotification("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
// Make the request
Notification response = await advisoryNotificationsServiceClient.GetNotificationAsync(name);

GetNotificationAsync(NotificationName, CancellationToken)

public virtual Task<Notification> GetNotificationAsync(NotificationName name, CancellationToken cancellationToken)

Gets a notification.

Parameters
NameDescription
nameNotificationName

Required. A name of the notification to retrieve. Format: organizations/{organization}/locations/{location}/notifications/{notification}.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskNotification

A Task containing the RPC response.

Example
// Create client
AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient = await AdvisoryNotificationsServiceClient.CreateAsync();
// Initialize request argument(s)
NotificationName name = NotificationName.FromOrganizationLocationNotification("[ORGANIZATION]", "[LOCATION]", "[NOTIFICATION]");
// Make the request
Notification response = await advisoryNotificationsServiceClient.GetNotificationAsync(name);

GetNotificationAsync(string, CallSettings)

public virtual Task<Notification> GetNotificationAsync(string name, CallSettings callSettings = null)

Gets a notification.

Parameters
NameDescription
namestring

Required. A name of the notification to retrieve. Format: organizations/{organization}/locations/{location}/notifications/{notification}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskNotification

A Task containing the RPC response.

Example
// Create client
AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient = await AdvisoryNotificationsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "organizations/[ORGANIZATION]/locations/[LOCATION]/notifications/[NOTIFICATION]";
// Make the request
Notification response = await advisoryNotificationsServiceClient.GetNotificationAsync(name);

GetNotificationAsync(string, CancellationToken)

public virtual Task<Notification> GetNotificationAsync(string name, CancellationToken cancellationToken)

Gets a notification.

Parameters
NameDescription
namestring

Required. A name of the notification to retrieve. Format: organizations/{organization}/locations/{location}/notifications/{notification}.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskNotification

A Task containing the RPC response.

Example
// Create client
AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient = await AdvisoryNotificationsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "organizations/[ORGANIZATION]/locations/[LOCATION]/notifications/[NOTIFICATION]";
// Make the request
Notification response = await advisoryNotificationsServiceClient.GetNotificationAsync(name);

ListNotifications(ListNotificationsRequest, CallSettings)

public virtual PagedEnumerable<ListNotificationsResponse, Notification> ListNotifications(ListNotificationsRequest request, CallSettings callSettings = null)

Lists notifications under a given parent.

Parameters
NameDescription
requestListNotificationsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListNotificationsResponseNotification

A pageable sequence of Notification resources.

Example
// Create client
AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient = AdvisoryNotificationsServiceClient.Create();
// Initialize request argument(s)
ListNotificationsRequest request = new ListNotificationsRequest
{
    ParentAsLocationName = LocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]"),
    View = NotificationView.Unspecified,
    LanguageCode = "",
};
// Make the request
PagedEnumerable<ListNotificationsResponse, Notification> response = advisoryNotificationsServiceClient.ListNotifications(request);

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

ListNotifications(LocationName, string, int?, CallSettings)

public virtual PagedEnumerable<ListNotificationsResponse, Notification> ListNotifications(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists notifications under a given parent.

Parameters
NameDescription
parentLocationName

Required. The parent, which owns this collection of notifications. Must be of the form "organizations/{organization}/locations/{location}".

pageTokenstring

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

pageSizeint

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
PagedEnumerableListNotificationsResponseNotification

A pageable sequence of Notification resources.

Example
// Create client
AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient = AdvisoryNotificationsServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]");
// Make the request
PagedEnumerable<ListNotificationsResponse, Notification> response = advisoryNotificationsServiceClient.ListNotifications(parent);

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

ListNotifications(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListNotificationsResponse, Notification> ListNotifications(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists notifications under a given parent.

Parameters
NameDescription
parentstring

Required. The parent, which owns this collection of notifications. Must be of the form "organizations/{organization}/locations/{location}".

pageTokenstring

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

pageSizeint

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
PagedEnumerableListNotificationsResponseNotification

A pageable sequence of Notification resources.

Example
// Create client
AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient = AdvisoryNotificationsServiceClient.Create();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListNotificationsResponse, Notification> response = advisoryNotificationsServiceClient.ListNotifications(parent);

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

ListNotificationsAsync(ListNotificationsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListNotificationsResponse, Notification> ListNotificationsAsync(ListNotificationsRequest request, CallSettings callSettings = null)

Lists notifications under a given parent.

Parameters
NameDescription
requestListNotificationsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListNotificationsResponseNotification

A pageable asynchronous sequence of Notification resources.

Example
// Create client
AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient = await AdvisoryNotificationsServiceClient.CreateAsync();
// Initialize request argument(s)
ListNotificationsRequest request = new ListNotificationsRequest
{
    ParentAsLocationName = LocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]"),
    View = NotificationView.Unspecified,
    LanguageCode = "",
};
// Make the request
PagedAsyncEnumerable<ListNotificationsResponse, Notification> response = advisoryNotificationsServiceClient.ListNotificationsAsync(request);

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

ListNotificationsAsync(LocationName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListNotificationsResponse, Notification> ListNotificationsAsync(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists notifications under a given parent.

Parameters
NameDescription
parentLocationName

Required. The parent, which owns this collection of notifications. Must be of the form "organizations/{organization}/locations/{location}".

pageTokenstring

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

pageSizeint

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
PagedAsyncEnumerableListNotificationsResponseNotification

A pageable asynchronous sequence of Notification resources.

Example
// Create client
AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient = await AdvisoryNotificationsServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListNotificationsResponse, Notification> response = advisoryNotificationsServiceClient.ListNotificationsAsync(parent);

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

ListNotificationsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListNotificationsResponse, Notification> ListNotificationsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists notifications under a given parent.

Parameters
NameDescription
parentstring

Required. The parent, which owns this collection of notifications. Must be of the form "organizations/{organization}/locations/{location}".

pageTokenstring

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

pageSizeint

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
PagedAsyncEnumerableListNotificationsResponseNotification

A pageable asynchronous sequence of Notification resources.

Example
// Create client
AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient = await AdvisoryNotificationsServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListNotificationsResponse, Notification> response = advisoryNotificationsServiceClient.ListNotificationsAsync(parent);

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