cdr

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: MIT Imports: 14 Imported by: 1

Documentation

Overview

Package pki provides support for HSDP CDR service

We only intent to support the CDR FHIR STU3 and newer with this library.

Index

Constants

View Source
const (
	APIVersion = "1"
)

Variables

View Source
var (
	ErrCDRURLCannotBeEmpty            = errors.New("base CDR URL cannot be empty")
	ErrEmptyResult                    = errors.New("empty result")
	ErrCouldNoReadResourceAfterCreate = errors.New("could not read resource after create")
	ErrNotImplementedYet              = errors.New("not implemented yet")
	ErrNonHttp20xResponse             = errors.New("non http 20x console response")
)

Errors

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors, and returns them if present.

Types

type Client

type Client struct {

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

	TenantSTU3     *TenantSTU3Service
	OperationsSTU3 *OperationsSTU3Service
	// contains filtered or unexported fields
}

A Client manages communication with HSDP CDR API

func NewClient

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

NewClient returns a new HSDP CDR API client. Configured console and IAM clients must be provided as the underlying API requires tokens from respective services

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) GetFHIRStoreURL added in v0.27.1

func (c *Client) GetFHIRStoreURL() string

GetFHIRStoreURL returns the base FHIR Store URL as configured

func (*Client) NewCDRRequest

func (c *Client) NewCDRRequest(method, path string, bodyBytes []byte, options []OptionFunc) (*http.Request, error)

NewCDRRequest creates an new CDR Service API request. A relative URL path can be provided in urlStr, in which case it is resolved relative to the base URL of the Client. Relative URL paths should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

func (*Client) SetFHIRStoreURL

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

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

type Config

type Config struct {
	Region      string
	Environment string
	RootOrgID   string
	CDRURL      string
	FHIRStore   string
	TimeZone    string
	DebugLog    string
}

Config contains the configuration of a client

type OperationsSTU3Service

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

func (*OperationsSTU3Service) Delete added in v0.27.1

func (o *OperationsSTU3Service) Delete(resourceID string, options ...OptionFunc) (bool, *Response, error)

Delete removes a FHIR resource

func (*OperationsSTU3Service) Get added in v0.27.1

func (o *OperationsSTU3Service) Get(resourceID string, options ...OptionFunc) (*stu3pb.ContainedResource, *Response, error)

Get returns a FHIR resource

func (*OperationsSTU3Service) Patch

func (o *OperationsSTU3Service) Patch(resourceID string, jsonPatch []byte, options ...OptionFunc) (*stu3pb.ContainedResource, *Response, error)

Patch makes changes to a FHIR resources accepting the JSONPatch format set

func (*OperationsSTU3Service) Post

func (o *OperationsSTU3Service) Post(resourceID string, jsonBody []byte, options ...OptionFunc) (*stu3pb.ContainedResource, *Response, error)

Post creates new FHIR resources

func (*OperationsSTU3Service) Put added in v0.27.1

func (o *OperationsSTU3Service) Put(resourceID string, jsonBody []byte, options ...OptionFunc) (*stu3pb.ContainedResource, *Response, error)

Put creates or updates new FHIR resources

type OptionFunc

type OptionFunc func(*http.Request) error

OptionFunc is the function signature function for options

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

type TenantSTU3Service

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

func (*TenantSTU3Service) GetOrganizationByID

func (t *TenantSTU3Service) GetOrganizationByID(orgID string) (*stu3pb.Organization, *Response, error)

func (*TenantSTU3Service) Onboard

func (t *TenantSTU3Service) Onboard(organization *stu3pb.Organization, options ...OptionFunc) (*stu3pb.Organization, *Response, error)

Onboard onboards the organization on the CDR under the rootOrgID

Directories

Path Synopsis
helper

Jump to

Keyboard shortcuts

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