Google Cloud Monitoring v3 API - Class SnoozeServiceClient (3.12.0)

public abstract class SnoozeServiceClient

Reference documentation and code samples for the Google Cloud Monitoring v3 API class SnoozeServiceClient.

SnoozeService client wrapper, for convenient use.

Inheritance

object > SnoozeServiceClient

Derived Types

Namespace

Google.Cloud.Monitoring.V3

Assembly

Google.Cloud.Monitoring.V3.dll

Remarks

The SnoozeService API is used to temporarily prevent an alert policy from generating alerts. A Snooze is a description of the criteria under which one or more alert policies should not fire alerts for the specified duration.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default SnoozeService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

GrpcClient

public virtual SnoozeService.SnoozeServiceClient GrpcClient { get; }

The underlying gRPC SnoozeService client

Property Value
Type Description
SnoozeServiceSnoozeServiceClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static SnoozeServiceClient Create()

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

Returns
Type Description
SnoozeServiceClient

The created SnoozeServiceClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskSnoozeServiceClient

The task representing the created SnoozeServiceClient.

CreateSnooze(ProjectName, Snooze, CallSettings)

public virtual Snooze CreateSnooze(ProjectName parent, Snooze snooze, CallSettings callSettings = null)

Creates a Snooze that will prevent alerts, which match the provided criteria, from being opened. The Snooze applies for a specific time interval.

Parameters
Name Description
parent ProjectName

Required. The project in which a Snooze should be created. The format is:

projects/[PROJECT_ID_OR_NUMBER]

snooze Snooze

Required. The Snooze to create. Omit the name field, as it will be filled in by the API.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Snooze

The RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = SnoozeServiceClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Snooze snooze = new Snooze();
// Make the request
Snooze response = snoozeServiceClient.CreateSnooze(parent, snooze);

CreateSnooze(CreateSnoozeRequest, CallSettings)

public virtual Snooze CreateSnooze(CreateSnoozeRequest request, CallSettings callSettings = null)

Creates a Snooze that will prevent alerts, which match the provided criteria, from being opened. The Snooze applies for a specific time interval.

Parameters
Name Description
request CreateSnoozeRequest

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
Snooze

The RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = SnoozeServiceClient.Create();
// Initialize request argument(s)
CreateSnoozeRequest request = new CreateSnoozeRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Snooze = new Snooze(),
};
// Make the request
Snooze response = snoozeServiceClient.CreateSnooze(request);

CreateSnooze(string, Snooze, CallSettings)

public virtual Snooze CreateSnooze(string parent, Snooze snooze, CallSettings callSettings = null)

Creates a Snooze that will prevent alerts, which match the provided criteria, from being opened. The Snooze applies for a specific time interval.

Parameters
Name Description
parent string

Required. The project in which a Snooze should be created. The format is:

projects/[PROJECT_ID_OR_NUMBER]

snooze Snooze

Required. The Snooze to create. Omit the name field, as it will be filled in by the API.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Snooze

The RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = SnoozeServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Snooze snooze = new Snooze();
// Make the request
Snooze response = snoozeServiceClient.CreateSnooze(parent, snooze);

CreateSnoozeAsync(ProjectName, Snooze, CallSettings)

public virtual Task<Snooze> CreateSnoozeAsync(ProjectName parent, Snooze snooze, CallSettings callSettings = null)

Creates a Snooze that will prevent alerts, which match the provided criteria, from being opened. The Snooze applies for a specific time interval.

Parameters
Name Description
parent ProjectName

Required. The project in which a Snooze should be created. The format is:

projects/[PROJECT_ID_OR_NUMBER]

snooze Snooze

Required. The Snooze to create. Omit the name field, as it will be filled in by the API.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Snooze snooze = new Snooze();
// Make the request
Snooze response = await snoozeServiceClient.CreateSnoozeAsync(parent, snooze);

CreateSnoozeAsync(ProjectName, Snooze, CancellationToken)

public virtual Task<Snooze> CreateSnoozeAsync(ProjectName parent, Snooze snooze, CancellationToken cancellationToken)

Creates a Snooze that will prevent alerts, which match the provided criteria, from being opened. The Snooze applies for a specific time interval.

Parameters
Name Description
parent ProjectName

Required. The project in which a Snooze should be created. The format is:

projects/[PROJECT_ID_OR_NUMBER]

