github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/dayu/v1/connections/results.go (about)

     1  package connections
     2  
     3  import "github.com/chnsz/golangsdk/pagination"
     4  
     5  type createResp struct {
     6  	// The ID of the data connection.
     7  	DataConnectionId string `json:"data_connection_id"`
     8  }
     9  
    10  // Connection is the structure that represents the data connection detail.
    11  type Connection struct {
    12  	// The data connection name.
    13  	DwName string `json:"dw_name"`
    14  	// The data connection type.
    15  	DwType string `json:"dw_type"`
    16  	// The dynamic configuration for the specified type of data connection.
    17  	DwConfig interface{} `json:"dw_config"`
    18  	// The agent ID.
    19  	AgentId string `json:"agent_id"`
    20  	// The agent name.
    21  	AgentName string `json:"agent_name"`
    22  	// The data connection mode.
    23  	EnvType int `json:"env_type"`
    24  	// The qualified name of the data connection.
    25  	QualifiedName string `json:"qualified_name"`
    26  	// The data connection ID.
    27  	DwId string `json:"dw_id"`
    28  	// The creator name.
    29  	CreateUser string `json:"create_user"`
    30  	// The creation time of the data connection.
    31  	CreateTime int `json:"create_time"`
    32  	// The catagory of the data connection.
    33  	DwCatagory string `json:"dw_catagory"`
    34  	// The update type of the data connection.
    35  	UpdateType int `json:"update_type"`
    36  }
    37  
    38  // ValidateResp is the structure that represents the result of data connection pre-check.
    39  type ValidateResp struct {
    40  	// The message of the data connection pre-check.
    41  	Message string `json:"message"`
    42  	// Whether the data connection pre-check is successful.
    43  	IsSuccess bool `json:"is_success"`
    44  }
    45  
    46  // ConnectionPage represents the response pages of the List method.
    47  type ConnectionPage struct {
    48  	pagination.OffsetPageBase
    49  }
    50  
    51  // IsEmpty checks whether a ConnectionPage struct is empty.
    52  func (b ConnectionPage) IsEmpty() (bool, error) {
    53  	arr, err := extractConnections(b)
    54  	return len(arr) == 0, err
    55  }
    56  
    57  // ExtractConnections is a method to extract the list of data connections.
    58  func extractConnections(r pagination.Page) ([]Connection, error) {
    59  	var s []Connection
    60  	err := r.(ConnectionPage).Result.ExtractIntoSlicePtr(&s, "data_connection_lists")
    61  	return s, err
    62  }