Documentation
¶
Overview ¶
Package has provides support for HSDP Appstreaming service
Index ¶
- Constants
- Variables
- type Client
- type Config
- type EBS
- type ErrorResponse
- type Image
- type ImagesService
- type OptionFunc
- type Resource
- type ResourceOptions
- type ResourcesReport
- type ResourcesService
- func (c *ResourcesService) CreateResource(resource Resource) (*[]Resource, *Response, error)
- func (c *ResourcesService) DeleteResource(resourceID string, options ...OptionFunc) (*ResourcesReport, *Response, error)
- func (c *ResourcesService) DeleteResources(opt *ResourceOptions, options ...OptionFunc) (*ResourcesReport, *Response, error)
- func (c *ResourcesService) GetResource(resourceID string, options ...OptionFunc) (*Resource, *Response, error)
- func (c *ResourcesService) GetResources(opt *ResourceOptions, options ...OptionFunc) (*[]Resource, *Response, error)
- func (c *ResourcesService) StartResource(resources []string, options ...OptionFunc) (*ResourcesReport, *Response, error)
- func (c *ResourcesService) StopResource(resources []string, options ...OptionFunc) (*ResourcesReport, *Response, error)
- type Response
- type ResponseError
- type Result
- type Session
- type SessionOptions
- type Sessions
- type SessionsService
- func (c *SessionsService) CreateSession(userID string, session Session) (*Sessions, *Response, error)
- func (c *SessionsService) DeleteSession(userID string) (bool, *Response, error)
- func (c *SessionsService) GetSession(userID string, opt *SessionOptions) (*Sessions, *Response, error)
- func (c *SessionsService) GetSessions() (*Sessions, *Response, error)
Constants ¶
const (
APIVersion = "1"
)
Constants
Variables ¶
var ( ErrBaseHASCannotBeEmpty = errors.New("base HAS URL cannot be empty") ErrMissingHASPermissions = errors.New("missing HAS permissions. Need 'HAS_RESOURCE.ALL' and 'HAS_SESSION.ALL'") ErrEmptyResult = errors.New("empty result") ErrCouldNoReadResourceAfterCreate = errors.New("could not read resource after create") ErrEmptyResults = errors.New("empty results") )
Errors
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // User agent used when communicating with the HSDP IAM API. UserAgent string Resources *ResourcesService Sessions *SessionsService Images *ImagesService // contains filtered or unexported fields }
A Client manages communication with HSDP IAM API
func NewClient ¶
NewClient returns a new HSDP HAS API client. If a nil httpClient is provided, http.DefaultClient will be used. A configured IAM client must be provided as well
func (*Client) SetBaseHASURL ¶
SetBaseHASURL sets the base URL for API requests to a custom endpoint. urlStr should always be specified with a trailing slash.
type EBS ¶
type EBS struct { DeleteOnTermination bool `json:"DeleteOnTermination"` Encrypted bool `json:"Encrypted"` Iops int `json:"Iops,omitempty"` KmsKeyID string `json:"KmsKeyId,omitempty"` SnapshotID string `json:"SnapshotId,omitempty"` VolumeSize int `json:"VolumeSize" validate:"min=20,required"` VolumeType string `json:"VolumeType" validate:"required" enum:"standard|io1|gp2|sc1|st1"` }
EBS options provided to AWS
type ErrorResponse ¶ added in v0.30.0
type ErrorResponse struct { Response *http.Response `json:"-"` Code string `json:"responseCode"` Message string `json:"responseMessage"` }
ErrorResponse represents an IAM errors response containing a code and a human readable message
func (*ErrorResponse) Error ¶ added in v0.30.0
func (e *ErrorResponse) Error() string
type ImagesService ¶
type ImagesService struct {
// contains filtered or unexported fields
}
func (*ImagesService) GetImages ¶
func (c *ImagesService) GetImages(options ...OptionFunc) (*[]Image, *Response, error)
GetImages retrieves images in HAS
type OptionFunc ¶
OptionFunc is the function signature function for options
type Resource ¶
type Resource struct { // the id of the resource. ID string `json:"id,omitempty"` // id for virtual machine image. This typically lives as an AMI and is defined elsewhere. Example: "ami-454654654" ImageID string `json:"imageId" validate:"required"` // Reference to resource type of cloud provider. Default will be a machine type configured for a VM image. Example: "g3.4xlarge" ResourceType string `json:"resourceType" validate:"required"` // The region where the resource will be hosted. See the providers documentation for available regions. Region string `json:"region" validate:"required"` // Number of resources requested. The maximum amount to request resources in one api call is 10. Defaults to 1. Count int `json:"count" validate:"min=1,max=10,required"` // Allows to perform filters and queries on a cluster of resources. ClusterTag string `json:"clusterTag" validate:"required"` EBS EBS `json:"ebs" validate:"required"` // Unique identifier to a resource (i.e. server/storage instance) ResourceID string `json:"resourceId,omitempty"` // The id of the organization that this resource belongs to. OrganizationID string `json:"organizationId,omitempty"` // The current sessionId of the session which has claimed the resource, will be not present when not claimed. SessionID string `json:"sessionId,omitempty"` // State of AWS resource. State string `json:"state,omitempty" enum:"PENDING|RUNNING|SHUTTING-DOWN|TERMINATED|REBOOTING|STOPPING|STOPPED|UNKNOWN"` // The DNS name of the resource DNS string `json:"dns,omitempty"` // When a resource is disabled it means that the resource is deleted and wont be used for sessions. // It will only be used as reference for historical session. Disabled bool `json:"disabled,omitempty"` }
Resource
type ResourceOptions ¶
type ResourceOptions struct { ClusterTag *string `url:"clusterTag,omitempty"` ImageID *string `url:"imageId,omitempty"` ResourceType *string `url:"resourceType,omitempty"` ResourceID *string `url:"resourceId,omitempty"` SessionID *string `url:"sessionId,omitempty"` State *string `url:"state,omitempty"` Region *string `url:"region,omitempty"` Force *bool `url:"force,omitempty"` }
type ResourcesReport ¶
type ResourcesReport struct {
Results []Result `json:"results"`
}
ResourcesReports represents a list of Result values
type ResourcesService ¶
type ResourcesService struct {
// contains filtered or unexported fields
}
ResourcesService provides operations on HAS resources
func (*ResourcesService) CreateResource ¶
func (c *ResourcesService) CreateResource(resource Resource) (*[]Resource, *Response, error)
CreateResource creates a new resource in HAS A server will be prepared immediately. That is, an EBS backed AMI will be created from provided reference and started. The Post operation allows a user to add new resources to the pool or cluster. This is an operational action, and requires elevated permissions to operate. This endpoint requires HAS_RESOURCE.ALL permission.
func (*ResourcesService) DeleteResource ¶
func (c *ResourcesService) DeleteResource(resourceID string, options ...OptionFunc) (*ResourcesReport, *Response, error)
DeleteResource deletes resources in HAS Delete a resource that is reserved. Resources that are claimed by a user can only be deleted by adding the force option. This endpoint requires HAS_RESOURCE.ALL permission.
func (*ResourcesService) DeleteResources ¶
func (c *ResourcesService) DeleteResources(opt *ResourceOptions, options ...OptionFunc) (*ResourcesReport, *Response, error)
DeleteResources deletes resources in HAS Delete multiple resources that are reserved. Resources that are claimed by a user can only be deleted by adding the force option. This endpoint requires HAS_RESOURCE.ALL permission.
func (*ResourcesService) GetResource ¶
func (c *ResourcesService) GetResource(resourceID string, options ...OptionFunc) (*Resource, *Response, error)
GetResource retrieves a resource in HAS Get overview of the requested resource. This endpoint requires HAS_RESOURCE.ALL permission.
func (*ResourcesService) GetResources ¶
func (c *ResourcesService) GetResources(opt *ResourceOptions, options ...OptionFunc) (*[]Resource, *Response, error)
GetResources retrieves resources in HAS Get overview of all current resource claims. All fields are case-sensitive. This endpoint requires HAS_RESOURCE.ALL permission.
func (*ResourcesService) StartResource ¶
func (c *ResourcesService) StartResource(resources []string, options ...OptionFunc) (*ResourcesReport, *Response, error)
StartResource starts a resource in HAS Start a resource to make sure it is in Running state. This endpoint requires HAS_RESOURCE.ALL permission.
func (*ResourcesService) StopResource ¶
func (c *ResourcesService) StopResource(resources []string, options ...OptionFunc) (*ResourcesReport, *Response, error)
StopResource stops a resource in HAS Stop a resource to make sure it is in Stopped state. This endpoint requires HAS_RESOURCE.ALL permission.
type Response ¶
Response is a HSDP IAM API response. This wraps the standard http.Response returned from HSDP IAM and provides convenient access to things like errors
func (*Response) StatusCode ¶ added in v0.73.0
type ResponseError ¶
type ResponseError struct { Error string `json:"error,omitempty"` ErrorDescription string `json:"error_description,omitempty"` }
ResponseError describes the response fields in case of error
type Result ¶
type Result struct { ResourceID string `json:"resourceId"` Action string `json:"action"` ResultCode int `json:"resultCode"` ResultMessage string `json:"resultMessage"` }
Result of a resource action API call
type Session ¶
type Session struct { // reference to session (to query specific status) SessionID string `json:"sessionId,omitempty"` //Full URL to resource (empty if not yet available) SessionURL string `json:"sessionUrl,omitempty"` // The session type SessionType string `json:"sessionType,omitempty" enum:"DEV"` // Enumerated status of resource claim State string `json:"state,omitempty" enum:"PENDING|AVAILABLE|TIMEDOUT|INUSE"` // The id of the resource that is used for this session ResourceID string `json:"resourceId,omitempty"` // The region where the resource was provisioned. Region string `json:"region,omitempty"` // The id of the user that has claimed this session. UserID string `json:"userId,omitempty"` // The image id of the session ImageID string `json:"imageId,omitempty"` // The cluster tag to target the specific cluster ClusterTag string `json:"clusterTag,omitempty"` // The remote IP of the instance RemoteIP string `json:"remoteIp,omitempty"` // The access token for the instance AccessToken string `json:"accessToken,omitempty"` }
Session describes a HAS session
type SessionOptions ¶
type SessionOptions struct {
ResourceID *string `url:"resourceId,omitempty"`
}
SessionOptions describes options (query) parameters which can be used on some API endpoints
type Sessions ¶
type Sessions struct { Sessions []Session `json:"sessions"` ResponseError }
Sessions contains a list of Session values
type SessionsService ¶
type SessionsService struct {
// contains filtered or unexported fields
}
SessionsService provides operations on HAS sessions
func (*SessionsService) CreateSession ¶
func (c *SessionsService) CreateSession(userID string, session Session) (*Sessions, *Response, error)
CreateSession creates a new user session in HAS
func (*SessionsService) DeleteSession ¶
func (c *SessionsService) DeleteSession(userID string) (bool, *Response, error)
DeleteSession deletes a user session in HAS
func (*SessionsService) GetSession ¶
func (c *SessionsService) GetSession(userID string, opt *SessionOptions) (*Sessions, *Response, error)
GetSession gets a user session in HAS
func (*SessionsService) GetSessions ¶
func (c *SessionsService) GetSessions() (*Sessions, *Response, error)
GetSessions gets all sessions in HAS