service

package
v0.0.0-...-22a6a96 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: BSD-3-Clause Imports: 22 Imported by: 117

Documentation

Overview

Package service - this package file will contain base service interfaces and structs for embedding into other service packages

Package service this file contains general error strings, types, or constants that are used within the service package

Package service is a temporary package and will eventually be replace with cacao-types/service/user.go TODO: EJS - replace with cacao-types

Index

Constants

View Source
const (
	NatsSubjectCredentials     common.QueryOp = common.NatsQueryOpPrefix + "credentials"
	NatsSubjectCredentialsGet                 = NatsSubjectCredentials + ".get"
	NatsSubjectCredentialsList                = NatsSubjectCredentials + ".list"

	EventCredentialAddRequested        common.EventType = "org.cyverse.events.CredentialAddRequested"
	EventCredentialGenerationRequested common.EventType = "org.cyverse.events.Credential.GenerationRequested"
	EventCredentialUpdateRequested     common.EventType = "org.cyverse.events.CredentialUpdateRequested"
	EventCredentialDeleteRequested     common.EventType = "org.cyverse.events.CredentialDeleteRequested"

	EventCredentialAdded   common.EventType = "org.cyverse.events.CredentialAdded"
	EventCredentialUpdated common.EventType = "org.cyverse.events.CredentialUpdated"
	EventCredentialDeleted common.EventType = "org.cyverse.events.CredentialDeleted"

	EventCredentialAddError    common.EventType = "org.cyverse.events.CredentialAddError"
	EventCredentialUpdateError common.EventType = "org.cyverse.events.CredentialUpdateError"
	EventCredentialDeleteError common.EventType = "org.cyverse.events.CredentialDeleteError"
	EventCredentialGetError    common.EventType = "org.cyverse.events.CredentialGetError"
	EventCredentialListError   common.EventType = "org.cyverse.events.CredentialListError"
)

QueryOp & EventType for credential operations

View Source
const (
	// EventDepMedDeleteProvider is event type for deleting a provider with dependent checking
	EventDepMedDeleteProvider = depMedPrefix + "deleteProvider"

	EventDepMedProviderDeletionErrored = depMedPrefix + "providerDeletionErrored"
	EventDepMedProviderHasDependent    = depMedPrefix + "providerHasDependent"
	EventDepMedProviderDeleted         = depMedPrefix + "providerDeleted"
)

EventType constants for deleting provider via dependency mediator

View Source
const (
	// EventDepMedDeleteTemplate is event type for deleting a template with dependent checking
	EventDepMedDeleteTemplate = depMedPrefix + "deleteTemplate"

	EventDepMedTemplateDeletionErrored = depMedPrefix + "templateDeletionErrored"
	EventDepMedTemplateHasDependent    = depMedPrefix + "templateHasDependent"
	EventDepMedTemplateDeleted         = depMedPrefix + "templateDeleted"
)

EventType constants for deleting template via dependency mediator

View Source
const (
	// EventDepMedDeleteWorkspace is event type for deleting a workspace with dependent checking
	EventDepMedDeleteWorkspace = depMedPrefix + "deleteWorkspace"

	EventDepMedWorkspaceDeletionErrored = depMedPrefix + "workspaceDeletionErrored"
	EventDepMedWorkspaceHasDependent    = depMedPrefix + "workspaceHasDependent"
	EventDepMedWorkspaceDeleted         = depMedPrefix + "workspaceDeleted"
)

EventType constants for deleting workspace via dependency mediator

View Source
const (
	// EventDepMedDeleteCredential is event type for deleting a credential with dependent checking
	EventDepMedDeleteCredential = depMedPrefix + "deleteCredential"

	EventDepMedCredentialDeletionErrored = depMedPrefix + "credentialDeletionErrored"
	EventDepMedCredentialHasDependent    = depMedPrefix + "credentialHasDependent"
	EventDepMedCredentialDeleted         = depMedPrefix + "credentialDeleted"
)

EventType constants for deleting credential via dependency mediator

View Source
const (
	// DeploymentGetQueryType ...
	DeploymentGetQueryType common.QueryOp = "cyverse.deployment.get"
	// DeploymentListQueryType ...
	DeploymentListQueryType common.QueryOp = "cyverse.deployment.list"
	// DeploymentGetRunQueryType ...
	DeploymentGetRunQueryType common.QueryOp = "cyverse.deployment.getRun"
	// DeploymentListRunQueryType ...
	DeploymentListRunQueryType common.QueryOp = "cyverse.deployment.listRun"
	// DeploymentGetRawStateQueryType ...
	DeploymentGetRawStateQueryType common.QueryOp = "cyverse.deployment.getRawState"
	// DeploymentGetLogsQueryType ...
	// Deprecated: logs itself should be fetched over HTTP instead of over NATS, use NATS for fetching HTTP URL to the logs
	DeploymentGetLogsQueryType common.QueryOp = "cyverse.deployment.getLogs"
	// DeploymentGetLogsLocationQueryType is query type for fetching location of logs for deployment or deployment run
	DeploymentGetLogsLocationQueryType common.QueryOp = "cyverse.deployment.getLogsLocation"
)
View Source
const (
	GeneralUnmarshalFromUserMSError     string = "could not unmarshal User object on User microservice side"
	GeneralEventOpTimeoutError          string = "event operation timeout"
	GeneralEventOpCanceledError         string = "event operation was canceled"
	GeneralActorNotAuthorizedError      string = "actor not authorized"
	GeneralActorNotFoundError           string = "actor was not found; perhaps you can use the bypass option"
	GeneralMethodNotYetImplementedError string = "method not yet implemented"
)

these general errors strings, perhaps applicable to multiple service to create a new error object from this string, call error.New(string)

View Source
const (
	UserUsernameNotSetError            string = "username was not set before using User" // if username not initialized before Load
	UserActorNotSetError               string = "actor was not set"
	UserUsernameNotFoundError          string = "username not found"
	UserUsernameReservedCannotAddError string = "username is reserved, cannot add user"
	UserUsernameExistsCannotAddError   string = "username exists, cannot add user"
	UserUpdateError                    string = "user could not be updated"
	UserDeleteError                    string = "user could not be deleted"
	UserSettingsError                  string = "problem decoding settings from database"
)

these are user object type of errors to create a new error, call error.New(string)

View Source
const (
	ProviderActorNotSetError string = "actor was not set"
	ProviderIDNotSetError    string = "provide id was not set"
)

these are provider object type of errors to create a new error, call error.New(string)

View Source
const (
	UserListFilterNotSetError            string = "user list filter was not set before Search/SearchNext"
	UserListFilterInvalidStartIndexError string = "user list filter has invalid start index"
	UserListFilterInvalidMaxItemsError   string = "user list filter has invalid max items"
	UserListLoadBoundaryError            string = "next start index is invalid or no more elements to load beyond end of user list"
	UserListEmptyListError               string = "user list results size 0"
)

these are user list types of errors to create a new error, call error.New(string)

View Source
const (
	// NatsSubjectInteractiveSession is the prefix of the queue name for Interactivesession queries
	NatsSubjectInteractiveSession common.QueryOp = common.NatsQueryOpPrefix + "interactivesession"

	// InteractiveSessionListQueryOp is the queue name for InteractiveSessionList query
	InteractiveSessionListQueryOp = NatsSubjectInteractiveSession + ".list"
	// InteractiveSessionGetQueryOp is the queue name for InteractiveSessionGet query
	InteractiveSessionGetQueryOp = NatsSubjectInteractiveSession + ".get"
	// InteractiveSessionGetByInstanceIDQueryOp is the queue name for InteractiveSessionGetByInstanceID query
	InteractiveSessionGetByInstanceIDQueryOp = NatsSubjectInteractiveSession + ".getByInstanceID"
	// InteractiveSessionGetByInstanceAddressQueryOp is the queue name for InteractiveSessionGetByInstanceAddress query
	InteractiveSessionGetByInstanceAddressQueryOp = NatsSubjectInteractiveSession + ".getByInstanceAddress"
	// InteractiveSessionCheckPrerequisitesQueryOp is the queue name for InteractiveSessionCheckPrerequisites query
	InteractiveSessionCheckPrerequisitesQueryOp = NatsSubjectInteractiveSession + ".checkPrerequisites"

	// InteractiveSessionCreateRequestedEvent is the cloudevent subject for InteractiveSessionCreate
	InteractiveSessionCreateRequestedEvent common.EventType = common.EventTypePrefix + "InteractiveSessionCreateRequested"
	// InteractiveSessionDeactivateRequestedEvent is the cloudevent subject for InteractiveSessionDeactivate
	InteractiveSessionDeactivateRequestedEvent common.EventType = common.EventTypePrefix + "InteractiveSessionDeactivateRequested"

	// InteractiveSessionCreatedEvent is the cloudevent subject for InteractiveSessionCreated
	InteractiveSessionCreatedEvent common.EventType = common.EventTypePrefix + "InteractiveSessionCreated"
	// InteractiveSessionDeactivatedEvent is the cloudevent subject for InteractiveSessionDeactivated
	InteractiveSessionDeactivatedEvent common.EventType = common.EventTypePrefix + "InteractiveSessionDeactivated"

	// InteractiveSessionCreateFailedEvent is the cloudevent subject for InteractiveSessionCreateFailed
	InteractiveSessionCreateFailedEvent common.EventType = common.EventTypePrefix + "InteractiveSessionCreateFailed"
	// InteractiveSessionDeactivateFailedEvent is the cloudevent subject for InteractiveSessionDeactivateFailed
	InteractiveSessionDeactivateFailedEvent common.EventType = common.EventTypePrefix + "InteractiveSessionDeactivateFailed"
)

Nats subjects

View Source
const (
	// NatsSubjectJS2Allocation is the prefix of the queue name for JS2Allocation queries
	NatsSubjectJS2Allocation common.QueryOp = common.NatsQueryOpPrefix + "js2allocation"

	// JS2UserGetQueryOp is the queue name for JS2UserGet query
	JS2UserGetQueryOp = NatsSubjectJS2Allocation + ".getUser"
	// JS2ProjectListQueryOp is the queue name for JS2ProjectList query
	JS2ProjectListQueryOp = NatsSubjectJS2Allocation + ".list"
)

Nats subjects

View Source
const (
	// NatsSubjectProvider is the prefix of the queue name for Provider queries
	NatsSubjectProvider common.QueryOp = common.NatsQueryOpPrefix + "provider"

	// ProviderGetQueryOp is the queue name for ProviderGet query
	ProviderGetQueryOp = NatsSubjectProvider + ".get"
	// ProviderListQueryOp is the queue name for ProviderList query
	ProviderListQueryOp = NatsSubjectProvider + ".list"

	// ProviderCreateRequestedEvent is the cloudevent subject for ProviderCreate
	ProviderCreateRequestedEvent common.EventType = common.EventTypePrefix + "ProviderCreateRequested"
	// ProviderDeleteAdminRequestedEvent is the cloudevent subject for ProviderDeleteAdmin
	ProviderDeleteRequestedEvent common.EventType = common.EventTypePrefix + "ProviderDeleteRequested"
	// ProviderUpdateRequestedEvent is the cloudevent subject for ProviderUpdate
	ProviderUpdateRequestedEvent common.EventType = common.EventTypePrefix + "ProviderUpdateRequested"

	// ProviderCreatedEvent is the cloudevent subject for ProviderCreated
	ProviderCreatedEvent common.EventType = common.EventTypePrefix + "ProviderCreated"
	// ProviderDeletedEvent is the cloudevent subject for ProviderDeleted
	ProviderDeletedEvent common.EventType = common.EventTypePrefix + "ProviderDeleted"
	// ProviderUpdatedEvent is the cloudevent subject for ProviderUpdated
	ProviderUpdatedEvent common.EventType = common.EventTypePrefix + "ProviderUpdated"

	// ProviderCreateFailedEvent is the cloudevent subject for ProviderCreateFailed
	ProviderCreateFailedEvent common.EventType = common.EventTypePrefix + "ProviderCreateFailed"
	// ProviderDeleteFailedEvent is the cloudevent subject for ProviderDeleteFailed
	ProviderDeleteFailedEvent common.EventType = common.EventTypePrefix + "ProviderDeleteFailed"
	// ProviderUpdateFailedEvent is the cloudevent subject for ProviderUpdateFailed
	ProviderUpdateFailedEvent common.EventType = common.EventTypePrefix + "ProviderUpdateFailed"
)

Nats subjects

View Source
const (
	// NatsSubjectTemplate is the prefix of the queue name for Template queries
	NatsSubjectTemplate common.QueryOp = common.NatsQueryOpPrefix + "template"

	/////////////////////////////////////////////////////////////////////////
	// TemplateSourceType
	/////////////////////////////////////////////////////////////////////////
	// TemplateSourceTypeListQueryOp is the queue name for TemplateSourceTypeList query
	TemplateSourceTypeListQueryOp = NatsSubjectTemplate + ".listSourceTypes"

	/////////////////////////////////////////////////////////////////////////
	// TemplateType
	/////////////////////////////////////////////////////////////////////////
	// TemplateTypeListQueryOp is the queue name for TemplateTypeList query
	TemplateTypeListQueryOp = NatsSubjectTemplate + ".listTypes"
	// TemplateTypeGetQueryOp is the queue name for TemplateTypeGet query
	TemplateTypeGetQueryOp = NatsSubjectTemplate + ".getType"

	// TemplateTypeCreateRequestedEvent is the cloudevent subject for TemplateTypeCreate
	TemplateTypeCreateRequestedEvent common.EventType = common.EventTypePrefix + "TemplateTypeCreateRequested"
	// TemplateTypeDeleteRequestedEvent is the cloudevent subject for TemplateTypeDelete
	TemplateTypeDeleteRequestedEvent common.EventType = common.EventTypePrefix + "TemplateTypeDeleteRequested"
	// TemplateTypeUpdateRequestedEvent is the cloudevent subject for TemplateTypeUpdate
	TemplateTypeUpdateRequestedEvent common.EventType = common.EventTypePrefix + "TemplateTypeUpdateRequested"

	// TemplateTypeCreatedEvent is the cloudevent subject for TemplateTypeCreated
	TemplateTypeCreatedEvent common.EventType = common.EventTypePrefix + "TemplateTypeCreated"
	// TemplateTypeDeletedEvent is the cloudevent subject for TemplateTypeDeleted
	TemplateTypeDeletedEvent common.EventType = common.EventTypePrefix + "TemplateTypeDeleted"
	// TemplateTypeUpdatedEvent is the loudevent subject for TemplateTypeUpdated
	TemplateTypeUpdatedEvent common.EventType = common.EventTypePrefix + "TemplateTypeUpdated"

	// TemplateTypeCreateFailedEvent is the cloudevent subject for TemplateTypeCreateFailed
	TemplateTypeCreateFailedEvent common.EventType = common.EventTypePrefix + "TemplateTypeCreateFailed"
	// TemplateTypeDeleteFailedEvent is the eloudevent subject for TemplateTypeDeleteFailed
	TemplateTypeDeleteFailedEvent common.EventType = common.EventTypePrefix + "TemplateTypeDeleteFailed"
	// TemplateTypeUpdateFailedEvent is the loudevent subject for TemplateTypeUpdateFailed
	TemplateTypeUpdateFailedEvent common.EventType = common.EventTypePrefix + "TemplateTypeUpdateFailed"

	/////////////////////////////////////////////////////////////////////////
	// TemplateCustomFieldType
	/////////////////////////////////////////////////////////////////////////
	// TemplateCustomFieldTypeListQueryOp is the queue name for TemplateCustomFieldTypeList query
	TemplateCustomFieldTypeListQueryOp = NatsSubjectTemplate + ".listCustomFieldTypes"
	// TemplateCustomFieldTypeGetQueryOp is the queue name for TemplateCustomFieldTypeGet query
	TemplateCustomFieldTypeGetQueryOp = NatsSubjectTemplate + ".getCustomFieldType"
	// TemplateCustomFieldTypeQueryQueryOp is the queue name for TemplateCustomFieldTypeQuery query
	TemplateCustomFieldTypeQueryQueryOp = NatsSubjectTemplate + ".queryCustomFieldType"

	// TemplateCustomFieldTypeCreateRequestedEvent is the cloudevent subject for TemplateCustomFieldTypeCreate
	TemplateCustomFieldTypeCreateRequestedEvent common.EventType = common.EventTypePrefix + "TemplateCustomFieldTypeCreateRequested"

	// TemplateCustomFieldTypeDeleteRequestedEvent is the cloudevent subject for TemplateCustomFieldTypeDelete
	TemplateCustomFieldTypeDeleteRequestedEvent common.EventType = common.EventTypePrefix + "TemplateCustomFieldTypeDeleteRequested"
	// TemplateCustomFieldTypeUpdateRequestedEvent is the cloudevent subject for TemplateCustomFieldTypeUpdate
	TemplateCustomFieldTypeUpdateRequestedEvent common.EventType = common.EventTypePrefix + "TemplateCustomFieldTypeUpdateRequested"

	// TemplateCustomFieldTypeCreatedEvent is the cloudevent subject for TemplateCustomFieldTypeCreated
	TemplateCustomFieldTypeCreatedEvent common.EventType = common.EventTypePrefix + "TemplateCustomFieldTypeCreated"
	// TemplateCustomFieldTypeDeletedEvent is the cloudevent subject for TemplateCustomFieldTypeDeleted
	TemplateCustomFieldTypeDeletedEvent common.EventType = common.EventTypePrefix + "TemplateCustomFieldTypeDeleted"
	// TemplateCustomFieldTypeUpdatedEvent is the cloudevent subject for TemplateCustomFieldTypeUpdated
	TemplateCustomFieldTypeUpdatedEvent common.EventType = common.EventTypePrefix + "TemplateCustomFieldTypeUpdated"

	// TemplateCustomFieldTypeCreateFailedEvent is the cloudevent subject for TemplateCustomFieldTypeCreateFailed
	TemplateCustomFieldTypeCreateFailedEvent common.EventType = common.EventTypePrefix + "TemplateCustomFieldTypeCreateFailed"
	// TemplateCustomFieldTypeDeleteFailedEvent is the cloudevent subject for TemplateCustomFieldTypeDeleteFailed
	TemplateCustomFieldTypeDeleteFailedEvent common.EventType = common.EventTypePrefix + "TemplateCustomFieldTypeDeleteFailed"
	// TemplateCustomFieldTypeUpdateFailedEvent is the cloudevent subject for TemplateCustomFieldTypeUpdateFailed
	TemplateCustomFieldTypeUpdateFailedEvent common.EventType = common.EventTypePrefix + "TemplateCustomFieldTypeUpdateFailed"

	/////////////////////////////////////////////////////////////////////////
	// Template
	/////////////////////////////////////////////////////////////////////////
	// TemplateListQueryOp is the queue name for TemplateList query
	TemplateListQueryOp = NatsSubjectTemplate + ".list"
	// TemplateGetQueryOp is the queue name for TemplateGet query
	TemplateGetQueryOp = NatsSubjectTemplate + ".get"
	// TemplateVersionListQueryOp is the queue name for TemplateVersionList query
	TemplateVersionListQueryOp = NatsSubjectTemplate + ".version.list"
	// TemplateVersionGetQueryOp is the queue name for TemplateVersionGet query
	TemplateVersionGetQueryOp = NatsSubjectTemplate + ".version.get"

	// TemplateImportRequestedEvent is the cloudevent subject for TemplateImport
	TemplateImportRequestedEvent common.EventType = common.EventTypePrefix + "TemplateImportRequested"
	// TemplateDeleteRequestedEvent is the cloudevent subject for TemplateDelete
	TemplateDeleteRequestedEvent common.EventType = common.EventTypePrefix + "TemplateDeleteRequested"
	// TemplateUpdateRequestedEvent is the cloudevent subject for TemplateUpdate
	TemplateUpdateRequestedEvent common.EventType = common.EventTypePrefix + "TemplateUpdateRequested"
	// TemplateSyncRequestedEvent is the cloudevent subject for TemplateSync
	TemplateSyncRequestedEvent common.EventType = common.EventTypePrefix + "TemplateSyncRequested"
	// TemplateVersionDisableRequestedEvent is the cloudevent subject for disable request for a template version
	TemplateVersionDisableRequestedEvent common.EventType = common.EventTypePrefix + "Template.Version.DisableRequested"

	// TemplateImportedEvent is the cloudevent subject for TemplateImported
	TemplateImportedEvent common.EventType = common.EventTypePrefix + "TemplateImported"
	// TemplateDeletedEvent is the cloudevent subject for TemplateDeleted
	TemplateDeletedEvent common.EventType = common.EventTypePrefix + "TemplateDeleted"
	// TemplateUpdatedEvent is the cloudevent subject for TemplateUpdated
	TemplateUpdatedEvent common.EventType = common.EventTypePrefix + "TemplateUpdated"
	// TemplateSyncedEvent is the cloudevent subject for TemplateSynced
	TemplateSyncedEvent common.EventType = common.EventTypePrefix + "TemplateSynced"

	// TemplateImportFailedEvent is the cloudevent subject for TemplateImportFailed
	TemplateImportFailedEvent common.EventType = common.EventTypePrefix + "TemplateImportFailed"
	// TemplateDeleteFailedEvent is the cloudevent subject for TemplateDeleteFailed
	TemplateDeleteFailedEvent common.EventType = common.EventTypePrefix + "TemplateDeleteFailed"
	// TemplateUpdateFailedEvent is the cloudevent subject for TemplateUpdateFailed
	TemplateUpdateFailedEvent common.EventType = common.EventTypePrefix + "TemplateUpdateFailed"
	// TemplateSyncFailedEvent is the cloudevent subject for TemplateSyncFailed
	TemplateSyncFailedEvent common.EventType = common.EventTypePrefix + "TemplateSyncFailed"

	// TemplateVersionDisabledEvent is the cloudevent subject for VersionDisabled
	TemplateVersionDisabledEvent common.EventType = common.EventTypePrefix + "Template.Version.Disabled"
	// TemplateVersionDisableFailedEvent is the cloudevent subject for VersionDisableFailed
	TemplateVersionDisableFailedEvent common.EventType = common.EventTypePrefix + "Template.Version.DisableFailed"
)

Nats subjects