snooze Snooze

Required. The Snooze to create. Omit the name field, as it will be filled in by the API.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Snooze snooze = new Snooze();
// Make the request
Snooze response = await snoozeServiceClient.CreateSnoozeAsync(parent, snooze);

CreateSnoozeAsync(CreateSnoozeRequest, CallSettings)

public virtual Task<Snooze> CreateSnoozeAsync(CreateSnoozeRequest request, CallSettings callSettings = null)

Creates a Snooze that will prevent alerts, which match the provided criteria, from being opened. The Snooze applies for a specific time interval.

Parameters
Name Description
request CreateSnoozeRequest

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
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
CreateSnoozeRequest request = new CreateSnoozeRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Snooze = new Snooze(),
};
// Make the request
Snooze response = await snoozeServiceClient.CreateSnoozeAsync(request);

CreateSnoozeAsync(CreateSnoozeRequest, CancellationToken)

public virtual Task<Snooze> CreateSnoozeAsync(CreateSnoozeRequest request, CancellationToken cancellationToken)

Creates a Snooze that will prevent alerts, which match the provided criteria, from being opened. The Snooze applies for a specific time interval.

Parameters
Name Description
request CreateSnoozeRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
CreateSnoozeRequest request = new CreateSnoozeRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Snooze = new Snooze(),
};
// Make the request
Snooze response = await snoozeServiceClient.CreateSnoozeAsync(request);

CreateSnoozeAsync(string, Snooze, CallSettings)

public virtual Task<Snooze> CreateSnoozeAsync(string parent, Snooze snooze, CallSettings callSettings = null)

Creates a Snooze that will prevent alerts, which match the provided criteria, from being opened. The Snooze applies for a specific time interval.

Parameters
Name Description
parent string

Required. The project in which a Snooze should be created. The format is:

projects/[PROJECT_ID_OR_NUMBER]

snooze Snooze

Required. The Snooze to create. Omit the name field, as it will be filled in by the API.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Snooze snooze = new Snooze();
// Make the request
Snooze response = await snoozeServiceClient.CreateSnoozeAsync(parent, snooze);

CreateSnoozeAsync(string, Snooze, CancellationToken)

public virtual Task<Snooze> CreateSnoozeAsync(string parent, Snooze snooze, CancellationToken cancellationToken)

Creates a Snooze that will prevent alerts, which match the provided criteria, from being opened. The Snooze applies for a specific time interval.

Parameters
Name Description
parent string

Required. The project in which a Snooze should be created. The format is:

projects/[PROJECT_ID_OR_NUMBER]

snooze Snooze

Required. The Snooze to create. Omit the name field, as it will be filled in by the API.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Snooze snooze = new Snooze();
// Make the request
Snooze response = await snoozeServiceClient.CreateSnoozeAsync(parent, snooze);

GetSnooze(GetSnoozeRequest, CallSettings)

public virtual Snooze GetSnooze(GetSnoozeRequest request, CallSettings callSettings = null)

Retrieves a Snooze by name.

Parameters
Name Description
request GetSnoozeRequest

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
Snooze

The RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = SnoozeServiceClient.Create();
// Initialize request argument(s)
GetSnoozeRequest request = new GetSnoozeRequest
{
    SnoozeName = SnoozeName.FromProjectSnooze("[PROJECT]", "[SNOOZE]"),
};
// Make the request
Snooze response = snoozeServiceClient.GetSnooze(request);

GetSnooze(SnoozeName, CallSettings)

public virtual Snooze GetSnooze(SnoozeName name, CallSettings callSettings = null)

Retrieves a Snooze by name.

Parameters
Name Description
name SnoozeName

Required. The ID of the Snooze to retrieve. The format is:

projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID]

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Snooze

The RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = SnoozeServiceClient.Create();
// Initialize request argument(s)
SnoozeName name = SnoozeName.FromProjectSnooze("[PROJECT]", "[SNOOZE]");
// Make the request
Snooze response = snoozeServiceClient.GetSnooze(name);

GetSnooze(string, CallSettings)

public virtual Snooze GetSnooze(string name, CallSettings callSettings = null)

Retrieves a Snooze by name.

Parameters
Name Description
name string

Required. The ID of the Snooze to retrieve. The format is:

projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID]

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Snooze

The RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = SnoozeServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/snoozes/[SNOOZE]";
// Make the request
Snooze response = snoozeServiceClient.GetSnooze(name);

GetSnoozeAsync(GetSnoozeRequest, CallSettings)

public virtual Task<Snooze> GetSnoozeAsync(GetSnoozeRequest request, CallSettings callSettings = null)

Retrieves a Snooze by name.

Parameters
Name Description
request GetSnoozeRequest

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
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
GetSnoozeRequest request = new GetSnoozeRequest
{
    SnoozeName = SnoozeName.FromProjectSnooze("[PROJECT]", "[SNOOZE]"),
};
// Make the request
Snooze response = await snoozeServiceClient.GetSnoozeAsync(request);

GetSnoozeAsync(GetSnoozeRequest, CancellationToken)

public virtual Task<Snooze> GetSnoozeAsync(GetSnoozeRequest request, CancellationToken cancellationToken)

Retrieves a Snooze by name.

Parameters
Name Description
request GetSnoozeRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
GetSnoozeRequest request = new GetSnoozeRequest
{
    SnoozeName = SnoozeName.FromProjectSnooze("[PROJECT]", "[SNOOZE]"),
};
// Make the request
Snooze response = await snoozeServiceClient.GetSnoozeAsync(request);

GetSnoozeAsync(SnoozeName, CallSettings)

public virtual Task<Snooze> GetSnoozeAsync(SnoozeName name, CallSettings callSettings = null)

Retrieves a Snooze by name.

Parameters
Name Description
name SnoozeName

Required. The ID of the Snooze to retrieve. The format is:

projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID]

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
SnoozeName name = SnoozeName.FromProjectSnooze("[PROJECT]", "[SNOOZE]");
// Make the request
Snooze response = await snoozeServiceClient.GetSnoozeAsync(name);

GetSnoozeAsync(SnoozeName, CancellationToken)

public virtual Task<Snooze> GetSnoozeAsync(SnoozeName name, CancellationToken cancellationToken)

Retrieves a Snooze by name.

Parameters
Name Description
name SnoozeName

Required. The ID of the Snooze to retrieve. The format is:

projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID]

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
SnoozeName name = SnoozeName.FromProjectSnooze("[PROJECT]", "[SNOOZE]");
// Make the request
Snooze response = await snoozeServiceClient.GetSnoozeAsync(name);

GetSnoozeAsync(string, CallSettings)

public virtual Task<Snooze> GetSnoozeAsync(string name, CallSettings callSettings = null)

Retrieves a Snooze by name.

Parameters
Name Description
name string

Required. The ID of the Snooze to retrieve. The format is:

projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID]

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/snoozes/[SNOOZE]";
// Make the request
Snooze response = await snoozeServiceClient.GetSnoozeAsync(name);

GetSnoozeAsync(string, CancellationToken)

public virtual Task<Snooze> GetSnoozeAsync(string name, CancellationToken cancellationToken)

Retrieves a Snooze by name.

Parameters
Name Description
name string

Required. The ID of the Snooze to retrieve. The format is:

projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID]

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/snoozes/[SNOOZE]";
// Make the request
Snooze response = await snoozeServiceClient.GetSnoozeAsync(name);

ListSnoozes(ProjectName, string, int?, CallSettings)

public virtual PagedEnumerable<ListSnoozesResponse, Snooze> ListSnoozes(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the Snoozes associated with a project. Can optionally pass in filter, which specifies predicates to match Snoozes.

Parameters
Name Description
parent ProjectName

Required. The project whose Snoozes should be listed. The format is:

projects/[PROJECT_ID_OR_NUMBER]

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
PagedEnumerableListSnoozesResponseSnooze

A pageable sequence of Snooze resources.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = SnoozeServiceClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedEnumerable<ListSnoozesResponse, Snooze> response = snoozeServiceClient.ListSnoozes(parent);

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

ListSnoozes(ListSnoozesRequest, CallSettings)

public virtual PagedEnumerable<ListSnoozesResponse, Snooze> ListSnoozes(ListSnoozesRequest request, CallSettings callSettings = null)

Lists the Snoozes associated with a project. Can optionally pass in filter, which specifies predicates to match Snoozes.

Parameters
Name Description
request ListSnoozesRequest

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
PagedEnumerableListSnoozesResponseSnooze

A pageable sequence of Snooze resources.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = SnoozeServiceClient.Create();
// Initialize request argument(s)
ListSnoozesRequest request = new ListSnoozesRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Filter = "",
};
// Make the request
PagedEnumerable<ListSnoozesResponse, Snooze> response = snoozeServiceClient.ListSnoozes(request);

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

