@benjamin.x.sebastian/google-cloud-common
TypeScript icon, indicating that this package has built-in type declarations

0.1.10 • Public • Published

Google Cloud Common

This library provides some common functionality used in every Google Cloud project, such as enabling APIs and validating that billing has been set up for the project.


Installing the google-cloud-common Library

npm i @benjamin.x.sebastian/google-cloud-common

Properties and Methods in the google-cloud-common Library

Properties

/**
 * @returns {ServiceUsageClient} The ServiceUsageClient object used by this
 *      project.
 */
export const serviceUsageClient = new ServiceUsageClient();
/**
 * @returns {string} The 'cloudbilling.googleapis.com' service.
 */
export const CLOUD_BILLING_API = 'cloudbilling.googleapis.com';

Methods

/**
 * getProjectIdentifier
 *
 * Gets the project identifier.
 *
 * @returns {string} The project identifier.
 */
export declare function getProjectIdentifier(): Promise<string>;
/**
 * enableServiceForProject
 *
 * Enables the specified service for the project.
 *
 * @param {string} serviceName The service to enable.
 * @param {string} projectIdentifier The project identifier, if defined.
 *      Otherwise, the projectIdentifier will be obtained.
 */
export declare function enableServiceForProject(serviceName: string, projectIdentifier?: string): Promise<void>;
/**
 * initializeServiceAPIForProject
 *
 * Initializes the specified service for the project and returns its API
 * library.
 *
 * @param {string} serviceName The service to enable.
 * @param {any} api The api to initialize.
 * @param {string} projectIdentifier The project identifier, if defined.
 *      Otherwise, the projectIdentifier will be obtained.
 *
 * @returns {API} The project identifier.
 */
export async function initializeServiceAPIForProject<APILibrary>(
    serviceName: string,
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    api: any,
    projectIdentifier?: string
): Promise<APILibrary> {
/**
 * validateCloudBillingAccount
 *
 * Validates the cloud billing account.
 *
 * @param {CloudBillingClient} cloudBillingClient The CloudBillingClient object
 *      used to perform the operations. It will be initialized if not defined.
 */
export declare function validateCloudBillingAccount(cloudBillingClient?: CloudBillingClient): Promise<void>;
/**
 * initializeGoogleCloudCommon
 *
 * Initializes the common functionality used in Google Cloud.
 *
 * @param {string} projectIdentifier The project identifier, if defined.
 *      Otherwise, the projectIdentifier will be obtained.
 *
 * @returns {CloudBillingClient} The CloudBillingClient object used to perform
 *      the operations.
 */
export declare function initializeGoogleCloudCommon(projectIdentifier?: string): Promise<CloudBillingClient>;

License

  • Apache Version 2.0
  • See LICENSE for details.

Readme

Keywords

none

Package Sidebar

Install

npm i @benjamin.x.sebastian/google-cloud-common

Weekly Downloads

0

Version

0.1.10

License

Apache-2.0

Unpacked Size

27.5 kB

Total Files

6

Last publish

Collaborators

  • benjamin.x.sebastian