ai

package
v0.85.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 14 Imported by: 1

Documentation

Overview

Package ai provides support the HSDP AI services

Index

Constants

View Source
const (
	APIVersion = "1"
)

Variables

View Source
var (
	ErrBaseURLCannotBeEmpty = errors.New("base URL cannot be empty")
	ErrEmptyResult          = errors.New("empty result")
	ErrInvalidEndpointURL   = errors.New("invalid endpoint URL")
)

Errors

Functions

This section is empty.

Types

type Client

type Client struct {
	// HTTP Client used to communicate with IAM API
	*iam.Client

	// User agent used when communicating with the HSDP Notification API
	UserAgent string

	ComputeTarget   *ComputeTargetService
	ComputeProvider *ComputeProviderService
	// contains filtered or unexported fields
}

A Client manages communication with HSDP AI APIs

func NewClient

func NewClient(iamClient *iam.Client, config *Config) (*Client, error)

NewClient returns a new AI base Client

func (*Client) Close

func (c *Client) Close()

Close releases allocated resources of clients

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do executes a http request. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.

func (*Client) GetBaseURL added in v0.44.0

func (c *Client) GetBaseURL() string

GetBaseURL returns the base URL as configured

func (*Client) GetEndpointURL

func (c *Client) GetEndpointURL() string

GetEndpointURL returns the FHIR Store Endpoint URL as configured

func (*Client) NewAIRequest

func (c *Client) NewAIRequest(method, requestPath string, opt interface{}, options ...OptionFunc) (*http.Request, error)

func (*Client) SetBaseURL added in v0.44.0

func (c *Client) SetBaseURL(urlStr string) error

SetBaseURL sets the base URL for API requests

func (*Client) SetEndpointURL

func (c *Client) SetEndpointURL(urlStr string) error

SetEndpointURL sets the endpoint URL for API requests to a custom endpoint. urlStr should always be specified with a trailing slash.

type ComputeEnvironment

type ComputeEnvironment struct {
	ID           string `json:"id,omitempty"`
	ResourceType string `json:"resourceType" Validate:"required"`
	Name         string `json:"name" Validate:"required"`
	Description  string `json:"description"`
	Image        string `json:"image" Validate:"required"`
	IsFactory    bool   `json:"isFactory,omitempty"`
	Created      string `json:"created,omitempty"`
	CreatedBy    string `json:"createdBy,omitempty"`
}

type ComputeEnvironmentService

type ComputeEnvironmentService struct {
	Client *Client

	Validate *validator.Validate
}

func (*ComputeEnvironmentService) CreateComputeEnvironment

func (s *ComputeEnvironmentService) CreateComputeEnvironment(env ComputeEnvironment) (*ComputeEnvironment, *Response, error)

func (*ComputeEnvironmentService) DeleteComputeEnvironment

func (s *ComputeEnvironmentService) DeleteComputeEnvironment(env ComputeEnvironment) (*Response, error)

func (*ComputeEnvironmentService) GetComputeEnvironmentByID

func (s *ComputeEnvironmentService) GetComputeEnvironmentByID(id string) (*ComputeEnvironment, *Response, error)

func (*ComputeEnvironmentService) GetComputeEnvironments

func (s *ComputeEnvironmentService) GetComputeEnvironments(opt *GetOptions, options ...OptionFunc) ([]ComputeEnvironment, *Response, error)

type ComputeProviderService

type ComputeProviderService struct {
	// contains filtered or unexported fields
}

func (*ComputeProviderService) UpdateProvider

func (s *ComputeProviderService) UpdateProvider(request UpdateRequest) (bool, *Response, error)

type ComputeTarget

type ComputeTarget struct {
	ID           string `json:"id,omitempty"`
	ResourceType string `json:"resourceType" Validate:"required"`
	Name         string `json:"name" Validate:"required"`
	Description  string `json:"description"`
	InstanceType string `json:"instanceType" Validate:"required"`
	Storage      int    `json:"storage,omitempty"`
	IsFactory    bool   `json:"isFactory,omitempty"`
	Created      string `json:"created,omitempty"`
	CreatedBy    string `json:"createdBy,omitempty"`
}

type ComputeTargetService

type ComputeTargetService struct {
	// contains filtered or unexported fields
}

func (*ComputeTargetService) CreateComputeTarget