View Source
const (
	// NatsSubjectToken is the prefix of the queue name for Token queries
	NatsSubjectToken common.QueryOp = common.NatsQueryOpPrefix + "token"

	// TokenListQueryOp is the queue name for TokenList query
	TokenListQueryOp = NatsSubjectToken + ".list"
	// TokenGetQueryOp is the queue name for TokenGet query
	TokenGetQueryOp = NatsSubjectToken + ".get"
	// TokenAuthCheckQueryOp is the queue name for checking authN and authZ of a token
	TokenAuthCheckQueryOp = NatsSubjectToken + ".authCheck"
	// TokenTypesListQueryOp is the cloudevent subject for ListTokenTypes
	TokenTypesListQueryOp = NatsSubjectToken + ".listTypes"
	// TokenCreateRequestedEvent is the cloudevent subject for TokenCreate
	TokenCreateRequestedEvent common.EventType = common.EventTypePrefix + "TokenCreateRequested"
	// TokenDeleteRequestedEvent is the cloudevent subject for TokenDelete
	TokenDeleteRequestedEvent common.EventType = common.EventTypePrefix + "TokenDeleteRequested"
	// TokenUpdateRequestedEvent is the cloudevent subject for TokenUpdate
	TokenUpdateRequestedEvent common.EventType = common.EventTypePrefix + "TokenUpdateRequested"
	// TokenRevokeRequestedEvent is the cloudevent subject for TokenRevoke
	TokenRevokeRequestedEvent common.EventType = common.EventTypePrefix + "TokenRevokeRequested"
	// TokenCreatedEvent is the cloudevent subject for TokenCreated
	TokenCreatedEvent common.EventType = common.EventTypePrefix + "TokenCreated"
	// TokenDeletedEvent is the cloudevent subject for TokenDeleted
	TokenDeletedEvent common.EventType = common.EventTypePrefix + "TokenDeleted"
	// TokenUpdatedEvent is the cloudevent subject for TokenUpdated
	TokenUpdatedEvent common.EventType = common.EventTypePrefix + "TokenUpdated"
	// TokenRevokedEvent is the cloudevent subject for TokenRevoked
	TokenRevokedEvent common.EventType = common.EventTypePrefix + "TokenRevoked"
	// TokenCreateFailedEvent is the cloudevent subject for TokenCreateFailed
	TokenCreateFailedEvent common.EventType = common.EventTypePrefix + "TokenCreateFailed"
	// TokenDeleteFailedEvent is the cloudevent subject for TokenDeleteFailed
	TokenDeleteFailedEvent common.EventType = common.EventTypePrefix + "TokenDeleteFailed"
	// TokenUpdateFailedEvent is the cloudevent subject for TokenUpdateFailed
	TokenUpdateFailedEvent common.EventType = common.EventTypePrefix + "TokenUpdateFailed"
	// TokenRevokeFailedEvent is the cloudevent subject for TokenRevokeFailed
	TokenRevokeFailedEvent common.EventType = common.EventTypePrefix + "TokenRevokeFailed"
)

Nats subjects

View Source
const (
	// DefaultUserListItemsMax is the default maximum number of UserList items to return
	DefaultUserListItemsMax = 500

	// ReservedCacaoSystemActor is a special actor that is used by the API gateway and perhaps other internal services,
	// which may be used to perform adminstrative operations on the user microservice, such as autocreating users
	// This is not a real user and logic should be added to prohibit creation of such a username
	ReservedCacaoSystemActor = "RESERVED_CACAO_SYSTEM_ACTOR"

	// ReservedAnonymousActor is a special actor that is used by the API gateway to denote public access. This is used
	// for endpoints that do not require authentication, but needs to publish events/query onto the message bus.
	ReservedAnonymousActor = "RESERVED_ANONYMOUS_ACTOR"
)
View Source
const (
	// NatsSubjectUserAction is the prefix of the queue name for UserAction queries
	NatsSubjectUserAction common.QueryOp = common.NatsQueryOpPrefix + "user_action"

	// UserActionListQueryOp is the queue name for UserActionList query
	UserActionListQueryOp = NatsSubjectUserAction + ".list"
	// UserActionGetQueryOp is the queue name for UserActionGet query
	UserActionGetQueryOp = NatsSubjectUserAction + ".get"

	// UserActionCreateRequestedEvent is the cloudevent subject for UserActionCreate
	UserActionCreateRequestedEvent common.EventType = common.EventTypePrefix + "UserActionCreateRequested"
	// UserActionDeleteRequestedEvent is the cloudevent subject for UserActionDelete
	UserActionDeleteRequestedEvent common.EventType = common.EventTypePrefix + "UserActionDeleteRequested"
	// UserActionUpdateRequestedEvent is the cloudevent subject for UserActionUpdate
	UserActionUpdateRequestedEvent common.EventType = common.EventTypePrefix + "UserActionUpdateRequested"

	// UserActionCreatedEvent is the cloudevent subject for UserActionCreated
	UserActionCreatedEvent common.EventType = common.EventTypePrefix + "UserActionCreated"
	// UserActionDeletedEvent is the cloudevent subject for UserActionDeleted
	UserActionDeletedEvent common.EventType = common.EventTypePrefix + "UserActionDeleted"
	// UserActionUpdatedEvent is the cloudevent subject for UserActionUpdated
	UserActionUpdatedEvent common.EventType = common.EventTypePrefix + "UserActionUpdated"

	// UserActionCreateFailedEvent is the cloudevent subject for UserActionCreateFailed
	UserActionCreateFailedEvent common.EventType = common.EventTypePrefix + "UserActionCreateFailed"
	// UserActionDeleteFailedEvent is the cloudevent subject for UserActionDeleteFailed
	UserActionDeleteFailedEvent common.EventType = common.EventTypePrefix + "UserActionDeleteFailed"
	// UserActionUpdateFailedEvent is the cloudevent subject for UserActionUpdateFailed
	UserActionUpdateFailedEvent common.EventType = common.EventTypePrefix + "UserActionUpdateFailed"
)

Nats subjects

View Source
const (
	NatsSubjectUsers                common.QueryOp = common.NatsQueryOpPrefix + "users"
	NatsSubjectUsersGet             common.QueryOp = NatsSubjectUsers + ".get"
	NatsSubjectUsersGetWithSettings common.QueryOp = NatsSubjectUsers + ".getwithsettings"
	NatsSubjectUsersList            common.QueryOp = NatsSubjectUsers + ".list"

	EventUserLogin common.EventType = common.EventTypePrefix + "UserLogin"

	EventUserAddRequested    common.EventType = common.EventTypePrefix + "UserAddRequested"
	EventUserUpdateRequested common.EventType = common.EventTypePrefix + "UserUpdateRequested"
	EventUserDeleteRequested common.EventType = common.EventTypePrefix + "UserDeleteRequested"

	EventUserAdded   common.EventType = common.EventTypePrefix + "UserAdded"
	EventUserUpdated common.EventType = common.EventTypePrefix + "UserUpdated"
	EventUserDeleted common.EventType = common.EventTypePrefix + "UserDeleted"

	EventUserAddError    common.EventType = common.EventTypePrefix + "UserAddError"
	EventUserUpdateError common.EventType = common.EventTypePrefix + "UserUpdateError"
	EventUserDeleteError common.EventType = common.EventTypePrefix + "UserDeleteError"
)

Nats Subjects root, get, list and other channels

View Source
const (
	NatsSubjectUserConfigsGet   common.QueryOp = NatsSubjectUsers + ".getconfigs"
	NatsSubjectUserFavoritesGet common.QueryOp = NatsSubjectUsers + ".getfavorites"
	NatsSubjectUserRecentsGet   common.QueryOp = NatsSubjectUsers + ".getrecents"
	NatsSubjectUserSettingsGet  common.QueryOp = NatsSubjectUsers + ".getsettings"

	EventUserConfigSetRequested      common.EventType = common.EventTypePrefix + "UserConfigSetRequested"
	EventUserFavoriteAddRequested    common.EventType = common.EventTypePrefix + "UserFavoriteAddRequested"
	EventUserFavoriteDeleteRequested common.EventType = common.EventTypePrefix + "UserFavoriteDeleteRequested"
	EventUserRecentSetRequested      common.EventType = common.EventTypePrefix + "UserRecentSetRequested"

	EventUserConfigSet       common.EventType = common.EventTypePrefix + "UserConfigSet"
	EventUserFavoriteAdded   common.EventType = common.EventTypePrefix + "UserFavoriteAdded"
	EventUserFavoriteDeleted common.EventType = common.EventTypePrefix + "UserFavoriteDeleted"
	EventUserRecentSet       common.EventType = common.EventTypePrefix + "UserRecentSet"

	EventUserConfigSetError      common.EventType = common.EventTypePrefix + "UserConfigSetError"
	EventUserFavoriteAddError    common.EventType = common.EventTypePrefix + "UserFavoriteAddError"
	EventUserFavoriteDeleteError common.EventType = common.EventTypePrefix + "UserFavoriteDeleteError"
	EventUserRecentSetError      common.EventType = common.EventTypePrefix + "UserRecentSetError"
)

EventType constants for operations that manipulates user configs/settings

View Source
const (
	// NatsSubjectWorkspace is the prefix of the queue name for Workspace queries
	NatsSubjectWorkspace common.QueryOp = common.NatsQueryOpPrefix + "workspace"

	// WorkspaceListQueryOp is the queue name for WorkspaceList query
	WorkspaceListQueryOp = NatsSubjectWorkspace + ".list"
	// WorkspaceGetQueryOp is the queue name for WorkspaceGet query
	WorkspaceGetQueryOp = NatsSubjectWorkspace + ".get"

	// WorkspaceCreateRequestedEvent is the cloudevent subject for WorkspaceCreate
	WorkspaceCreateRequestedEvent common.EventType = common.EventTypePrefix + "WorkspaceCreateRequested"
	// WorkspaceDeleteRequestedEvent is the cloudevent subject for WorkspaceDelete
	WorkspaceDeleteRequestedEvent common.EventType = common.EventTypePrefix + "WorkspaceDeleteRequested"
	// WorkspaceUpdateRequestedEvent is the cloudevent subject for WorkspaceUpdate
	WorkspaceUpdateRequestedEvent common.EventType = common.EventTypePrefix + "WorkspaceUpdateRequested"

	// WorkspaceCreatedEvent is the cloudevent subject for WorkspaceCreated
	WorkspaceCreatedEvent common.EventType = common.EventTypePrefix + "WorkspaceCreated"
	// WorkspaceDeletedEvent is the cloudevent subject for WorkspaceDeleted
	WorkspaceDeletedEvent common.EventType = common.EventTypePrefix + "WorkspaceDeleted"
	// WorkspaceUpdatedEvent is the cloudevent subject for WorkspaceUpdated
	WorkspaceUpdatedEvent common.EventType = common.EventTypePrefix + "WorkspaceUpdated"

	// WorkspaceCreateFailedEvent is the cloudevent subject for WorkspaceCreateFailed
	WorkspaceCreateFailedEvent common.EventType = common.EventTypePrefix + "WorkspaceCreateFailed"
	// WorkspaceDeleteFailedEvent is the cloudevent subject for WorkspaceDeleteFailed
	WorkspaceDeleteFailedEvent common.EventType = common.EventTypePrefix + "WorkspaceDeleteFailed"
	// WorkspaceUpdateFailedEvent is the cloudevent subject for WorkspaceUpdateFailed
	WorkspaceUpdateFailedEvent common.EventType = common.EventTypePrefix + "WorkspaceUpdateFailed"
)

Nats subjects

View Source
const DeploymentCreateFailed common.EventType = common.EventTypePrefix + "DeploymentCreateFailed"

DeploymentCreateFailed ...

View Source
const DeploymentCreateRunRequested common.EventType = common.EventTypePrefix + "DeploymentCreateRunRequested"

DeploymentCreateRunRequested ...

View Source
const DeploymentCreated common.EventType = common.EventTypePrefix + "DeploymentCreated"

DeploymentCreated ...

View Source
const DeploymentCreationRequested common.EventType = common.EventTypePrefix + "DeploymentCreationRequested"

DeploymentCreationRequested ...

View Source
const DeploymentDeleteFailed common.EventType = common.EventTypePrefix + "DeploymentDeleteFailed"

DeploymentDeleteFailed ...

View Source
const DeploymentDeleted common.EventType = common.EventTypePrefix + "DeploymentDeleted"

DeploymentDeleted ...

View Source
const DeploymentDeletionRequested common.EventType = common.EventTypePrefix + "DeploymentDeletionRequested"

DeploymentDeletionRequested ...

View Source
const DeploymentDeletionStarted common.EventType = common.EventTypePrefix + "DeploymentDeletionStarted"

DeploymentDeletionStarted indicate that the deletion has started but not yet finished. This event is only emitted if the deletion involves clean up cloud resources. Note: deletion could still fail after this.

View Source
const DeploymentIDPrefix string = "deployment"

DeploymentIDPrefix is the prefix for deployment ID

View Source
const DeploymentMonitoringStartFailed common.EventType = common.EventTypePrefix + "DeploymentMonitoringStartFailed"

DeploymentMonitoringStartFailed ...

View Source
const DeploymentMonitoringStarted common.EventType = common.EventTypePrefix + "DeploymentMonitoringStarted"

DeploymentMonitoringStarted ...

View Source
const DeploymentMonitoringStopFailed common.EventType = common.EventTypePrefix + "DeploymentMonitoringStopFailed"

DeploymentMonitoringStopFailed ...

View Source
const DeploymentMonitoringStopped common.EventType = common.EventTypePrefix + "DeploymentMonitoringStopped"

DeploymentMonitoringStopped ...

View Source
const DeploymentParameterUpdateFailed common.EventType = common.EventTypePrefix + "DeploymentParameterUpdateFailed"

DeploymentParameterUpdateFailed ...

View Source
const DeploymentParameterUpdateRequested common.EventType = common.EventTypePrefix + "DeploymentParameterUpdateRequested"

DeploymentParameterUpdateRequested ...

View Source
const DeploymentParameterUpdated common.EventType = common.EventTypePrefix + "DeploymentParameterUpdated"

DeploymentParameterUpdated ...

View Source
const DeploymentRunCreateFailed common.EventType = common.EventTypePrefix + "DeploymentRunCreateFailed"

DeploymentRunCreateFailed ...

View Source
const DeploymentRunCreated common.EventType = common.EventTypePrefix + "DeploymentRunCreated"

DeploymentRunCreated ...

View Source
const DeploymentStartMonitoringRequested common.EventType = common.EventTypePrefix + "DeploymentStartMonitoringRequested"

DeploymentStartMonitoringRequested ...

View Source
const DeploymentStateRefreshFailed common.EventType = common.EventTypePrefix + "DeploymentStateRefreshFailed"

DeploymentStateRefreshFailed ...

View Source
const DeploymentStateRefreshRequested common.EventType = common.EventTypePrefix + "DeploymentStateRefreshRequested"

DeploymentStateRefreshRequested ...

View Source
const DeploymentStateRefreshed common.EventType = common.EventTypePrefix + "DeploymentRefreshStateRequested"

DeploymentStateRefreshed ...

View Source
const DeploymentStopMonitoringRequested common.EventType = common.EventTypePrefix + "DeploymentStopMonitoringRequested"

DeploymentStopMonitoringRequested ...

View Source
const DeploymentUpdateFailed common.EventType = common.EventTypePrefix + "DeploymentUpdateFailed"

DeploymentUpdateFailed ...

View Source
const DeploymentUpdateRequested common.EventType = common.EventTypePrefix + "DeploymentParameterUpdateRequested"

DeploymentUpdateRequested ...

View Source
const DeploymentUpdated common.EventType = common.EventTypePrefix + "DeploymentUpdated"

DeploymentUpdated ...

View Source
const RunIDPrefix string = "run"

RunIDPrefix is the prefix for run ID

View Source
const (
	UserListFilterValueEmptyWarning string = "Warning UserFilter value was not set, will return all"
)

these are just warning strings to create a new error, call error.New(string)

View Source
const WorkflowCreateFailedEvent common.EventType = common.EventTypePrefix + "WorkflowCreateFailed"

WorkflowCreateFailedEvent is the event name of WorkflowCreateFailed

View Source
const WorkflowCreateRequestedEvent common.EventType = common.EventTypePrefix + "WorkflowCreateRequested"

WorkflowCreateRequestedEvent is the type name of WorkflowCreate request

View Source
const WorkflowCreatedEvent common.EventType = common.EventTypePrefix + "WorkflowCreated"

WorkflowCreatedEvent is the cloudevent name of WorkflowCreated defined below

View Source
const WorkflowResubmitFailedEvent common.EventType = common.EventTypePrefix + "WorkflowResubmitFailed"

WorkflowResubmitFailedEvent is the name of the WorkflowResubmitFailed event

View Source
const WorkflowResubmitRequestedEvent common.EventType = common.EventTypePrefix + "WorkflowResubmitRequested"

WorkflowResubmitRequestedEvent is the type name of WorkflowResubmit request

View Source
const WorkflowResubmittedEvent common.EventType = common.EventTypePrefix + "WorkflowResubmitted"

WorkflowResubmittedEvent is the name of the WorkflowResubmitted event

View Source
const WorkflowTerminateFailedEvent common.EventType = common.EventTypePrefix + "WorkflowTerminateFailed"

WorkflowTerminateFailedEvent is the name of the WorkflowTerminateFailed

View Source
const WorkflowTerminateRequestedEvent common.EventType = common.EventTypePrefix + "WorkflowTerminateRequested"

WorkflowTerminateRequestedEvent is the type name of WorkflowTerminate request

View Source
const WorkflowTerminatedEvent common.EventType = common.EventTypePrefix + "WorkflowTerminated"

WorkflowTerminatedEvent is the name of the WorkflowTerminated

Variables

DeploymentStatusAllowDeletion is list of current status that allows deletion.

DeploymentStatusAllowRunCreation is list of current status that allows run creation.

View Source
var (
	// TemplateCacaoReservedPurposes defines cacao reserved purposes
	TemplateCacaoReservedPurposes []TemplatePurpose = []TemplatePurpose{TemplatePurposeCacaoPrerequisite}
)

Functions

func NewInteractiveSessionID

func NewInteractiveSessionID() common.ID

NewInteractiveSessionID generates a new InteractiveSessionID

func NewJS2ProjectID

func NewJS2ProjectID() common.ID

NewJS2ProjectID generates a new JS2ProjectID

func NewTemplateID

func NewTemplateID() common.ID

NewTemplateID generates a new TemplateID

func NewUserActionID

func NewUserActionID() common.ID

NewUserActionID generates a new UserActionID

func NewWorkspaceID

func NewWorkspaceID() common.ID

NewWorkspaceID generates a new WorkspaceID

Types

type AWMProvider

type AWMProvider string

AWMProvider is the ID of cloud provider, used by Argo Workflow Mediator(AWM)

type Actor

type Actor struct {
	Actor    string
	Emulator string
}

Actor is the user that performs certain action. This is for scenario where you only need to express the user that initiate actions without including error like Session does.

func ActorFromSession

func ActorFromSession(session Session) Actor

ActorFromSession construct Actor from service.Session

func (Actor) IsSet

func (a Actor) IsSet() bool

IsSet returns true if actor is set

func (Actor) Session

func (a Actor) Session() Session

Session returns a Session object that copy SessionActor and SessionEmulator fields from Actor. This is useful for service client to convert Actor to Session in request.

type CacaoAlreadyExistError

type CacaoAlreadyExistError struct {
	CacaoErrorBase
}

CacaoAlreadyExistError is an error for object already exist

type CacaoCommunicationError

type CacaoCommunicationError struct {
	CacaoErrorBase
}

CacaoCommunicationError is an error for communication failure.

type CacaoError

type CacaoError interface {
	// Error returns error message that includes both contextual and standard error messages.
	Error() string
	// ContextualError returns contextual error message. e.g., "actor 'edwin' is not authorized to create a user"
	ContextualError() string
	// StandardError returns standard error message. e.g., "unauthorize access"
	StandardError() CacaoStandardErrorMessage
	// IsTemporary tells if the error is transitive meaning that you may get different result at next call.
	IsTemporary() bool
	// MarshalJSON marshals the error to JSON bytes
	MarshalJSON() ([]byte, error)
	// GetBase returns CacaoErrorBase type
	GetBase() CacaoErrorBase
}

CacaoError is for cacao service errors.

func ConvertJSONToCacaoError

func ConvertJSONToCacaoError(jsonBytes []byte) (CacaoError, error)

ConvertJSONToCacaoError converts JSON bytes into CacaoError

func NewCacaoAlreadyExistError

func NewCacaoAlreadyExistError(contextualMsg string) CacaoError

NewCacaoAlreadyExistError creates a new CacaoAlreadyExistError

func NewCacaoAlreadyExistErrorWithOptions

func NewCacaoAlreadyExistErrorWithOptions(contextualMsg string, options ...CacaoErrorOption) CacaoError

NewCacaoAlreadyExistErrorWithOptions creates a new CacaoAlreadyExistError with options

func NewCacaoCommunicationError

func NewCacaoCommunicationError(contextualMsg string) CacaoError

NewCacaoCommunicationError creates a new CacaoCommunicationError

func NewCacaoCommunicationErrorWithOptions

func NewCacaoCommunicationErrorWithOptions(contextualMsg string, options ...CacaoErrorOption) CacaoError

NewCacaoCommunicationErrorWithOptions creates a new CacaoCommunicationError with options

func NewCacaoGeneralError

func NewCacaoGeneralError(contextualMsg string) CacaoError

NewCacaoGeneralError creates a new CacaoGeneralError

func NewCacaoGeneralErrorWithOptions

func NewCacaoGeneralErrorWithOptions(contextualMsg string, options ...CacaoErrorOption) CacaoError

NewCacaoGeneralErrorWithOptions creates a new CacaoGeneralError with options

func NewCacaoInvalidParameterError

func NewCacaoInvalidParameterError(contextualMsg string) CacaoError

NewCacaoInvalidParameterError creates a new CacaoInvalidParameterError

func NewCacaoInvalidParameterErrorWithOptions

func NewCacaoInvalidParameterErrorWithOptions(contextualMsg string, options ...CacaoErrorOption) CacaoError

NewCacaoInvalidParameterErrorWithOptions creates a new CacaoInvalidParameterError with options

func NewCacaoMarshalError

func NewCacaoMarshalError(contextualMsg string) CacaoError

NewCacaoMarshalError creates a new CacaoMarshalError

func NewCacaoMarshalErrorWithOptions

func NewCacaoMarshalErrorWithOptions(contextualMsg string, options ...CacaoErrorOption) CacaoError

NewCacaoMarshalErrorWithOptions creates a new CacaoMarshalError with options

func NewCacaoNotFoundError

func NewCacaoNotFoundError(contextualMsg string) CacaoError

NewCacaoNotFoundError creates a new CacaoNotFoundError

func NewCacaoNotFoundErrorWithOptions

func NewCacaoNotFoundErrorWithOptions(contextualMsg string, options ...CacaoErrorOption) CacaoError

NewCacaoNotFoundErrorWithOptions creates a new CacaoNotFoundError with options

func NewCacaoNotImplementedError

func NewCacaoNotImplementedError(contextualMsg string) CacaoError

NewCacaoNotImplementedError creates a new CacaoNotImplementedError

func NewCacaoNotImplementedErrorWithOptions

func NewCacaoNotImplementedErrorWithOptions(contextualMsg string, options ...CacaoErrorOption) CacaoError

NewCacaoNotImplementedErrorWithOptions creates a new CacaoNotImplementedError with options

func NewCacaoOperationCanceledError

func NewCacaoOperationCanceledError(contextualMsg string) CacaoError

NewCacaoOperationCanceledError creates a new CacaoOperationCanceledError

func NewCacaoOperationCanceledErrorWithOptions

func NewCacaoOperationCanceledErrorWithOptions(contextualMsg string, options ...CacaoErrorOption) CacaoError

NewCacaoOperationCanceledErrorWithOptions creates a new CacaoOperationCanceledError with options

func NewCacaoTimeoutError

func NewCacaoTimeoutError(contextualMsg string) CacaoError

NewCacaoTimeoutError creates a new CacaoTimeoutError

func NewCacaoTimeoutErrorWithOptions

func NewCacaoTimeoutErrorWithOptions(contextualMsg string, options ...CacaoErrorOption) CacaoError

NewCacaoTimeoutErrorWithOptions creates a new CacaoTimeoutError with options

func NewCacaoUnauthorizedError

func NewCacaoUnauthorizedError(contextualMsg string) CacaoError

NewCacaoUnauthorizedError creates a new CacaoUnauthorizedError

func NewCacaoUnauthorizedErrorWithOptions

func NewCacaoUnauthorizedErrorWithOptions(contextualMsg string, options ...CacaoErrorOption) CacaoError

NewCacaoUnauthorizedErrorWithOptions creates a new CacaoUnauthorizedError with options

func ToCacaoError

func ToCacaoError(err error) CacaoError

ToCacaoError check if error is CacaoError, if not wrap the error message into a general error

type CacaoErrorBase

type CacaoErrorBase struct {
	StandardMessage   CacaoStandardErrorMessage `json:"standard_msg"`
	ContextualMessage string                    `json:"contextual_msg,omitempty"`
	Options           CacaoErrorOptions         `json:"options,omitempty"`
}

CacaoErrorBase is a struct for base cacao service error type.

func (*CacaoErrorBase) ContextualError

func (err *CacaoErrorBase) ContextualError() string

ContextualError returns a contextual error message

func (*CacaoErrorBase) Error

func (err *CacaoErrorBase) Error() string

Error returns a message

func (*CacaoErrorBase) GetBase

func (err *CacaoErrorBase) GetBase() CacaoErrorBase

GetBase returns CacaoErrorBase type

func (*CacaoErrorBase) IsTemporary

func (err *CacaoErrorBase) IsTemporary() bool

IsTemporary returns whether the error is temporary

func (*CacaoErrorBase) MarshalJSON

func (err *CacaoErrorBase) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON bytes

func (*CacaoErrorBase) ReplaceOptions

func (err *CacaoErrorBase) ReplaceOptions(options CacaoErrorOptions)

ReplaceOptions replace existing options

func (*CacaoErrorBase) SetContextualError

func (err *CacaoErrorBase) SetContextualError(message string)

SetContextualError sets a contextual error message

func (*CacaoErrorBase) SetOptions

func (err *CacaoErrorBase) SetOptions(options ...CacaoErrorOption)

SetOptions sets options

func (*CacaoErrorBase) SetStandardError

func (err *CacaoErrorBase) SetStandardError(message CacaoStandardErrorMessage)

SetStandardError sets a standard error message

func (*CacaoErrorBase) StandardError

func (err *CacaoErrorBase) StandardError() CacaoStandardErrorMessage

StandardError returns a standard error message

type CacaoErrorOption

type CacaoErrorOption func(options *CacaoErrorOptions)

CacaoErrorOption is a option type for CacaoError

func CacaoErrorTemporary

func CacaoErrorTemporary(val bool) CacaoErrorOption

CacaoErrorTemporary creates an option for CacaoError meaning that the error is temporary

type CacaoErrorOptions

type CacaoErrorOptions struct {
	Temporary bool `json:"temporary,omitempty"` // set true if the error is temporary one

}

CacaoErrorOptions is an option that stores additional information of the error

type CacaoGeneralError

type CacaoGeneralError struct {
	CacaoErrorBase
}

CacaoGeneralError is an error for general failure.

type CacaoInvalidParameterError

type CacaoInvalidParameterError struct {
	CacaoErrorBase
}

CacaoInvalidParameterError is an error for invalid input parameter

type CacaoMarshalError

type CacaoMarshalError struct {
	CacaoErrorBase
}

CacaoMarshalError is an error for marshal and unmarshal.

type CacaoNotFoundError

type CacaoNotFoundError struct {
	CacaoErrorBase
}

CacaoNotFoundError is an error for object not found

type CacaoNotImplementedError

type CacaoNotImplementedError struct {
	CacaoErrorBase
}

CacaoNotImplementedError is an error for function not implemented

type CacaoOperationCanceledError

type CacaoOperationCanceledError struct {
	CacaoErrorBase
}

CacaoOperationCanceledError is an error for operation canceled

type CacaoStandardErrorMessage

type CacaoStandardErrorMessage string

CacaoStandardErrorMessage is an error message type, describing error type. It is also used to determine error type (e.g., CacaoMarshalError) from CacaoError interface.

const (
	CacaoMarshalErrorMessage           CacaoStandardErrorMessage = "marshal/unmarshal failed"
	CacaoUnauthorizedErrorMessage      CacaoStandardErrorMessage = "unauthorized access"
	CacaoTimeoutErrorMessage           CacaoStandardErrorMessage = "operation timedout error"
	CacaoOperationCanceledErrorMessage CacaoStandardErrorMessage = "operation canceled error"
	CacaoInvalidParameterErrorMessage  CacaoStandardErrorMessage = "invalid parameter error"
	CacaoNotFoundErrorMessage          CacaoStandardErrorMessage = "object not found"
	CacaoAlreadyExistErrorMessage      CacaoStandardErrorMessage = "object already exist"
	CacaoNotImplementedErrorMessage    CacaoStandardErrorMessage = "function not implemenated"
	CacaoCommunicationErrorMessage     CacaoStandardErrorMessage = "communication failed" // e.g., NATS request failed
	CacaoGeneralErrorMessage           CacaoStandardErrorMessage = "work failed"
)

defines standard error messages the standard error messages are used to determine types of CacaoError and to describe error

type CacaoTimeoutError

type CacaoTimeoutError struct {
	CacaoErrorBase
}

CacaoTimeoutError is an error for operation timeout

type CacaoUnauthorizedError

type CacaoUnauthorizedError struct {
	CacaoErrorBase
}

CacaoUnauthorizedError is an error for unauthorized user/access

type CredentialClient

type CredentialClient interface {
	Get(ctx context.Context, actor Actor, ID string) (*CredentialModel, error)
	List(ctx context.Context, actor Actor, filter CredentialListFilter) ([]CredentialModel, error)
	Add(ctx context.Context, actor Actor, secret CredentialModel) (credID string, err error)
	Update(ctx context.Context, actor Actor, credID string, update CredentialUpdate) error
	Delete(ctx context.Context, actor Actor, ID string) error
	Generate(ctx context.Context, actor Actor, credential CredentialModel) (credID string, err error)
}

CredentialClient ...

func NewNatsCredentialClientFromConn

func NewNatsCredentialClientFromConn(queryConn messaging2.QueryConnection, eventConn messaging2.EventConnection) (CredentialClient, error)

NewNatsCredentialClientFromConn creates a new client from existing Connections. Note if you only need query functionality, then only supply queryConn, same for event functionality and eventConn.

type CredentialCreateRequest

type CredentialCreateRequest CredentialModel

CredentialCreateRequest ...

type CredentialCreateResponse

type CredentialCreateResponse struct {
	Session  `json:",inline"`
	Username string         `json:"username,omitempty"`
	ID       string         `json:"id,omitempty"`
	Type     CredentialType `json:"type,omitempty"`
}

CredentialCreateResponse ...

type CredentialDeleteRequest

type CredentialDeleteRequest struct {
	Session  `json:",inline"`
	Username string `json:"username"`
	ID       string `json:"id"`
}

CredentialDeleteRequest ...

type CredentialDeleteResponse

type CredentialDeleteResponse struct {
	Session  `json:",inline"`
	Username string         `json:"username,omitempty"`
	ID       string         `json:"id,omitempty"`
	Type     CredentialType `json:"type,omitempty"`
}

CredentialDeleteResponse ...

type CredentialGetReply

type CredentialGetReply CredentialModel

CredentialGetReply ...

type CredentialGetRequest

type CredentialGetRequest struct {
	Session  `json:",inline"`
	Username string `json:"username"`
	ID       string `json:"id"`
}

CredentialGetRequest ...

type CredentialListFilter

type CredentialListFilter struct {
	Username string            `json:"username"`            // owner, default to actor
	Type     CredentialType    `json:"type,omitempty"`      // leave empty if all types
	IsSystem *bool             `json:"is_system,omitempty"` // leave nil if both system & non-system
	Disabled *bool             `json:"disabled,omitempty"`  // leave nil if both disabled & enabled
	Tags     map[string]string `json:"tag"`                 // leave tag value as empty if only want to check tag name present
}

CredentialListFilter contains the filter options supported by the list operation

type CredentialListReply

type CredentialListReply struct {
	Session  `json:",inline"`
	Username string            `json:"username"` // owner
	List     []CredentialModel `json:"list"`
}

CredentialListReply ...

type CredentialListRequest

type CredentialListRequest struct {
	Session `json:",inline"`
	Filter  CredentialListFilter `json:",inline"`
}

CredentialListRequest ...

type CredentialModel

type CredentialModel struct {
	Session
	ID                string            `json:"id"`
	Name              string            `json:"name"`
	Username          string            `json:"username"`
	Type              CredentialType    `json:"type"`
	Value             string            `json:"value,omitempty"`
	Description       string            `json:"description,omitempty"`
	IsSystem          bool              `json:"is_system,omitempty"`
	IsHidden          bool              `json:"is_hidden,omitempty"`
	Disabled          bool              `json:"disabled"`
	Visibility        VisibilityType    `json:"visibility,omitempty"` // not currently used, neither service nor client respect this value. There is a default value "Default"
	Tags              map[string]string `json:"tags,omitempty"`
	CreatedAt         time.Time         `json:"created_at"`
	UpdatedAt         time.Time         `json:"updated_at"`
	UpdatedBy         string            `json:"updated_by"`
	UpdatedEmulatorBy string            `json:"updated_emulator_by"`
}

CredentialModel ...

func (*CredentialModel) AddTag

func (c *CredentialModel) AddTag(s string)

AddTag add a tag to the credential. Tag is added as a tag key (unique within a credential)

func (*CredentialModel) GetPrimaryID

func (c *CredentialModel) GetPrimaryID() string

GetPrimaryID returns the globally unique ID of the credential, which is the combination of owner's username and credential ID.

func (*CredentialModel) GetRedacted

func (c *CredentialModel) GetRedacted() CredentialModel

GetRedacted will return a new Secret with the Value set to "REDACTED"

func (*CredentialModel) GetTags

func (c *CredentialModel) GetTags() []string

GetTags return tags as a list of string (tag keys)

func (*CredentialModel) RemoveAllTags

func (c *CredentialModel) RemoveAllTags()

RemoveAllTags ...

func (*CredentialModel) RemoveTag

func (c *CredentialModel) RemoveTag(s string)

RemoveTag removes a tag from credential.

func (*CredentialModel) Verify

func (c *CredentialModel) Verify() (bool, error)

Verify verify a credential model

type CredentialType

type CredentialType string

CredentialType is the type of credential.

const (
	GitCredentialType           CredentialType = "git"
	PublicSSHKeyCredentialType  CredentialType = "ssh"
	PrivateSSHKeyCredentialType CredentialType = "ssh_private"
	OpenStackCredentialType     CredentialType = "openstack"
	AWSCredentialType           CredentialType = "aws"
	KubeconfigCredentialType    CredentialType = "kubeconfig"
)

CredentialType Constants

type CredentialUpdate

type CredentialUpdate struct {
	Name *string `json:"name,omitempty"`
	// modify type could affect other service, there is not a clear use case to modify credential type, credential created with wrong type should be deleted and re-created.
	//Type        *CredentialType `json:"type,omitempty"`
	Value       *string         `json:"value,omitempty"`
	Description *string         `json:"description,omitempty"`
	Disabled    *bool           `json:"disabled,omitempty"`
	Visibility  *VisibilityType `json:"visibility,omitempty"`
	// update or add (if tag name does not exist) tags
	UpdateOrAddTags map[string]string   `json:"update_tags,omitempty"`
	DeleteTags      map[string]struct{} `json:"delete_tags,omitempty"`
}

CredentialUpdate is a struct that contains fields for credential that can be updated. Fields in this struct should correspond to fields in CredentialModel, but the type should be null-able equivalent (e.g. string => *string). If the value of a field in this struct is nil, that means the field should not be updated.

func (CredentialUpdate) NeedToUpdate

func (update CredentialUpdate) NeedToUpdate() bool

NeedToUpdate checks if there is a need to update credential.

type CredentialUpdateRequest

type CredentialUpdateRequest struct {
	Session  `json:",inline"`
	Username string           `json:"username"`
	ID       string           `json:"id"`
	Update   CredentialUpdate `json:"update"`
}

CredentialUpdateRequest ...

type CredentialUpdateResponse

type CredentialUpdateResponse struct {
	Session      `json:",inline"`
	Username     string         `json:"username"`
	ID           string         `json:"id"`
	Type         CredentialType `json:"type,omitempty"`
	ValueUpdated bool           `json:"value_updated"`
}

CredentialUpdateResponse ...

type DepCheckDeletionRequest

type DepCheckDeletionRequest struct {
	Session
	ID string `json:"ID"`
}

DepCheckDeletionRequest is event body for deletion request with dependent checking. Note: the type of object to be deleted is not specified by fields in this struct, but by the event type.

type DepCheckDeletionResponse

type DepCheckDeletionResponse struct {
	Session
	ID           string `json:"ID"`
	Deleted      bool   `json:"deleted"`
	HasDependent bool   `json:"has_dependent"`
}

DepCheckDeletionResponse is event body for response to deletion request with dependent checking. Note: the type of object to be deleted is not specified by fields in this struct, but by the event type.

func (DepCheckDeletionResponse) Errored

func (resp DepCheckDeletionResponse) Errored() bool

Errored return true if the response has errored

type DepCheckDeletionResult

type DepCheckDeletionResult struct {
	HasDependent bool
	Deleted      bool
}

DepCheckDeletionResult is the result of a deletion operation with dependency check

func (DepCheckDeletionResult) ToError

func (r DepCheckDeletionResult) ToError(objectType string, objectID string) error

ToError is a utility method for checking the deletion result, it will not return error if object is deleted.

type DependencyMediatorClient

type DependencyMediatorClient interface {
	DeleteCredential(ctx context.Context, session Session, credID string) (DepCheckDeletionResult, error)
	DeleteTemplate(ctx context.Context, session Session, template common.ID) (DepCheckDeletionResult, error)
	DeleteProvider(ctx context.Context, session Session, provider common.ID) (DepCheckDeletionResult, error)
	DeleteWorkspace(ctx context.Context, session Session, workspace common.ID) (DepCheckDeletionResult, error)
}

DependencyMediatorClient is client interface for dependency mediator which checks and enforce for dependency relationship between different objects. e.g. a Credential cannot be deleted when there is a deployment dependent on it.

func NewDependencyMediatorClientFromConn

func NewDependencyMediatorClientFromConn(queryConn messaging2.QueryConnection, eventConn messaging2.EventConnection) (DependencyMediatorClient, error)

NewDependencyMediatorClientFromConn ...

type Deployment

type Deployment struct {
	ID            common.ID               `json:"id"`
	Name          string                  `json:"name"`
	Description   string                  `json:"description"`
	CreatedAt     time.Time               `json:"created_at"`
	UpdatedAt     time.Time               `json:"updated_at"`
	Owner         string                  `json:"owner"`
	Workspace     common.ID               `json:"workspace"`
	Template      common.ID               `json:"template"`
	TemplateType  TemplateTypeName        `json:"template_type"`
	PrimaryCloud  common.ID               `json:"primary_cloud"`
	CurrentStatus DeploymentStatus        `json:"current_status"`
	PendingStatus DeploymentPendingStatus `json:"pending_status"`
	StatusMsg     string                  `json:"status_msg"`
	// map[CredentialID]ProviderID
	CloudCredentials map[string]common.ID `json:"cloud_credentials"`
	GitCredential    string               `json:"git_credential"`
	LastRun          *DeploymentRun       `json:"last_run"`
}

Deployment ...

type DeploymentClient

type DeploymentClient interface {
	Get(ctx context.Context, actor Actor, deploymentID common.ID) (*Deployment, error)
	Search(ctx context.Context, actor Actor, option DeploymentListOption) (DeploymentList, error)
	SearchNext(ctx context.Context, actor Actor, list DeploymentList) (DeploymentList, error)
	GetRun(ctx context.Context, actor Actor, deployment, run common.ID) (*DeploymentRun, error)
	SearchRun(ctx context.Context, actor Actor, option DeploymentRunListOption) (DeploymentRunList, error)
	SearchRunNext(ctx context.Context, actor Actor, list DeploymentRunList) (DeploymentRunList, error)
	GetRawState(ctx context.Context, actor Actor, deployment, run common.ID) ([]byte, error)
	ListDeploymentLogsLocations(ctx context.Context, actor Actor, deployment common.ID) ([]LogsLocation, error)
	ListRunLogsLocations(ctx context.Context, actor Actor, deployment, run common.ID) ([]LogsLocation, error)

	CreateAsync(actor Actor, tid common.TransactionID, option DeploymentCreateParam) error
	RefreshStateAsync(actor Actor, tid common.TransactionID, deployment common.ID) error
	UpdateAsync(actor Actor, tid common.TransactionID, deployment Deployment, updateFields []string) error
	UpdateParametersAsync(actor Actor, tid common.TransactionID, deployment common.ID, param DeploymentParameterValues) error
	DeleteAsync(actor Actor, tid common.TransactionID, deployment common.ID) error
	CreateRunAsync(actor Actor, tid common.TransactionID, param DeploymentRunCreateParam) error

	Create(ctx context.Context, actor Actor, tid common.TransactionID, option DeploymentCreateParam) (deployment common.ID, err error)
	RefreshState(ctx context.Context, actor Actor, tid common.TransactionID, deployment common.ID) (DeploymentStateView, error)
	Update(ctx context.Context, actor Actor, tid common.TransactionID, deployment Deployment, updateFields []string) (common.ID, error)
	UpdateParameters(ctx context.Context, actor Actor, tid common.TransactionID, deployment common.ID, param DeploymentParameterValues) (runID common.ID, err error)
	// Delete sends a deletion request and listen for a response.
	// Because deletion can be an async process (it needs time to clean up provisioned resources if any), when this call
	// return with no error, the deployment could still be in the deletion process.
	// The boolean return value indicate whether deployment has been deleted by this call.
	Delete(ctx context.Context, actor Actor, tid common.TransactionID, deployment common.ID) (deleted bool, err error)
	CreateRun(ctx context.Context, actor Actor, tid common.TransactionID, param DeploymentRunCreateParam) (*DeploymentRun, error)
}

DeploymentClient is interface to interact with the Deployment Service. Async methods only publish the request, they do NOT wait for response. Sync method will generate new transaction ID if empty.

func NewDeploymentClientFromConn

func NewDeploymentClientFromConn(queryConn messaging2.QueryConnection, eventConn messaging2.EventConnection) (DeploymentClient, error)

NewDeploymentClientFromConn creates a new client from existing connections.

Note, if you only need query functionality, then only supply queryConn, same for event functionality and eventConn.

type DeploymentCreateParam

type DeploymentCreateParam struct {
	Name         string    `json:"name"`
	Description  string    `json:"description"`
	Workspace    common.ID `json:"workspace"`
	Template     common.ID `json:"template"`
	PrimaryCloud common.ID `json:"primary_cloud"`
	// all cloud providers that this deployment operates on
	CloudProviders []common.ID `json:"cloud_providers"`
	// map[CredentialID]ProviderID
	CloudCredentials map[string]common.ID `json:"cloud_credentials"`
	// if private git repo
	GitCredential string `json:"git_credential"`
}

DeploymentCreateParam are parameter needed to create a new deployment.

type DeploymentCreateRunRequest

type DeploymentCreateRunRequest struct {
	Session     `json:",inline"`
	CreateParam DeploymentRunCreateParam `json:",inline"`
}

DeploymentCreateRunRequest is an event that request the creation of a deployment run

type DeploymentCreateRunResult

type DeploymentCreateRunResult struct {
	Session `json:",inline"`
	Run     DeploymentRun `json:"run"`
}

DeploymentCreateRunResult is an event that contains the result to the create run request

type DeploymentCreationRequest

type DeploymentCreationRequest struct {
	Session     `json:",inline"`
	CreateParam DeploymentCreateParam `json:",inline"`
}

DeploymentCreationRequest is an event that request the creation of a deployment

type DeploymentCreationResult

type DeploymentCreationResult struct {
	Session `json:",inline"`
	ID      common.ID `json:"id"`
}

DeploymentCreationResult is an event that contains the result to the creation request

type DeploymentDeletionRequest

type DeploymentDeletionRequest struct {
	Session `json:",inline"`
	// deployment ID
	ID common.ID `json:"id"`
}

DeploymentDeletionRequest is an event that request the deletion of a deployment

type DeploymentDeletionResult

type DeploymentDeletionResult struct {
	Session `json:",inline"`
	// deployment ID
	ID           common.ID        `json:"id"`
	TemplateType TemplateTypeName `json:"template_type"`
}

DeploymentDeletionResult is an event that contains the result to the deletion request

type DeploymentFilter

type DeploymentFilter struct {
	User                 string                  `json:"user,omitempty"`
	Template             common.ID               `json:"template,omitempty"`
	TemplateSet          []common.ID             `json:"template_set,omitempty"`
	Workspace            common.ID               `json:"workspace,omitempty"`
	PrimaryCloudProvider common.ID               `json:"primary_provider,omitempty"`
	LastRunStatus        string                  `json:"last_run_status,omitempty"`
	CurrentStatus        DeploymentStatus        `json:"current_status,omitempty"`
	PendingStatus        DeploymentPendingStatus `json:"pending_status,omitempty"`
	// list deployment with any current status, this override the CurrentStatus filter
	AllCurrentStatus bool   `json:"all_current_status,omitempty"`
	CredentialID     string `json:"credential,omitempty"`
}

DeploymentFilter are filters available on deployment list. Only results matched the set filter will be retained.

type DeploymentGetLogsQuery

type DeploymentGetLogsQuery struct {
	Session    `json:",inline"`
	Deployment common.ID `json:"deployment"`
	Run        common.ID `json:"run"`
}

DeploymentGetLogsQuery is a query to fetch the current logs of a deployment run Deprecated: logs itself should be fetched over HTTP instead of over NATS, use NATS for fetching HTTP URL to the logs

type DeploymentGetLogsReply

type DeploymentGetLogsReply struct {
	Session    `json:",inline"`
	Deployment common.ID `json:"deployment"`
	Logs       string    `json:"logs"`
}

