connection

package
v0.9.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeDWS        = "DWS"
	TypeDLI        = "DLI"
	TypeSparkSQL   = "SparkSQL"
	TypeHive       = "HIVE"
	TypeRDS        = "RDS"
	TypeCloudTable = "CloudTable"
	TypeHOST       = "HOST"
)
View Source
const (
	MethodAgent  = "agent"
	MethodDirect = "direct"
)
View Source
const HeaderWorkspace = "workspace"

Variables

This section is empty.

Functions

func Create

func Create(client *golangsdk.ServiceClient, opts Connection) error

Create is used to create a connection. The supported connection types include DWS, DLI, Spark SQL, RDS, CloudTable, and Hive. Send request /v1/{project_id}/connections

func Delete

func Delete(client *golangsdk.ServiceClient, connName, workspace string) error

Delete is used to delete a connection. Send request DELETE /v1/{project_id}/connections/{connection_name}

func Export

func Export(client *golangsdk.ServiceClient, workspace string) (io.ReadCloser, error)

Export is used to export all connection information that is compressed in ZIP format. Send request POST /v1/{project_id}/connections/export

func Update

func Update(client *golangsdk.ServiceClient, conn Connection, opts UpdateOpts, workspace string) error

Update is used to edit a connection. Send request PUT /v1/{project_id}/connections/{connection_name}?ischeck=true

Types

type CloudTableConfig

type CloudTableConfig struct {
	// Name of a CloudTable cluster.
	ClusterName string `json:"clusterName" required:"true"`
}

type Connection

type Connection struct {
	// Workspace ID.
	Workspace string `json:"-"`
	// Connection name. The name contains a maximum of 100 characters, including only letters, numbers, hyphens (-), and underscores (_).
	// The connection name must be unique.
	Name string `json:"name" required:"true"`
	// Connection type. Should be one of: DWS, DLI, SparkSQL, HIVE, RDS, CloudTable, HOST.
	Type string `json:"type" required:"true"`
	// Config connection configuration. The configuration item varies with the connection type.
	// You do not need to set the config parameter for DLI connections.
	// For other types of connections, see the description of connection configuration items.
	Config interface{} `json:"config,omitempty"`
	// Description of the connection. The description contains a maximum of 255 characters.
	Description string `json:"description,omitempty"`
}

func Get

func Get(client *golangsdk.ServiceClient, connectionName string, workspace string) (*Connection, error)

Get is used to query configuration details of a specific connection. Send request GET /v1/{project_id}/connections/{connection_name}

func (*Connection) UnmarshalJSON

func (c *Connection) UnmarshalJSON(data []byte) error

type DWSConfig

type DWSConfig struct {
	// Name of a DWS cluster.
	ClusterName string `json:"clusterName,omitempty"`
	// IP address for accessing the DWS cluster.
	IP string `json:"ip,omitempty"`
	// Port for accessing the DWS cluster.
	Port string `json:"port,omitempty"`
	// Username of the database. This username is the username entered during the creation of the DWS cluster.
	Username string `json:"userName" required:"true"`
	// Password for accessing the database. This password is the password entered during the creation of the DWS cluster.
	Password string `json:"password" required:"true"`
	// Specifies whether to enable the SSL connection.
	SSLEnable bool `json:"sslEnable" required:"true"`
	// Name of a KMS key.
	KMSKey string `json:"kmsKey" required:"true"`
	// Name of a CDM cluster.
	AgentName string `json:"agentName" required:"true"`
}

type HOSTConfig

type HOSTConfig struct {
	// IP address of the host.
	IP string `json:"ip" required:"true"`
	// SSH port number of the host.
	Port string `json:"port" required:"true"`
	// Username for logging in to the host.
	Username string `json:"userName" required:"true"`
	// Password for logging in to the host.
	Password string `json:"password,omitempty"`
	// Name of a CDM cluster.
	AgentName string `json:"agentName" required:"true"`
	// Name of a KMS key.
	KMSKey string `json:"kmsKey" required:"true"`
	// KeyLocation is a path to key authorisation.
	KeyLocation string `json:"keyLocation" required:"true"`
}

type HiveConfig

type HiveConfig struct {
	// Name of an MRS cluster.
	ClusterName string `json:"clusterName" required:"true"`
	// Method to connect.
	//   agent: connected through an agent.
	//   direct: connected directly.
	ConnectionMethod string `json:"connectionMethod" required:"true"`
	// Username of the MRS cluster. This parameter is mandatory when connectionMethod is set to agent.
	Username string `json:"userName,omitempty"`
	// Password for accessing the MRS cluster. This parameter is mandatory when connectionMethod is set to agent.
	Password string `json:"password,omitempty"`
	// Name of a CDM cluster. This parameter is mandatory when connectionMethod is set to agent.
	AgentName string `json:"agentName,omitempty"`
	// Name of a KMS key. This parameter is mandatory when connectionMethod is set to agent.
	KMSKey string `json:"kmsKey,omitempty"`
}

type ListOpts

type ListOpts struct {
	Offset         int    `q:"offset"`
	Limit          int    `q:"limit"`
	ConnectionName string `q:"connectionName"`
}

type ListResp

type ListResp struct {
	// Total the number of connections.
	Total int `q:"total"`
	// Connection the Connection list.
	Connections []Connection `q:"connections"`
}

func List

func List(client *golangsdk.ServiceClient, opts ListOpts) (*ListResp, error)

List is used to query a connection list. Send request GET /v1/{project_id}/connections?offset={offset}&limit={limit}&connectionName={connectionName}

type RDSConfig

type RDSConfig struct {
	// Address for accessing RDS.
	IP string `json:"ip" required:"true"`
	// Port for accessing RDS.
	Port string `json:"port" required:"true"`
	// Username of the database. This username is the username entered during the creation of the cluster.
	Username string `json:"userName" required:"true"`
	// Password for accessing the database. This password is the password entered during the creation of the cluster.
	Password string `json:"password" required:"true"`
	// Name of a CDM cluster.
	AgentName string `json:"agentName" required:"true"`
	// Name of a KMS key.
	KMSKey string `json:"kmsKey" required:"true"`
	// Name of the driver.
	DriverName string `json:"driverName" required:"true"`
	// Path of the driver on OBS.
	DriverPath string `json:"driverPath" required:"true"`
}

type SparkConfig

type SparkConfig struct {
	// Name of an MRS cluster.
	ClusterName string `json:"clusterName" required:"true"`
	// Method to connect.
	//   agent: connected through an agent.
	//   direct: connected directly.
	ConnectionMethod string `json:"connectionMethod" required:"true"`
	// Username of the MRS cluster. This parameter is mandatory when connectionMethod is set to agent.
	Username string `json:"userName,omitempty"`
	// Password for accessing the MRS cluster. This parameter is mandatory when connectionMethod is set to agent.
	Password string `json:"password,omitempty"`
	// Name of a CDM cluster. This parameter is mandatory when connectionMethod is set to agent.
	AgentName string `json:"agentName,omitempty"`
	// Name of a KMS key. This parameter is mandatory when connectionMethod is set to agent.
	KMSKey string `json:"kmsKey,omitempty"`
}

type UpdateOpts

type UpdateOpts struct {
	// IsCheck indicates whether to perform check. The default value is No.
	IsCheck bool `q:"ischeck"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL