Documentation ¶
Index ¶
- type Gcp
- func (g *Gcp) GetOAuth2AccessToken(scope []string) (*oauth2.Token, error)
- func (g *Gcp) GetOAuth2IdToken(scope []string) (*oauth2.Token, error)
- func (g *Gcp) PubsubPublish(t *pubsub.Topic, message map[string]interface{}) (string, error)
- func (g *Gcp) PubsubReceive(s *pubsub.Subscription, limit int, timeout int) ([]any, error)
- func (g *Gcp) PubsubSubscription(subscription string) *pubsub.Subscription
- func (g *Gcp) PubsubTopic(topic string) *pubsub.Topic
- func (g *Gcp) QueryTimeSeries(projectId string, query string) ([]*monitoringpb.TimeSeriesData, error)
- func (g *Gcp) SpreadsheetAppend(spreadsheetId string, sheetName string, valueRange []interface{}) (string, error)
- func (g *Gcp) SpreadsheetAppendWithUniqueId(spreadsheetId string, sheetName string, values map[string]interface{}) (int64, error)
- func (g *Gcp) SpreadsheetGet(spreadsheetId string, sheetName string, cellRange string) ([][]interface{}, error)
- func (g *Gcp) SpreadsheetGetRowByFilters(spreadsheetId string, sheetName string, filters map[string]string) (map[string]interface{}, error)
- func (g *Gcp) SpreadsheetGetUniqueIdByFiltersAndAppendIfNotExist(spreadsheetId string, sheetName string, filters map[string]string, ...) (int64, error)
- func (g *Gcp) SpreadsheetUpdate(spreadsheetId string, sheetName string, cellRange string, ...) (string, error)
- type GcpConfig
- type ModuleInstance
- type Option
- type RootModule
- type ServiceAccountKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gcp ¶
type Gcp struct {
// contains filtered or unexported fields
}
func (*Gcp) GetOAuth2AccessToken ¶
This function is a method of the `Gcp` struct and is used to obtain an OAuth2 access token for a given set of scopes. It takes in a variable number of scope strings as arguments and returns an `oauth2.Token` and an error.
func (*Gcp) GetOAuth2IdToken ¶
This is a method of the `Gcp` struct that is used to obtain an OAuth2 ID token for a given set of scopes. It takes in a variable number of scope strings as arguments and returns an `oauth2.Token` and an error. It first checks if the `scope` argument is nil, and if so, it sets it to the default `scope` value of the `Gcp` struct. It then calls the `getTokenSource` function to obtain a token source with the specified scopes and uses it to obtain the ID token by calling the `Token` method on the token source. If there is an error obtaining the token source or the token itself, an error is returned.
func (*Gcp) PubsubPublish ¶
func (*Gcp) PubsubReceive ¶
func (*Gcp) PubsubSubscription ¶
func (g *Gcp) PubsubSubscription(subscription string) *pubsub.Subscription
func (*Gcp) QueryTimeSeries ¶
func (g *Gcp) QueryTimeSeries(projectId string, query string) ([]*monitoringpb.TimeSeriesData, error)
This function is querying time series data from Google Cloud Monitoring API. It takes in a project ID and a query string as parameters, and returns a slice of `monitoringpb.TimeSeriesData` and an error.
func (*Gcp) SpreadsheetAppend ¶
func (g *Gcp) SpreadsheetAppend(spreadsheetId string, sheetName string, valueRange []interface{}) (string, error)
Appends a row of data to a Google Sheet. Parameters: - spreadsheetId: the ID of the Google Sheet. - sheetName: the name of the sheet to append data to. - valueRange: a slice of interface{} values representing the data to append. Returns: - string: an empty string. - error: an error if one occurred, otherwise nil.
func (*Gcp) SpreadsheetAppendWithUniqueId ¶
func (g *Gcp) SpreadsheetAppendWithUniqueId(spreadsheetId string, sheetName string, values map[string]interface{}) (int64, error)
This function appends a row of data to a Google Sheet with a unique ID. Parameters: - spreadsheetId: the ID of the Google Sheet. - sheetName: the name of the sheet to append data to. - values: a slice of interface{} values representing the data to append. Returns: - string: the unique ID of the appended row. - error: an error if one occurred, otherwise nil.
func (*Gcp) SpreadsheetGet ¶
func (g *Gcp) SpreadsheetGet(spreadsheetId string, sheetName string, cellRange string) ([][]interface{}, error)
This function retrieves data from a Google Sheet. Parameters: - spreadsheetId: the ID of the Google Sheet. - sheetName: the name of the sheet to retrieve data from. - cellRange: the range of cells to retrieve data from. Returns: - [][]interface{}: a 2D slice of interface{} values representing the retrieved data. - error: an error if one occurred, otherwise nil.
func (*Gcp) SpreadsheetGetRowByFilters ¶
func (g *Gcp) SpreadsheetGetRowByFilters(spreadsheetId string, sheetName string, filters map[string]string) (map[string]interface{}, error)
Similar to https://pkg.go.dev/google.golang.org/api/sheets/v4#SpreadsheetsService.GetByDataFilter Get a row from a Google Sheet based on filters. Parameters: - spreadsheetId: the ID of the Google Sheet. - sheetName: the name of the sheet to search data in. - filters: a map of column names to values to search for in the specified column. Returns: - map[string]interface{}: a map of the row data if a match is found. - error: an error if one occurred, otherwise nil.
func (*Gcp) SpreadsheetGetUniqueIdByFiltersAndAppendIfNotExist ¶
func (*Gcp) SpreadsheetUpdate ¶
func (g *Gcp) SpreadsheetUpdate(spreadsheetId string, sheetName string, cellRange string, valueRange []interface{}) (string, error)
Updates a range of cells in a Google Sheet. Parameters: - spreadsheetId: the ID of the Google Sheet. - sheetName: the name of the sheet to update data in. - cellRange: the range of cells to update data in. - valueRange: a slice of interface{} values representing the data to update. Returns: - string: an empty string. - error: an error if one occurred, otherwise nil.
type GcpConfig ¶
type GcpConfig struct { Key ServiceAccountKey Scope []string ProjectId string }
type ModuleInstance ¶
type ModuleInstance struct {
// contains filtered or unexported fields
}
ModuleInstance represents an instance of the JS module.
func (*ModuleInstance) Exports ¶
func (mi *ModuleInstance) Exports() modules.Exports
type RootModule ¶
type RootModule struct{}
RootModule is the global module instance that will create module instances for each VU.
func New ¶
func New() *RootModule
func (*RootModule) NewModuleInstance ¶
func (*RootModule) NewModuleInstance(vu modules.VU) modules.Instance
type ServiceAccountKey ¶
type ServiceAccountKey struct { AuthProviderX509CertUrl string `json:"auth_provider_x509_cert_url"` AuthURL string `json:"auth_uri"` ClientEmail string `json:"client_email"` ClientID string `json:"client_id"` ClientSecret string `json:"client_secret"` ClientX509CertUrl string `json:"client_x509_cert_url"` PrivateKey string `json:"private_key"` PrivateKeyID string `json:"private_key_id"` ProjectID string `json:"project_id"` TokenURL string `json:"token_uri"` Type string `json:"type"` UniverseDomain string `json:"universe_domain"` }