func (s *ComputeTargetService) CreateComputeTarget(target ComputeTarget) (*ComputeTarget, *Response, error)

func (*ComputeTargetService) DeleteComputeTarget

func (s *ComputeTargetService) DeleteComputeTarget(target ComputeTarget) (*Response, error)

func (*ComputeTargetService) GetComputeTargetByID

func (s *ComputeTargetService) GetComputeTargetByID(id string) (*ComputeTarget, *Response, error)

func (*ComputeTargetService) GetComputeTargets

func (s *ComputeTargetService) GetComputeTargets(opt *GetOptions, options ...OptionFunc) ([]ComputeTarget, *Response, error)

type Config

type Config struct {
	Region         string
	Environment    string
	OrganizationID string `Validate:"required"`
	BaseURL        string
	Service        string `Validate:"required"`
	DebugLog       io.Writer
	Retry          int
}

Config contains the configuration of a Client

type EnvironmentVariable

type EnvironmentVariable struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type GetOptions

type GetOptions struct {
	Page  *string `url:"_page,omitempty"`
	Count *string `url:"_count,omitempty"`
	Sort  *string `url:"_sort,omitempty"`
}

GetOptions describes the fields on which you can search for producers

type InputEntry

type InputEntry struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

type Job

type Job struct {
	ID                      string                 `json:"id,omitempty"`
	ResourceType            string                 `json:"resourceType"`
	Name                    string                 `json:"name"`
	Description             string                 `json:"description"`
	Type                    string                 `json:"type"`
	Model                   ReferenceComputeModel  `json:"model"`
	ComputeTarget           ReferenceComputeTarget `json:"computeTarget"`
	Input                   []InputEntry           `json:"input"`
	Output                  []OutputEntry          `json:"output"`
	EnvVars                 []EnvironmentVariable  `json:"envVars"`
	CommandArgs             []string               `json:"commandArgs"`
	Status                  string                 `json:"status,omitempty"`
	StatusMessage           string                 `json:"statusMessage,omitempty"`
	Labels                  []string               `json:"labels,omitempty"`
	CreatedBy               string                 `json:"createdBy,omitempty"`
	Created                 string                 `json:"created,omitempty"`
	Completed               string                 `json:"completed,omitempty"`
	Duration                int                    `json:"duration,omitempty"`
	Timeout                 int                    `json:"timeOut,omitempty"`
	AdditionalConfiguration string                 `json:"additionalConfiguration,omitempty"`
}

type JobService

type JobService struct {
	Client *Client

	Path string `Validate:"required"`

	Validate *validator.Validate
}

func (*JobService) CreateJob

func (s *JobService) CreateJob(job Job) (*Job, *Response, error)

func (*JobService) DeleteJob

func (s *JobService) DeleteJob(job Job) (*Response, error)

func (*JobService) GetJobByID

func (s *JobService) GetJobByID(id string) (*Job, *Response, error)

func (*JobService) GetJobs

func (s *JobService) GetJobs(opt *GetOptions, options ...OptionFunc) ([]Job, *Response, error)

func (*JobService) TerminateJob

func (s *JobService) TerminateJob(job Job) (*Response, error)

type OptionFunc

type OptionFunc func(*http.Request) error

OptionFunc is the function signature function for options

type OutputEntry

type OutputEntry struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

type ReferenceComputeEnvironment

type ReferenceComputeEnvironment struct {
	Reference  string `json:"reference"`
	Identifier string `json:"identifier,omitempty"`
}

type ReferenceComputeModel

type ReferenceComputeModel struct {
	Reference  string `json:"reference"`
	Identifier string `json:"identifier,omitempty"`
}

type ReferenceComputeTarget

type ReferenceComputeTarget struct {
	Reference  string `json:"reference"`
	Identifier string `json:"identifier,omitempty"`
}

type Response

type Response struct {
	*http.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

func (r *Response) StatusCode() int

type SourceCode

type SourceCode struct {
	URL      string `json:"url" Validate:"required"`
	Branch   string `json:"branch,omitempty"`
	CommitID string `json:"commitID,omitempty"`
	SSHKey   string `json:"sshKey,omitempty"`
}

type UpdateRequest

type UpdateRequest struct {
	AccessKey string `json:"accessKey" Validate:"required"`
	SecretKey string `json:"secretKey" Validate:"required"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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