DeploymentGetLogsReply is reply for GetLogs query Deprecated: logs itself should be fetched over HTTP instead of over NATS, use NATS for fetching HTTP URL to the logs

func (DeploymentGetLogsReply) ToCloudEvent

func (r DeploymentGetLogsReply) ToCloudEvent(source string) (cloudevents.Event, error)

ToCloudEvent converts to cloudevent

type DeploymentGetQuery

type DeploymentGetQuery struct {
	Session `json:",inline"`
	ID      common.ID `json:"id"`
}

DeploymentGetQuery is a query to fetch a single deployment

type DeploymentGetRawStateQuery

type DeploymentGetRawStateQuery struct {
	Session    `json:",inline"`
	Deployment common.ID `json:"deployment"`
	Run        common.ID `json:"run"`
}

DeploymentGetRawStateQuery is a query to fetch the most recent raw state of a deployment run

type DeploymentGetRawStateReply

type DeploymentGetRawStateReply struct {
	Session  `json:",inline"`
	RawState []byte `json:"raw_state"`
}

DeploymentGetRawStateReply is reply for GetRawState query

func (DeploymentGetRawStateReply) ToCloudEvent

func (r DeploymentGetRawStateReply) ToCloudEvent(source string) (cloudevents.Event, error)

ToCloudEvent converts to cloudevent

type DeploymentGetReply

type DeploymentGetReply struct {
	Session      `json:",inline"`
	Deployment   Deployment `json:"deployment"`
	DeploymentID common.ID  `json:"id"`
}

DeploymentGetReply is reply to Get query

func (DeploymentGetReply) ToCloudEvent

func (r DeploymentGetReply) ToCloudEvent(source string) (cloudevents.Event, error)

ToCloudEvent converts to cloudevent

type DeploymentGetRunQuery

type DeploymentGetRunQuery struct {
	Session    `json:",inline"`
	Deployment common.ID `json:"deployment"`
	Run        common.ID `json:"run"`
}

DeploymentGetRunQuery is a query to fetch a specific instance of deployment run

type DeploymentGetRunReply

type DeploymentGetRunReply struct {
	Session    `json:",inline"`
	Deployment common.ID     `json:"deployment"`
	Run        DeploymentRun `json:"run"`
}

DeploymentGetRunReply is reply yo GetRun query

func (DeploymentGetRunReply) ToCloudEvent

func (r DeploymentGetRunReply) ToCloudEvent(source string) (cloudevents.Event, error)

ToCloudEvent converts to cloudevent

type DeploymentList

type DeploymentList interface {
	GetOptions() DeploymentListOption
	GetDeployments() []Deployment
	GetStart() int     // index of start of current list, -1 if no results or error
	GetSize() int      // size of the current list, 0 if nothing is found, -1 if error
	GetNextStart() int // index of next partition to retrieve, -1 if error is found
}

DeploymentList is a list of deployment with helper for pagination.

type DeploymentListOption

type DeploymentListOption struct {
	SortBy        SortByField
	SortDirection SortDirection
	Filter        DeploymentFilter
	// offset that the result list should begins on
	Offset   int
	PageSize int
	// Return full run object for the CurrentRun/LastRun, if false then only the Run ID is populated for CurrentRun/LastRun
	FullRunObject bool `json:"full_run"`
}

DeploymentListOption is option for fetching a list of deployment.

type DeploymentListQuery

type DeploymentListQuery struct {
	Session       `json:",inline"`
	Filters       DeploymentFilter `json:"filters"`
	SortBy        SortByField      `json:"sort_by"`
	SortDirection SortDirection    `json:"sort_dir"`
	Offset        int              `json:"offset"`
	// Return full run object for the CurrentRun/LastRun, if false then only the Run ID is populated for CurrentRun/LastRun
	FullRunObject bool `json:"full_run"`
	// no limit if -1.
	Limit int `json:"limit"`
}

DeploymentListQuery is a query to fetch a list of deployments

type DeploymentListReply

type DeploymentListReply struct {
	Session `json:",inline"`
	Offset  int `json:"offset"`
	Count   int `json:"count"`
	// Return full run object for the CurrentRun/LastRun, if false then only the Run ID is populated for CurrentRun/LastRun
	FullRunObject bool         `json:"full_run"`
	Deployments   []Deployment `json:"deployments"`

	ReplyListStream `json:",inline"`
}

DeploymentListReply is reply to List query

func (DeploymentListReply) ToCloudEvent

func (r DeploymentListReply) ToCloudEvent(source string) (cloudevents.Event, error)

ToCloudEvent converts to cloudevent

type DeploymentListRunQuery

type DeploymentListRunQuery struct {
	Session           `json:",inline"`
	Deployment        common.ID `json:"deployment"`
	RequestPagination `json:",inline"`
}

DeploymentListRunQuery is a query that fetch a list of deployment run for a specific deployment

type DeploymentListRunReply

type DeploymentListRunReply struct {
	Session `json:",inline"`
	Offset  int             `json:"offset"`
	Count   int             `json:"count"`
	Runs    []DeploymentRun `json:"runs"`

	ReplyListStream `json:",inline"`
}

DeploymentListRunReply is reply to ListRun query

func (DeploymentListRunReply) ToCloudEvent

func (r DeploymentListRunReply) ToCloudEvent(source string) (cloudevents.Event, error)

ToCloudEvent converts to cloudevent

type DeploymentLogsLocationQuery

type DeploymentLogsLocationQuery struct {
	Session      `json:",inline"`
	Deployment   common.ID        `json:"deployment"`
	TemplateType TemplateTypeName `json:"template_type"`
	// if Run is empty, list only logs that are specific to deployment, e.g. deletion logs
	Run common.ID `json:"run"`
}

DeploymentLogsLocationQuery ...

type DeploymentLogsLocationReply

type DeploymentLogsLocationReply struct {
	Session       `json:",inline"`
	Deployment    common.ID        `json:"deployment"`
	TemplateType  TemplateTypeName `json:"template_type"`
	Run           common.ID        `json:"run"`
	LogsLocations []LogsLocation   `json:"logs_locations"`
}

DeploymentLogsLocationReply ...

func (DeploymentLogsLocationReply) ToCloudEvent

func (r DeploymentLogsLocationReply) ToCloudEvent(source string) (cloudevents.Event, error)

ToCloudEvent converts to cloudevent

type DeploymentParameter

type DeploymentParameter struct {
	Name  string      `json:"name"`
	Type  string      `json:"type"`
	Value interface{} `json:"value"`
}

DeploymentParameter is one instance of parameter to deployment

type DeploymentParameterUpdateRequest

type DeploymentParameterUpdateRequest struct {
	Session     `json:",inline"`
	Deployment  common.ID                 `json:"id"`
	ParamValues DeploymentParameterValues `json:"param_values"`
}

DeploymentParameterUpdateRequest is an event that request updating paramters of a deployment

type DeploymentParameterUpdateResult

type DeploymentParameterUpdateResult struct {
	Session `json:",inline"`
	ID      common.ID
}

DeploymentParameterUpdateResult is an event that contains the result to the update parameter request

type DeploymentParameterValues

type DeploymentParameterValues map[string]interface{} // map[ParamName]ParamValue

DeploymentParameterValues is the values of parameters

type DeploymentPendingStatus

type DeploymentPendingStatus string

DeploymentPendingStatus is a pending status of deployment, it represents a pending transition that occurs on the deployment object.

const (
	// DeploymentStatusNoPending means that the deployment has no pending transition.
	DeploymentStatusNoPending DeploymentPendingStatus = "none"
	// DeploymentStatusCreating is the pending status when a run is running.
	DeploymentStatusCreating DeploymentPendingStatus = "creating"
	// DeploymentStatusDeleting is the pending status when a deployment is deleting.
	DeploymentStatusDeleting DeploymentPendingStatus = "deleting"
)

func (DeploymentPendingStatus) String

func (ps DeploymentPendingStatus) String() string

String ...

func (DeploymentPendingStatus) Valid

func (ps DeploymentPendingStatus) Valid() bool

Valid ...

type DeploymentResource

type DeploymentResource struct {
	ID                  string                     `json:"id"`
	Type                DeploymentResourceType     `json:"type"`
	ProviderType        string                     `json:"provider_type"`
	Provider            common.ID                  `json:"provider"`
	Attributes          map[string]interface{}     `json:"attributes"`
	SensitiveAttributes []interface{}              `json:"sensitive_attributes"`
	AvailableActions    []DeploymentResourceAction `json:"available_actions"`
}

DeploymentResource is a type of resource

type DeploymentResourceAction

type DeploymentResourceAction string

DeploymentResourceAction is actions that can be performed on resource level or resource instance level

const (
	// OpenWebShell ...
	OpenWebShell DeploymentResourceAction = "web_shell"

	// OpenWebDesktop ...
	OpenWebDesktop DeploymentResourceAction = "web_desktop"

	// OpenStackStartInstance ...
	OpenStackStartInstance DeploymentResourceAction = "start"

	// OpenStackShutDownInstance ...
	OpenStackShutDownInstance DeploymentResourceAction = "shut_down"

	// OpenStackShelveInstance ...
	OpenStackShelveInstance DeploymentResourceAction = "shelve"

	// OpenStackUnshelveInstance ...
	OpenStackUnshelveInstance DeploymentResourceAction = "unshelve"

	// OpenStackSuspendInstance ...
	OpenStackSuspendInstance DeploymentResourceAction = "suspend"

	// OpenStackResumeInstance ...
	OpenStackResumeInstance DeploymentResourceAction = "resume"
)

type DeploymentResourceType

type DeploymentResourceType string

DeploymentResourceType is the name of the resource type

const OpenStackInstance DeploymentResourceType = "openstack_instance"

OpenStackInstance ...

const OpenStackVolume DeploymentResourceType = "openstack_volume"

OpenStackVolume ...

type DeploymentRun

type DeploymentRun struct {
	ID              common.ID             `json:"id"`
	Deployment      common.ID             `json:"deployment"`
	Owner           string                `json:"owner"`
	Start           time.Time             `json:"start"`
	End             time.Time             `json:"end"`
	TemplateVersion common.ID             `json:"template_version"`
	GitURL          string                `json:"git_url"`
	CommitHash      string                `json:"commit"`
	Parameters      []DeploymentParameter `json:"parameters"`
	// map[CredentialID]ProviderID
	CloudCredentials map[string]common.ID `json:"cloud_credentials"`
	GitCredential    string               `json:"git_credential"`
	Status           string               `json:"status"`
	StatusMsg        string               `json:"status_msg"`
	// most recent state
	LastState      DeploymentStateView `json:"last_state"`
	StateUpdatedAt time.Time           `json:"state_updated_at"`
}

DeploymentRun is the result of running the deployment. For VM-based, it happens each time the template is run/executed/applied. Including initial creation, re-apply after parameter updates, explicit re-apply requested by user.

type DeploymentRunCreateParam

type DeploymentRunCreateParam struct {
	Deployment common.ID `json:"deployment"`
	// the version of the template to use for the run, leave empty to use the latest version.
	TemplateVersion common.ID                 `json:"template_version"`
	ParamValues     DeploymentParameterValues `json:"param_values"`
}

DeploymentRunCreateParam are parameters that are needed to create a deployment run

type DeploymentRunList

type DeploymentRunList interface {
	GetOption() DeploymentRunListOption
	GetRuns() []DeploymentRun
	GetStart() int     // index of start of current list, -1 if no results or error
	GetSize() int      // size of the current list, 0 if nothing is found, -1 if error
	GetNextStart() int // index of next partition to retrieve, -1 if error is found
}

DeploymentRunList is an list of deployment runs with pagination helper

type DeploymentRunListOption

type DeploymentRunListOption struct {
	Deployment common.ID
	// offset that the result list should begins on
	Offset   int
	PageSize int
}

DeploymentRunListOption is option available for fetching a list of deployment runs.

type DeploymentStartMonitoring

type DeploymentStartMonitoring struct {
	Session `json:",inline"`
	// deployment ID
	ID common.ID `json:"id"`
}

DeploymentStartMonitoring is an event that request the specified deployment to be monitored

type DeploymentStartMonitoringResult

type DeploymentStartMonitoringResult struct {
	Session `json:",inline"`
	// deployment ID
	ID common.ID `json:"id"`
}

DeploymentStartMonitoringResult is an event that contains the result to start monitoring request

type DeploymentStateRefresh

type DeploymentStateRefresh struct {
	Session `json:",inline"`
	ID      common.ID `json:"id"`
}

DeploymentStateRefresh is an event to request a state refresh on a deployment

type DeploymentStateRefreshResult

type DeploymentStateRefreshResult struct {
	Session `json:",inline"`
	ID      common.ID           `json:"id"`
	State   DeploymentStateView `json:"state"`
}

DeploymentStateRefreshResult an event that contains result to the state refresh request

type DeploymentStateView

type DeploymentStateView struct {
	Resources []DeploymentResource `json:"resources"`
}

DeploymentStateView is a higher level view of raw state

type DeploymentStatus

type DeploymentStatus string

DeploymentStatus is the status of a deployment, note that it is different from the status of a run.

const (
	// DeploymentStatusNone is the initial status for deployment, when deployment has no run.
	DeploymentStatusNone DeploymentStatus = "none"
	// DeploymentStatusActive is the status for deployment that has 1+ run, and last run succeeds.
	DeploymentStatusActive DeploymentStatus = "active"
	// DeploymentStatusDeleted is the status when a deployment is deleted successfully.
	DeploymentStatusDeleted DeploymentStatus = "deleted"
	// DeploymentStatusCreationErrored is the status when a deployment's last run failed.
	DeploymentStatusCreationErrored DeploymentStatus = "creation_errored"
	// DeploymentStatusDeletionErrored is the status when the deletion failed.
	DeploymentStatusDeletionErrored DeploymentStatus = "deletion_errored"
)

func (DeploymentStatus) AllowDeletion

func (ds DeploymentStatus) AllowDeletion() bool

AllowDeletion ...

func (DeploymentStatus) AllowRunCreation

func (ds DeploymentStatus) AllowRunCreation() bool

AllowRunCreation ...

func (DeploymentStatus) AvailableTransition

func (ds DeploymentStatus) AvailableTransition() []DeploymentPendingStatus

AvailableTransition shows what pending status is available based on the current status. return nil if status is not valid status.

func (DeploymentStatus) String

func (ds DeploymentStatus) String() string

String ...

func (DeploymentStatus) Valid

func (ds DeploymentStatus) Valid() bool

Valid ...

func (DeploymentStatus) ValidPendingStatus

func (ds DeploymentStatus) ValidPendingStatus(pendingStatus DeploymentPendingStatus) bool

ValidPendingStatus ...

type DeploymentStopMonitoring

type DeploymentStopMonitoring struct {
	Session `json:",inline"`
	// deployment ID
	ID common.ID `json:"id"`
}

DeploymentStopMonitoring is an event that request to stop monitoring the specified deployment

type DeploymentStopMonitoringResult

type DeploymentStopMonitoringResult struct {
	Session `json:",inline"`
	// deployment ID
	ID common.ID `json:"id"`
}

DeploymentStopMonitoringResult is an event that contains the result to stop monitoring request

type DeploymentUpdateRequest

type DeploymentUpdateRequest struct {
	Session      `json:",inline"`
	Deployment   Deployment `json:"deployment"`
	UpdateFields []string   `json:"update_fields"`
}

DeploymentUpdateRequest is an event that request updating of a deployment.

type DeploymentUpdateResult

type DeploymentUpdateResult struct {
	Session `json:",inline"`
	ID      common.ID
}

DeploymentUpdateResult is an event that contains the result to the update request

type FilterField

type FilterField string

FilterField is the name of the User field to be filtered on when listing users.

const (
	UsernameFilterField FilterField = "UsernameField"
	IsAdminFilterField  FilterField = "IsAdminField"
)

FilterField constants

type GitTemplateSource

type GitTemplateSource struct {
	URI              string                            `json:"uri"`
	AccessParameters GitTemplateSourceAccessParameters `json:"access_parameters"`
	Visibility       TemplateSourceVisibility          `json:"source_visibility"`
}

GitTemplateSource is a convenience type for access the AccessParameters of TemplateSource. This offers better type safety than accessing the map[string]interface{} directly.

type GitTemplateSourceAccessParameters

type GitTemplateSourceAccessParameters struct {
	Branch string `json:"branch" mapstructure:"branch"`
	Tag    string `json:"tag" mapstructure:"tag"`
	Path   string `json:"path" mapstructure:"path"`
	Commit string `json:"commit" mapstructure:"commit"`
}

GitTemplateSourceAccessParameters ...

type InteractiveSessionClient

type InteractiveSessionClient interface {
	Get(ctx context.Context, actor Actor, interactiveSessionID common.ID) (*InteractiveSessionModel, error)
	GetByInstanceID(ctx context.Context, actor Actor, instanceID string) (*InteractiveSessionModel, error)
	GetByInstanceAddress(ctx context.Context, actor Actor, instanceAddress string) (*InteractiveSessionModel, error)

	List(ctx context.Context, actor Actor) ([]InteractiveSessionModel, error)
	CheckPrerequisites(ctx context.Context, actor Actor, protocol InteractiveSessionProtocol, instanceAddress string, instanceAdminUsername string) (bool, error)

	Create(ctx context.Context, actor Actor, interactiveSession InteractiveSessionModel) (common.ID, error)
	Deactivate(ctx context.Context, actor Actor, interactiveSessionID common.ID) error
}

InteractiveSessionClient is the client for InteractiveSession The ISMS Client contains three methods: Create, List and Check.

Get: Is used to get an interactive session stored in the database.
GetByInstanceID: Is used to get an interactive session stored in the database by instance ID.
GetByInstanceAddress: Is used to get an interactive session stored in the database by instance address.
ListAll: Is used to list all interactive sessions stored in the database.
List: Is used to list all active/creating interactive sessions.
CheckPrerequisites: Is used to check if the given interactive session can be created. Please provide the following fields when checking:
	InstanceAddress // IP Address of the instance (String)
	InstanceAdminUsername // Admin username of the instance (string)
	Protocol // Either SSH or VNC (String)
Create: Is used to create and interactive session. Please provide the following fields when creating a session:
	InstanceID // (String)
	InstanceAddress // IP Address of the instance (String)
	InstanceAdminUsername // Admin username of the instance (string)
	Protocol // Either SSH or VNC (String)
	CloudID // Identifier of the cloud where the instance is hosted. (String)
Deactivate: Is used to change the state of an interactive session to inactive.

func NewNatsInteractiveSessionClientFromConn

func NewNatsInteractiveSessionClientFromConn(queryConn messaging2.QueryConnection, eventConn messaging2.EventConnection) (InteractiveSessionClient, error)

NewNatsInteractiveSessionClientFromConn creates a new client from existing Connections.

Note if you only need query functionality, then only supply queryConn, same for event functionality and eventConn.

type InteractiveSessionListModel

type InteractiveSessionListModel struct {
	Session
	InteractiveSessions []InteractiveSessionModel `json:"interactive_sessions"`
}

InteractiveSessionListModel is the InteractiveSession list model

type InteractiveSessionModel

type InteractiveSessionModel struct {
	Session

	ID                    common.ID                  `json:"id"`
	Owner                 string                     `json:"owner"`
	InstanceID            string                     `json:"instance_id"`
	InstanceAddress       string                     `json:"instance_address"`
	InstanceAdminUsername string                     `json:"instance_admin_username"`
	CloudID               string                     `json:"cloud_id"`
	Protocol              InteractiveSessionProtocol `json:"protocol"`
	RedirectURL           string                     `json:"redirect_url"`
	State                 InteractiveSessionState    `json:"state"`
	CreatedAt             time.Time                  `json:"created_at"`
	UpdatedAt             time.Time                  `json:"updated_at"`
}

InteractiveSessionModel is the InteractiveSession model The proper model for the ISMS. Containing all needed fields both incoming and outgoing.

InstanceID: ID of the instance to connect to.
InstanceAddress: IP-Address of the instance to connect to.
InstanceAdminUsername: Admin username in the instance to login
CloudID: ID of the cloud to connect to.
Protocol: Protocol of the session
RedirectURL: Contains the URL containing both IP+Encrypted Key returned by the ISMS. Used to redirect the user
	to a Guacamole Lite server.
State: state of the interactive session

func (*InteractiveSessionModel) GetPrimaryID

func (i *InteractiveSessionModel) GetPrimaryID() common.ID

GetPrimaryID returns the primary ID of the InteractiveSession

type InteractiveSessionProtocol

type InteractiveSessionProtocol string

InteractiveSessionProtocol is the protocol of an interactive session

const (
	// InteractiveSessionProtocolUnknown is for an unknown interactive session protocol
	InteractiveSessionProtocolUnknown InteractiveSessionProtocol = ""
	// InteractiveSessionProtocolSSH is for a SSH interactive session protocol
	InteractiveSessionProtocolSSH InteractiveSessionProtocol = "ssh"
	// InteractiveSessionProtocolVNC is for a VNC interactive session protocol
	InteractiveSessionProtocolVNC InteractiveSessionProtocol = "vnc"
)

func (InteractiveSessionProtocol) MarshalJSON

func (p InteractiveSessionProtocol) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a InteractiveSessionProtocol.

func (InteractiveSessionProtocol) String

String returns the string representation of a InteractiveSessionProtocol.

func (*InteractiveSessionProtocol) UnmarshalJSON

func (p *InteractiveSessionProtocol) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a InteractiveSessionProtocol to the appropriate enumeration constant.

type InteractiveSessionState

type InteractiveSessionState string

InteractiveSessionState is the state of an interactive session

const (
	// InteractiveSessionStateUnknown is for the unknown interactive session
	InteractiveSessionStateUnknown InteractiveSessionState = ""
	// InteractiveSessionStateCreating is for the interactive session in creation
	InteractiveSessionStateCreating InteractiveSessionState = "creating"
	// InteractiveSessionStateFailed is for the interactive session failed in creation
	InteractiveSessionStateFailed InteractiveSessionState = "failed"
	// InteractiveSessionStateActive is for the active interactive session
	InteractiveSessionStateActive InteractiveSessionState = "active"
	// InteractiveSessionStateInactive is for the inactive interactive session
	InteractiveSessionStateInactive InteractiveSessionState = "inactive"
)

func (InteractiveSessionState) MarshalJSON

func (p InteractiveSessionState) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a InteractiveSessionState.

func (InteractiveSessionState) String

func (p InteractiveSessionState) String() string

String returns the string representation of a InteractiveSessionState.

func (*InteractiveSessionState) UnmarshalJSON

func (p *InteractiveSessionState) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a InteractiveSessionState to the appropriate enumeration constant.

type JS2Allocation

type JS2Allocation struct {
	ID               string    `json:"id"`
	Start            time.Time `json:"start"`
	End              time.Time `json:"end"`
	ProjectCode      string    `json:"project_code"`
	Resource         string    `json:"resource"`
	ComputeAllocated float64   `json:"compute_allocated"`
	ComputeUsed      float64   `json:"compute_used"`
	StorageAllocated float64   `json:"storage_allocated"`
}

