目录

Cloud

Cloud-side entry point class, which provides Cloud instances for different data processing locations. After initializing Cloud, you need to obtain an instance, which allows you to perform operations such as creating an Auth Service instance.

Constructor Summary

Constructor Info

constructor(path?: string, name: string, region?: string)

Constructor.

Method Summary

Qualifier and Type

Method Name

Cloud

createInstance(path?: string, name: string, region?: string)

Creates a Cloud instance.

Auth

auth()

Creates a Cloud Auth instance.

CloudDB

database(config: DatabaseConfig)

Creates a CloudDB instance.

CloudFunction

function()

Creates a CloudFunction instance.

Enum Summary

Enum

Description

Region

Data processing locations.

Constructors

[h2]constructor

Method

constructor(path?: string, name: string, region?: string)

Initializes a Cloud instance.

Parameters

Name

Description

path

Path to the authentication credential file (agc-apiclient-xxx-xxx.json). This parameter is optional.

name

Name of the Cloud instance.

region

Data processing location to which the instance belongs. This parameter is optional.

Methods

[h2]createInstance

Method

createInstance(path?: string, name: string, region?: string): Cloud

Initializes a Cloud instance.

Parameters

Name

Type

Description

path

string

Path to the authentication credential file. This parameter is optional.

name

string

Name of the Cloud instance.

region

string

Data processing location. This parameter is optional.

Return

Type

Description

Cloud

Cloud object.

[h2]auth

Method

auth(): Auth

Obtains the Auth instance corresponding to the data processing location.

Return

Type

Description

Auth

Auth object.

[h2]database

Method

database(config: DatabaseConfig): CloudDB

Obtains the CloudDB instance corresponding to the data processing location. The Cloud DB zone configuration can be transferred and data can be managed only after the instance is obtained.

Parameters

Name

Type

Description

config

DatabaseConfig

DatabaseConfig object, containing the Cloud DB zone name and trace ID.

Trace IDs are used to trace requests. You can view the trace IDs in logs of the local development environment.

Trace IDs can be generated in either of the following methods:

  • Custom: This type of trace ID can be used to trace all subsequent requests. You can pass a parameter to customize a trace ID. If an invalid trace ID is passed, the system will automatically generate one.

    The custom trace ID must contain 1 to 32 characters and can consist of only the following:

    • Letters (a to f)
    • Digits (0 to 9)
  • Automatically generated: If you do not customize a trace ID, the system will automatically generate one for each request. This type of trace ID can be used to trace and locate a request.

Return

Type

Description

CloudDB

If the API is successfully called, a CloudDB object will be obtained. You can use the collection method to perform create, read, update, and delete operations on the CloudDB object.

[h2]function

Method

function(): CloudFunction

Obtains the CloudFunction instance corresponding to the data processing location.

Return

Type

Description

CloudFunction

CloudFunction object.

Enums

[h2]Region

Data processing locations.

Value

Description

REGION_CN

China region.

REGION_RU

Russia region.

REGION_SG

Singapore region.

REGION_DE

Germany region.