Class v1beta.AppOptimizeClient (0.1.1)

Service for managing and querying optimization reports. v1beta

Package

@google-cloud/appoptimize

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of AppOptimizeClient.

Parameters
Name Description
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new AppOptimizeClient({fallback: true}, gax); ```

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.

appOptimizeStub

appOptimizeStub?: Promise<{
        [name: string]: Function;
    }>;

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

locationsClient

locationsClient: LocationsClient;

operationsClient

operationsClient: gax.OperationsClient;

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

applicationPath(project, location, application)

applicationPath(project: string, location: string, application: string): string;

Return a fully-qualified application resource name string.

Parameters
Name Description
project string
location string
application string
Returns
Type Description
string

{string} Resource name string.

cancelOperation(request, optionsOrCallback, callback)

cancelOperation(request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: gax.CallOptions | Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED.

Parameters
Name Description
request CancelOperationRequest

The request object that will be sent.

optionsOrCallback CallOptions | Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>
callback Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type Description
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.cancelOperation({name: ''});

checkCreateReportProgress(name)

checkCreateReportProgress(name: string): Promise<LROperation<protos.google.cloud.appoptimize.v1beta.Report, protos.google.cloud.appoptimize.v1beta.OperationMetadata>>;

Check the status of the long running operation returned by createReport().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.appoptimize.v1beta.Report, protos.google.cloud.appoptimize.v1beta.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * 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 Google Cloud project that will own the report.
   *  This value does not define the scope of the report data. See `Report.scope`
   *  for setting the data scope.
   *  Format: `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'
  /**
   *  Required. The ID to use for this report. This ID must be unique within
   *  the parent project and should comply with RFC 1034 restrictions (letters,
   *  numbers, and hyphen, with the first character a letter, the last a letter
   *  or a number, and a 63 character maximum).
   */
  // const reportId = 'abc123'
  /**
   *  Required. The report resource to create.
   */
  // const report = {}

  // Imports the Appoptimize library
  const {AppOptimizeClient} = require('@google-cloud/appoptimize').v1beta;

  // Instantiates a client
  const appoptimizeClient = new AppOptimizeClient();

  async function callCreateReport() {
    // Construct request
    const request = {
      parent,
      reportId,
      report,
    };

    // Run request
    const [operation] = await appoptimizeClient.createReport(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateReport();

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.

createReport(request, options)

createReport(request?: protos.google.cloud.appoptimize.v1beta.ICreateReportRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.appoptimize.v1beta.IReport, protos.google.cloud.appoptimize.v1beta.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Creates a new report.

This initiates a long-running operation that, upon completion, results in a report resource. Once the report is created, its results can be read via ReadReport.

Parameters
Name Description
request ICreateReportRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.appoptimize.v1beta.IReport, protos.google.cloud.appoptimize.v1beta.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * 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 Google Cloud project that will own the report.
   *  This value does not define the scope of the report data. See `Report.scope`
   *  for setting the data scope.
   *  Format: `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'
  /**
   *  Required. The ID to use for this report. This ID must be unique within
   *  the parent project and should comply with RFC 1034 restrictions (letters,
   *  numbers, and hyphen, with the first character a letter, the last a letter
   *  or a number, and a 63 character maximum).
   */
  // const reportId = 'abc123'
  /**
   *  Required. The report resource to create.
   */
  // const report = {}

  // Imports the Appoptimize library
  const {AppOptimizeClient} = require('@google-cloud/appoptimize').v1beta;

  // Instantiates a client
  const appoptimizeClient = new AppOptimizeClient();

  async function callCreateReport() {
    // Construct request
    const request = {
      parent,
      reportId,
      report,
    };

    // Run request
    const [operation] = await appoptimizeClient.createReport(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateReport();

createReport(request, options, callback)

createReport(request: protos.google.cloud.appoptimize.v1beta.ICreateReportRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.appoptimize.v1beta.IReport, protos.google.cloud.appoptimize.v1beta.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateReportRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.appoptimize.v1beta.IReport, protos.google.cloud.appoptimize.v1beta.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

createReport(request, callback)

createReport(request: protos.google.cloud.appoptimize.v1beta.ICreateReportRequest, callback: Callback<LROperation<protos.google.cloud.appoptimize.v1beta.IReport, protos.google.cloud.appoptimize.v1beta.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateReportRequest
callback Callback<LROperation<protos.google.cloud.appoptimize.v1beta.IReport, protos.google.cloud.appoptimize.v1beta.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteOperation(request, optionsOrCallback, callback)

deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, optionsOrCallback?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;

Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Parameters
Name Description
request DeleteOperationRequest

The request object that will be sent.

optionsOrCallback CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>
callback Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type Description
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.deleteOperation({name: ''});

deleteReport(request, options)

deleteReport(request?: protos.google.cloud.appoptimize.v1beta.IDeleteReportRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        protos.google.cloud.appoptimize.v1beta.IDeleteReportRequest | undefined,
        {} | undefined
    ]>;

Deletes the specified report.

Parameters
Name Description
request IDeleteReportRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.protobuf.IEmpty, protos.google.cloud.appoptimize.v1beta.IDeleteReportRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.

Example

  /**
   * 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 report to delete.
   *  Format: `projects/{project}/locations/{location}/reports/{report_id}`.
   */
  // const name = 'abc123'
  /**
   *  Optional. If set to true, and the report is not found, the request will
   *  succeed but no action will be taken on the server.
   */
  // const allowMissing = true

  // Imports the Appoptimize library
  const {AppOptimizeClient} = require('@google-cloud/appoptimize').v1beta;

  // Instantiates a client
  const appoptimizeClient = new AppOptimizeClient();

  async function callDeleteReport() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await appoptimizeClient.deleteReport(request);
    console.log(response);
  }

  callDeleteReport();

deleteReport(request, options, callback)

deleteReport(request: protos.google.cloud.appoptimize.v1beta.IDeleteReportRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.appoptimize.v1beta.IDeleteReportRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteReportRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.appoptimize.v1beta.IDeleteReportRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteReport(request, callback)

deleteReport(request: protos.google.cloud.appoptimize.v1beta.IDeleteReportRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.appoptimize.v1beta.IDeleteReportRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteReportRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.appoptimize.v1beta.IDeleteReportRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getLocation(request, options, callback)

getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;

Gets information about a location.

Parameters
Name Description
request LocationProtos.google.cloud.location.IGetLocationRequest

The request object that will be sent.

options CallOptions | Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>

Call options. See CallOptions for more details.

callback Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
Promise<google.cloud.location.ILocation>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

const [response] = await client.getLocation(request);

getOperation(request, optionsOrCallback, callback)

getOperation(request: protos.google.longrunning.GetOperationRequest, optionsOrCallback?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters
Name Description
request GetOperationRequest

The request object that will be sent.

optionsOrCallback CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>
callback Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing . {Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type Description
Promise<[protos.google.longrunning.Operation]>
Example

const client = longrunning.operationsClient();
const name = '';
const [response] = await client.getOperation({name});
// doThingsWith(response)

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

getReport(request, options)

getReport(request?: protos.google.cloud.appoptimize.v1beta.IGetReportRequest, options?: CallOptions): Promise<[
        protos.google.cloud.appoptimize.v1beta.IReport,
        protos.google.cloud.appoptimize.v1beta.IGetReportRequest | undefined,
        {} | undefined
    ]>;

Retrieves the details of a report configuration.

Parameters
Name Description
request IGetReportRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.appoptimize.v1beta.IReport, protos.google.cloud.appoptimize.v1beta.IGetReportRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Report. Please see the documentation for more details and examples.

Example

  /**
   * 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 report to retrieve.
   *  Format: `projects/{project}/locations/{location}/reports/{report_id}`.
   */
  // const name = 'abc123'

  // Imports the Appoptimize library
  const {AppOptimizeClient} = require('@google-cloud/appoptimize').v1beta;

  // Instantiates a client
  const appoptimizeClient = new AppOptimizeClient();

  async function callGetReport() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await appoptimizeClient.getReport(request);
    console.log(response);
  }

  callGetReport();

getReport(request, options, callback)

getReport(request: protos.google.cloud.appoptimize.v1beta.IGetReportRequest, options: CallOptions, callback: Callback<protos.google.cloud.appoptimize.v1beta.IReport, protos.google.cloud.appoptimize.v1beta.IGetReportRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetReportRequest
options CallOptions
callback Callback<protos.google.cloud.appoptimize.v1beta.IReport, protos.google.cloud.appoptimize.v1beta.IGetReportRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getReport(request, callback)

getReport(request: protos.google.cloud.appoptimize.v1beta.IGetReportRequest, callback: Callback<protos.google.cloud.appoptimize.v1beta.IReport, protos.google.cloud.appoptimize.v1beta.IGetReportRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetReportRequest
callback Callback<protos.google.cloud.appoptimize.v1beta.IReport, protos.google.cloud.appoptimize.v1beta.IGetReportRequest | null | undefined, {} | null | 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.

listLocationsAsync(request, options)

listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;

Lists information about the supported locations for this service. Returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request LocationProtos.google.cloud.location.IListLocationsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<google.cloud.location.ILocation>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . 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.

Example

const iterable = client.listLocationsAsync(request);
for await (const response of iterable) {
  // process response
}

listOperationsAsync(request, options)

listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.IOperation>;

Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED. Returns an iterable object.

For-await-of syntax is used with the iterable to recursively get response element on-demand.

Parameters
Name Description
request ListOperationsRequest

The request object that will be sent.

options CallOptions

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

Returns
Type Description
AsyncIterable<protos.google.longrunning.IOperation>

{Object} An iterable Object that conforms to iteration protocols.

Example

const client = longrunning.operationsClient();
for await (const response of client.listOperationsAsync(request));
// doThingsWith(response)

listReports(request, options)

listReports(request?: protos.google.cloud.appoptimize.v1beta.IListReportsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.appoptimize.v1beta.IReport[],
        protos.google.cloud.appoptimize.v1beta.IListReportsRequest | null,
        protos.google.cloud.appoptimize.v1beta.IListReportsResponse
    ]>;

Lists reports within a given project.

Parameters
Name Description
request IListReportsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.appoptimize.v1beta.IReport[], protos.google.cloud.appoptimize.v1beta.IListReportsRequest | null, protos.google.cloud.appoptimize.v1beta.IListReportsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of Report. 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 listReportsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listReports(request, options, callback)

listReports(request: protos.google.cloud.appoptimize.v1beta.IListReportsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.appoptimize.v1beta.IListReportsRequest, protos.google.cloud.appoptimize.v1beta.IListReportsResponse | null | undefined, protos.google.cloud.appoptimize.v1beta.IReport>): void;
Parameters
Name Description
request IListReportsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.appoptimize.v1beta.IListReportsRequest, protos.google.cloud.appoptimize.v1beta.IListReportsResponse | null | undefined, protos.google.cloud.appoptimize.v1beta.IReport>
Returns
Type Description
void

listReports(request, callback)

listReports(request: protos.google.cloud.appoptimize.v1beta.IListReportsRequest, callback: PaginationCallback<protos.google.cloud.appoptimize.v1beta.IListReportsRequest, protos.google.cloud.appoptimize.v1beta.IListReportsResponse | null | undefined, protos.google.cloud.appoptimize.v1beta.IReport>): void;
Parameters
Name Description
request IListReportsRequest
callback PaginationCallback<protos.google.cloud.appoptimize.v1beta.IListReportsRequest, protos.google.cloud.appoptimize.v1beta.IListReportsResponse | null | undefined, protos.google.cloud.appoptimize.v1beta.IReport>
Returns
Type Description
void

listReportsAsync(request, options)

listReportsAsync(request?: protos.google.cloud.appoptimize.v1beta.IListReportsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.appoptimize.v1beta.IReport>;

Equivalent to listReports, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IListReportsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.appoptimize.v1beta.IReport>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Report. 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.

Example

  /**
   * 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 project whose reports are to be listed.
   *  Format: `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'
  /**
   *  Optional. The maximum number of reports to return. The service may return
   *  fewer than this value. If unspecified, the server will determine the number
   *  of results to return.
   */
  // const pageSize = 1234
  /**
   *  Optional. A page token, received from a previous `ListReports` call.
   *  Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to `ListReports` must match
   *  the call that provided the page token.
   */
  // const pageToken = 'abc123'

  // Imports the Appoptimize library
  const {AppOptimizeClient} = require('@google-cloud/appoptimize').v1beta;

  // Instantiates a client
  const appoptimizeClient = new AppOptimizeClient();

  async function callListReports() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = appoptimizeClient.listReportsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListReports();

listReportsStream(request, options)

listReportsStream(request?: protos.google.cloud.appoptimize.v1beta.IListReportsRequest, options?: CallOptions): Transform;

Equivalent to listReports, but returns a NodeJS Stream object.

Parameters
Name Description
request IListReportsRequest

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 Report 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 listReportsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

locationPath(project, location)

locationPath(project: string, location: string): string;

Return a fully-qualified location resource name string.

Parameters
Name Description
project string
location string
Returns
Type Description
string

{string} Resource name string.

matchApplicationFromApplicationName(applicationName)

matchApplicationFromApplicationName(applicationName: string): string | number;

Parse the application from Application resource.

Parameter
Name Description
applicationName string

A fully-qualified path representing Application resource.

Returns
Type Description
string | number

{string} A string representing the application.

matchLocationFromApplicationName(applicationName)

matchLocationFromApplicationName(applicationName: string): string | number;

Parse the location from Application resource.

Parameter
Name Description
applicationName string

A fully-qualified path representing Application resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromReportName(reportName)

matchLocationFromReportName(reportName: string): string | number;

Parse the location from Report resource.

Parameter
Name Description
reportName string

A fully-qualified path representing Report resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchProjectFromApplicationName(applicationName)

matchProjectFromApplicationName(applicationName: string): string | number;

Parse the project from Application resource.

Parameter
Name Description
applicationName string

A fully-qualified path representing Application resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location 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.

matchProjectFromReportName(reportName)

matchProjectFromReportName(reportName: string): string | number;

Parse the project from Report resource.

Parameter
Name Description
reportName string

A fully-qualified path representing Report resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchReportFromReportName(reportName)

matchReportFromReportName(reportName: string): string | number;

Parse the report from Report resource.

Parameter
Name Description
reportName string

A fully-qualified path representing Report resource.

Returns
Type Description
string | number

{string} A string representing the report.

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.

readReport(request, options)

readReport(request?: protos.google.cloud.appoptimize.v1beta.IReadReportRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IListValue[],
        protos.google.cloud.appoptimize.v1beta.IReadReportRequest | null,
        protos.google.cloud.appoptimize.v1beta.IReadReportResponse
    ]>;

Reads data within a specified report.

Parameters
Name Description
request IReadReportRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.protobuf.IListValue[], protos.google.cloud.appoptimize.v1beta.IReadReportRequest | null, protos.google.cloud.appoptimize.v1beta.IReadReportResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of ListValue. 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 readReportAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

readReport(request, options, callback)

readReport(request: protos.google.cloud.appoptimize.v1beta.IReadReportRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.appoptimize.v1beta.IReadReportRequest, protos.google.cloud.appoptimize.v1beta.IReadReportResponse | null | undefined, protos.google.protobuf.IListValue>): void;
Parameters
Name Description
request IReadReportRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.appoptimize.v1beta.IReadReportRequest, protos.google.cloud.appoptimize.v1beta.IReadReportResponse | null | undefined, protos.google.protobuf.IListValue>
Returns
Type Description
void

readReport(request, callback)

readReport(request: protos.google.cloud.appoptimize.v1beta.IReadReportRequest, callback: PaginationCallback<protos.google.cloud.appoptimize.v1beta.IReadReportRequest, protos.google.cloud.appoptimize.v1beta.IReadReportResponse | null | undefined, protos.google.protobuf.IListValue>): void;
Parameters
Name Description
request IReadReportRequest
callback PaginationCallback<protos.google.cloud.appoptimize.v1beta.IReadReportRequest, protos.google.cloud.appoptimize.v1beta.IReadReportResponse | null | undefined, protos.google.protobuf.IListValue>
Returns
Type Description
void

readReportAsync(request, options)

readReportAsync(request?: protos.google.cloud.appoptimize.v1beta.IReadReportRequest, options?: CallOptions): AsyncIterable<protos.google.protobuf.IListValue>;

Equivalent to readReport, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IReadReportRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.protobuf.IListValue>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing ListValue. 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.

Example

  /**
   * 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 resource name of the report to query.
   *  Format: `projects/{project}/locations/{location}/reports/{report_id}`.
   */
  // const name = 'abc123'
  /**
   *  Optional. The maximum number of rows to return. The service may return
   *  fewer than this value. If unspecified, at most 10,000 rows will be returned
   *  per page. The maximum allowed value is 25,000; values above 25,000 are
   *  coerced to 25,000.
   */
  // const pageSize = 1234
  /**
   *  Optional. A page token, received from a previous `ReadReport` call, to
   *  retrieve the subsequent page of results. When `page_token` is specified,
   *  `job_reference` must also be provided from the previous response, and the
   *  `statement` field must not be set.
   */
  // const pageToken = 'abc123'

  // Imports the Appoptimize library
  const {AppOptimizeClient} = require('@google-cloud/appoptimize').v1beta;

  // Instantiates a client
  const appoptimizeClient = new AppOptimizeClient();

  async function callReadReport() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const iterable = appoptimizeClient.readReportAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callReadReport();

readReportStream(request, options)

readReportStream(request?: protos.google.cloud.appoptimize.v1beta.IReadReportRequest, options?: CallOptions): Transform;

Equivalent to readReport, but returns a NodeJS Stream object.

Parameters
Name Description
request IReadReportRequest

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 ListValue 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 readReportAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

reportPath(project, location, report)

reportPath(project: string, location: string, report: string): string;

Return a fully-qualified report resource name string.

Parameters
Name Description
project string
location string
report string
Returns
Type Description
string

{string} Resource name string.