ListSnoozes(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListSnoozesResponse, Snooze> ListSnoozes(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the Snoozes associated with a project. Can optionally pass in filter, which specifies predicates to match Snoozes.

Parameters
Name Description
parent string

Required. The project whose Snoozes should be listed. The format is:

projects/[PROJECT_ID_OR_NUMBER]

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
PagedEnumerableListSnoozesResponseSnooze

A pageable sequence of Snooze resources.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = SnoozeServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedEnumerable<ListSnoozesResponse, Snooze> response = snoozeServiceClient.ListSnoozes(parent);

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

ListSnoozesAsync(ProjectName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListSnoozesResponse, Snooze> ListSnoozesAsync(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the Snoozes associated with a project. Can optionally pass in filter, which specifies predicates to match Snoozes.

Parameters
Name Description
parent ProjectName

Required. The project whose Snoozes should be listed. The format is:

projects/[PROJECT_ID_OR_NUMBER]

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
PagedAsyncEnumerableListSnoozesResponseSnooze

A pageable asynchronous sequence of Snooze resources.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedAsyncEnumerable<ListSnoozesResponse, Snooze> response = snoozeServiceClient.ListSnoozesAsync(parent);

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

ListSnoozesAsync(ListSnoozesRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListSnoozesResponse, Snooze> ListSnoozesAsync(ListSnoozesRequest request, CallSettings callSettings = null)

Lists the Snoozes associated with a project. Can optionally pass in filter, which specifies predicates to match Snoozes.

Parameters
Name Description
request ListSnoozesRequest

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
PagedAsyncEnumerableListSnoozesResponseSnooze

A pageable asynchronous sequence of Snooze resources.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
ListSnoozesRequest request = new ListSnoozesRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Filter = "",
};
// Make the request
PagedAsyncEnumerable<ListSnoozesResponse, Snooze> response = snoozeServiceClient.ListSnoozesAsync(request);

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

ListSnoozesAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListSnoozesResponse, Snooze> ListSnoozesAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the Snoozes associated with a project. Can optionally pass in filter, which specifies predicates to match Snoozes.

Parameters
Name Description
parent string

Required. The project whose Snoozes should be listed. The format is:

projects/[PROJECT_ID_OR_NUMBER]

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
PagedAsyncEnumerableListSnoozesResponseSnooze

A pageable asynchronous sequence of Snooze resources.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedAsyncEnumerable<ListSnoozesResponse, Snooze> response = snoozeServiceClient.ListSnoozesAsync(parent);

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

UpdateSnooze(Snooze, FieldMask, CallSettings)

public virtual Snooze UpdateSnooze(Snooze snooze, FieldMask updateMask, CallSettings callSettings = null)

Updates a Snooze, identified by its name, with the parameters in the given Snooze object.

Parameters
Name Description
snooze Snooze

Required. The Snooze to update. Must have the name field present.

updateMask FieldMask

Required. The fields to update.

For each field listed in update_mask:

  • If the Snooze object supplied in the UpdateSnoozeRequest has a value for that field, the value of the field in the existing Snooze will be set to the value of the field in the supplied Snooze.
  • If the field does not have a value in the supplied Snooze, the field in the existing Snooze is set to its default value.

Fields not listed retain their existing value.

The following are the field names that are accepted in update_mask:

  • display_name
  • interval.start_time
  • interval.end_time

That said, the start time and end time of the Snooze determines which fields can legally be updated. Before attempting an update, users should consult the documentation for UpdateSnoozeRequest, which talks about which fields can be updated.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Snooze

The RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = SnoozeServiceClient.Create();
// Initialize request argument(s)
Snooze snooze = new Snooze();
FieldMask updateMask = new FieldMask();
// Make the request
Snooze response = snoozeServiceClient.UpdateSnooze(snooze, updateMask);

UpdateSnooze(UpdateSnoozeRequest, CallSettings)

public virtual Snooze UpdateSnooze(UpdateSnoozeRequest request, CallSettings callSettings = null)

Updates a Snooze, identified by its name, with the parameters in the given Snooze object.

Parameters
Name Description
request UpdateSnoozeRequest

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
Snooze

The RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = SnoozeServiceClient.Create();
// Initialize request argument(s)
UpdateSnoozeRequest request = new UpdateSnoozeRequest
{
    Snooze = new Snooze(),
    UpdateMask = new FieldMask(),
};
// Make the request
Snooze response = snoozeServiceClient.UpdateSnooze(request);

UpdateSnoozeAsync(Snooze, FieldMask, CallSettings)

public virtual Task<Snooze> UpdateSnoozeAsync(Snooze snooze, FieldMask updateMask, CallSettings callSettings = null)

Updates a Snooze, identified by its name, with the parameters in the given Snooze object.

Parameters
Name Description
snooze Snooze

Required. The Snooze to update. Must have the name field present.

updateMask FieldMask

Required. The fields to update.

For each field listed in update_mask:

  • If the Snooze object supplied in the UpdateSnoozeRequest has a value for that field, the value of the field in the existing Snooze will be set to the value of the field in the supplied Snooze.
  • If the field does not have a value in the supplied Snooze, the field in the existing Snooze is set to its default value.

Fields not listed retain their existing value.

The following are the field names that are accepted in update_mask:

  • display_name
  • interval.start_time
  • interval.end_time

That said, the start time and end time of the Snooze determines which fields can legally be updated. Before attempting an update, users should consult the documentation for UpdateSnoozeRequest, which talks about which fields can be updated.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
Snooze snooze = new Snooze();
FieldMask updateMask = new FieldMask();
// Make the request
Snooze response = await snoozeServiceClient.UpdateSnoozeAsync(snooze, updateMask);

UpdateSnoozeAsync(Snooze, FieldMask, CancellationToken)

public virtual Task<Snooze> UpdateSnoozeAsync(Snooze snooze, FieldMask updateMask, CancellationToken cancellationToken)

Updates a Snooze, identified by its name, with the parameters in the given Snooze object.

Parameters
Name Description
snooze Snooze

Required. The Snooze to update. Must have the name field present.

updateMask FieldMask

Required. The fields to update.

For each field listed in update_mask:

  • If the Snooze object supplied in the UpdateSnoozeRequest has a value for that field, the value of the field in the existing Snooze will be set to the value of the field in the supplied Snooze.
  • If the field does not have a value in the supplied Snooze, the field in the existing Snooze is set to its default value.

Fields not listed retain their existing value.

The following are the field names that are accepted in update_mask:

  • display_name
  • interval.start_time
  • interval.end_time

That said, the start time and end time of the Snooze determines which fields can legally be updated. Before attempting an update, users should consult the documentation for UpdateSnoozeRequest, which talks about which fields can be updated.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
Snooze snooze = new Snooze();
FieldMask updateMask = new FieldMask();
// Make the request
Snooze response = await snoozeServiceClient.UpdateSnoozeAsync(snooze, updateMask);

UpdateSnoozeAsync(UpdateSnoozeRequest, CallSettings)

public virtual Task<Snooze> UpdateSnoozeAsync(UpdateSnoozeRequest request, CallSettings callSettings = null)

Updates a Snooze, identified by its name, with the parameters in the given Snooze object.

Parameters
Name Description
request UpdateSnoozeRequest

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
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateSnoozeRequest request = new UpdateSnoozeRequest
{
    Snooze = new Snooze(),
    UpdateMask = new FieldMask(),
};
// Make the request
Snooze response = await snoozeServiceClient.UpdateSnoozeAsync(request);

UpdateSnoozeAsync(UpdateSnoozeRequest, CancellationToken)

public virtual Task<Snooze> UpdateSnoozeAsync(UpdateSnoozeRequest request, CancellationToken cancellationToken)

Updates a Snooze, identified by its name, with the parameters in the given Snooze object.

Parameters
Name Description
request UpdateSnoozeRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnooze

A Task containing the RPC response.

Example
// Create client
SnoozeServiceClient snoozeServiceClient = await SnoozeServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateSnoozeRequest request = new UpdateSnoozeRequest
{
    Snooze = new Snooze(),
    UpdateMask = new FieldMask(),
};
// Make the request
Snooze response = await snoozeServiceClient.UpdateSnoozeAsync(request);