JS2Allocation is a struct for JetStream Allocation information

type JS2AllocationClient

type JS2AllocationClient interface {
	// Deprecated: new js2allocation service no longer support this
	GetUser(ctx context.Context, actor Actor, nocache bool) (*JS2UserModel, error)
	List(ctx context.Context, actor Actor, nocache bool) ([]JS2ProjectModel, error)
}

JS2AllocationClient is the client for JS2Allocation

func NewNatsJS2AllocationClientFromConn

func NewNatsJS2AllocationClientFromConn(queryConn messaging2.QueryConnection, eventConn messaging2.EventConnection) (JS2AllocationClient, error)

NewNatsJS2AllocationClientFromConn creates a new client from existing Connections.

type JS2PI

type JS2PI struct {
	Username  string `json:"username"`
	FirstName string `json:"firstname"`
	LastName  string `json:"lastname"`
}

JS2PI is a struct for JetStream PI information

type JS2ProjectListModel

type JS2ProjectListModel struct {
	Session
	Projects []JS2ProjectModel `json:"projects"`
	NoCache  bool              `json:"nocache"`
}

JS2ProjectListModel is the JS2 Project list model

type JS2ProjectModel

type JS2ProjectModel struct {
	Session

	ID          common.ID       `json:"id"`
	Owner       string          `json:"owner"`
	Title       string          `json:"title"`
	Description string          `json:"description,omitempty"`
	PI          JS2PI           `json:"pi"`
	Allocations []JS2Allocation `json:"allocations"`
	RetrievedAt time.Time       `json:"retrieved_at"`
}

JS2ProjectModel is the JS2 Project model

func (*JS2ProjectModel) GetPrimaryID

func (p *JS2ProjectModel) GetPrimaryID() common.ID

GetPrimaryID returns the primary ID of the JS2 Project

type JS2UserModel

type JS2UserModel struct {
	Session

	Owner        string    `json:"owner"`
	TACCUsername string    `json:"tacc_username"`
	RetrievedAt  time.Time `json:"retrieved_at"`

	NoCache bool `json:"nocache"`
}

JS2UserModel is the JS2 User model

func (*JS2UserModel) GetPrimaryID

func (u *JS2UserModel) GetPrimaryID() string

GetPrimaryID returns the primary ID of the JS2 User

type LogsLocation

type LogsLocation struct {
	DeploymentStatus DeploymentStatus `json:"deployment_status"`
	RunStatus        string           `json:"run_status"`
	LogsID           string           `json:"logs_id"`
	LogsURL          string           `json:"logs_url"`
	AuthHeader       string           `json:"auth_header"`
}

LogsLocation describe the location to download the deployment/run logs.

Run logs will have RunStatus != "" and DeploymentStatus == "". Deployment logs will have RunStatus == "" and , DeploymentStatus != "".

Currently, there is only deletion logs for deployment, so DeploymentStatus will either be "" or "deleted".

func (LogsLocation) IsDeploymentDeletionLogs

func (l LogsLocation) IsDeploymentDeletionLogs() bool

IsDeploymentDeletionLogs ...

func (LogsLocation) IsDeploymentLogs

func (l LogsLocation) IsDeploymentLogs() bool

IsDeploymentLogs ...

func (LogsLocation) IsRunExecutionLogs

func (l LogsLocation) IsRunExecutionLogs() bool

IsRunExecutionLogs returns true if logs is when deployment is in execution stage.

func (LogsLocation) IsRunLogs

func (l LogsLocation) IsRunLogs() bool

IsRunLogs ...

func (LogsLocation) IsRunPreflightLogs

func (l LogsLocation) IsRunPreflightLogs() bool

IsRunPreflightLogs returns true if logs is when deployment is in pre-flight stage.

type OpenStackCredential

type OpenStackCredential struct {
	IdentityAPIVersion string `json:"OS_IDENTITY_API_VERSION" mapstructure:"OS_IDENTITY_API_VERSION"`
	RegionName         string `json:"OS_REGION_NAME" mapstructure:"OS_REGION_NAME"`
	Interface          string `json:"OS_INTERFACE" mapstructure:"OS_INTERFACE"`
	AuthURL            string `json:"OS_AUTH_URL" mapstructure:"OS_AUTH_URL"`
	ProjectDomainID    string `json:"OS_PROJECT_DOMAIN_ID" mapstructure:"OS_PROJECT_DOMAIN_ID"`
	ProjectDomainName  string `json:"OS_PROJECT_DOMAIN_NAME" mapstructure:"OS_PROJECT_DOMAIN_NAME"`
	ProjectID          string `json:"OS_PROJECT_ID" mapstructure:"OS_PROJECT_ID"`
	ProjectName        string `json:"OS_PROJECT_NAME" mapstructure:"OS_PROJECT_NAME"`
	UserDomainName     string `json:"OS_USER_DOMAIN_NAME" mapstructure:"OS_USER_DOMAIN_NAME"`

	Username string `json:"OS_USERNAME" mapstructure:"OS_USERNAME"`
	Password string `json:"OS_PASSWORD" mapstructure:"OS_PASSWORD"`

	AuthType      string `json:"OS_AUTH_TYPE" mapstructure:"OS_AUTH_TYPE"`
	AppCredID     string `json:"OS_APPLICATION_CREDENTIAL_ID" mapstructure:"OS_APPLICATION_CREDENTIAL_ID"`
	AppCredName   string `json:"OS_APPLICATION_CREDENTIAL_NAME" mapstructure:"OS_APPLICATION_CREDENTIAL_NAME"`
	AppCredSecret string `json:"OS_APPLICATION_CREDENTIAL_SECRET" mapstructure:"OS_APPLICATION_CREDENTIAL_SECRET"`
}

OpenStackCredential is credential for OpenStack. This include both username/password and Application Credential.

type OpenStackInstanceAttributes

type OpenStackInstanceAttributes struct {
	ID         uuid.UUID   `json:"id"` // FIXME rebundant field? There is already ID field in DeploymentResource
	Name       string      `json:"name"`
	FloatingIP net.IP      `json:"floating_ip"`
	Image      string      `json:"image"`
	ImageID    uuid.UUID   `json:"image_id"`
	Flavor     string      `json:"flavor"`
	FlavorID   uuid.UUID   `json:"flavor_id"`
	Status     string      `json:"status"`
	Volumes    []uuid.UUID `json:"volumes,omitempty"`
}

OpenStackInstanceAttributes corresponds to the Attributes in DeploymentResourceInstance

type OpenStackVolumeAttributes

type OpenStackVolumeAttributes struct {
	ID   uuid.UUID `json:"id"` // FIXME rebundant field?
	Name string    `json:"name"`
	Size uint64    `json:"size"`
}

OpenStackVolumeAttributes corresponds to the Attributes in DeploymentResourceInstance

type ProviderClient

type ProviderClient interface {
	Get(ctx context.Context, actor Actor, id common.ID) (*ProviderModel, error)
	List(ctx context.Context, actor Actor) ([]ProviderModel, error)
	Create(ctx context.Context, actor Actor, provider ProviderModel) (common.ID, common.TransactionID, error)
	Delete(ctx context.Context, actor Actor, id common.ID) (common.TransactionID, error)
	Update(ctx context.Context, actor Actor, provider ProviderModel) (common.TransactionID, error)
}

ProviderClient is the client for provider metadata service

func NewNatsProviderClientFromConn

func NewNatsProviderClientFromConn(queryConn messaging2.QueryConnection, eventConn messaging2.EventConnection) (ProviderClient, error)

NewNatsProviderClientFromConn creates a new client from existing connections.

Note, if you only need query functionality, then only supply queryConn, same for event functionality and eventConn.

type ProviderListModel

type ProviderListModel struct {
	Session
	List []ProviderModel `json:"list"`
}

ProviderListModel ...

type ProviderModel

type ProviderModel struct {
	ID        common.ID              `json:"id" bson:"_id"`
	Name      string                 `json:"name" bson:"name"`
	Type      ProviderType           `json:"type" bson:"type"`
	URL       string                 `json:"url" bson:"url"`
	Owner     string                 `json:"owner"`
	Public    bool                   `json:"public"`
	CreatedAt time.Time              `json:"created_at,omitempty" bson:"created_at"`
	UpdatedAt time.Time              `json:"updated_at,omitempty" bson:"updated_at"`
	Metadata  map[string]interface{} `json:"metadata,omitempty" bson:"metadata"`
}

ProviderModel represents a provider

type ProviderRequest

type ProviderRequest struct {
	Session
	ProviderModel
}

ProviderRequest is the request object used for operations (get/list/create/update/delete), this is the struct that is being embedded into data field of cloudevent.

type ProviderResponse

type ProviderResponse ProviderRequest

ProviderResponse is the response/reply struct for operations like get/create/update/delete.

type ProviderType

type ProviderType string

ProviderType is the type of provider

const (
	OpenStackProviderType ProviderType = "openstack"
	AWSProviderType       ProviderType = "aws"
)

ProviderType constants

type ReplyListStream

type ReplyListStream struct {
	// total number of replies, at least 1
	TotalReplies int `json:"total_reply"`
	// index of the reply, start at 0
	ReplyIndex int `json:"reply_index"`
}

ReplyListStream contains fields needed for streaming a list of objects in multiple replies

type RequestPagination

type RequestPagination struct {
	// offset that a page begins on
	Offset int `json:"offset"`
	// limit of page size, -1 for unlimited page size
	PageSizeLimit int `json:"limit"`
}

RequestPagination contains fields needed to request pagination in the list result

type Session

type Session struct {
	SessionActor    string `json:"actor"`
	SessionEmulator string `json:"emulator,omitempty"`
	// Deprecated: use ServiceError instead
	ErrorType string `json:"error_type,omitempty"` // the type of error
	// Deprecated: use ServiceError instead
	ErrorMessage string         `json:"error_message,omitempty"` // custom or contextual error message
	ServiceError CacaoErrorBase `json:"service_error,omitempty"` // Ultimately, this will replace ErrorType and ErrorMessage fields above.
}

Session implements SessionContext. ErrorType & ErrorMessage fields are the old way of passing error, there is only a few service that still uses it to signal error. We will migrate everything to using ServiceError.

func CopySessionActors

func CopySessionActors(session Session) Session

CopySessionActors copies over the actor and emulator in Session. This is useful when copying actors from request to response.

func (Session) GetError

func (b Session) GetError() (string, string)

GetError returns error type & msg. Note this is the old way of passing error from service to client. Deprecated: use GetServiceError instead.

func (Session) GetServiceError

func (b Session) GetServiceError() CacaoError

GetServiceError returns the service error (which implements built-in error interface). This is the newer way to passing error from service to client.

func (Session) GetSessionActor

func (b Session) GetSessionActor() string

GetSessionActor ...

func (Session) GetSessionEmulator

func (b Session) GetSessionEmulator() string

GetSessionEmulator ...

func (*Session) SetSessionActor

func (b *Session) SetSessionActor(s string)

SetSessionActor ...

func (*Session) SetSessionEmulator

func (b *Session) SetSessionEmulator(s string)

SetSessionEmulator ...

type SessionContext

type SessionContext interface {
	GetSessionActor() string    // username of the person making requests
	GetSessionEmulator() string // set if the Actor's is being emulated by another user, presumably an admin
	SetSessionActor(string)
	SetSessionEmulator(string)
	GetError() (string, string) // gets the error type and message
	GetServiceError() CacaoError
}

SessionContext is the base interface for objects for microservices, it enables actor, emulator and error information to be passed around between service and its client as part of the object.

type SortByField

type SortByField string

SortByField is the field to sort the results by

const (
	SortByID             SortByField = "id"
	SortByWorkspace      SortByField = "workspace"
	SortByTemplate       SortByField = "template"
	SortByPrimaryCloud   SortByField = "primary_cloud"
	SortByStatus         SortByField = "status"
	SortByStateUpdatedAt SortByField = "state_updated_at"
)

Fields to sort by

type SortDirection

type SortDirection int

SortDirection is the sort direction in the list result, this is used for deployment list and user list(to be implemented)

const (
	AscendingSort  SortDirection = 1 // This should be the default if omitted
	DescendingSort SortDirection = -1
)

SortDirection constants

type StanDependencyMediatorClient

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

StanDependencyMediatorClient is an implementation of DependencyMediatorClient over STAN

func (StanDependencyMediatorClient) DeleteCredential

func (dm StanDependencyMediatorClient) DeleteCredential(ctx context.Context, session Session, credID string) (DepCheckDeletionResult, error)

DeleteCredential attempts to delete a credential while ensuring the dependency integrity. Deletion will not succeed if there is any other objects (deployments, templates) that depends on this credential.

func (StanDependencyMediatorClient) DeleteProvider

func (dm StanDependencyMediatorClient) DeleteProvider(ctx context.Context, session Session, provider common.ID) (DepCheckDeletionResult, error)

DeleteProvider attempts to delete a provider while ensuring the dependency integrity. FIXME provider currently will mostly likely always has deployments depend on it. But there is no way to check if deployments of other user(not the owner/creator of the provider) are using the provider, so it is not possible to do a thorough check on dependents.

func (StanDependencyMediatorClient) DeleteTemplate

func (dm StanDependencyMediatorClient) DeleteTemplate(ctx context.Context, session Session, template common.ID) (DepCheckDeletionResult, error)

DeleteTemplate attempts to delete a template while ensuring the dependency integrity. Deletion will not succeed if there is any other objects (deployments, providers) that depends on this template.

func (StanDependencyMediatorClient) DeleteWorkspace

func (dm StanDependencyMediatorClient) DeleteWorkspace(ctx context.Context, session Session, workspace common.ID) (DepCheckDeletionResult, error)

DeleteWorkspace attempts to delete a workspace while ensuring the dependency integrity. Deletion will not succeed if there is any other objects (deployments) that depends on this template.

type Template

type Template interface {
	SessionContext

	GetPrimaryID() common.ID // points to ID
	GetID() common.ID
	GetOwner() string
	GetName() string
	GetDescription() string
	IsPublic() bool
	IsDeleted() bool
	GetSource() TemplateSource
	GetMetadata() TemplateMetadata
	GetUIMetadata() TemplateUIMetadata
	GetCreatedAt() time.Time
	GetUpdatedAt() time.Time
	GetUpdateFieldNames() []string
	GetCredentialID() string
	GetIncludeCacaoReservedPurposes() bool
	GetLatestVersionID() common.ID

	SetPrimaryID(id common.ID)
	SetID(id common.ID)
	SetName(name string)
	SetDescription(description string)
	SetPublic(isPublic bool)
	SetSource(source TemplateSource)
	SetUpdateFieldNames(fieldNames []string)
	SetCredentialID(credentialID string)
	SetIncludeCacaoReservedPurposes(include bool)
}

Template is the standard interface for all Template implementations

type TemplateCacaoTask

type TemplateCacaoTask struct {
	Type                 TemplateCacaoTaskType      `json:"type,omitempty"`
	Location             string                     `json:"location,omitempty"`
	ExecuteOn            TemplateCacaoTaskExecuteOn `json:"execute_on,omitempty"`
	Arguments            []string                   `json:"args,omitempty"`
	EnvironmentVariables []TemplateCacaoTaskKeyVal  `json:"env,omitempty"`
	RunAction            TemplateCacaoTaskRunAction `json:"run_action,omitempty"`
	RunParams            []TemplateCacaoTaskKeyVal  `json:"run_params,omitempty"`
}

TemplateCacaoTask is a struct for a pre/post task in metadata

type TemplateCacaoTaskExecuteOn

type TemplateCacaoTaskExecuteOn struct {
	Type   TemplateCacaoTaskExecuteOnType
	NodeID int // only used when Type is 'TemplateCacaoTaskExecuteOnTypeParticular'
}

TemplateCacaoTaskExecuteOn indicates where a task to perform.

func (TemplateCacaoTaskExecuteOn) MarshalBSONValue

func (t TemplateCacaoTaskExecuteOn) MarshalBSONValue() (bsontype.Type, []byte, error)

MarshalBSONValue returns the BSON representation of a TemplateCacaoTaskExecuteOn.

func (TemplateCacaoTaskExecuteOn) MarshalJSON

func (t TemplateCacaoTaskExecuteOn) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a TemplateCacaoTaskExecuteOn.

func (TemplateCacaoTaskExecuteOn) String

String returns the string representation of a TemplateCacaoTaskExecuteOn.

func (*TemplateCacaoTaskExecuteOn) UnmarshalBSONValue

func (t *TemplateCacaoTaskExecuteOn) UnmarshalBSONValue(bt bsontype.Type, b []byte) error

UnmarshalBSONValue converts the BSON representation of a TemplateCacaoTaskExecuteOn to the appropriate enumeration constant.

func (*TemplateCacaoTaskExecuteOn) UnmarshalJSON

func (t *TemplateCacaoTaskExecuteOn) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplateCacaoTaskExecuteOn to the appropriate enumeration constant.

type TemplateCacaoTaskExecuteOnType

type TemplateCacaoTaskExecuteOnType string

TemplateCacaoTaskExecuteOnType indicates where a task to perform.

const (
	// TemplateCacaoTaskExecuteOnTypeUnknown indicates that the type of the task execution is unspecified.
	TemplateCacaoTaskExecuteOnTypeUnknown TemplateCacaoTaskExecuteOnType = ""

	// TemplateCacaoTaskExecuteOnTypeAll indicates that the task will be performed on all instances
	TemplateCacaoTaskExecuteOnTypeAll TemplateCacaoTaskExecuteOnType = "all"
	// TemplateCacaoTaskExecuteOnTypeAllButFirst indicates that the task will be performed on all but the first instance
	TemplateCacaoTaskExecuteOnTypeAllButFirst TemplateCacaoTaskExecuteOnType = "all_but_first"
	// TemplateCacaoTaskExecuteOnTypeParticular indicates that the task will be performed on a particular instance
	TemplateCacaoTaskExecuteOnTypeParticular TemplateCacaoTaskExecuteOnType = "particular"
)

Enumeration constants for TemplateCacaoTaskExecuteOnType.

type TemplateCacaoTaskKeyVal

type TemplateCacaoTaskKeyVal struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

TemplateCacaoTaskKeyVal is a struct for representing key-value formatted values.

func (*TemplateCacaoTaskKeyVal) UnmarshalJSON

func (t *TemplateCacaoTaskKeyVal) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplateCacaoTaskKeyVal to the object form.

type TemplateCacaoTaskRunAction

type TemplateCacaoTaskRunAction string

TemplateCacaoTaskRunAction indicates what to do when the task type is `run_deployment_action`.

const (
	// TemplateCacaoTaskRunActionUnknown indicates that the run action of the task is unspecified.
	TemplateCacaoTaskRunActionUnknown TemplateCacaoTaskRunAction = ""

	// TemplateCacaoTaskRunActionRunDelete indicates that it deletes run at the step.
	TemplateCacaoTaskRunActionRunDelete TemplateCacaoTaskRunAction = "run_delete"
	// TemplateCacaoTaskRunActionRunParamUpdate indicates that it updates parameters of a run at the step.
	TemplateCacaoTaskRunActionRunParamUpdate TemplateCacaoTaskRunAction = "run_param_update"
)

Enumeration constants for TemplateCacaoTaskRunAction.

func (TemplateCacaoTaskRunAction) MarshalJSON

func (t TemplateCacaoTaskRunAction) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a TemplateCacaoTaskRunAction.

func (TemplateCacaoTaskRunAction) String

String returns the string representation of a TemplateCacaoTaskRunAction.

func (*TemplateCacaoTaskRunAction) UnmarshalJSON

func (t *TemplateCacaoTaskRunAction) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplateCacaoTaskRunAction to the appropriate enumeration constant.

type TemplateCacaoTaskType

type TemplateCacaoTaskType string

TemplateCacaoTaskType indicates the type of a task to perform. For example, if the task is to run an ansible script then the type would be `ansible`.

const (
	// TemplateCacaoTaskTypeUnknown indicates that the type of the task is unspecified.
	TemplateCacaoTaskTypeUnknown TemplateCacaoTaskType = ""

	// TemplateCacaoTaskTypeCacaoAtmosphereLegacy indicates that the task is used to run a command via atmosphere
	TemplateCacaoTaskTypeCacaoAtmosphereLegacy TemplateCacaoTaskType = "cacao_atmosphere_legacy"
	// TemplateCacaoTaskTypeAnsible indicates that the task is used to run a command via ansible
	TemplateCacaoTaskTypeAnsible TemplateCacaoTaskType = "ansible"
	// TemplateCacaoTaskTypeScriptRemote indicates that the task is used to run a command via a remote script
	TemplateCacaoTaskTypeScriptRemote TemplateCacaoTaskType = "script_remote"
	// TemplateCacaoTaskTypeScriptLocal indicates that the task is used to run a command via a local script
	TemplateCacaoTaskTypeScriptLocal TemplateCacaoTaskType = "script_local"
	// TemplateCacaoTaskTypeDocker indicates that the task is used to run a docker instance
	TemplateCacaoTaskTypeDocker TemplateCacaoTaskType = "docker"
	// TemplateCacaoTaskTypeDeploymentRunAction indicates that the task is used to run a deployment run action
	TemplateCacaoTaskTypeDeploymentRunAction TemplateCacaoTaskType = "deployment_run_action"
)

Enumeration constants for TemplateCacaoTaskType.

func (TemplateCacaoTaskType) MarshalJSON

func (t TemplateCacaoTaskType) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a TemplateCacaoTaskType.

func (TemplateCacaoTaskType) String

func (t TemplateCacaoTaskType) String() string

String returns the string representation of a TemplateCacaoTaskType.

func (*TemplateCacaoTaskType) UnmarshalJSON

func (t *TemplateCacaoTaskType) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplateCacaoTaskType to the appropriate enumeration constant.

type TemplateClient

