This API allows users to plan for GCP capacity associated with their projects. Users can request additional capacity for GCP resources such as VMs, PDs, etc. v1beta
Package
@google-cloud/capacityplannerConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);Construct an instance of CapacityPlanningServiceClient.
| Parameters | |
|---|---|
| Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
Properties
apiEndpoint
get apiEndpoint(): string;The DNS address for this API service.
apiEndpoint
static get apiEndpoint(): string;The DNS address for this API service - same as servicePath.
auth
auth: gax.GoogleAuth;capacityPlanningServiceStub
capacityPlanningServiceStub?: Promise<{
[name: string]: Function;
}>;descriptors
descriptors: Descriptors;innerApiCalls
innerApiCalls: {
[name: string]: Function;
};pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};port
static get port(): number;The port for this API service.
scopes
static get scopes(): string[];The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;The DNS address for this API service.
universeDomain
get universeDomain(): string;warn
warn: (code: string, message: string, warnType?: string) => void;Methods
capacityPlanPath(project, capacityPlan)
capacityPlanPath(project: string, capacityPlan: string): string;Return a fully-qualified capacityPlan resource name string.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
capacityPlan |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
close()
close(): Promise<void>;Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
| Returns | |
|---|---|
| Type | Description |
Promise<void> |
{Promise} A promise that resolves when the client is closed. |
folderLocationForecastsPath(folder, location, forecast)
folderLocationForecastsPath(folder: string, location: string, forecast: string): string;Return a fully-qualified folderLocationForecasts resource name string.
| Parameters | |
|---|---|
| Name | Description |
folder |
string
|
location |
string
|
forecast |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
folderLocationReservationsPath(folder, location, reservation)
folderLocationReservationsPath(folder: string, location: string, reservation: string): string;Return a fully-qualified folderLocationReservations resource name string.
| Parameters | |
|---|---|
| Name | Description |
folder |
string
|
location |
string
|
reservation |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
getCapacityPlan(request, options)
getCapacityPlan(request?: protos.google.cloud.capacityplanner.v1beta.IGetCapacityPlanRequest, options?: CallOptions): Promise<[
protos.google.cloud.capacityplanner.v1beta.ICapacityPlan,
protos.google.cloud.capacityplanner.v1beta.IGetCapacityPlanRequest | undefined,
{} | undefined
]>;Returns information about the capacity plan.
| Parameters | |
|---|---|
| Name | Description |
request |
IGetCapacityPlanRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.cloud.capacityplanner.v1beta.ICapacityPlan,
protos.google.cloud.capacityplanner.v1beta.IGetCapacityPlanRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing CapacityPlan. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the capacity plan to retrieve.
* Format: projects/{project}/capacityPlans/{capacity_plan}
*/
// const name = 'abc123'
// Imports the Capacityplanner library
const {CapacityPlanningServiceClient} = require('@google-cloud/capacityplanner').v1beta;
// Instantiates a client
const capacityplannerClient = new CapacityPlanningServiceClient();
async function callGetCapacityPlan() {
// Construct request
const request = {
name,
};
// Run request
const response = await capacityplannerClient.getCapacityPlan(request);
console.log(response);
}
callGetCapacityPlan();
getCapacityPlan(request, options, callback)
getCapacityPlan(request: protos.google.cloud.capacityplanner.v1beta.IGetCapacityPlanRequest, options: CallOptions, callback: Callback<protos.google.cloud.capacityplanner.v1beta.ICapacityPlan, protos.google.cloud.capacityplanner.v1beta.IGetCapacityPlanRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IGetCapacityPlanRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.capacityplanner.v1beta.ICapacityPlan, protos.google.cloud.capacityplanner.v1beta.IGetCapacityPlanRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
getCapacityPlan(request, callback)
getCapacityPlan(request: protos.google.cloud.capacityplanner.v1beta.IGetCapacityPlanRequest, callback: Callback<protos.google.cloud.capacityplanner.v1beta.ICapacityPlan, protos.google.cloud.capacityplanner.v1beta.IGetCapacityPlanRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IGetCapacityPlanRequest
|
callback |
Callback<protos.google.cloud.capacityplanner.v1beta.ICapacityPlan, protos.google.cloud.capacityplanner.v1beta.IGetCapacityPlanRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
getProjectId()
getProjectId(): Promise<string>;| Returns | |
|---|---|
| Type | Description |
Promise<string> |
|
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;| Parameter | |
|---|---|
| Name | Description |
callback |
Callback<string, undefined, undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
| Returns | |
|---|---|
| Type | Description |
Promise<{
[name: string]: Function;
}> |
{Promise} A promise that resolves to an authenticated service stub. |
matchCapacityPlanFromCapacityPlanName(capacityPlanName)
matchCapacityPlanFromCapacityPlanName(capacityPlanName: string): string | number;Parse the capacity_plan from CapacityPlan resource.
| Parameter | |
|---|---|
| Name | Description |
capacityPlanName |
string
A fully-qualified path representing CapacityPlan resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the capacity_plan. |
matchFolderFromFolderLocationForecastsName(folderLocationForecastsName)
matchFolderFromFolderLocationForecastsName(folderLocationForecastsName: string): string | number;Parse the folder from FolderLocationForecasts resource.
| Parameter | |
|---|---|
| Name | Description |
folderLocationForecastsName |
string
A fully-qualified path representing folder_location_forecasts resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the folder. |
matchFolderFromFolderLocationReservationsName(folderLocationReservationsName)
matchFolderFromFolderLocationReservationsName(folderLocationReservationsName: string): string | number;Parse the folder from FolderLocationReservations resource.
| Parameter | |
|---|---|
| Name | Description |
folderLocationReservationsName |
string
A fully-qualified path representing folder_location_reservations resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the folder. |
matchForecastFromFolderLocationForecastsName(folderLocationForecastsName)
matchForecastFromFolderLocationForecastsName(folderLocationForecastsName: string): string | number;Parse the forecast from FolderLocationForecasts resource.
| Parameter | |
|---|---|
| Name | Description |
folderLocationForecastsName |
string
A fully-qualified path representing folder_location_forecasts resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the forecast. |
matchForecastFromOrganizationLocationForecastsName(organizationLocationForecastsName)
matchForecastFromOrganizationLocationForecastsName(organizationLocationForecastsName: string): string | number;Parse the forecast from OrganizationLocationForecasts resource.
| Parameter | |
|---|---|
| Name | Description |
organizationLocationForecastsName |
string
A fully-qualified path representing organization_location_forecasts resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the forecast. |
matchForecastFromProjectLocationForecastsName(projectLocationForecastsName)
matchForecastFromProjectLocationForecastsName(projectLocationForecastsName: string): string | number;Parse the forecast from ProjectLocationForecasts resource.
| Parameter | |
|---|---|
| Name | Description |
projectLocationForecastsName |
string
A fully-qualified path representing project_location_forecasts resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the forecast. |
matchLocationFromFolderLocationForecastsName(folderLocationForecastsName)
matchLocationFromFolderLocationForecastsName(folderLocationForecastsName: string): string | number;Parse the location from FolderLocationForecasts resource.
| Parameter | |
|---|---|
| Name | Description |
folderLocationForecastsName |
string
A fully-qualified path representing folder_location_forecasts resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the location. |
matchLocationFromFolderLocationReservationsName(folderLocationReservationsName)
matchLocationFromFolderLocationReservationsName(folderLocationReservationsName: string): string | number;Parse the location from FolderLocationReservations resource.
| Parameter | |
|---|---|
| Name | Description |
folderLocationReservationsName |
string
A fully-qualified path representing folder_location_reservations resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the location. |
matchLocationFromOrganizationLocationForecastsName(organizationLocationForecastsName)
matchLocationFromOrganizationLocationForecastsName(organizationLocationForecastsName: string): string | number;Parse the location from OrganizationLocationForecasts resource.
| Parameter | |
|---|---|
| Name | Description |
organizationLocationForecastsName |
string
A fully-qualified path representing organization_location_forecasts resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the location. |
matchLocationFromOrganizationLocationReservationsName(organizationLocationReservationsName)
matchLocationFromOrganizationLocationReservationsName(organizationLocationReservationsName: string): string | number;Parse the location from OrganizationLocationReservations resource.
| Parameter | |
|---|---|
| Name | Description |
organizationLocationReservationsName |
string
A fully-qualified path representing organization_location_reservations resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the location. |
matchLocationFromProjectLocationForecastsName(projectLocationForecastsName)
matchLocationFromProjectLocationForecastsName(projectLocationForecastsName: string): string | number;Parse the location from ProjectLocationForecasts resource.
| Parameter | |
|---|---|
| Name | Description |
projectLocationForecastsName |
string
A fully-qualified path representing project_location_forecasts resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the location. |
matchLocationFromProjectLocationReservationsName(projectLocationReservationsName)
matchLocationFromProjectLocationReservationsName(projectLocationReservationsName: string): string | number;Parse the location from ProjectLocationReservations resource.
| Parameter | |
|---|---|
| Name | Description |
projectLocationReservationsName |
string
A fully-qualified path representing project_location_reservations resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the location. |
matchOrganizationFromOrganizationLocationForecastsName(organizationLocationForecastsName)
matchOrganizationFromOrganizationLocationForecastsName(organizationLocationForecastsName: string): string | number;Parse the organization from OrganizationLocationForecasts resource.
| Parameter | |
|---|---|
| Name | Description |
organizationLocationForecastsName |
string
A fully-qualified path representing organization_location_forecasts resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the organization. |
matchOrganizationFromOrganizationLocationReservationsName(organizationLocationReservationsName)
matchOrganizationFromOrganizationLocationReservationsName(organizationLocationReservationsName: string): string | number;Parse the organization from OrganizationLocationReservations resource.
| Parameter | |
|---|---|
| Name | Description |
organizationLocationReservationsName |
string
A fully-qualified path representing organization_location_reservations resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the organization. |
matchProjectFromCapacityPlanName(capacityPlanName)
matchProjectFromCapacityPlanName(capacityPlanName: string): string | number;Parse the project from CapacityPlan resource.
| Parameter | |
|---|---|
| Name | Description |
capacityPlanName |
string
A fully-qualified path representing CapacityPlan resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromProjectLocationForecastsName(projectLocationForecastsName)
matchProjectFromProjectLocationForecastsName(projectLocationForecastsName: string): string | number;Parse the project from ProjectLocationForecasts resource.
| Parameter | |
|---|---|
| Name | Description |
projectLocationForecastsName |
string
A fully-qualified path representing project_location_forecasts resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromProjectLocationReservationsName(projectLocationReservationsName)
matchProjectFromProjectLocationReservationsName(projectLocationReservationsName: string): string | number;Parse the project from ProjectLocationReservations resource.
| Parameter | |
|---|---|
| Name | Description |
projectLocationReservationsName |
string
A fully-qualified path representing project_location_reservations resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromProjectName(projectName)
matchProjectFromProjectName(projectName: string): string | number;Parse the project from Project resource.
| Parameter | |
|---|---|
| Name | Description |
projectName |
string
A fully-qualified path representing Project resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the project. |
matchReservationFromFolderLocationReservationsName(folderLocationReservationsName)
matchReservationFromFolderLocationReservationsName(folderLocationReservationsName: string): string | number;Parse the reservation from FolderLocationReservations resource.
| Parameter | |
|---|---|
| Name | Description |
folderLocationReservationsName |
string
A fully-qualified path representing folder_location_reservations resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the reservation. |
matchReservationFromOrganizationLocationReservationsName(organizationLocationReservationsName)
matchReservationFromOrganizationLocationReservationsName(organizationLocationReservationsName: string): string | number;Parse the reservation from OrganizationLocationReservations resource.
| Parameter | |
|---|---|
| Name | Description |
organizationLocationReservationsName |
string
A fully-qualified path representing organization_location_reservations resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the reservation. |
matchReservationFromProjectLocationReservationsName(projectLocationReservationsName)
matchReservationFromProjectLocationReservationsName(projectLocationReservationsName: string): string | number;Parse the reservation from ProjectLocationReservations resource.
| Parameter | |
|---|---|
| Name | Description |
projectLocationReservationsName |
string
A fully-qualified path representing project_location_reservations resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the reservation. |
organizationLocationForecastsPath(organization, location, forecast)
organizationLocationForecastsPath(organization: string, location: string, forecast: string): string;Return a fully-qualified organizationLocationForecasts resource name string.
| Parameters | |
|---|---|
| Name | Description |
organization |
string
|
location |
string
|
forecast |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
organizationLocationReservationsPath(organization, location, reservation)
organizationLocationReservationsPath(organization: string, location: string, reservation: string): string;Return a fully-qualified organizationLocationReservations resource name string.
| Parameters | |
|---|---|
| Name | Description |
organization |
string
|
location |
string
|
reservation |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
projectLocationForecastsPath(project, location, forecast)
projectLocationForecastsPath(project: string, location: string, forecast: string): string;Return a fully-qualified projectLocationForecasts resource name string.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
forecast |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
projectLocationReservationsPath(project, location, reservation)
projectLocationReservationsPath(project: string, location: string, reservation: string): string;Return a fully-qualified projectLocationReservations resource name string.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
reservation |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
projectPath(project)
projectPath(project: string): string;Return a fully-qualified project resource name string.
| Parameter | |
|---|---|
| Name | Description |
project |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
queryCapacityPlanInsights(request, options)
queryCapacityPlanInsights(request?: protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlanInsightsRequest, options?: CallOptions): Promise<[
protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlanInsightsResponse,
protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlanInsightsRequest | undefined,
{} | undefined
]>;Query capacity plan insights that are in the parent parameter and match your specified filters.
| Parameters | |
|---|---|
| Name | Description |
request |
IQueryCapacityPlanInsightsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlanInsightsResponse,
protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlanInsightsRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing QueryCapacityPlanInsightsResponse. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The parent resource container.
* Format: projects/{project}
*/
// const parent = 'abc123'
/**
* Required. The filters to apply to the capacity plan.
*/
// const capacityPlanFilters = {}
// Imports the Capacityplanner library
const {CapacityPlanningServiceClient} = require('@google-cloud/capacityplanner').v1beta;
// Instantiates a client
const capacityplannerClient = new CapacityPlanningServiceClient();
async function callQueryCapacityPlanInsights() {
// Construct request
const request = {
parent,
capacityPlanFilters,
};
// Run request
const response = await capacityplannerClient.queryCapacityPlanInsights(request);
console.log(response);
}
callQueryCapacityPlanInsights();
queryCapacityPlanInsights(request, options, callback)
queryCapacityPlanInsights(request: protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlanInsightsRequest, options: CallOptions, callback: Callback<protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlanInsightsResponse, protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlanInsightsRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IQueryCapacityPlanInsightsRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlanInsightsResponse, protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlanInsightsRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
queryCapacityPlanInsights(request, callback)
queryCapacityPlanInsights(request: protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlanInsightsRequest, callback: Callback<protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlanInsightsResponse, protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlanInsightsRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IQueryCapacityPlanInsightsRequest
|
callback |
Callback<protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlanInsightsResponse, protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlanInsightsRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
queryCapacityPlans(request, options)
queryCapacityPlans(request?: protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansRequest, options?: CallOptions): Promise<[
protos.google.cloud.capacityplanner.v1beta.ICapacityPlan[],
protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansRequest | null,
protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansResponse
]>;Returns a list of the capacity plans that are in the parent parameter and match your specified filters. (The maximum list length is limited by the pageSize parameter.)
| Parameters | |
|---|---|
| Name | Description |
request |
IQueryCapacityPlansRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.cloud.capacityplanner.v1beta.ICapacityPlan[],
protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansRequest | null,
protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansResponse
]> |
{Promise} - The promise which resolves to an array. The first element of the array is Array of CapacityPlan. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using |
queryCapacityPlans(request, options, callback)
queryCapacityPlans(request: protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansRequest, protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansResponse | null | undefined, protos.google.cloud.capacityplanner.v1beta.ICapacityPlan>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IQueryCapacityPlansRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansRequest, protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansResponse | null | undefined, protos.google.cloud.capacityplanner.v1beta.ICapacityPlan>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
queryCapacityPlans(request, callback)
queryCapacityPlans(request: protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansRequest, callback: PaginationCallback<protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansRequest, protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansResponse | null | undefined, protos.google.cloud.capacityplanner.v1beta.ICapacityPlan>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IQueryCapacityPlansRequest
|
callback |
PaginationCallback<protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansRequest, protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansResponse | null | undefined, protos.google.cloud.capacityplanner.v1beta.ICapacityPlan>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
queryCapacityPlansAsync(request, options)
queryCapacityPlansAsync(request?: protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.capacityplanner.v1beta.ICapacityPlan>;Equivalent to queryCapacityPlans, but returns an iterable object.
for-await-of syntax is used with the iterable to get response elements on-demand.
| Parameters | |
|---|---|
| Name | Description |
request |
IQueryCapacityPlansRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
AsyncIterable<protos.google.cloud.capacityplanner.v1beta.ICapacityPlan> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing CapacityPlan. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The parent resource container.
* Format:
* projects/{project} or
* folders/{folder} or
* organizations/{organization}
*/
// const parent = 'abc123'
/**
* Optional. The maximum number of plans to return per page. The service may
* return fewer than this value. If unspecified, the server will use a
* sensible default. The maximum value is 1000; values above 1000 will be
* coerced to 1000.
*/
// const pageSize = 1234
/**
* Optional. A page token, received from a previous `QueryCapacityPlans` call.
* Provide this to retrieve the subsequent page.
*/
// const pageToken = 'abc123'
/**
* Optional. The Google Cloud Platform location of capacity plans. If
* unspecified, all locations will be included.
*/
// const location = 'abc123'
// Imports the Capacityplanner library
const {CapacityPlanningServiceClient} = require('@google-cloud/capacityplanner').v1beta;
// Instantiates a client
const capacityplannerClient = new CapacityPlanningServiceClient();
async function callQueryCapacityPlans() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = capacityplannerClient.queryCapacityPlansAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callQueryCapacityPlans();
queryCapacityPlansStream(request, options)
queryCapacityPlansStream(request?: protos.google.cloud.capacityplanner.v1beta.IQueryCapacityPlansRequest, options?: CallOptions): Transform;Equivalent to queryCapacityPlans, but returns a NodeJS Stream object.
| Parameters | |
|---|---|
| Name | Description |
request |
IQueryCapacityPlansRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Transform |
{Stream} An object stream which emits an object representing CapacityPlan on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using |