UNPKG

googleapis

Version:
600 lines (599 loc) 30.7 kB
import { OAuth2Client, JWT, Compute, UserRefreshClient, BaseExternalAccountClient, GaxiosResponseWithHTTP2, GoogleConfigurable, MethodOptions, StreamMethodOptions, GlobalOptions, GoogleAuth, BodyResponseCallback, APIRequestContext } from 'googleapis-common'; import { Readable } from 'stream'; export declare namespace cloudlocationfinder_v1 { export interface Options extends GlobalOptions { version: 'v1'; } interface StandardParameters { /** * Auth client or API Key for the request */ auth?: string | OAuth2Client | JWT | Compute | UserRefreshClient | BaseExternalAccountClient | GoogleAuth; /** * V1 error format. */ '$.xgafv'?: string; /** * OAuth access token. */ access_token?: string; /** * Data format for response. */ alt?: string; /** * JSONP */ callback?: string; /** * Selector specifying which fields to include in a partial response. */ fields?: string; /** * API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ key?: string; /** * OAuth 2.0 token for the current user. */ oauth_token?: string; /** * Returns response with indentations and line breaks. */ prettyPrint?: boolean; /** * Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ quotaUser?: string; /** * Legacy upload protocol for media (e.g. "media", "multipart"). */ uploadType?: string; /** * Upload protocol for media (e.g. "raw", "multipart"). */ upload_protocol?: string; } /** * Cloud Location Finder API * * * * @example * ```js * const {google} = require('googleapis'); * const cloudlocationfinder = google.cloudlocationfinder('v1'); * ``` */ export class Cloudlocationfinder { context: APIRequestContext; projects: Resource$Projects; constructor(options: GlobalOptions, google?: GoogleConfigurable); } /** * Represents resource cloud locations. */ export interface Schema$CloudLocation { /** * Optional. The carbon free energy percentage of the cloud location. This represents the average percentage of time customers' application will be running on carbon-free energy. See https://cloud.google.com/sustainability/region-carbon for more details. There is a difference between default value 0 and unset value. 0 means the carbon free energy percentage is 0%, while unset value means the carbon footprint data is not available. */ carbonFreeEnergyPercentage?: number | null; /** * Optional. The type of the cloud location. */ cloudLocationType?: string | null; /** * Optional. The provider of the cloud location. Values can be Google Cloud or third-party providers, including AWS, Azure, or Oracle Cloud Infrastructure. */ cloudProvider?: string | null; /** * Output only. The containing cloud location in the strict nesting hierarchy. For example, the containing cloud location of a zone is a region. */ containingCloudLocation?: string | null; /** * Optional. The human-readable name of the cloud location. Example: us-east-2, us-east1. */ displayName?: string | null; /** * Identifier. Name of the cloud location. Unique name of the cloud location including project and location using the form: `projects/{project_id\}/locations/{location\}/cloudLocations/{cloud_location\}` */ name?: string | null; /** * Optional. The two-letter ISO 3166-1 alpha-2 code of the cloud location. Examples: US, JP, KR. */ territoryCode?: string | null; } /** * Message for response to listing cloud locations. */ export interface Schema$ListCloudLocationsResponse { /** * Output only. List of cloud locations. */ cloudLocations?: Schema$CloudLocation[]; /** * Output only. The continuation token, used to page through large result sets. Provide this value in a subsequent request as page_token in subsequent requests to retrieve the next page. If this field is not present, there are no subsequent results. */ nextPageToken?: string | null; } /** * The response message for Locations.ListLocations. */ export interface Schema$ListLocationsResponse { /** * A list of locations that matches the specified filter in the request. */ locations?: Schema$Location[]; /** * The standard List next-page token. */ nextPageToken?: string | null; } /** * A resource that represents a Google Cloud location. */ export interface Schema$Location { /** * The friendly name for this location, typically a nearby city name. For example, "Tokyo". */ displayName?: string | null; /** * Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"\} */ labels?: { [key: string]: string; } | null; /** * The canonical id for this location. For example: `"us-east1"`. */ locationId?: string | null; /** * Service-specific metadata. For example the available capacity at the given location. */ metadata?: { [key: string]: any; } | null; /** * Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"` */ name?: string | null; } /** * Message for response to searching cloud locations. */ export interface Schema$SearchCloudLocationsResponse { /** * Output only. List of cloud locations. */ cloudLocations?: Schema$CloudLocation[]; /** * Output only. The continuation token, used to page through large result sets. Provide this value in a subsequent request as page_token in subsequent requests to retrieve the next page. If this field is not present, there are no subsequent results. */ nextPageToken?: string | null; } export class Resource$Projects { context: APIRequestContext; locations: Resource$Projects$Locations; constructor(context: APIRequestContext); } export class Resource$Projects$Locations { context: APIRequestContext; cloudLocations: Resource$Projects$Locations$Cloudlocations; constructor(context: APIRequestContext); /** * Gets information about a location. * @example * ```js * // Before running the sample: * // - Enable the API at: * // https://console.developers.google.com/apis/api/cloudlocationfinder.googleapis.com * // - Login into gcloud by running: * // ```sh * // $ gcloud auth application-default login * // ``` * // - Install the npm module by running: * // ```sh * // $ npm install googleapis * // ``` * * const {google} = require('googleapis'); * const cloudlocationfinder = google.cloudlocationfinder('v1'); * * async function main() { * const auth = new google.auth.GoogleAuth({ * // Scopes can be specified either as an array or as a single, space-delimited string. * scopes: ['https://www.googleapis.com/auth/cloud-platform'], * }); * * // Acquire an auth client, and bind it to all future calls * const authClient = await auth.getClient(); * google.options({auth: authClient}); * * // Do the magic * const res = await cloudlocationfinder.projects.locations.get({ * // Resource name for the location. * name: 'projects/my-project/locations/my-location', * }); * console.log(res.data); * * // Example response * // { * // "displayName": "my_displayName", * // "labels": {}, * // "locationId": "my_locationId", * // "metadata": {}, * // "name": "my_name" * // } * } * * main().catch(e => { * console.error(e); * throw e; * }); * * ``` * * @param params - Parameters for request * @param options - Optionally override request options, such as `url`, `method`, and `encoding`. * @param callback - Optional callback that handles the response. * @returns A promise if used with async/await, or void if used with a callback. */ get(params: Params$Resource$Projects$Locations$Get, options: StreamMethodOptions): Promise<GaxiosResponseWithHTTP2<Readable>>; get(params?: Params$Resource$Projects$Locations$Get, options?: MethodOptions): Promise<GaxiosResponseWithHTTP2<Schema$Location>>; get(params: Params$Resource$Projects$Locations$Get, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void; get(params: Params$Resource$Projects$Locations$Get, options: MethodOptions | BodyResponseCallback<Schema$Location>, callback: BodyResponseCallback<Schema$Location>): void; get(params: Params$Resource$Projects$Locations$Get, callback: BodyResponseCallback<Schema$Location>): void; get(callback: BodyResponseCallback<Schema$Location>): void; /** * Lists information about the supported locations for this service. This method can be called in two ways: * **List all public locations:** Use the path `GET /v1/locations`. * **List project-visible locations:** Use the path `GET /v1/projects/{project_id\}/locations`. This may include public locations as well as private or other locations specifically visible to the project. * @example * ```js * // Before running the sample: * // - Enable the API at: * // https://console.developers.google.com/apis/api/cloudlocationfinder.googleapis.com * // - Login into gcloud by running: * // ```sh * // $ gcloud auth application-default login * // ``` * // - Install the npm module by running: * // ```sh * // $ npm install googleapis * // ``` * * const {google} = require('googleapis'); * const cloudlocationfinder = google.cloudlocationfinder('v1'); * * async function main() { * const auth = new google.auth.GoogleAuth({ * // Scopes can be specified either as an array or as a single, space-delimited string. * scopes: ['https://www.googleapis.com/auth/cloud-platform'], * }); * * // Acquire an auth client, and bind it to all future calls * const authClient = await auth.getClient(); * google.options({auth: authClient}); * * // Do the magic * const res = await cloudlocationfinder.projects.locations.list({ * // Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage. * extraLocationTypes: 'placeholder-value', * // A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160). * filter: 'placeholder-value', * // The resource that owns the locations collection, if applicable. * name: 'projects/my-project', * // The maximum number of results to return. If not set, the service selects a default. * pageSize: 'placeholder-value', * // A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page. * pageToken: 'placeholder-value', * }); * console.log(res.data); * * // Example response * // { * // "locations": [], * // "nextPageToken": "my_nextPageToken" * // } * } * * main().catch(e => { * console.error(e); * throw e; * }); * * ``` * * @param params - Parameters for request * @param options - Optionally override request options, such as `url`, `method`, and `encoding`. * @param callback - Optional callback that handles the response. * @returns A promise if used with async/await, or void if used with a callback. */ list(params: Params$Resource$Projects$Locations$List, options: StreamMethodOptions): Promise<GaxiosResponseWithHTTP2<Readable>>; list(params?: Params$Resource$Projects$Locations$List, options?: MethodOptions): Promise<GaxiosResponseWithHTTP2<Schema$ListLocationsResponse>>; list(params: Params$Resource$Projects$Locations$List, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void; list(params: Params$Resource$Projects$Locations$List, options: MethodOptions | BodyResponseCallback<Schema$ListLocationsResponse>, callback: BodyResponseCallback<Schema$ListLocationsResponse>): void; list(params: Params$Resource$Projects$Locations$List, callback: BodyResponseCallback<Schema$ListLocationsResponse>): void; list(callback: BodyResponseCallback<Schema$ListLocationsResponse>): void; } export interface Params$Resource$Projects$Locations$Get extends StandardParameters { /** * Resource name for the location. */ name?: string; } export interface Params$Resource$Projects$Locations$List extends StandardParameters { /** * Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage. */ extraLocationTypes?: string[]; /** * A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160). */ filter?: string; /** * The resource that owns the locations collection, if applicable. */ name?: string; /** * The maximum number of results to return. If not set, the service selects a default. */ pageSize?: number; /** * A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page. */ pageToken?: string; } export class Resource$Projects$Locations$Cloudlocations { context: APIRequestContext; constructor(context: APIRequestContext); /** * Retrieves a resource containing information about a cloud location. * @example * ```js * // Before running the sample: * // - Enable the API at: * // https://console.developers.google.com/apis/api/cloudlocationfinder.googleapis.com * // - Login into gcloud by running: * // ```sh * // $ gcloud auth application-default login * // ``` * // - Install the npm module by running: * // ```sh * // $ npm install googleapis * // ``` * * const {google} = require('googleapis'); * const cloudlocationfinder = google.cloudlocationfinder('v1'); * * async function main() { * const auth = new google.auth.GoogleAuth({ * // Scopes can be specified either as an array or as a single, space-delimited string. * scopes: ['https://www.googleapis.com/auth/cloud-platform'], * }); * * // Acquire an auth client, and bind it to all future calls * const authClient = await auth.getClient(); * google.options({auth: authClient}); * * // Do the magic * const res = await cloudlocationfinder.projects.locations.cloudLocations.get({ * // Required. Name of the resource. * name: 'projects/my-project/locations/my-location/cloudLocations/my-cloudLocation', * }); * console.log(res.data); * * // Example response * // { * // "carbonFreeEnergyPercentage": {}, * // "cloudLocationType": "my_cloudLocationType", * // "cloudProvider": "my_cloudProvider", * // "containingCloudLocation": "my_containingCloudLocation", * // "displayName": "my_displayName", * // "name": "my_name", * // "territoryCode": "my_territoryCode" * // } * } * * main().catch(e => { * console.error(e); * throw e; * }); * * ``` * * @param params - Parameters for request * @param options - Optionally override request options, such as `url`, `method`, and `encoding`. * @param callback - Optional callback that handles the response. * @returns A promise if used with async/await, or void if used with a callback. */ get(params: Params$Resource$Projects$Locations$Cloudlocations$Get, options: StreamMethodOptions): Promise<GaxiosResponseWithHTTP2<Readable>>; get(params?: Params$Resource$Projects$Locations$Cloudlocations$Get, options?: MethodOptions): Promise<GaxiosResponseWithHTTP2<Schema$CloudLocation>>; get(params: Params$Resource$Projects$Locations$Cloudlocations$Get, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void; get(params: Params$Resource$Projects$Locations$Cloudlocations$Get, options: MethodOptions | BodyResponseCallback<Schema$CloudLocation>, callback: BodyResponseCallback<Schema$CloudLocation>): void; get(params: Params$Resource$Projects$Locations$Cloudlocations$Get, callback: BodyResponseCallback<Schema$CloudLocation>): void; get(callback: BodyResponseCallback<Schema$CloudLocation>): void; /** * Lists cloud locations under a given project and location. * @example * ```js * // Before running the sample: * // - Enable the API at: * // https://console.developers.google.com/apis/api/cloudlocationfinder.googleapis.com * // - Login into gcloud by running: * // ```sh * // $ gcloud auth application-default login * // ``` * // - Install the npm module by running: * // ```sh * // $ npm install googleapis * // ``` * * const {google} = require('googleapis'); * const cloudlocationfinder = google.cloudlocationfinder('v1'); * * async function main() { * const auth = new google.auth.GoogleAuth({ * // Scopes can be specified either as an array or as a single, space-delimited string. * scopes: ['https://www.googleapis.com/auth/cloud-platform'], * }); * * // Acquire an auth client, and bind it to all future calls * const authClient = await auth.getClient(); * google.options({auth: authClient}); * * // Do the magic * const res = await cloudlocationfinder.projects.locations.cloudLocations.list({ * // Optional. A filter expression that filters resources listed in the response. The expression is in the form of field=value. For example, 'cloud_location_type=CLOUD_LOCATION_TYPE_REGION'. Multiple filter queries are space-separated. For example, 'cloud_location_type=CLOUD_LOCATION_TYPE_REGION territory_code="US"' By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. * filter: 'placeholder-value', * // Optional. The maximum number of cloud locations to return per page. The service might return fewer cloud locations than this value. If unspecified, server will pick an appropriate default. * pageSize: 'placeholder-value', * // Optional. A token identifying a page of results the server should return. Provide page token returned by a previous 'ListCloudLocations' call to retrieve the next page of results. When paginating, all other parameters provided to 'ListCloudLocations' must match the call that provided the page token. * pageToken: 'placeholder-value', * // Required. The parent, which owns this collection of cloud locations. Format: projects/{project\}/locations/{location\} * parent: 'projects/my-project/locations/my-location', * }); * console.log(res.data); * * // Example response * // { * // "cloudLocations": [], * // "nextPageToken": "my_nextPageToken" * // } * } * * main().catch(e => { * console.error(e); * throw e; * }); * * ``` * * @param params - Parameters for request * @param options - Optionally override request options, such as `url`, `method`, and `encoding`. * @param callback - Optional callback that handles the response. * @returns A promise if used with async/await, or void if used with a callback. */ list(params: Params$Resource$Projects$Locations$Cloudlocations$List, options: StreamMethodOptions): Promise<GaxiosResponseWithHTTP2<Readable>>; list(params?: Params$Resource$Projects$Locations$Cloudlocations$List, options?: MethodOptions): Promise<GaxiosResponseWithHTTP2<Schema$ListCloudLocationsResponse>>; list(params: Params$Resource$Projects$Locations$Cloudlocations$List, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void; list(params: Params$Resource$Projects$Locations$Cloudlocations$List, options: MethodOptions | BodyResponseCallback<Schema$ListCloudLocationsResponse>, callback: BodyResponseCallback<Schema$ListCloudLocationsResponse>): void; list(params: Params$Resource$Projects$Locations$Cloudlocations$List, callback: BodyResponseCallback<Schema$ListCloudLocationsResponse>): void; list(callback: BodyResponseCallback<Schema$ListCloudLocationsResponse>): void; /** * Searches for cloud locations from a given source location. * @example * ```js * // Before running the sample: * // - Enable the API at: * // https://console.developers.google.com/apis/api/cloudlocationfinder.googleapis.com * // - Login into gcloud by running: * // ```sh * // $ gcloud auth application-default login * // ``` * // - Install the npm module by running: * // ```sh * // $ npm install googleapis * // ``` * * const {google} = require('googleapis'); * const cloudlocationfinder = google.cloudlocationfinder('v1'); * * async function main() { * const auth = new google.auth.GoogleAuth({ * // Scopes can be specified either as an array or as a single, space-delimited string. * scopes: ['https://www.googleapis.com/auth/cloud-platform'], * }); * * // Acquire an auth client, and bind it to all future calls * const authClient = await auth.getClient(); * google.options({auth: authClient}); * * // Do the magic * const res = * await cloudlocationfinder.projects.locations.cloudLocations.search({ * // Optional. The maximum number of cloud locations to return. The service might return fewer cloud locations than this value. If unspecified, server will pick an appropriate default. * pageSize: 'placeholder-value', * // Optional. A token identifying a page of results the server should return. Provide Page token returned by a previous 'ListCloudLocations' call to retrieve the next page of results. When paginating, all other parameters provided to 'ListCloudLocations' must match the call that provided the page token. * pageToken: 'placeholder-value', * // Required. The parent, which owns this collection of cloud locations. Format: projects/{project\}/locations/{location\} * parent: 'projects/my-project/locations/my-location', * // Optional. The query string in search query syntax. While filter is used to filter the search results by attributes, query is used to specify the search requirements. * query: 'placeholder-value', * // Required. The source cloud location to search from. Example search can be searching nearby cloud locations from the source cloud location by latency. * sourceCloudLocation: 'placeholder-value', * }); * console.log(res.data); * * // Example response * // { * // "cloudLocations": [], * // "nextPageToken": "my_nextPageToken" * // } * } * * main().catch(e => { * console.error(e); * throw e; * }); * * ``` * * @param params - Parameters for request * @param options - Optionally override request options, such as `url`, `method`, and `encoding`. * @param callback - Optional callback that handles the response. * @returns A promise if used with async/await, or void if used with a callback. */ search(params: Params$Resource$Projects$Locations$Cloudlocations$Search, options: StreamMethodOptions): Promise<GaxiosResponseWithHTTP2<Readable>>; search(params?: Params$Resource$Projects$Locations$Cloudlocations$Search, options?: MethodOptions): Promise<GaxiosResponseWithHTTP2<Schema$SearchCloudLocationsResponse>>; search(params: Params$Resource$Projects$Locations$Cloudlocations$Search, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void; search(params: Params$Resource$Projects$Locations$Cloudlocations$Search, options: MethodOptions | BodyResponseCallback<Schema$SearchCloudLocationsResponse>, callback: BodyResponseCallback<Schema$SearchCloudLocationsResponse>): void; search(params: Params$Resource$Projects$Locations$Cloudlocations$Search, callback: BodyResponseCallback<Schema$SearchCloudLocationsResponse>): void; search(callback: BodyResponseCallback<Schema$SearchCloudLocationsResponse>): void; } export interface Params$Resource$Projects$Locations$Cloudlocations$Get extends StandardParameters { /** * Required. Name of the resource. */ name?: string; } export interface Params$Resource$Projects$Locations$Cloudlocations$List extends StandardParameters { /** * Optional. A filter expression that filters resources listed in the response. The expression is in the form of field=value. For example, 'cloud_location_type=CLOUD_LOCATION_TYPE_REGION'. Multiple filter queries are space-separated. For example, 'cloud_location_type=CLOUD_LOCATION_TYPE_REGION territory_code="US"' By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. */ filter?: string; /** * Optional. The maximum number of cloud locations to return per page. The service might return fewer cloud locations than this value. If unspecified, server will pick an appropriate default. */ pageSize?: number; /** * Optional. A token identifying a page of results the server should return. Provide page token returned by a previous 'ListCloudLocations' call to retrieve the next page of results. When paginating, all other parameters provided to 'ListCloudLocations' must match the call that provided the page token. */ pageToken?: string; /** * Required. The parent, which owns this collection of cloud locations. Format: projects/{project\}/locations/{location\} */ parent?: string; } export interface Params$Resource$Projects$Locations$Cloudlocations$Search extends StandardParameters { /** * Optional. The maximum number of cloud locations to return. The service might return fewer cloud locations than this value. If unspecified, server will pick an appropriate default. */ pageSize?: number; /** * Optional. A token identifying a page of results the server should return. Provide Page token returned by a previous 'ListCloudLocations' call to retrieve the next page of results. When paginating, all other parameters provided to 'ListCloudLocations' must match the call that provided the page token. */ pageToken?: string; /** * Required. The parent, which owns this collection of cloud locations. Format: projects/{project\}/locations/{location\} */ parent?: string; /** * Optional. The query string in search query syntax. While filter is used to filter the search results by attributes, query is used to specify the search requirements. */ query?: string; /** * Required. The source cloud location to search from. Example search can be searching nearby cloud locations from the source cloud location by latency. */ sourceCloudLocation?: string; } export {}; }