Documentation ¶
Index ¶
- type CreateRequest
- type CreateResponse
- type GetResponse
- type ListResponse
- type PostgresUsersService
- func (svc *PostgresUsersService) Create(ctx context.Context, projectID, instanceID, username, database string, ...) (res CreateResponse, err error)
- func (svc *PostgresUsersService) Get(ctx context.Context, projectID, instanceID, userID string) (res GetResponse, err error)
- func (svc *PostgresUsersService) List(ctx context.Context, projectID, instanceID string) (res ListResponse, err error)
- type User
- type UserGetItem
- type UserListItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateRequest ¶
type CreateRequest struct { Database string `json:"database,omitempty"` Roles []string `json:"roles,omitempty"` Username string `json:"username,omitempty"` }
CreateRequest holds data for requesting new user
type CreateResponse ¶
type CreateResponse struct {
Item User `json:"item,omitempty"`
}
CreateResponse is the server response when creating a new user
type GetResponse ¶
type GetResponse struct {
Item UserGetItem `json:"item,omitempty"`
}
GetResponse is a struct representing the server's get response
type ListResponse ¶
type ListResponse struct { Count int `json:"count,omitempty"` Items []UserListItem `json:"items,omitempty"` }
ListResponse represents a list of users returned from the server
type PostgresUsersService ¶
PostgresUsersService is the service that manages Postgres Flex instances
func New ¶
func New(c common.Client) *PostgresUsersService
New returns a new handler for the service
func (*PostgresUsersService) Create ¶
func (svc *PostgresUsersService) Create(ctx context.Context, projectID, instanceID, username, database string, roles []string) (res CreateResponse, err error)
Create adds a new Postgres user and returns the server response (CreateResponse) and error if occurred See also https://api.stackit.schwarz/postgres-flex-service/openapi.html#tag/users/paths/~1projects~1{projectId}~1instances~1{instanceId}~1users~1{userId}/post
func (*PostgresUsersService) Get ¶
func (svc *PostgresUsersService) Get(ctx context.Context, projectID, instanceID, userID string) (res GetResponse, err error)
Get returns the user information by project, instance ID and user ID See also https://api.stackit.schwarz/postgres-flex-service/openapi.html#tag/users/paths/~1projects~1{projectId}~1instances~1{instanceId}~1users~1{userId}/get
func (*PostgresUsersService) List ¶
func (svc *PostgresUsersService) List(ctx context.Context, projectID, instanceID string) (res ListResponse, err error)
List returns a list of Postgres Flex users See also https://api.stackit.schwarz/postgres-flex-service/openapi.html#tag/users/paths/~1projects~1{projectId}~1instances~1{instanceId}~1users/get
type User ¶
type User struct { Database string `json:"database,omitempty"` Hostname string `json:"hostname,omitempty"` ID string `json:"id,omitempty"` Password string `json:"password,omitempty"` Port int `json:"port,omitempty"` Roles []string `json:"roles,omitempty"` URI string `json:"uri,omitempty"` Username string `json:"username,omitempty"` }
User represents a user with access to the database
type UserGetItem ¶
type UserGetItem struct { Database string `json:"database,omitempty"` Hostname string `json:"hostname,omitempty"` ID string `json:"id,omitempty"` Port int `json:"port,omitempty"` Roles []string `json:"roles,omitempty"` Username string `json:"username,omitempty"` }
UserGetItem is an item in GetResponse
type UserListItem ¶
type UserListItem struct { ID string `json:"id,omitempty"` Username string `json:"username,omitempty"` }
UserListItem is an item in the Items list of ListResponse