Documentation
¶
Index ¶
- func NewAWSReservationResponse(reservation *models.AWSReservation, instances []*models.ReservationInstance) render.Renderer
- func NewAccountIdentityResponse(accDetails *clients.AccountDetailsAWS) render.Renderer
- func NewAzureReservationResponse(reservation *models.AzureReservation, instances []*models.ReservationInstance) render.Renderer
- func NewGCPReservationResponse(reservation *models.GCPReservation, instances []*models.ReservationInstance) render.Renderer
- func NewListInstanceTypeResponse(sl []*clients.InstanceType) render.Renderer
- func NewListLaunchTemplateResponse(sl []*clients.LaunchTemplate, meta *page.Metadata) render.Renderer
- func NewListSourcesResponse(sourceList []*clients.Source, meta *page.Metadata) render.Renderer
- func NewNoopReservationResponse(reservation *models.NoopReservation) render.Renderer
- func NewPermissionsResponse(sl []string) render.Renderer
- func NewPubkeyListResponse(pubkeys []*models.Pubkey, meta *page.Metadata) render.Renderer
- func NewReservationListResponse(reservations []*models.Reservation, meta *page.Metadata) render.Renderer
- func NewReservationResponse(reservation *models.Reservation) render.Renderer
- func SqlNullToStringPtr(s sql.NullString) *string
- func StringNullToEmpty(str *string) string
- type AWSReservationRequest
- type AWSReservationResponse
- type AccountIdentityResponse
- type AvailabilityStatusRequest
- type AzureReservationRequest
- type AzureReservationResponse
- type GCPReservationRequest
- type GCPReservationResponse
- type GenericReservationListResponse
- type GenericReservationResponse
- type InstanceResponse
- type InstanceTypeListResponse
- type InstanceTypeResponse
- type LaunchTemplateListResponse
- type LaunchTemplateResponse
- type NoopReservationResponse
- type PermissionsResponse
- type PubkeyListResponse
- type PubkeyRequest
- type PubkeyResponse
- type ResponseError
- func NewAWSError(ctx context.Context, message string, err error) *ResponseError
- func NewAzureError(ctx context.Context, message string, err error) *ResponseError
- func NewClientError(ctx context.Context, err error) *ResponseError
- func NewDAOError(ctx context.Context, message string, err error) *ResponseError
- func NewEnqueueTaskError(ctx context.Context, message string, err error) *ResponseError
- func NewGCPError(ctx context.Context, message string, err error) *ResponseError
- func NewInvalidRequestError(ctx context.Context, message string, err error) *ResponseError
- func NewMissingIdentityError(ctx context.Context, msg string, err error) *ResponseError
- func NewMissingPermissionError(ctx context.Context, resource, permission string, err error) *ResponseError
- func NewMissingRequestParameterError(ctx context.Context, message string) *ResponseError
- func NewNotFoundError(ctx context.Context, message string, err error) *ResponseError
- func NewRenderError(ctx context.Context, message string, err error) *ResponseError
- func NewResponseError(ctx context.Context, status int, userMsg string, err error) *ResponseError
- func NewStatusError(ctx context.Context, message string, err error) *ResponseError
- func NewURLParsingError(ctx context.Context, message string, err error) *ResponseError
- func NewWrongArchitectureUserError(ctx context.Context, err error) *ResponseError
- func PubkeyDuplicateError(ctx context.Context, message string, err error) *ResponseError
- type SourceListResponse
- type SourceResponse
- type SourceUploadInfoResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAWSReservationResponse ¶
func NewAWSReservationResponse(reservation *models.AWSReservation, instances []*models.ReservationInstance) render.Renderer
func NewAccountIdentityResponse ¶
func NewAccountIdentityResponse(accDetails *clients.AccountDetailsAWS) render.Renderer
func NewAzureReservationResponse ¶
func NewAzureReservationResponse(reservation *models.AzureReservation, instances []*models.ReservationInstance) render.Renderer
func NewGCPReservationResponse ¶
func NewGCPReservationResponse(reservation *models.GCPReservation, instances []*models.ReservationInstance) render.Renderer
func NewListInstanceTypeResponse ¶
func NewListInstanceTypeResponse(sl []*clients.InstanceType) render.Renderer
func NewListSourcesResponse ¶
func NewNoopReservationResponse ¶
func NewNoopReservationResponse(reservation *models.NoopReservation) render.Renderer
func NewPermissionsResponse ¶
func NewPubkeyListResponse ¶
func NewReservationResponse ¶
func NewReservationResponse(reservation *models.Reservation) render.Renderer
func SqlNullToStringPtr ¶
func SqlNullToStringPtr(s sql.NullString) *string
func StringNullToEmpty ¶
Types ¶
type AWSReservationRequest ¶
type AWSReservationRequest struct {
// Pubkey ID. Always required even when launch template provides one.
PubkeyID int64 `json:"pubkey_id" yaml:"pubkey_id"`
// Source ID.
SourceID string `json:"source_id" yaml:"source_id"`
// AWS region.
Region string `json:"region" yaml:"region"`
// Optional name of the instance(s).
Name string `json:"name" yaml:"name"`
// Optional launch template ID ("lt-9848392734432") or empty for no template.
LaunchTemplateID string `json:"launch_template_id,omitempty" yaml:"launch_template_id"`
// AWS Instance type.
InstanceType string `json:"instance_type" yaml:"instance_type"`
// Amount of instances to provision of type: Instance type.
Amount int32 ` json:"amount" yaml:"amount"`
// Image Builder UUID of the image that should be launched. AMI's must be prefixed with 'ami-'.
ImageID string `json:"image_id" yaml:"image_id"`
// Immediately power off the system after initialization
PowerOff bool `json:"poweroff" yaml:"poweroff"`
}
type AWSReservationResponse ¶
type AWSReservationResponse struct {
ID int64 `json:"reservation_id" yaml:"reservation_id"`
// Pubkey ID.
PubkeyID *int64 `json:"pubkey_id,omitempty" yaml:"pubkey_id,omitempty"`
// Source ID.
SourceID string `json:"source_id" yaml:"source_id"`
// AWS region.
Region string `json:"region" yaml:"region"`
// AWS Instance type.
InstanceType string `json:"instance_type" yaml:"instance_type"`
// Amount of instances to provision of type: Instance type.
Amount int32 `json:"amount" yaml:"amount"`
// The ID of the image from which the instance is created.
ImageID string `json:"image_id" yaml:"image_id"`
// Optional launch template ID ("lt-9848392734432") or empty for no template.
LaunchTemplateID string `json:"launch_template_id" yaml:"launch_template_id"`
// The ID of the aws reservation which was created, or missing if not created yet.
AWSReservationID string `json:"aws_reservation_id,omitempty" yaml:"aws_reservation_id"`
// Optional name of the instance(s).
Name string `json:"name" yaml:"name"`
// Immediately power off the system after initialization
PowerOff bool `json:"poweroff" yaml:"poweroff"`
// Instances array, only present for finished reservations
Instances []InstanceResponse `json:"instances,omitempty" yaml:"instances"`
}
func (*AWSReservationResponse) Render ¶
func (p *AWSReservationResponse) Render(_ http.ResponseWriter, _ *http.Request) error
type AccountIdentityResponse ¶
type AccountIdentityResponse struct {
*clients.AccountIdentity
}
func (*AccountIdentityResponse) Render ¶
func (s *AccountIdentityResponse) Render(_ http.ResponseWriter, _ *http.Request) error
type AvailabilityStatusRequest ¶
type AvailabilityStatusRequest struct {
SourceID string `json:"source_id" yaml:"source_id"`
}
type AzureReservationRequest ¶
type AzureReservationRequest struct {
PubkeyID int64 `json:"pubkey_id" yaml:"pubkey_id"`
SourceID string `json:"source_id" yaml:"source_id"`
// Image Builder UUID of the image that should be launched. This can be directly Azure image ID.
ImageID string `json:"image_id" yaml:"image_id"`
// ResourceGroup to use to deploy the resources into
ResourceGroup string `` /* 201-byte string literal not displayed */
// Azure Location also known as region to deploy the VM into.
// Be aware it needs to be the same as the image location.
// Defaults to the Resource group location or 'eastus' if new resource group is also created in this request.
Location string `` /* 248-byte string literal not displayed */
// Azure Instance type.
InstanceSize string `json:"instance_size" yaml:"instance_size"`
// Amount of instances to provision of size: InstanceSize.
Amount int64 `json:"amount" yaml:"amount"`
// Name of the instance(s). Defaults to redhat-vm.
Name string `` /* 147-byte string literal not displayed */
// Immediately power off the system after initialization.
PowerOff bool `json:"poweroff" yaml:"poweroff"`
}
type AzureReservationResponse ¶
type AzureReservationResponse struct {
ID int64 `json:"reservation_id" yaml:"reservation_id"`
PubkeyID *int64 `json:"pubkey_id,omitempty" yaml:"pubkey_id,omitempty"`
SourceID string `json:"source_id" yaml:"source_id"`
ResourceGroup string `json:"resource_group" yaml:"resource_group"`
// Azure Location. Included only if it was explicitly passed by User.
// If it was induced from Resource Group, it will be empty and thus not included in response.
Location string `json:"location,omitempty" yaml:"location,omitempty"`
// Azure Instance size.
InstanceSize string `json:"instance_size" yaml:"instance_size"`
// Amount of instances to provision of type: Instance type.
Amount int64 `json:"amount" yaml:"amount"`
// The ID of the image from which the instance is created.
ImageID string `json:"image_id" yaml:"image_id"`
// Optional name of the instance(s).
Name string `json:"name" yaml:"name"`
// Immediately PowerOff the system after initialization.
PowerOff bool `json:"poweroff" yaml:"poweroff"`
// Instances IDs, only present for finished reservations.
Instances []InstanceResponse `json:"instances,omitempty" yaml:"instances"`
}
func (*AzureReservationResponse) Render ¶
func (p *AzureReservationResponse) Render(_ http.ResponseWriter, _ *http.Request) error
type GCPReservationRequest ¶
type GCPReservationRequest struct {
// Pubkey ID.
PubkeyID int64 `json:"pubkey_id" yaml:"pubkey_id"`
// Source ID.
SourceID string `json:"source_id" yaml:"source_id"`
// Optional launch template id global/instanceTemplates/ID or empty string
LaunchTemplateID string `json:"launch_template_id,omitempty" yaml:"launch_template_id"`
// Optional name pattern of the instance(s).
NamePattern string `json:"name_pattern" yaml:"name_pattern"`
// GCP zone.
Zone string `json:"zone" yaml:"zone"`
// GCP Machine type.
MachineType string `json:"machine_type" yaml:"machine_type"`
// Amount of instances to provision of type: Instance type.
Amount int64 ` json:"amount" yaml:"amount"`
// Image Builder UUID of the image that should be launched.
ImageID string `json:"image_id" yaml:"image_id"`
// Immediately power off the system after initialization.
PowerOff bool `json:"poweroff" yaml:"poweroff"`
}
type GCPReservationResponse ¶
type GCPReservationResponse struct {
ID int64 `json:"reservation_id" yaml:"reservation_id"`
// Pubkey ID.
PubkeyID *int64 `json:"pubkey_id,omitempty" yaml:"pubkey_id,omitempty"`
// Source ID.
SourceID string `json:"source_id" yaml:"source_id"`
// GCP zone.
Zone string `json:"zone" yaml:"zone"`
// GCP Machine type.
MachineType string `json:"machine_type" yaml:"machine_type"`
// Amount of instances to provision of type: Instance type.
Amount int64 `json:"amount" yaml:"amount"`
// The ID of the image from which the instance is created.
ImageID string `json:"image_id" yaml:"image_id"`
// Optional name pattern of the instance(s).
NamePattern string `json:"name_pattern" yaml:"name_pattern"`
// The name of the gcp operation which was created.
GCPOperationName string `json:"gcp_operation_name,omitempty" yaml:"gcp_operation_name"`
// Optional launch template id global/instanceTemplates/ID or empty string
LaunchTemplateID string `json:"launch_template_id,omitempty" yaml:"launch_template_id"`
// Immediately power off the system after initialization
PowerOff bool `json:"poweroff" yaml:"poweroff"`
// Instances IDs, only present for finished reservations.
Instances []InstanceResponse `json:"instances,omitempty" yaml:"instances"`
}
func (*GCPReservationResponse) Render ¶
func (p *GCPReservationResponse) Render(_ http.ResponseWriter, _ *http.Request) error
type GenericReservationListResponse ¶
type GenericReservationListResponse struct {
Data []*GenericReservationResponse `json:"data" yaml:"data"`
Metadata page.Metadata `json:"metadata" yaml:"metadata"`
}
func (*GenericReservationListResponse) Render ¶
func (p *GenericReservationListResponse) Render(_ http.ResponseWriter, _ *http.Request) error
type GenericReservationResponse ¶
type GenericReservationResponse struct {
ID int64 `json:"id" yaml:"id"`
// Provider type. Required.
Provider int `json:"provider" yaml:"provider"`
// Time when reservation was made.
CreatedAt time.Time `json:"created_at" yaml:"created_at"`
// Total number of job steps for this reservation.
Steps int32 `json:"steps" yaml:"steps"`
// User-facing step descriptions for each step. Length of StepTitles must be equal to Steps.
StepTitles []string `json:"step_titles" yaml:"step_titles"`
// Active job step for this reservation. See Status for more details.
Step int32 `json:"step" yaml:"step"`
// Textual status of the reservation or error when there was a failure
Status string `json:"status" yaml:"status"`
// Error message when reservation was not successful. Only set when Success if false.
Error string `json:"error" yaml:"error"`
// Time when reservation was finished or nil when it's still processing.
FinishedAt *time.Time `json:"finished_at" nullable:"true" yaml:"finished_at"`
// Flag indicating success, error or unknown state (NULL). See Status for the actual error.
Success *bool `json:"success" nullable:"true" yaml:"success"`
}
func (*GenericReservationResponse) Render ¶
func (p *GenericReservationResponse) Render(_ http.ResponseWriter, _ *http.Request) error
type InstanceResponse ¶
type InstanceResponse struct {
// Instance ID which has been created on a cloud provider.
InstanceID string `json:"instance_id" yaml:"instance_id"`
// Instance's description, ip and dns
Detail models.ReservationInstanceDetail `json:"detail" yaml:"detail"`
}
type InstanceTypeListResponse ¶
type InstanceTypeListResponse struct {
Data []*InstanceTypeResponse `json:"data" yaml:"data"`
}
func (*InstanceTypeListResponse) Render ¶
func (s *InstanceTypeListResponse) Render(_ http.ResponseWriter, _ *http.Request) error
type InstanceTypeResponse ¶
type InstanceTypeResponse clients.InstanceType
func (*InstanceTypeResponse) Render ¶
func (s *InstanceTypeResponse) Render(_ http.ResponseWriter, _ *http.Request) error
type LaunchTemplateListResponse ¶
type LaunchTemplateListResponse struct {
Data []*LaunchTemplateResponse `json:"data" yaml:"data"`
Metadata page.Metadata `json:"metadata" yaml:"metadata"`
}
func (*LaunchTemplateListResponse) Render ¶
func (s *LaunchTemplateListResponse) Render(_ http.ResponseWriter, _ *http.Request) error
type LaunchTemplateResponse ¶
type LaunchTemplateResponse struct {
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"`
}
See clients.LaunchTemplate
type NoopReservationResponse ¶
type NoopReservationResponse struct {
ID int64 `json:"reservation_id" yaml:"reservation_id"`
}
func (*NoopReservationResponse) Render ¶
func (p *NoopReservationResponse) Render(_ http.ResponseWriter, _ *http.Request) error
type PermissionsResponse ¶
type PermissionsResponse struct {
Valid bool `json:"valid"`
MissingEntities []string `json:"missing_entities,omitempty"`
}
func (*PermissionsResponse) Render ¶
func (s *PermissionsResponse) Render(_ http.ResponseWriter, _ *http.Request) error
type PubkeyListResponse ¶
type PubkeyListResponse struct {
Data []*PubkeyResponse `json:"data" yaml:"data"`
Metadata page.Metadata `json:"metadata" yaml:"metadata"`
}
func (*PubkeyListResponse) Render ¶
func (p *PubkeyListResponse) Render(_ http.ResponseWriter, _ *http.Request) error
type PubkeyRequest ¶
type PubkeyRequest struct {
Name string `json:"name" yaml:"name" description:"Enter the name of the newly created pubkey."`
Body string `json:"body" yaml:"body" description:"Add a public part of a SSH key pair."`
}
See models.Pubkey
func (*PubkeyRequest) NewModel ¶
func (p *PubkeyRequest) NewModel() *models.Pubkey
type PubkeyResponse ¶
type PubkeyResponse struct {
ID int64 `json:"id" yaml:"id"`
AccountID int64 `json:"-" yaml:"-"`
Name string `json:"name" yaml:"name"`
Body string `json:"body" yaml:"body"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
Fingerprint string `json:"fingerprint,omitempty" yaml:"fingerprint,omitempty"`
FingerprintLegacy string `json:"fingerprint_legacy,omitempty" yaml:"fingerprint_legacy,omitempty"`
}
See models.Pubkey
func NewPubkeyResponse ¶
func NewPubkeyResponse(pubkey *models.Pubkey) *PubkeyResponse
func (*PubkeyResponse) Render ¶
func (p *PubkeyResponse) Render(_ http.ResponseWriter, _ *http.Request) error
type ResponseError ¶
type ResponseError struct {
// HTTP status code
HTTPStatusCode int `json:"-" yaml:"-"`
// user facing error message
Message string `json:"msg,omitempty" yaml:"msg,omitempty"`
// trace id from context (if provided)
TraceId string `json:"trace_id,omitempty" yaml:"trace_id"`
// edge id from context (if provided)
EdgeId string `json:"edge_id,omitempty" yaml:"edge_id"`
// full root cause
Error string `json:"error" yaml:"error"`
// build commit
Version string `json:"version" yaml:"version"`
// build time
BuildTime string `json:"build_time" yaml:"build_time"`
// environment (prod or stage or ephemeral)
Environment string `json:"environment,omitempty" yaml:"environment"`
}
ResponseError is used as a payload for all errors. Use NewResponseError function to create new type to set some fields correctly.
func NewAWSError ¶
func NewAWSError(ctx context.Context, message string, err error) *ResponseError
func NewAzureError ¶
func NewAzureError(ctx context.Context, message string, err error) *ResponseError
func NewClientError ¶
func NewClientError(ctx context.Context, err error) *ResponseError
func NewDAOError ¶
func NewDAOError(ctx context.Context, message string, err error) *ResponseError
func NewEnqueueTaskError ¶
func NewEnqueueTaskError(ctx context.Context, message string, err error) *ResponseError
func NewGCPError ¶
func NewGCPError(ctx context.Context, message string, err error) *ResponseError
func NewInvalidRequestError ¶
func NewInvalidRequestError(ctx context.Context, message string, err error) *ResponseError
func NewMissingIdentityError ¶
func NewMissingIdentityError(ctx context.Context, msg string, err error) *ResponseError
func NewMissingPermissionError ¶
func NewMissingPermissionError(ctx context.Context, resource, permission string, err error) *ResponseError
func NewMissingRequestParameterError ¶
func NewMissingRequestParameterError(ctx context.Context, message string) *ResponseError
func NewNotFoundError ¶
func NewNotFoundError(ctx context.Context, message string, err error) *ResponseError
func NewRenderError ¶
func NewRenderError(ctx context.Context, message string, err error) *ResponseError
func NewResponseError ¶
func NewStatusError ¶
func NewStatusError(ctx context.Context, message string, err error) *ResponseError
func NewURLParsingError ¶
func NewURLParsingError(ctx context.Context, message string, err error) *ResponseError
func NewWrongArchitectureUserError ¶
func NewWrongArchitectureUserError(ctx context.Context, err error) *ResponseError
func PubkeyDuplicateError ¶
func PubkeyDuplicateError(ctx context.Context, message string, err error) *ResponseError
func (*ResponseError) Render ¶
func (e *ResponseError) Render(_ http.ResponseWriter, r *http.Request) error
type SourceListResponse ¶
type SourceListResponse struct {
Data []*SourceResponse `json:"data" yaml:"data"`
Metadata page.Metadata `json:"metadata" yaml:"metadata"`
}
func (*SourceListResponse) Render ¶
func (s *SourceListResponse) Render(_ http.ResponseWriter, _ *http.Request) error
type SourceResponse ¶
type SourceResponse struct {
ID string `json:"id" yaml:"id"`
Name string `json:"name,omitempty" yaml:"name"`
Uid string `json:"uid" yaml:"uid"`
Provider string `json:"provider" yaml:"provider" description:"One of ('azure', 'aws', 'gcp')"`
Status string `json:"status" yaml:"status"`
SourceTypeID string `json:"source_type_id" yaml:"source_type_id" deprecated:"true"`
}
See clients.Source
func (*SourceResponse) Render ¶
func (s *SourceResponse) Render(_ http.ResponseWriter, _ *http.Request) error
type SourceUploadInfoResponse ¶
type SourceUploadInfoResponse struct {
Provider string `json:"provider" yaml:"provider"`
AwsInfo *clients.AccountDetailsAWS `json:"aws" nullable:"true" yaml:"aws"`
AzureInfo *clients.AccountDetailsAzure `json:"azure" nullable:"true" yaml:"azure"`
GcpInfo *clients.AccountDetailsGCP `json:"gcp" nullable:"true" yaml:"gcp"`
}
func (SourceUploadInfoResponse) Render ¶
func (s SourceUploadInfoResponse) Render(_ http.ResponseWriter, _ *http.Request) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.