type TemplateClient interface {
	// Source Types
	ListSourceTypes(ctx context.Context, actor Actor) ([]TemplateSourceType, error)

	// Types
	GetType(ctx context.Context, actor Actor, templateTypeName TemplateTypeName) (TemplateType, error)
	ListTypes(ctx context.Context, actor Actor) ([]TemplateType, error)
	ListTypesForProviderType(ctx context.Context, actor Actor, providerType TemplateProviderType) ([]TemplateType, error)

	CreateType(ctx context.Context, actor Actor, templateType TemplateType) error
	UpdateType(ctx context.Context, actor Actor, templateType TemplateType) error
	UpdateTypeFields(ctx context.Context, actor Actor, templateType TemplateType, updateFieldNames []string) error
	DeleteType(ctx context.Context, actor Actor, templateTypeName TemplateTypeName) error

	// Custom Field Type
	ListCustomFieldTypes(ctx context.Context, actor Actor) ([]TemplateCustomFieldType, error)
	GetCustomFieldType(ctx context.Context, actor Actor, customFieldTypeName string) (TemplateCustomFieldType, error)
	QueryCustomFieldType(ctx context.Context, actor Actor, customFieldTypeName string, queryParams map[string]string) (TemplateCustomFieldTypeQueryResult, error)

	CreateCustomFieldType(ctx context.Context, actor Actor, customFieldType TemplateCustomFieldType) error
	UpdateCustomFieldType(ctx context.Context, actor Actor, customFieldType TemplateCustomFieldType) error
	UpdateCustomFieldTypeFields(ctx context.Context, actor Actor, customFieldType TemplateCustomFieldType, updateFieldNames []string) error
	DeleteCustomFieldType(ctx context.Context, actor Actor, customFieldTypeName string) error

	// Template
	List(ctx context.Context, actor Actor, includeCacaoReservedPurposes bool) ([]Template, error)
	Get(ctx context.Context, actor Actor, templateID common.ID) (Template, error)

	Import(ctx context.Context, actor Actor, template Template, credentialID string) (common.ID, error)
	Update(ctx context.Context, actor Actor, template Template) error
	UpdateFields(ctx context.Context, actor Actor, template Template, updateFieldNames []string) error
	Sync(ctx context.Context, actor Actor, templateID common.ID, credentialID string) error
	Delete(ctx context.Context, actor Actor, templateID common.ID) error

	// TemplateVersion
	ListTemplateVersions(ctx context.Context, actor Actor, templateID common.ID) ([]TemplateVersion, error)
	GetTemplateVersion(ctx context.Context, actor Actor, versionID common.ID) (*TemplateVersion, error)
	DisableTemplateVersion(ctx context.Context, actor Actor, versionID common.ID) error
}

TemplateClient is the client for Template

func NewNatsTemplateClientFromConn

func NewNatsTemplateClientFromConn(queryConn messaging2.QueryConnection, eventConn messaging2.EventConnection) (TemplateClient, error)

NewNatsTemplateClientFromConn creates a new client from existing connections.

Note, if you only need query functionality, then only supply queryConn, same for event functionality and eventConn.

type TemplateCustomFieldType

type TemplateCustomFieldType interface {
	SessionContext

	GetPrimaryID() string // points to Name
	GetName() string
	GetDescription() string
	GetQueryMethod() TemplateCustomFieldTypeQueryMethod
	GetQueryTarget() string
	GetQueryData() string
	GetQueryResultJSONPathFilter() string
	GetUpdateFieldNames() []string

	SetPrimaryID(name string)
	SetName(name string)
	SetDescription(description string)
	SetQueryMethod(method TemplateCustomFieldTypeQueryMethod)
	SetQueryTarget(target string)
	SetQueryData(data string)
	SetQueryResultJSONPathFilter(jsonpath string)
	SetUpdateFieldNames(fieldNames []string)
}

TemplateCustomFieldType is the standard interface for all Template Custom Field Type implementations

type TemplateCustomFieldTypeListItemModel

type TemplateCustomFieldTypeListItemModel struct {
	Name                      string                             `json:"name"`
	Description               string                             `json:"description,omitempty"`
	QueryMethod               TemplateCustomFieldTypeQueryMethod `json:"query_method"`
	QueryTarget               string                             `json:"query_target"`
	QueryData                 string                             `json:"query_data,omitempty"`
	QueryResultJSONPathFilter string                             `json:"query_result_jsonpath_filter,omitempty"`
}

TemplateCustomFieldTypeListItemModel is the element type in TemplateCustomFieldTypeModel

type TemplateCustomFieldTypeListModel

type TemplateCustomFieldTypeListModel struct {
	Session

	TemplateCustomFieldTypes []TemplateCustomFieldTypeListItemModel `json:"template_custom_field_types"`
}

TemplateCustomFieldTypeListModel is the Template Custom Field Type list model

func (*TemplateCustomFieldTypeListModel) GetTemplateCustomFieldTypes

func (t *TemplateCustomFieldTypeListModel) GetTemplateCustomFieldTypes() []TemplateCustomFieldType

GetTemplateCustomFieldTypes returns template custom field types

type TemplateCustomFieldTypeModel

type TemplateCustomFieldTypeModel struct {
	Session

	Name                      string                             `json:"name"`
	Description               string                             `json:"description,omitempty"`
	QueryMethod               TemplateCustomFieldTypeQueryMethod `json:"query_method"`
	QueryTarget               string                             `json:"query_target"`
	QueryData                 string                             `json:"query_data,omitempty"`
	QueryResultJSONPathFilter string                             `json:"query_result_jsonpath_filter,omitempty"`

	UpdateFieldNames []string          `json:"update_field_names,omitempty"`
	QueryParams      map[string]string `json:"query_params,omitempty"`
}

TemplateCustomFieldTypeModel is the Template Custom Field Type model

func (*TemplateCustomFieldTypeModel) GetDescription

func (t *TemplateCustomFieldTypeModel) GetDescription() string

GetDescription returns the description of the Template Custom Field Type

func (*TemplateCustomFieldTypeModel) GetName

func (t *TemplateCustomFieldTypeModel) GetName() string

GetName returns the name of the Template Custom Field Type

func (*TemplateCustomFieldTypeModel) GetPrimaryID

func (t *TemplateCustomFieldTypeModel) GetPrimaryID() string

GetPrimaryID returns the primary ID of the Template Custom Field Type

func (*TemplateCustomFieldTypeModel) GetQueryData

func (t *TemplateCustomFieldTypeModel) GetQueryData() string

GetQueryData returns the query data of the Template Custom Field Type

func (*TemplateCustomFieldTypeModel) GetQueryMethod

GetQueryMethod returns the query method of the Template Custom Field Type

func (*TemplateCustomFieldTypeModel) GetQueryParams

func (t *TemplateCustomFieldTypeModel) GetQueryParams() map[string]string

GetQueryParams returns the query params for query API

func (*TemplateCustomFieldTypeModel) GetQueryResultJSONPathFilter

func (t *TemplateCustomFieldTypeModel) GetQueryResultJSONPathFilter() string

GetQueryResultJSONPathFilter returns the JSONPath filter that filters query result data

func (*TemplateCustomFieldTypeModel) GetQueryTarget

func (t *TemplateCustomFieldTypeModel) GetQueryTarget() string

GetQueryTarget returns the query target of the Template Custom Field Type

func (*TemplateCustomFieldTypeModel) GetUpdateFieldNames

func (t *TemplateCustomFieldTypeModel) GetUpdateFieldNames() []string

GetUpdateFieldNames returns the field names to be updated

func (*TemplateCustomFieldTypeModel) SetDescription

func (t *TemplateCustomFieldTypeModel) SetDescription(description string)

SetDescription sets the description of the Template Custom Field Type

func (*TemplateCustomFieldTypeModel) SetName

func (t *TemplateCustomFieldTypeModel) SetName(name string)

SetName sets the name of the Template Custom Field Type

func (*TemplateCustomFieldTypeModel) SetPrimaryID

func (t *TemplateCustomFieldTypeModel) SetPrimaryID(name string)

SetPrimaryID sets the primary ID of the Template Custom Field Type

func (*TemplateCustomFieldTypeModel) SetQueryData

func (t *TemplateCustomFieldTypeModel) SetQueryData(data string)

SetQueryData sets the data of the Template Custom Field Type

func (*TemplateCustomFieldTypeModel) SetQueryMethod

SetQueryMethod sets the query method of the Template Custom Field Type data

func (*TemplateCustomFieldTypeModel) SetQueryParams

func (t *TemplateCustomFieldTypeModel) SetQueryParams(queryParams map[string]string)

SetQueryParams sets the query params

func (*TemplateCustomFieldTypeModel) SetQueryResultJSONPathFilter

func (t *TemplateCustomFieldTypeModel) SetQueryResultJSONPathFilter(jsonpath string)

SetQueryResultJSONPathFilter sets the JSONPath filter that filters query result data

func (*TemplateCustomFieldTypeModel) SetQueryTarget

func (t *TemplateCustomFieldTypeModel) SetQueryTarget(target string)

SetQueryTarget sets the query target of the Template Custom Field Type

func (*TemplateCustomFieldTypeModel) SetUpdateFieldNames

func (t *TemplateCustomFieldTypeModel) SetUpdateFieldNames(fieldNames []string)

SetUpdateFieldNames sets the field names to be updated

type TemplateCustomFieldTypeQueryMethod

type TemplateCustomFieldTypeQueryMethod string

TemplateCustomFieldTypeQueryMethod is the type of a template custom field type query method

const (
	// TemplateCustomFieldTypeQueryMethodUnknown is for an unknown query method
	TemplateCustomFieldTypeQueryMethodUnknown TemplateCustomFieldTypeQueryMethod = ""
	// TemplateCustomFieldTypeQueryMethodREST is for an api endpoint query method
	TemplateCustomFieldTypeQueryMethodREST TemplateCustomFieldTypeQueryMethod = "rest"
	// TemplateCustomFieldTypeQueryMethodNATS is for a NATS message channel query method
	TemplateCustomFieldTypeQueryMethodNATS TemplateCustomFieldTypeQueryMethod = "nats"
)

func (TemplateCustomFieldTypeQueryMethod) MarshalJSON

func (t TemplateCustomFieldTypeQueryMethod) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a TemplateCustomFieldTypeQueryTargetType.

func (TemplateCustomFieldTypeQueryMethod) String

String returns the string representation of a TemplateCustomFieldTypeQueryTargetType.

func (*TemplateCustomFieldTypeQueryMethod) UnmarshalJSON

func (t *TemplateCustomFieldTypeQueryMethod) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplateCustomFieldTypeQueryTargetType to the appropriate enumeration constant.

type TemplateCustomFieldTypeQueryResult

type TemplateCustomFieldTypeQueryResult interface {
	SessionContext

	GetName() string
	GetDataType() string
	GetValue() interface{}
}

TemplateCustomFieldTypeQueryResult is the standard interface for all Template Custom Field Type Query Result implementations

type TemplateCustomFieldTypeQueryResultModel

type TemplateCustomFieldTypeQueryResultModel struct {
	Session

	Name     string      `json:"name"`
	DataType string      `json:"data_type"`
	Value    interface{} `json:"value"`
}

TemplateCustomFieldTypeQueryResultModel is the Template Custom Field Type query result model

func (*TemplateCustomFieldTypeQueryResultModel) GetDataType

GetDataType returns the data type of the template custom field type

func (*TemplateCustomFieldTypeQueryResultModel) GetName

GetName returns the name of the template custom field type

func (*TemplateCustomFieldTypeQueryResultModel) GetValue

func (t *TemplateCustomFieldTypeQueryResultModel) GetValue() interface{}

GetValue returns the values of the template custom field type

type TemplateEngine

type TemplateEngine string

TemplateEngine is the type of a template engine

const (
	// TemplateEngineUnknown is for an unknown template engine
	TemplateEngineUnknown TemplateEngine = ""
	// TemplateEngineTerraform is for terraform template engine
	TemplateEngineTerraform TemplateEngine = "terraform"
	// TemplateEngineKubernetes is for kuberntes template engine, this refers raw manifest (no parameterization)
	TemplateEngineKubernetes TemplateEngine = "kubernetes"
)

func (TemplateEngine) MarshalJSON

func (t TemplateEngine) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a TemplateEngine.

func (TemplateEngine) String

func (t TemplateEngine) String() string

String returns the string representation of a TemplateEngine.

func (*TemplateEngine) UnmarshalJSON

func (t *TemplateEngine) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplateEngine to the appropriate enumeration constant.

type TemplateFilter

type TemplateFilter struct {
	Key   TemplateFilterKey `json:"key,omitempty"`
	Value interface{}       `json:"value,omitempty"`
}

TemplateFilter is a struct for a filter in metadata

type TemplateFilterKey

type TemplateFilterKey string

TemplateFilterKey indicates the type of a filter key.

const (
	// TemplateFilterKeyUnknown indicates that the value is unknown
	TemplateFilterKeyUnknown TemplateFilterKey = ""
	// TemplateFilterKeyImageAllowed indicates that the value is a list of images allowed
	TemplateFilterKeyImageAllowed TemplateFilterKey = "images_allowed"
	// TemplateFilterKeyImageBlocked indicates that the value is a list of images blocked
	TemplateFilterKeyImageBlocked TemplateFilterKey = "images_blocked"
)

Enumeration constants for TemplateFilterType.

func (TemplateFilterKey) MarshalJSON

func (t TemplateFilterKey) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a TemplateFilterKey.

func (TemplateFilterKey) String

func (t TemplateFilterKey) String() string

String returns the string representation of a TemplateFilterKey.

func (*TemplateFilterKey) UnmarshalJSON

func (t *TemplateFilterKey) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplateFilterKey to the appropriate enumeration constant.

type TemplateFormat

type TemplateFormat string

TemplateFormat is the format of a template

const (
	// TemplateFormatUnknown is for a template in unkonwn format
	TemplateFormatUnknown TemplateFormat = ""
	// TemplateFormatYAML is for a template in yaml format
	TemplateFormatYAML TemplateFormat = "yaml"
	// TemplateFormatJSON is for a template in json format
	TemplateFormatJSON TemplateFormat = "json"
	// TemplateFormatHCL is for a template in hcl format, the format used by Terraform for *.tf files
	TemplateFormatHCL TemplateFormat = "hcl"
)

func (TemplateFormat) MarshalJSON

func (t TemplateFormat) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a TemplateFormat.

func (TemplateFormat) String

func (t TemplateFormat) String() string

String returns the string representation of a TemplateFormat.

func (*TemplateFormat) UnmarshalJSON

func (t *TemplateFormat) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplateFormat to the appropriate enumeration constant.

type TemplateListItemModel

type TemplateListItemModel struct {
	ID              common.ID          `json:"id"`
	Owner           string             `json:"owner"`
	Name            string             `json:"name"`
	Description     string             `json:"description"`
	Public          bool               `json:"public"`
	Deleted         bool               `json:"deleted"`
	Source          TemplateSource     `json:"source"`
	LatestVersionID common.ID          `json:"latest_version_id"`
	Metadata        TemplateMetadata   `json:"metadata"`
	UIMetadata      TemplateUIMetadata `json:"ui_metadata"`
	CreatedAt       time.Time          `json:"created_at"`
	UpdatedAt       time.Time          `json:"updated_at"`
}

TemplateListItemModel is the element type in TemplateListModel

type TemplateListModel

type TemplateListModel struct {
	Session

	Templates []TemplateListItemModel `json:"templates"`
}

TemplateListModel is the template list model

func (*TemplateListModel) GetTemplates

func (t *TemplateListModel) GetTemplates() []Template

GetTemplates returns templates

type TemplateMetadata

type TemplateMetadata struct {
	SchemaURL         string              `json:"schema_url,omitempty"`
	SchemaVersion     string              `json:"schema_version,omitempty"`
	Name              string              `json:"name,omitempty"`
	Author            string              `json:"author,omitempty"`
	AuthorEmail       string              `json:"author_email,omitempty"`
	Description       string              `json:"description,omitempty"`
	DocURL            string              `json:"doc_url,omitempty"`
	TemplateType      TemplateTypeName    `json:"template_type,omitempty"`
	Purpose           TemplatePurpose     `json:"purpose,omitempty"`
	PublishedVersions []string            `json:"published_versions,omitempty"`
	CacaoPreTasks     []TemplateCacaoTask `json:"cacao_pre_tasks,omitempty"`
	CacaoPostTasks    []TemplateCacaoTask `json:"cacao_post_tasks,omitempty"`
	// Parameters stores template parameters
	// e.g.,
	// [
	//     {"name": "instance_count", "default": 1, "type": "integer"},
	//     {"name": "instance_name", "type": "string"}
	// ]
	Parameters []TemplateParameter `json:"parameters,omitempty"`
	// Filters add filters to screen out field values
	// e.g.,
	// [
	//     {"Key": "images_allowed", "value": "xxxxx"}
	//]
	Filters []TemplateFilter `json:"filters,omitempty"`
}

TemplateMetadata is a struct for template metadata The struct is generated from a metadata file (e.g., https://github.com/cyverse/tf-openstack-single-image/blob/master/metadata.json)

func (*TemplateMetadata) GetFilter

func (meta *TemplateMetadata) GetFilter(key TemplateFilterKey) *TemplateFilter

GetFilter returns TemplateFilter with the given key If the filter with the given key does not exist, returns nil

func (*TemplateMetadata) GetFilterValueStrArr

func (meta *TemplateMetadata) GetFilterValueStrArr(key TemplateFilterKey) []string

GetFilterValueStrArr returns TemplateFilter value with the given key

func (*TemplateMetadata) GetImagesAllowed

func (meta *TemplateMetadata) GetImagesAllowed() []string

GetImagesAllowed returns images allowed

func (*TemplateMetadata) GetImagesBlocked

func (meta *TemplateMetadata) GetImagesBlocked() []string

GetImagesBlocked returns images blocked

func (*TemplateMetadata) GetParameter

func (meta *TemplateMetadata) GetParameter(name string) *TemplateParameter

GetParameter returns TemplateParameter with the given name If the parameter with the given name does not exist, returns nil

type TemplateModel

type TemplateModel struct {
	Session

	ID              common.ID          `json:"id"`
	Owner           string             `json:"owner"`
	Name            string             `json:"name"`
	Description     string             `json:"description"`
	Public          bool               `json:"public"`
	Deleted         bool               `json:"deleted"`
	Source          TemplateSource     `json:"source"`
	LatestVersionID common.ID          `json:"latest_version_id"`
	Metadata        TemplateMetadata   `json:"metadata"`
	UIMetadata      TemplateUIMetadata `json:"ui_metadata"`
	CreatedAt       time.Time          `json:"created_at"`
	UpdatedAt       time.Time          `json:"updated_at"`

	UpdateFieldNames             []string `json:"update_field_names,omitempty"`
	CredentialID                 string   `json:"credential_id,omitempty"`                   // for import and sync
	IncludeCacaoReservedPurposes bool     `json:"include_cacao_reserved_purposes,omitempty"` // for list
}

TemplateModel is the template model. Implements Template.

func (TemplateModel) GetCreatedAt

func (t TemplateModel) GetCreatedAt() time.Time

GetCreatedAt returns the creation time of the Template

func (TemplateModel) GetCredentialID

func (t TemplateModel) GetCredentialID() string

GetCredentialID returns the credential id of the Template

func (*TemplateModel) GetDescription

func (t *TemplateModel) GetDescription() string

GetDescription returns the description of the Template

func (*TemplateModel) GetID

func (t *TemplateModel) GetID() common.ID

GetID returns the ID of the Template

func (TemplateModel) GetIncludeCacaoReservedPurposes

func (t TemplateModel) GetIncludeCacaoReservedPurposes() bool

GetIncludeCacaoReservedPurposes returns if it include Templates having cacao reserved purposes

func (TemplateModel) GetLatestVersionID

func (t TemplateModel) GetLatestVersionID() common.ID

GetLatestVersionID returns the ID of latest version of the template

func (*TemplateModel) GetMetadata

func (t *TemplateModel) GetMetadata() TemplateMetadata

GetMetadata returns the metadata of the Template

func (*TemplateModel) GetName

func (t *TemplateModel) GetName() string

GetName returns the name of the Template

func (*TemplateModel) GetOwner

func (t *TemplateModel) GetOwner() string

GetOwner returns the owner of the Template

func (*TemplateModel) GetPrimaryID

func (t *TemplateModel) GetPrimaryID() common.ID

GetPrimaryID returns the primary ID of the Template

func (*TemplateModel) GetSource

func (t *TemplateModel) GetSource() TemplateSource

GetSource returns the source of the Template

func (*TemplateModel) GetUIMetadata

func (t *TemplateModel) GetUIMetadata() TemplateUIMetadata

GetUIMetadata returns the ui metadata of the Template

func (*TemplateModel) GetUpdateFieldNames

func (t *TemplateModel) GetUpdateFieldNames() []string

GetUpdateFieldNames returns the field names to be updated

func (TemplateModel) GetUpdatedAt

func (t TemplateModel) GetUpdatedAt() time.Time

GetUpdatedAt returns the modified time of the Template

func (*TemplateModel) IsDeleted

func (t *TemplateModel) IsDeleted() bool

IsDeleted returns the true if the template is deleted.

func (*TemplateModel) IsPublic

func (t *TemplateModel) IsPublic() bool

IsPublic returns the accessibility of the Template, returns True if it is publically accessible

func (*TemplateModel) SetCredentialID

func (t *TemplateModel) SetCredentialID(credentialID string)

SetCredentialID sets the credential id of the Template

func (*TemplateModel) SetDescription

func (t *TemplateModel) SetDescription(description string)

SetDescription sets the description of the Template

func (*TemplateModel) SetID

func (t *TemplateModel) SetID(id common.ID)

SetID sets the ID of the Template

func (*TemplateModel) SetIncludeCacaoReservedPurposes

func (t *TemplateModel) SetIncludeCacaoReservedPurposes(include bool)

SetIncludeCacaoReservedPurposes sets to include Templates having cacao reserved purposes

func (*TemplateModel) SetName

func (t *TemplateModel) SetName(name string)

SetName sets the name of the Template

func (*TemplateModel) SetPrimaryID

func (t *TemplateModel) SetPrimaryID(id common.ID)

SetPrimaryID sets the primary ID of the Template

func (*TemplateModel) SetPublic

func (t *TemplateModel) SetPublic(isPublic bool)

SetPublic sets the accessibility of the Template

func (*TemplateModel) SetSource

func (t *TemplateModel) SetSource(source TemplateSource)

SetSource sets the source of the Template

func (*TemplateModel) SetUpdateFieldNames

func (t *TemplateModel) SetUpdateFieldNames(fieldNames []string)

SetUpdateFieldNames sets the field names to be updated

type TemplateParameter

type TemplateParameter struct {
	Name        string        `json:"name,omitempty"`
	Type        string        `json:"type,omitempty"`
	Description string        `json:"description,omitempty"`
	Default     interface{}   `json:"default,omitempty"`
	Enum        []interface{} `json:"enum,omitempty"`
	// DataValidationType can have something like "ip_address" or "username" to validate data value
	// application can determine how to use this
	DataValidationType string `json:"data_validation_type,omitempty"`
	Required           bool   `json:"required,omitempty"`
	Editable           bool   `json:"editable,omitempty"`
	Base64             bool   `json:"base64,omitempty"`
}

TemplateParameter is a struct for a parameter in metadata

func (*TemplateParameter) CheckValue

func (param *TemplateParameter) CheckValue(value interface{}) (typeName string, resultValue interface{}, err error)

CheckValue checks value against parameter type and correct the format. nil is allowed and used to indicate that no value is provided for the parameter, and should use default value instead.

func (*TemplateParameter) CheckValueFromString

func (param *TemplateParameter) CheckValueFromString(value string) (string, interface{}, error)

CheckValueFromString checks value in string format against parameter type and correct the format. When default is defined for the parameter, empty string ("") is treated as lack of value.

func (*TemplateParameter) CorrectDataType

func (param *TemplateParameter) CorrectDataType() error

CorrectDataType corrects data type Updates Default and Enum fields to have correct data types

func (*TemplateParameter) UnmarshalJSON

func (param *TemplateParameter) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplateParameter to the object form.

type TemplateProviderType

type TemplateProviderType string

TemplateProviderType is the type of a template provider

const (
	// TemplateProviderTypeUnknown is for a template for unknown provider
	TemplateProviderTypeUnknown TemplateProviderType = ""
	// TemplateProviderTypeOpenStack is for a template for Openstack provider
	TemplateProviderTypeOpenStack TemplateProviderType = "openstack"
	// TemplateProviderTypeAWS is for a template for AWS provider
	TemplateProviderTypeAWS TemplateProviderType = "aws"
	// TemplateProviderTypeGCP is for a template for GCP provider
	TemplateProviderTypeGCP TemplateProviderType = "gcp"
	// TemplateProviderTypeAzure is for a template for Azure provider
	TemplateProviderTypeAzure TemplateProviderType = "azure"
	// TemplateProviderTypeKubernetes is for a template for Kubernetes provider
	TemplateProviderTypeKubernetes TemplateProviderType = "kubernetes"
)

func (TemplateProviderType) MarshalJSON

func (t TemplateProviderType) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a TemplateProviderType.

func (TemplateProviderType) String

func (t TemplateProviderType) String() string

String returns the string representation of a TemplateProviderType.

func (*TemplateProviderType) UnmarshalJSON

func (t *TemplateProviderType) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplateProviderType to the appropriate enumeration constant.

type TemplatePurpose

type TemplatePurpose string

TemplatePurpose indicates the reason that a template exists. For example, if the template is intended to be used to spin up compute instances then the template purpose would be `compute`. Similarly, if the template is intended to be used to provision storage then the template purpose would be `storage`. Templates used for all other purposes can be classified as `general`.

const (
	// TemplatePurposeUnknown indicates that the purpose of the template is unspecified.
	TemplatePurposeUnknown TemplatePurpose = ""

	// for V1
	// TemplatePurposeCompute indicates that the template is used to spin up a compute instance.
	TemplatePurposeCompute TemplatePurpose = "compute"
	// TemplatePurposeStorage indicates that the template is used to provision storage.
	TemplatePurposeStorage TemplatePurpose = "storage"

	// for V2
	// TemplatePurposeOpenStackCompute indicates that the template is used to provision an openstack compute instance.
	TemplatePurposeOpenStackCompute TemplatePurpose = "openstack_compute"
	// TemplatePurposeOpenstackStorage indicates that the template is used to provision an openstack (unspecified) storage.
	TemplatePurposeOpenStackStorage TemplatePurpose = "openstack_storage"
	// TemplatePurposeOpenstackStorage indicates that the template is used to provision an openstack share storage.
	TemplatePurposeOpenStackShareStorage TemplatePurpose = "openstack_share_storage"
	// TemplatePurposeOpenstackStorage indicates that the template is used to provision an openstack volume storage.
	TemplatePurposeOpenStackVolumeStorage TemplatePurpose = "openstack_volume_storage"
	// TemplatePurposeGeneral indicates that the template is used to provision a general compute instance.
	TemplatePurposeGeneral TemplatePurpose = "general"
	// TemplatePurposeAWSCompute indicates that the template is used to provision an aws compute instance.
	TemplatePurposeAWSCompute TemplatePurpose = "aws_compute"
	// TemplatePurposeAWSStorage indicates that the template is used to provision an aws (unspecified) storage.
	TemplatePurposeAWSStorage TemplatePurpose = "aws_storage"
	// TemplatePurposeAWSStorage indicates that the template is used to provision an aws EBS storage.
	TemplatePurposeAWSEbsStorage TemplatePurpose = "aws_ebs_storage"
	// TemplatePurposeAWSStorage indicates that the template is used to provision an aws EBS storage.
	TemplatePurposeAWSS3Storage TemplatePurpose = "aws_s3_storage"
	// TemplatePurposeBareSystem indicates that the template is used to provision a bare system.
	TemplatePurposeBareSystem TemplatePurpose = "bare_system"
	// TemplatePurposeNextflow indicates that the template is used to provision a nextflow workflow.
	TemplatePurposeNextflow TemplatePurpose = "nextflow"
	// TemplatePurposeKubernetes indicates that the template is used to provision a kubernetes cluster.
	TemplatePurposeKubernetes TemplatePurpose = "kubernetes"
	// TemplatePurposeMultiCloud indicates that the template is used to provision a multi-cloud cluster.
	TemplatePurposeMultiCloud TemplatePurpose = "multi_cloud"
	// TemplatePurposeCacaoPrerequisite indicates that the template is cacao reserved for prerequisite.
	TemplatePurposeCacaoPrerequisite TemplatePurpose = "cacao_prerequisite"
)

Enumeration constants for TemplatePurpose.

func (TemplatePurpose) MarshalJSON

func (t TemplatePurpose) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a TemplatePurpose.

func (TemplatePurpose) String

func (t TemplatePurpose) String() string

String returns the string representation of a TemplatePurpose.

func (*TemplatePurpose) UnmarshalJSON

func (t *TemplatePurpose) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplatePurpose to the appropriate enumeration constant.

type TemplateSource

type TemplateSource struct {
	Type TemplateSourceType `json:"type"`
	URI  string             `json:"uri"` // e.g., 'github.com/cyverse/sometemplate'
	// AccessParameters is used to pass additional parameters for accessing source (e.g., git branch name ...)
	// e.g., for git,
	// "branch": "master"
	// "tag": "tag_test"
	// "path": "/sub_dir_to_template_in_repo"
	AccessParameters map[string]interface{}   `json:"access_parameters"`
	Visibility       TemplateSourceVisibility `json:"source_visibility"` // e.g., 'public' or 'private'
}

TemplateSource is a struct for template source information

func (TemplateSource) Git

Git convert to GitTemplateSource. If TemplateSource is not type git, then return nil.

type TemplateSourceCredential

type TemplateSourceCredential struct {
	Username string `json:"GIT_USERNAME,omitempty"`
	Password string `json:"GIT_PASSWORD,omitempty"`
	SSHKey   string `json:"GIT_SSH_KEY,omitempty"`
}

TemplateSourceCredential is a struct for storing credentials to access template source

type TemplateSourceType

type TemplateSourceType string

TemplateSourceType is the type of a template source

const (
	// TemplateSourceTypeUnknown is for a template source from unknown
	TemplateSourceTypeUnknown TemplateSourceType = ""

	// TemplateSourceTypeGit is for a template source from git
	TemplateSourceTypeGit TemplateSourceType = "git"
)

func (TemplateSourceType) MarshalJSON

func (t TemplateSourceType) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a TemplateSourceType.

func (TemplateSourceType) String

func (t TemplateSourceType) String() string

String returns the string representation of a TemplateSourceType.

func (*TemplateSourceType) UnmarshalJSON

func (t *TemplateSourceType) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplateSourceType to the appropriate enumeration constant.

type TemplateSourceTypeListModel

type TemplateSourceTypeListModel struct {
	Session

	TemplateSourceTypes []TemplateSourceType `json:"template_source_types"`
}

TemplateSourceTypeListModel is the template type list model

func (*TemplateSourceTypeListModel) GetTemplateSourceTypes

func (t *TemplateSourceTypeListModel) GetTemplateSourceTypes() []TemplateSourceType

GetTemplateSourceTypes returns template source types

type TemplateSourceVisibility

type TemplateSourceVisibility string

TemplateSourceVisibility is the visibility of a template source

const (
	// TemplateSourceVisibilityUnknown is for an unknown template source
	TemplateSourceVisibilityUnknown TemplateSourceVisibility = ""

	// TemplateSourceVisibilityPublic is for a public template source, no authentication is required to access the source
	TemplateSourceVisibilityPublic TemplateSourceVisibility = "public"
	// TemplateSourceVisibilityPrivate is for a private template source, the user’s credentials must be used to access the source
	TemplateSourceVisibilityPrivate TemplateSourceVisibility = "private"
)

func (TemplateSourceVisibility) MarshalJSON

func (t TemplateSourceVisibility) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a TemplateSourceVisibility.

func (TemplateSourceVisibility) String

func (t TemplateSourceVisibility) String() string

String returns the string representation of a TemplateSourceVisibility.

func (*TemplateSourceVisibility) UnmarshalJSON

func (t *TemplateSourceVisibility) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplateSourceVisibility to the appropriate enumeration constant.

type TemplateType

type TemplateType interface {
	SessionContext

	GetPrimaryID() TemplateTypeName // points to Name
	GetName() TemplateTypeName
	GetFormats() []TemplateFormat
	GetEngine() TemplateEngine
	GetProviderTypes() []TemplateProviderType
	GetUpdateFieldNames() []string

	SetPrimaryID(id TemplateTypeName)
	SetName(name TemplateTypeName)
	SetFormats(formats []TemplateFormat)
	SetEngine(engine TemplateEngine)
	SetProviderTypes(providerTypes []TemplateProviderType)
	SetUpdateFieldNames(fieldNames []string)
}

TemplateType is the standard interface for all TemplateType implementations

type TemplateTypeListItemModel

type TemplateTypeListItemModel struct {
	Name          TemplateTypeName       `json:"name"`
	Formats       []TemplateFormat       `json:"formats,omitempty"`        // e.g., {'yaml', 'json'}
	Engine        TemplateEngine         `json:"engine"`                   // e.g., 'terraform'
	ProviderTypes []TemplateProviderType `json:"provider_types,omitempty"` // e.g., {'openstack', 'aws', `kubernetes`}
}

TemplateTypeListItemModel is the element type in TemplateTypeListModel

type TemplateTypeListModel

type TemplateTypeListModel struct {
	Session

	TemplateTypes []TemplateTypeListItemModel `json:"template_types"`
}

TemplateTypeListModel is the template type list model

func (*TemplateTypeListModel) GetTemplateTypes

func (t *TemplateTypeListModel) GetTemplateTypes() []TemplateType

GetTemplateTypes returns template types

type TemplateTypeModel

type TemplateTypeModel struct {
	Session

	Name          TemplateTypeName       `json:"name"`
	Formats       []TemplateFormat       `json:"formats,omitempty"`        // e.g., {'yaml', 'json'}
	Engine        TemplateEngine         `json:"engine,omitempty"`         // e.g., 'terraform'
	ProviderTypes []TemplateProviderType `json:"provider_types,omitempty"` // e.g., {'openstack', 'aws', `kubernetes`}

	UpdateFieldNames []string `json:"update_field_names,omitempty"`
}

TemplateTypeModel is the type of template and is only compatible to certain cloud providers. Implements TemplateType.

func (*TemplateTypeModel) GetEngine

func (t *TemplateTypeModel) GetEngine() TemplateEngine

GetEngine returns the engine for the TemplateType

func (*TemplateTypeModel) GetFormats

func (t *TemplateTypeModel) GetFormats() []TemplateFormat

GetFormats returns the formats supported by the TemplateType

func (*TemplateTypeModel) GetName

func (t *TemplateTypeModel) GetName() TemplateTypeName

GetName returns the name of the TemplateType

func (*TemplateTypeModel) GetPrimaryID

func (t *TemplateTypeModel) GetPrimaryID() TemplateTypeName

GetPrimaryID returns the primary ID of the TemplateType

func (*TemplateTypeModel) GetProviderTypes

func (t *TemplateTypeModel) GetProviderTypes() []TemplateProviderType

GetProviderTypes returns the provider types supported by the TemplateType

func (*TemplateTypeModel) GetUpdateFieldNames

func (t *TemplateTypeModel) GetUpdateFieldNames() []string

GetUpdateFieldNames returns the field names to be updated

func (*TemplateTypeModel) SetEngine

func (t *TemplateTypeModel) SetEngine(engine TemplateEngine)

SetEngine sets the engine for the TemplateType

func (*TemplateTypeModel) SetFormats

func (t *TemplateTypeModel) SetFormats(formats []TemplateFormat)

SetFormats sets the formats supported by the TemplateType

func (*TemplateTypeModel) SetName

func (t *TemplateTypeModel) SetName(name TemplateTypeName)

SetName sets the name of the TemplateType

func (*TemplateTypeModel) SetPrimaryID

func (t *TemplateTypeModel) SetPrimaryID(id TemplateTypeName)

SetPrimaryID sets the primary ID of the TemplateType

func (*TemplateTypeModel) SetProviderTypes

func (t *TemplateTypeModel) SetProviderTypes(providerTypes []TemplateProviderType)

SetProviderTypes sets the provider types supported by the TemplateType

func (*TemplateTypeModel) SetUpdateFieldNames

func (t *TemplateTypeModel) SetUpdateFieldNames(fieldNames []string)

SetUpdateFieldNames sets the field names to be updated

type TemplateTypeName

type TemplateTypeName string

TemplateTypeName is name (primary identifier) of template type

type TemplateUIField

type TemplateUIField struct {
	Name       string             `json:"name,omitempty"`
	FieldType  string             `json:"field_type,omitempty"`
	UILabel    string             `json:"ui_label,omitempty"`
	HelpText   string             `json:"help_text,omitempty"`
	Parameters []TemplateUIKeyVal `json:"parameters,omitempty"`
}

TemplateUIField is a struct for a ui wizard field in UI metadata

func (TemplateUIField) GetParametersMap

func (field TemplateUIField) GetParametersMap() map[string]interface{}

GetParametersMap returns a map for Parameters array

type TemplateUIGroup

type TemplateUIGroup struct {
	Type        TemplateUIGroupType   `json:"type,omitempty"`
	Title       string                `json:"title,omitempty"`
	HelpText    string                `json:"help_text,omitempty"`
	Collapsible bool                  `json:"collapsible,omitempty"`
	Toggleable  bool                  `json:"toggleable,omitempty"`
	Items       []TemplateUIGroupItem `json:"items,omitempty"`
}

TemplateUIGroup is a struct for a ui wizard group in UI metadata

type TemplateUIGroupItem

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

TemplateUIGroupItem is one of TemplateUIField, TemplateUIGroup, or TemplateUIRow

func (*TemplateUIGroupItem) GetField

func (item *TemplateUIGroupItem) GetField() *TemplateUIField

GetField returns group item as *TemplateUIField type

func (*TemplateUIGroupItem) GetGroup

func (item *TemplateUIGroupItem) GetGroup() *TemplateUIGroup

GetGroup returns group item as *TemplateUIGroup type

func (*TemplateUIGroupItem) GetRow

func (item *TemplateUIGroupItem) GetRow() *TemplateUIRow

GetRow returns group item as *TemplateUIRow type

func (*TemplateUIGroupItem) IsField

func (item *TemplateUIGroupItem) IsField() bool

IsField returns true if the group item is field type

func (*TemplateUIGroupItem) IsGroup

func (item *TemplateUIGroupItem) IsGroup() bool

IsGroup returns true if the group item is group type

func (*TemplateUIGroupItem) IsRow

func (item *TemplateUIGroupItem) IsRow() bool

IsRow returns true if the group item is row type

func (TemplateUIGroupItem) MarshalBSON

func (item TemplateUIGroupItem) MarshalBSON() ([]byte, error)

MarshalBSON returns the BSON representation of a TemplateUIGroupItem.

func (*TemplateUIGroupItem) MarshalJSON

func (item *TemplateUIGroupItem) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a TemplateUIGroupItem.

func (*TemplateUIGroupItem) UnmarshalBSON

func (item *TemplateUIGroupItem) UnmarshalBSON(b []byte) error

UnmarshalBSON converts the BSON representation of a TemplateUIGroupItem to the appropriate object.

func (*TemplateUIGroupItem) UnmarshalJSON

func (item *TemplateUIGroupItem) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplateUIGroupItem to the appropriate object.

type TemplateUIGroupType

type TemplateUIGroupType string

TemplateUIGroupType defines group type.

const (
	// TemplateUIGroupTypeUnknown indicates that the group type is unspecified.
	TemplateUIGroupTypeUnknown TemplateUIGroupType = ""

	// TemplateUIGroupTypeGroup indicates that the group is a simple group.
	TemplateUIGroupTypeGroup TemplateUIGroupType = "group"
	// TemplateUIGroupTypeAdvancedSettings indicates that the group is an advanced settings.
	TemplateUIGroupTypeAdvancedSettings TemplateUIGroupType = "advanced_settings"
	// TemplateUIGroupTypeRow indicates that the group is a row.
	TemplateUIGroupTypeRow TemplateUIGroupType = "row"
)

Enumeration constants for TemplateUIGroupType.

func (TemplateUIGroupType) MarshalJSON

func (t TemplateUIGroupType) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a TemplateUIGroupType.

func (TemplateUIGroupType) String

func (t TemplateUIGroupType) String() string

String returns the string representation of a TemplateUIGroupType.

func (*TemplateUIGroupType) UnmarshalJSON

func (t *TemplateUIGroupType) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplateUIGroupType to the appropriate enumeration constant.

type TemplateUIKeyVal

type TemplateUIKeyVal struct {
	Key   string      `json:"key,omitempty"`
	Value interface{} `json:"value,omitempty"`
}

TemplateUIKeyVal is a struct for representing key-value formatted values.

type TemplateUIMetadata

type TemplateUIMetadata struct {
	SchemaURL     string           `json:"schema_url,omitempty"`
	SchemaVersion string           `json:"schema_version,omitempty"`
	Author        string           `json:"author,omitempty"`
	AuthorEmail   string           `json:"author_email,omitempty"`
	Description   string           `json:"description,omitempty"`
	DocURL        string           `json:"doc_url,omitempty"`
	Steps         []TemplateUIStep `json:"steps,omitempty"`
}

TemplateUIMetadata is a struct for template UI metadata

type TemplateUIRow

type TemplateUIRow struct {
	Type   TemplateUIRowType `json:"type,omitempty"`
	Fields []TemplateUIField `json:"fields,omitempty"`
}

TemplateUIRow is a struct for a ui wizard row in UI metadata

type TemplateUIRowType

type TemplateUIRowType string

TemplateUIRowType defines row type.

const (
	// TemplateUIRowTypeUnknown indicates that the row type is unspecified.
	TemplateUIRowTypeUnknown TemplateUIRowType = ""

	// TemplateUIRowTypeRow indicates that the row is a simple row.
	TemplateUIRowTypeRow TemplateUIRowType = "row"
)

Enumeration constants for TemplateUIRowType.

func (TemplateUIRowType) MarshalJSON

func (t TemplateUIRowType) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a TemplateUIRowType.

func (TemplateUIRowType) String

func (t TemplateUIRowType) String() string

String returns the string representation of a TemplateUIRowType.

func (*TemplateUIRowType) UnmarshalJSON

func (t *TemplateUIRowType) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a TemplateUIRowType to the appropriate enumeration constant.

type TemplateUIStep

type TemplateUIStep struct {
	Title    string                `json:"title,omitempty"`
	HelpText string                `json:"help_text,omitempty"`
	Items    []TemplateUIGroupItem `json:"items,omitempty"`
}

TemplateUIStep is a struct for a ui wizard step in UI metadata

type TemplateVersion

type TemplateVersion struct {
	ID         common.ID      `json:"id"`
	TemplateID common.ID      `json:"template_id"`
	Source     TemplateSource `json:"source"`
	Disabled   bool           `json:"disabled"`
	DisabledAt time.Time      `json:"disabled_at"`
	// Credential that is needed to get the template from source, empty if not needed
	CredentialID string             `json:"credential_id"`
	Metadata     TemplateMetadata   `json:"metadata"`
	UIMetadata   TemplateUIMetadata `json:"ui_metadata"`
	CreatedAt    time.Time          `json:"created_at"`
}

TemplateVersion is a version of a template, it captures the template metadata at a specific checkpoint (e.g. git commit).

type TemplateVersionDisableRequest

type TemplateVersionDisableRequest struct {
	Session
	VersionID common.ID `json:"version_id"`
}

TemplateVersionDisableRequest is the event body for events related to template version

type TemplateVersionDisableResponse

type TemplateVersionDisableResponse = TemplateVersionModel

TemplateVersionDisableResponse is the response event of TemplateVersionDisableRequest

type TemplateVersionListModel

type TemplateVersionListModel struct {
	Session
	Versions []TemplateVersion `json:"versions"`
}

TemplateVersionListModel is the body of reply for listing versions

type TemplateVersionModel

type TemplateVersionModel struct {
	Session
	TemplateVersion
}

TemplateVersionModel is the body of the query/reply for getting a single version, and query for listing versions

type TerraformWorkflowData

type TerraformWorkflowData struct {
	// ID of the Terraform template to be applied. This will be used to name
	// the Terraform workspace used when appling the template, and keyed the
	// Terraform State in the Terraform backend
	TemplateID string `mapstructure:"template_id"`
	// name of the terraform module to execute as child module
	TfModuleName string `mapstructure:"module_name"`
	Username     string `mapstructure:"username"`
	// ID of the cloud credential to use
	CloudCredID string                 `mapstructure:"cloud_cred_id"`
	AnsibleVars map[string]interface{} `mapstructure:"ansible_vars"`
	// Encrypted cloud credential encoded in base64
	CloudCredentialBase64 string `mapstructure:"cloud_cred"`
}

TerraformWorkflowData is the parameter to required to create a Terraform workflow. Corresponds to WfDat in WorkflowCreate

type TokenAuthCheckRequest

type TokenAuthCheckRequest struct {
	Session
	Token common.TokenID `json:"token"`
}

TokenAuthCheckRequest is the request to check authN and authZ of a token on an operation.

type TokenClient

type TokenClient interface {
	// AuthCheck checks for authN and authZ of a token on an operation, and resolve to username of owner if successful.
	// TODO pass operation identifier to this to check authZ.
	AuthCheck(ctx context.Context, actor Actor, token common.TokenID) (*TokenModel, error)
	Get(ctx context.Context, actor Actor, tokenID common.ID) (*TokenModel, error)
	List(ctx context.Context, actor Actor) ([]TokenModel, error)
	ListTypes(ctx context.Context, actor Actor) ([]TokenType, error)
	Create(ctx context.Context, actor Actor, token TokenCreateModel) (common.TokenID, error)
	Update(ctx context.Context, actor Actor, token TokenModel) error
	UpdateFields(ctx context.Context, actor Actor, token TokenModel, updateFieldNames []string) error
	Delete(ctx context.Context, actor Actor, tokenID common.ID) error
	Revoke(ctx context.Context, actor Actor, tokenID common.ID) error
}

TokenClient is the client for Token

func NewNatsTokenClientFromConn

func NewNatsTokenClientFromConn(queryConn messaging2.QueryConnection, eventConn messaging2.EventConnection) (TokenClient, error)

NewNatsTokenClientFromConn creates a new client from existing connections.

Note, if you only need query functionality, then only supply queryConn, same for event functionality and eventConn.

type TokenCreateBulkModel

type TokenCreateBulkModel struct {
	Owner             string            `json:"owner"`
	Name              string            `json:"name"`
	Description       string            `json:"description,omitempty"`
	DelegatedContexts string            `json:"DelegatedContexts"`
	Public            bool              `json:"public"`
	Expiration        time.Time         `json:"expiration"`
	Start             *time.Time        `json:"start,omitempty"`
	Scopes            string            `json:"scopes"`
	DelegatedContext  string            `json:"delegated_context,omitempty"`
	Tags              map[string]string `json:"tags"`
	Tokens            []TokenModel      `json:"tokens"`
}

TokenCreateBulkModel is the Token model for creating bulk tokens from an email/DelegatedContexts list. TODO implement

type TokenCreateModel

type TokenCreateModel struct {
	Session

	ID               common.ID         `json:"id"`
	Owner            string            `json:"owner"`
	Name             string            `json:"name"`
	Description      string            `json:"description,omitempty"`
	Public           bool              `json:"public"`
	Expiration       time.Time         `json:"expiration"`
	Start            *time.Time        `json:"start,omitempty"`
	Scopes           string            `json:"scopes"`
	DelegatedContext string            `json:"delegated_context,omitempty"`
	Type             TokenType         `json:"type"`
	Tags             map[string]string `json:"tags"`
	CreatedAt        time.Time         `json:"created_at"`
	UpdatedAt        time.Time         `json:"updated_at"`
	Token            string            `json:"token"`
}

TokenCreateModel is the Token model for exposing extra Token secret only on create

type TokenListModel

type TokenListModel struct {
	Session
	Tokens []TokenModel `json:"tokens"`
}

TokenListModel is the representation of a list of Tokens

type TokenModel

type TokenModel struct {
	Session

	ID               common.ID         `json:"id"`
	Owner            string            `json:"owner"`
	Name             string            `json:"name"`
	Description      string            `json:"description,omitempty"`
	Public           bool              `json:"public"`
	Expiration       time.Time         `json:"expiration"`
	Start            *time.Time        `json:"start,omitempty"`
	Scopes           string            `json:"scopes"`
	DelegatedContext string            `json:"delegated_context,omitempty"`
	Type             TokenType         `json:"type"`
	Tags             map[string]string `json:"tags"`
	LastAccessed     *time.Time        `json:"last_accessed"`
	CreatedAt        time.Time         `json:"created_at"`
	UpdatedAt        time.Time         `json:"updated_at"`

	UpdateFieldNames []string `json:"update_field_names,omitempty"`
}

TokenModel is the token model

func (*TokenModel) Verify

func (t *TokenModel) Verify() (bool, error)

Verify verifies that the token is correctly formed and valid

type TokenType

type TokenType string

TokenType is the type of token

const (
	// PersonalTokenType is a token for personal use
	PersonalTokenType TokenType = "personal"
	// DelegatedTokenType is a token for delegated account / api access
	DelegatedTokenType TokenType = "delegated"
	// InternalDeployType is a token for internal use by cacao
	InternalDeployType TokenType = "internal-deploy"
)

func (TokenType) MarshalJSON

func (t TokenType) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a TokenType

func (TokenType) String

func (t TokenType) String() string

String returns the string representation of a TokenType

func (*TokenType) UnmarshalJSON

func (t *TokenType) UnmarshalJSON(b []byte) error

UnmarshalJSON converts JSON/string into the appropriate TokenType enum

type TokenTypeListModel

type TokenTypeListModel struct {
	Session
	TokenTypes []TokenType `json:"token_types"`
}

TokenTypeListModel is the representation of the list of token types

type UserActionClient

type UserActionClient interface {
	// UserAction
	Get(ctx context.Context, actor Actor, userActionID common.ID) (*UserActionModel, error)
	List(ctx context.Context, actor Actor) ([]UserActionModel, error)

	Create(ctx context.Context, actor Actor, userAction UserActionModel) (common.ID, error)
	Update(ctx context.Context, actor Actor, userAction UserActionModel) error
	UpdateFields(ctx context.Context, actor Actor, userAction UserActionModel, updateFieldNames []string) error
	Delete(ctx context.Context, actor Actor, userActionID common.ID) error
}

UserActionClient is the client for UserAction

func NewNatsUserActionClientFromConn

func NewNatsUserActionClientFromConn(queryConn messaging2.QueryConnection, eventConn messaging2.EventConnection) (UserActionClient, error)

NewNatsUserActionClientFromConn creates a new client from existing connections.

Note, if you only need query functionality, then only supply queryConn, same for event functionality and eventConn.

type UserActionItem

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

UserActionItem is a struct for user action item

func NewUserActionItemForScriptAction

func NewUserActionItemForScriptAction(sourceType UserActionScriptSourceType, dataType UserActionScriptDataType, data string) UserActionItem

NewUserActionItemForScriptAction creates UserActionItem for script action

func (*UserActionItem) GetScriptAction

func (item *UserActionItem) GetScriptAction() *UserScriptActionItem

GetScriptAction returns user action item as *UserScriptActionItem type

func (*UserActionItem) IsScriptAction

func (item *UserActionItem) IsScriptAction() bool

IsScriptAction returns true if the user action item is script action

func (UserActionItem) MarshalBSON

func (item UserActionItem) MarshalBSON() ([]byte, error)

MarshalBSON returns the BSON representation of a UserActionItem.

func (UserActionItem) MarshalJSON

func (item UserActionItem) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a UserActionItem.

func (*UserActionItem) SetScriptAction

func (item *UserActionItem) SetScriptAction(scriptAction *UserScriptActionItem)

SetScriptAction sets user script action item

func (*UserActionItem) UnmarshalBSON

func (item *UserActionItem) UnmarshalBSON(b []byte) error

UnmarshalBSON converts the BSON representation of a UserActionItem to the appropriate object.

func (*UserActionItem) UnmarshalJSON

func (item *UserActionItem) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a UserActionItem to the appropriate item.

type UserActionListModel

type UserActionListModel struct {
	Session
	UserActions []UserActionModel `json:"user_actions"`
}

UserActionListModel is the user action list model

type UserActionMethod

type UserActionMethod string

UserActionMethod is the method of user action

const (
	// UserActionMethodUnknown is for an unknown action
	UserActionMethodUnknown UserActionMethod = ""
	// UserActionMethodScript is for a script action
	UserActionMethodScript UserActionMethod = "script"
)

func (UserActionMethod) MarshalJSON

func (u UserActionMethod) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a UserActionMethod.

func (UserActionMethod) String

func (u UserActionMethod) String() string

String returns the string representation of a UserActionMethod.

func (*UserActionMethod) UnmarshalJSON

func (u *UserActionMethod) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a UserActionMethod to the appropriate enumeration constant.

type UserActionModel

type UserActionModel struct {
	Session

	ID          common.ID      `json:"id"`
	Owner       string         `json:"owner"`
	Name        string         `json:"name"`
	Description string         `json:"description,omitempty"`
	Public      bool           `json:"public"`
	Type        UserActionType `json:"type"` // e.g., instance_execution
	Action      UserActionItem `json:"action"`
	CreatedAt   time.Time      `json:"created_at"`
	UpdatedAt   time.Time      `json:"updated_at"`

	UpdateFieldNames []string `json:"update_field_names,omitempty"`
}

UserActionModel is the user action model

func (*UserActionModel) GetPrimaryID

func (u *UserActionModel) GetPrimaryID() common.ID

GetPrimaryID returns the primary ID of the UserAction

type UserActionScriptDataType

type UserActionScriptDataType string

UserActionScriptDataType is the type of user action script data

const (
	// UserActionScriptDataTypeUnknown is for an unknown user action script data
	UserActionScriptDataTypeUnknown UserActionScriptDataType = ""
	// UserActionScriptDataTypePython is for a python user action script data
	UserActionScriptDataTypePython UserActionScriptDataType = "text/x-python"
	// UserActionScriptDataTypeShellScript is for a shell script user action script data
	UserActionScriptDataTypeShellScript UserActionScriptDataType = "text/x-shellscript"
	// UserActionScriptDataTypePerl is for a perl user action script data
	UserActionScriptDataTypePerl UserActionScriptDataType = "application/x-perl"
)

func (UserActionScriptDataType) MarshalJSON

func (u UserActionScriptDataType) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a UserActionScriptDataType.

func (UserActionScriptDataType) String

func (u UserActionScriptDataType) String() string

String returns the string representation of a UserActionScriptDataType.

func (*UserActionScriptDataType) UnmarshalJSON

func (u *UserActionScriptDataType) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a UserActionScriptDataType to the appropriate enumeration constant.

type UserActionScriptSourceType

type UserActionScriptSourceType string

UserActionScriptSourceType is the type of user action script source

const (
	// UserActionScriptSourceTypeUnknown is for an unknown user action script source
	UserActionScriptSourceTypeUnknown UserActionScriptSourceType = ""
	// UserActionScriptSourceTypeURL is for an URL user action script source
	UserActionScriptSourceTypeURL UserActionScriptSourceType = "url"
	// UserActionScriptSourceTypeRaw is for a raw user action script source
	UserActionScriptSourceTypeRaw UserActionScriptSourceType = "raw"
)

func (UserActionScriptSourceType) MarshalJSON

func (u UserActionScriptSourceType) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a UserActionScriptSourceType.

func (UserActionScriptSourceType) String

String returns the string representation of a UserActionScriptSourceType.

func (*UserActionScriptSourceType) UnmarshalJSON

func (u *UserActionScriptSourceType) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a UserActionScriptSourceType to the appropriate enumeration constant.

type UserActionType

type UserActionType string

UserActionType is the type of user action

const (
	// UserActionTypeUnknown is for an unknown action
	UserActionTypeUnknown UserActionType = ""
	// UserActionTypeInstanceExecution is for an action that executes on instances
	UserActionTypeInstanceExecution UserActionType = "instance_execution"
)

func (UserActionType) MarshalJSON

func (u UserActionType) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a UserActionType.

func (UserActionType) String

func (u UserActionType) String() string

String returns the string representation of a UserActionType.

func (*UserActionType) UnmarshalJSON

func (u *UserActionType) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the JSON representation of a UserActionType to the appropriate enumeration constant.

type UserClient

type UserClient interface {
	Add(ctx context.Context, actor Actor, user UserModel) error
	Update(ctx context.Context, actor Actor, user UserModel) error
	Get(ctx context.Context, actor Actor, username string, withSettings bool) (*UserModel, error) // get a user based on username
	Delete(ctx context.Context, actor Actor, user UserModel) error
	// UserHasLoggedIn will publish a notification event that notify relevant services that a user has logged in.
	UserHasLoggedIn(ctx context.Context, actor Actor, user UserModel) error

	GetSettings(ctx context.Context, actor Actor, username string) (*common.UserSettings, error)
	GetConfigs(ctx context.Context, actor Actor, username string) (*map[string]string, error)
	GetFavorites(ctx context.Context, actor Actor, username string) (*map[string][]string, error)
	GetRecents(ctx context.Context, actor Actor, username string) (*map[string]string, error)
	SetConfig(ctx context.Context, actor Actor, username string, key string, value string) error
	AddFavorite(ctx context.Context, actor Actor, username string, key string, value string) error
	DeleteFavorite(ctx context.Context, actor Actor, username string, key string, value string) error
	SetRecent(ctx context.Context, actor Actor, username string, key string, value string) error

	Search(ctx context.Context, actor Actor, filter UserListFilter) (UserList, error) // Given a filter, return a user list up to DefaultUserListItemsMax
	SearchNext(ctx context.Context, actor Actor, userlist UserList) error             // load the next in a search, given the original UserList
}

UserClient is client for user microservice.

func NewNatsUserClientFromConn

func NewNatsUserClientFromConn(queryConn messaging2.QueryConnection, eventConn messaging2.EventConnection) (UserClient, error)

NewNatsUserClientFromConn creates a new client from existing connections.

Note, if you only need query functionality, then only supply queryConn, same for event functionality and eventConn.

type UserList

type UserList interface {
	SessionContext

	GetFilter() UserListFilter
	GetUsers() []UserModel
	GetStart() int           // index of start of current list, -1 if no results or error, available after successful Load()
	GetSize() int            // size of the current list, 0 if nothing is found, -1 if error, available after successful Load()
	GetTotalFilterSize() int // total size of filter, 0 if nothing is found, -1 if error
	GetNextStart() int       // index of next partition to retrieve, -1 if error is found, set to TotalFilterSize if all results returned
}

UserList is the interface that defines objects that can retrieve lists of users TODO - currently not implemented

type UserListFilter

type UserListFilter struct {
	Field           FilterField   `json:"field"`
	Value           string        `json:"value"`                    // if not set, defaults to all
	SortBy          SortDirection `json:"sort_direction,omitempty"` // default is AscendingSort
	MaxItems        int           `json:"max_items,omitempty"`      // requested max items to return in the list, defaults to DefaultUserListItemsMax
	Start           int           `json:"start_index"`              // start index to retrieve from total list, default 0
	IncludeDisabled bool          `json:"include_disabled"`         // if true, then disabled users will also be included in the filter (not yet implemented)
}

UserListFilter is the struct that defines the filter for a UserList

type UserListModel

type UserListModel struct {
	Session
	Filter     UserListFilter
	Users      []UserModel
	StartIndex int `json:"start_index"`
	TotalSize  int `json:"total_size"`
	NextStart  int `json:"next_start"`
}

UserListModel implements UserList.

func (*UserListModel) GetFilter

func (ul *UserListModel) GetFilter() UserListFilter

GetFilter ...

func (*UserListModel) GetNextStart

func (ul *UserListModel) GetNextStart() int

GetNextStart ...

func (*UserListModel) GetSize

func (ul *UserListModel) GetSize() int

GetSize ...

func (*UserListModel) GetStart

func (ul *UserListModel) GetStart() int

GetStart ...

func (*UserListModel) GetTotalFilterSize

func (ul *UserListModel) GetTotalFilterSize() int

GetTotalFilterSize ...

func (*UserListModel) GetUsers

func (ul *UserListModel) GetUsers() []UserModel

GetUsers ...

func (*UserListModel) HasNext

func (ul *UserListModel) HasNext() bool

HasNext ...

type UserModel

type UserModel struct {
	Session
	Username          string              `json:"username"`
	FirstName         string              `json:"first_name,omitempty"`
	LastName          string              `json:"last_name,omitempty"`
	PrimaryEmail      string              `json:"primary_email,omitempty"`
	IsAdmin           bool                `json:"is_admin,omitempty"`
	DisabledAt        time.Time           `json:"disabled_at,omitempty"`
	WithSettings      bool                `json:"with_settings,omitempty"`
	UserSettings      common.UserSettings `json:"settings,omitempty"`
	CreatedAt         time.Time           `json:"created_at"`
	UpdatedAt         time.Time           `json:"updated_at"`
	UpdatedBy         string              `json:"updated_by"`
	UpdatedEmulatorBy string              `json:"updated_emulator_by"`
}

UserModel represents one user

func (UserModel) GetPrimaryID

func (u UserModel) GetPrimaryID() string

GetPrimaryID returns the username of user.

type UserScriptActionItem

type UserScriptActionItem struct {
	Method     UserActionMethod           `json:"method"` // this should be script
	SourceType UserActionScriptSourceType `json:"source_type"`
	DataType   UserActionScriptDataType   `json:"data_type"`
	Data       string                     `json:"data"`
}

UserScriptActionItem is a struct for user script action item

type UserSettingsReply

type UserSettingsReply struct {
	Session
	common.UserSettings `json:",inline"`
}

UserSettingsReply is used to receiving query reply over nats

type UserSettingsRequest

type UserSettingsRequest struct {
	Session
	Username string `json:"username"`
	Key      string `json:"key"`
	Value    string `json:"value"`
}

UserSettingsRequest is used to pass requests (query & event) over nats

type UserUpdate

type UserUpdate struct {
	FirstName    *string              `json:"first_name,omitempty"`
	LastName     *string              `json:"last_name,omitempty"`
	PrimaryEmail *string              `json:"primary_email,omitempty"`
	IsAdmin      *bool                `json:"is_admin,omitempty"`
	Disabled     *bool                `json:"disabled,omitempty"`
	UserSettings *common.UserSettings `json:"settings,omitempty"`
}

UserUpdate ...

type UserUpdateRequest

type UserUpdateRequest struct {
	Session
	Username string     `json:"username"`
	Update   UserUpdate `json:",inline"`
}

UserUpdateRequest ...

type VisibilityType

type VisibilityType string

VisibilityType is the visibility of credential, this is not currently used

type WorkflowCreate

type WorkflowCreate struct {
	// cloud provider that the workflow operates on, this determines which Argo Cluster to dispatch the workflow to
	Provider AWMProvider `json:"provider"`

	// username of the user, null if not user specific
	Username *string `json:"username"`

	// filename of the workflow definition
	WorkflowFilename string `json:"workflow_filename"`

	// workflow data, parameters and other metadata used to create the workflow
	WfDat map[string]interface{} `json:"workflow_data"`
}

WorkflowCreate is an event that request the creation of a workflow.

type WorkflowCreateFailed

type WorkflowCreateFailed struct {
	// ID of the request event (WorkflowCreate) that caused this event
	RequestID common.EventID `json:"req_id"`

	// The provider that the workflow is attempted to be created in
	Provider AWMProvider `json:"provider"`

	// Type of the error occurred that cause the creation to fail
	Error string `json:"error"`

	// Extra error message
	Msg string `json:"msg"`
}

WorkflowCreateFailed is an event emitted when failure occurred during workflow creation. This event is emitted in response to a WorkflowCreate event.

type WorkflowCreated

type WorkflowCreated struct {
	// ID of the request event (WorkflowCreate) that caused this event
	RequestID common.EventID `json:"req_id"`

	// The provider of which the workflow is created in
	Provider AWMProvider `json:"provider"`

	// Name of the created workflow
	WorkflowName string `json:"workflow_name"`
}

WorkflowCreated is an event emitted when a Workflow is created.

type WorkflowResubmit

type WorkflowResubmit struct {
	// cloud provider that the workflow operates on, this determines which Argo Cluster to dispatch the workflow to
	Provider AWMProvider `json:"provider"`

	// name of the workflow
	WorkflowName string `json:"workflow_name"`
}

WorkflowResubmit is an event that request the resubmission of a workflow.

type WorkflowResubmitFailed

type WorkflowResubmitFailed struct {

	// ID of the request event (WorkflowTerminate) that caused this event
	RequestID common.EventID `json:"req_id"`

	// cloud provider that the workflow operates on, this determines which Argo Cluster to dispatch the workflow to
	Provider AWMProvider `json:"provider"`

	// name of the workflow that is requested to be resubmitted
	WorkflowName string `json:"workflow_name"`

	// Type of the error occurred that cause the resubmission to fail
	Error string `json:"error"`

	// Extra error message
	Msg string `json:"msg"`
}

WorkflowResubmitFailed is an event that is emitted when workflow resubmission failed.

type WorkflowResubmitted

type WorkflowResubmitted struct {
	// ID of the request event (WorkflowResubmit) that caused this event
	RequestID common.EventID `json:"req_id"`

	// cloud provider that the workflow operates on, this determines which Argo Cluster to dispatch the workflow to
	Provider AWMProvider `json:"provider"`

	// name of the workflow that is requested to be resubmitted
	WorkflowName string `json:"workflow_name"`

	// name of the newly created workflow as the result of the resubmission
	NewWorkflowName string `json:"new_workflow_name"`
}

WorkflowResubmitted is an event that is emitted when workflow resubmission succeeded.

type WorkflowTerminate

type WorkflowTerminate struct {
	// cloud provider that the workflow operates on, this determines which Argo Cluster to dispatch the workflow to
	Provider AWMProvider `json:"provider"`

	// name of the workflow
	WorkflowName string `json:"workflow_name"`
}

WorkflowTerminate is an event that request the terminatation of a workflow.

type WorkflowTerminateFailed

type WorkflowTerminateFailed struct {
	// ID of the request event (WorkflowTerminate) that caused this event
	RequestID common.EventID `json:"req_id"`

	// cloud provider that the workflow operates on, this determines which Argo Cluster to dispatch the workflow to
	Provider AWMProvider `json:"provider"`

	// name of the workflow
	WorkflowName string `json:"workflow_name"`

	// Type of the error occurred that cause the termination to fail
	Error string `json:"error"`

	// Extra error message
	Msg string `json:"msg"`
}

WorkflowTerminateFailed is an event emitted when fail to terminate a workflow.

type WorkflowTerminated

type WorkflowTerminated struct {
	// ID of the request event (WorkflowTerminate) that caused this event
	RequestID common.EventID `json:"req_id"`

	// cloud provider that the workflow operates on, this determines which Argo Cluster to dispatch the workflow to
	Provider AWMProvider `json:"provider"`

	// name of the workflow
	WorkflowName string `json:"workflow_name"`

	// status of the workflow
	WorkflowStatus string `json:"workflow_status"`
}

WorkflowTerminated is an event emitted when a workflow is terminated via a WorkflowTerminateCmd event.

type WorkspaceClient

type WorkspaceClient interface {
	Get(ctx context.Context, actor Actor, workspaceID common.ID) (*WorkspaceModel, error)
	List(ctx context.Context, actor Actor) ([]WorkspaceModel, error)

	Create(ctx context.Context, actor Actor, workspace WorkspaceModel) (common.ID, error)
	CreateAsync(ctx context.Context, actor Actor, workspace WorkspaceModel) (messaging2.EventResponsePromise, error)
	CreateAsyncResponse(ctx context.Context, promise messaging2.EventResponsePromise) (WorkspaceModel, error)
	Update(ctx context.Context, actor Actor, workspace WorkspaceModel) error
	UpdateFields(ctx context.Context, actor Actor, workspace WorkspaceModel, updateFieldNames []string) error
	Delete(ctx context.Context, actor Actor, workspaceID common.ID) error
}

WorkspaceClient is the client for Workspace

func NewNatsWorkspaceClientFromConn

func NewNatsWorkspaceClientFromConn(queryConn messaging2.QueryConnection, eventConn messaging2.EventConnection) (WorkspaceClient, error)

NewNatsWorkspaceClientFromConn creates a new client from existing connections.

Note, if you only need query functionality, then only supply queryConn, same for event functionality and eventConn.

type WorkspaceListModel

type WorkspaceListModel struct {
	Session
	Workspaces []WorkspaceModel `json:"workspaces"`
}

WorkspaceListModel is the workspace list model

type WorkspaceModel

type WorkspaceModel struct {
	Session

	ID                common.ID `json:"id"`
	Owner             string    `json:"owner"`
	Name              string    `json:"name"`
	Description       string    `json:"description,omitempty"`
	DefaultProviderID common.ID `json:"default_provider_id,omitempty"`
	CreatedAt         time.Time `json:"created_at"`
	UpdatedAt         time.Time `json:"updated_at"`

	UpdateFieldNames []string `json:"update_field_names,omitempty"`
}

WorkspaceModel is the workspace model

func (*WorkspaceModel) GetPrimaryID

func (w *WorkspaceModel) GetPrimaryID() common.ID

GetPrimaryID returns the primary ID of the Workspace

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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