Documentation ¶
Overview ¶
Package alien4cloud provides a client for using the https://alien4cloud.github.io API.
Usage:
import "github.com/alien4cloud/alien4cloud-go-client/v3/alien4cloud" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/alien4cloud/alien4cloud-go-client/alien4cloud" // with go modules disabled
Then you could create a client and use the different services exposed by the Alien4Cloud API:
client, err := alien4cloud.NewClient(url, user, password, caFile, skipSecure) if err != nil { log.Panic(err) } // Timeout after one minute (this is optional you can use a context without timeout or cancelation) ctx, cancel := context.WithTimeout(context.Background(), time.Minute) defer cancel() err = client.Login(ctx) if err != nil { log.Panic(err) } userDetails, err := client.UserService().GetUser(ctx, username)
NOTE: Using the https://pkg.go.dev/context package, allows to easily pass cancelation signals and deadlines to API calls for handling a request.
For more sample code snippets, see the https://github.com/alien4cloud/alien4cloud-go-client/tree/master/examples directory.
Index ¶
- Constants
- func ReadA4CResponse(response *http.Response, data interface{}) error
- type Activity
- type Application
- type ApplicationCreateRequest
- type ApplicationDeployRequest
- type ApplicationService
- type BasicTopologyInfo
- type CSAR
- type CSARDependency
- type CancelExecRequest
- type CatalogService
- type Client
- type CreateUpdateUserRequest
- type Deployment
- type DeploymentArtifact
- type DeploymentService
- type EntrySchema
- type Environment
- type Error
- type Event
- type EventService
- type Execution
- type ExecutionCallback
- type FacetedSearchResult
- type Group
- type Header
- type Informations
- type Location
- type LocationConfiguration
- type LocationMatch
- type LocationModifierReference
- type LocationPoliciesPostRequestIn
- type Log
- type LogFilter
- type LogService
- type Logs
- type NodeTemplate
- type NodeTemplatePropertyValue
- type Orchestrator
- type OrchestratorService
- type ParsingErr
- type ParsingError
- type PropertyDefinition
- type PropertyValue
- type Retry
- type RuntimeTopology
- type SearchRequest
- type SecretProviderConfiguration
- type SimpleMark
- type Tag
- type Time
- type Topology
- type TopologyEditor
- type TopologyEditorAddNode
- type TopologyEditorAddRelationships
- type TopologyEditorContext
- type TopologyEditorExecuteNodeRequest
- type TopologyEditorExecuteRequest
- type TopologyEditorUpdateCapabilityProperty
- type TopologyEditorUpdateNodeProperty
- type TopologyEditorUpdateNodePropertyComplexType
- type TopologyEditorWorkflow
- type TopologyService
- type UpdateDeploymentTopologyRequest
- type User
- type UserService
- type Version
- type Workflow
- type WorkflowActivity
- func (wa *WorkflowActivity) AppendAfter(stepName string) *WorkflowActivity
- func (wa *WorkflowActivity) InlineWorkflow(inlineWorkflow string) *WorkflowActivity
- func (wa *WorkflowActivity) InsertBefore(stepName string) *WorkflowActivity
- func (wa *WorkflowActivity) OperationCall(target, targetRelationship, interfaceName, operationName string) *WorkflowActivity
- func (wa *WorkflowActivity) SetState(target, stateName string) *WorkflowActivity
- type WorkflowExecution
- type WorkflowStep
- type WorkflowStepInstance
Constants ¶
const ( // DefaultEnvironmentName is the default name of the environment created by // Alien4Cloud for an application DefaultEnvironmentName = "Environment" // ApplicationDeploymentInProgress a4c status ApplicationDeploymentInProgress = "DEPLOYMENT_IN_PROGRESS" // ApplicationDeployed a4c status ApplicationDeployed = "DEPLOYED" // ApplicationUndeploymentInProgress a4c status ApplicationUndeploymentInProgress = "UNDEPLOYMENT_IN_PROGRESS" // ApplicationUndeployed a4c status ApplicationUndeployed = "UNDEPLOYED" // ApplicationError a4c status ApplicationError = "FAILURE" // ApplicationUpdateError a4c status ApplicationUpdateError = "UPDATE_FAILURE" // ApplicationUpdated a4c status ApplicationUpdated = "UPDATED" // ApplicationUpdateInProgress a4c status ApplicationUpdateInProgress = "UPDATE_IN_PROGRESS" // WorkflowSucceeded workflow a4c status WorkflowSucceeded = "SUCCEEDED" // WorkflowRunning workflow a4c status WorkflowRunning = "RUNNING" // WorkflowFailed workflow a4c status WorkflowFailed = "FAILED" // NodeStart node a4c status NodeStart = "initial" // NodeSubmitting node a4c status NodeSubmitting = "submitting" // NodeSubmitted node a4c status NodeSubmitted = "submitted" // NodePending node a4c status NodePending = "pending" // NodeRunning node a4c status NodeRunning = "running" // NodeExecuting node a4c status NodeExecuting = "executing" // NodeExecuted node a4c status NodeExecuted = "executed" // NodeEnd node a4c status NodeEnd = "end" // NodeError node a4c status NodeError = "error" // NodeFailed node a4c status NodeFailed = "failed" // FunctionConcat is a function used in attribute/property values to concatenate strings FunctionConcat = "concat" // FunctionGetInput is a function used in attribute/property values to reference an input property FunctionGetInput = "get_input" // ROLE_ADMIN is the adminstrator role ROLE_ADMIN = "ADMIN" // ROLE_COMPONENTS_MANAGER allows to define packages on how to install, configure, start and connect components (mapped as node types) ROLE_COMPONENTS_MANAGER = "COMPONENTS_MANAGER" // ROLE_ARCHITECT allows to define application templates (topologies) by reusing building blocks (node types defined by components managers) ROLE_ARCHITECT = "ARCHITECT" // ROLE_APPLICATIONS_MANAGER allows to define applications with it’s own topologies that can be linked to a global topology from architects and that can reuse components defined by the components managers ROLE_APPLICATIONS_MANAGER = "APPLICATIONS_MANAGER" )
const ( // CallOperationWorkflowActivityType is the type of a call operation activity CallOperationWorkflowActivityType = "org.alien4cloud.tosca.model.workflow.activities.CallOperationWorkflowActivity" // InlineWorkflowActivityType is the type of an inline workflow activity InlineWorkflowActivityType = "org.alien4cloud.tosca.model.workflow.activities.InlineWorkflowActivity" // SetStateWorkflowActivityType is the type of an activity setting the state of a component SetStateWorkflowActivityType = "org.alien4cloud.tosca.model.workflow.activities.SetStateWorkflowActivity" // DelegateWorkflowActivity is the type of an activity delegated to an orchestrator DelegateWorkflowActivity = "org.alien4cloud.tosca.model.workflow.activities.DelegateWorkflowActivity" // StepStarted is the status of a workflow step that is started (currently running, not yet completed) StepStarted = "STARTED" // StepCompletedSuccessfull is the status of a workflow step that has completed successfully StepCompletedSuccessfull = "COMPLETED_SUCCESSFULL" // StepCompletedSuccessfull is the status of a workflow step that has failed StepCompletedWithError = "COMPLETED_WITH_ERROR" )
Variables ¶
This section is empty.
Functions ¶
func ReadA4CResponse ¶
ReadA4CResponse is an helper function that allow to fully read and close a response body and unmarshal its json content into a provided data structure. If response status code is greather or equal to 400 it automatically parse an error response and returns it as a non-nil error.
Types ¶
type Activity ¶
type Activity struct { Type string `json:"type,omitempty"` InterfaceName string `json:"interfaceName,omitempty"` // for activities of type org.alien4cloud.tosca.model.workflow.activities.CallOperationWorkflowActivity OperationName string `json:"operationName,omitempty"` // for activities of type org.alien4cloud.tosca.model.workflow.activities.CallOperationWorkflowActivity Delegate string `json:"delegate,omitempty"` // for activities of type org.alien4cloud.tosca.model.workflow.activities.DelegateWorkflowActivity StateName string `json:"stateName,omitempty"` // for activities of type org.alien4cloud.tosca.model.workflow.activities.SetStateWorkflowActivity Inline string `json:"inline,omitempty"` // for activities of type org.alien4cloud.tosca.model.workflow.activities.InlineWorkflowActivity }
Activity holds a workflow activity properties
type Application ¶
type Application struct { ID string `json:"id"` Name string `json:"name"` Tags []Tag `json:"tags,omitempty"` }
Application represent fields of an application returned by A4C
type ApplicationCreateRequest ¶
type ApplicationCreateRequest struct { Name string `json:"name"` ArchiveName string `json:"archiveName"` TopologyTemplateVersionID string `json:"topologyTemplateVersionId"` }
ApplicationCreateRequest is the representation of a request to create an application from a topology template
type ApplicationDeployRequest ¶
type ApplicationDeployRequest struct { ApplicationEnvironmentID string `json:"applicationEnvironmentId"` ApplicationID string `json:"applicationId"` }
ApplicationDeployRequest is the representation of a request to deploy an application in the A4C
type ApplicationService ¶
type ApplicationService interface { // Creates an application from a template and return its ID CreateAppli(ctx context.Context, appName string, appTemplate string) (string, error) // Returns the Alien4Cloud environment ID from a given application ID and environment name GetEnvironmentIDbyName(ctx context.Context, appID string, envName string) (string, error) // Returns true if the application with the given ID exists IsApplicationExist(ctx context.Context, applicationID string) (bool, error) // SearchApplications allows to list applications corresponding to a given SearchRequest // // It returns a slice of Application and the total number of applications matching the search request query and filters. // That means that this number can be used to control pagination processing along with the from and size parameters // of the SearchRequest. SearchApplications(ctx context.Context, searchRequest SearchRequest) ([]Application, int, error) // Returns the application ID using the given filter GetApplicationsID(ctx context.Context, filter string) ([]string, error) // Returns the application with the given ID GetApplicationByID(ctx context.Context, id string) (*Application, error) // Deletes an application DeleteApplication(ctx context.Context, appID string) error // Sets a tag tagKey/tagValue for the application SetTagToApplication(ctx context.Context, applicationID string, tagKey string, tagValue string) error // Returns the tag value for the given application ID and tag key GetApplicationTag(ctx context.Context, applicationID string, tagKey string) (string, error) // Returns the deployment topology for an application given an environment GetDeploymentTopology(ctx context.Context, appID string, envID string) (*Topology, error) // SearchEnvironments allows to list environments of a given applications using a given SearchRequest // // It returns a slice of Application and the total number of environments matching the search request query and filters. // That means that this number can be used to control pagination processing along with the from and size parameters // of the SearchRequest. SearchEnvironments(ctx context.Context, applicationID string, searchRequest SearchRequest) ([]Environment, int, error) }
ApplicationService is the interface to the service managing Applications
type BasicTopologyInfo ¶
type CSAR ¶
type CSAR struct { DefinitionHash string `json:"definitionHash,omitempty"` DelegateID string `json:"delegateId,omitempty"` DelegateType string `json:"delegateType,omitempty"` Dependencies []CSARDependency `json:"dependencies,omitempty"` Description string `json:"description,omitempty"` HasTopology bool `json:"hasTopology,omitempty"` Hash string `json:"hash,omitempty"` ID string `json:"id,omitempty"` ImportDate int `json:"importDate,omitempty"` ImportSource string `json:"importSource,omitempty"` License string `json:"license,omitempty"` Name string `json:"name,omitempty"` NestedVersion Version `json:"nestedVersion,omitempty"` NodeTypesCount int `json:"nodeTypesCount,omitempty"` Tags []Tag `json:"tags,omitempty"` TemplateAuthor string `json:"templateAuthor,omitempty"` ToscaDefaultNamespace string `json:"toscaDefaultNamespace,omitempty"` ToscaDefinitionsVersion string `json:"toscaDefinitionsVersion,omitempty"` Version string `json:"version,omitempty"` Workspace string `json:"workspace,omitempty"` YamlFilePath string `json:"yamlFilePath,omitempty"` }
CSAR holds properties defining a Cloud Service ARchive
type CSARDependency ¶
type CSARDependency struct { Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Hash string `json:"hash,omitempty"` }
CSARDependency holds properties defining a dependency on an archive
type CancelExecRequest ¶
type CancelExecRequest struct { EnvironmentID string `json:"environmentId"` ExecutionID string `json:"executionId"` }
cancelExecRequest is the representation of a request to cancel an execution.
type CatalogService ¶
type CatalogService interface { // UploadCSAR submits a Cloud Service ARchive to Alien4Cloud catalog // // The csar should be a zip archive containing a single YAML TOSCA definition file at the root of the archive. // CSAR could be uploaded into a given workspace, this is a premium feature leave empty on OSS version. // If workspace is empty the default workspace will be used. // // A critical note is that this function may return a ParsingErr. ParsingErr may contain only warnings // or informative errors that could be ignored. This can be checked by type casting into a ParsingErr // and calling HasCriticalErrors() function. UploadCSAR(ctx context.Context, csar io.Reader, workspace string) (csarDefinition CSAR, err error) }
CatalogService is the interface to the service mamaging a4c catalog
type Client ¶
type Client interface { Login(ctx context.Context) error Logout(ctx context.Context) error ApplicationService() ApplicationService DeploymentService() DeploymentService EventService() EventService LogService() LogService OrchestratorService() OrchestratorService TopologyService() TopologyService CatalogService() CatalogService UserService() UserService // NewRequest allows to create a custom request to be sent to Alien4Cloud // given a Context, method, url path and optional body. // // If the provided body is also an io.Closer, the Client Do function will automatically // close it. // The body needs to be a ReadSeeker in order to rewind request on retries. // // NewRequestWithContext returns a Request suitable for use with Client.Do // // If body is of type *bytes.Reader or *strings.Reader, the returned // request's ContentLength is set to its // exact value (instead of -1) NewRequest(ctx context.Context, method, urlStr string, body io.ReadSeeker) (*http.Request, error) // Do sends an HTTP request and returns an HTTP response // // If the returned error is nil, the Response will contain a non-nil // Body which the user is expected to close. If the Body is not both // read to EOF and closed, the Client's underlying RoundTripper // (typically Transport) may not be able to re-use a persistent TCP // connection to the server for a subsequent "keep-alive" request. // ReadA4CResponse() helper function is typically used to do this. // // The request Body, if non-nil, will be closed by the Do function // even on errors. // // Optional Retry functions may be provided. Those functions are executed sequentially to determine // if and how a request should be retried. See Retry documentation for more details. // Note: a special Retry function is always added at the end of the retries list. It will // automatically retry 403 Forbidden errors by trying to call Client.Login first. // This is for backward compatibility. Do(req *http.Request, retries ...Retry) (*http.Response, error) }
Client is the client interface to Alien4cloud
type CreateUpdateUserRequest ¶
type CreateUpdateUserRequest struct { UserName string `json:"username"` FirstName string `json:"firstName,omitempty"` LastName string `json:"lastName,omitempty"` Email string `json:"email,omitempty"` Roles []string `json:"roles,omitempty"` Password string `json:"password,omitempty"` }
CreateUserRequest holds parameters of a requets to create or update a user
type Deployment ¶
type Deployment struct { DeploymentUsername string `json:"deploymentUsername"` EndDate Time `json:"endDate"` EnvironmentID string `json:"environmentId"` ID string `json:"id"` LocationIds []string `json:"locationIds"` OrchestratorDeploymentID string `json:"orchestratorDeploymentId"` OrchestratorID string `json:"orchestratorId"` SourceID string `json:"sourceId"` SourceName string `json:"sourceName"` SourceType string `json:"sourceType"` StartDate Time `json:"startDate"` VersionID string `json:"versionId"` WorkflowExecutions map[string]string `json:"workflowExecutions"` }
Deployment is the representation a deployment
type DeploymentArtifact ¶
type DeploymentArtifact struct { ArtifactType string `json:"artifactType"` ArtifactRef string `json:"artifactRef,omitempty"` ArtifactRepository string `json:"artifactRepository,omitempty"` ArchiveName string `json:"archiveName,omitempty"` ArchiveVersion string `json:"archiveVersion,omitempty"` RepositoryURL string `json:"repositoryURL,omitempty"` RepositoryCredential map[string]interface{} `json:"repositoryCredential,omitempty"` RepositoryName string `json:"repositoryName,omitempty"` ArtifactName string `json:"artifactName,omitempty"` DeployPath string `json:"deployPath,omitempty"` Description string `json:"description,omitempty"` }
DeploymentArtifact holds properties of an artifact (file) input definition in topology
type DeploymentService ¶
type DeploymentService interface { // Gets matching locations where a given application can be deployed GetLocationsMatching(ctx context.Context, topologyID string, envID string) ([]LocationMatch, error) // Deploys the given application in the given environment using the given orchestrator // if location is empty, the first matching location will be used DeployApplication(ctx context.Context, appID string, envID string, location string) error // Updates an application with the latest topology version UpdateApplication(ctx context.Context, appID, envID string) error // Updates inputs of a deployment topology UpdateDeploymentTopology(ctx context.Context, appID, envID string, request UpdateDeploymentTopologyRequest) error // Uploads an input artifact UploadDeploymentInputArtifact(ctx context.Context, appID, envID, inputArtifact, filePath string) error // Returns the deployment list for the given appID and envID GetDeploymentList(ctx context.Context, appID string, envID string) ([]Deployment, error) // Returns a deployment given its ID GetDeployment(ctx context.Context, deploymentID string) (Deployment, error) // Undeploys an application UndeployApplication(ctx context.Context, appID string, envID string) error // WaitUntilStateIs Waits until the state of an Alien4Cloud application is one of the given statuses as parameter and returns the actual status. WaitUntilStateIs(ctx context.Context, appID string, envID string, statuses ...string) (string, error) // Returns current deployment status for the given applicationID and environmentID GetDeploymentStatus(ctx context.Context, applicationID string, environmentID string) (string, error) // Returns current deployment ID for the given applicationID and environmentID GetCurrentDeploymentID(ctx context.Context, applicationID string, environmentID string) (string, error) // Returns the node status for the given applicationID and environmentID and nodeName GetNodeStatus(ctx context.Context, applicationID string, environmentID string, nodeName string) (string, error) // Returns the output attributes of nodes in the given applicationID and environmentID GetOutputAttributes(ctx context.Context, applicationID string, environmentID string) (map[string][]string, error) // Returns the application deployment attributes for the first instance of a node name GetAttributesValue(ctx context.Context, applicationID string, environmentID string, nodeName string, requestedAttributesName []string) (map[string]string, error) // Returns the application deployment attributes for the specified instance of a node name GetInstanceAttributesValue(ctx context.Context, applicationID string, environmentID string, nodeName, instanceName string, requestedAttributesName []string) (map[string]string, error) // Runs Alien4Cloud workflowName workflow for the given a4cAppID and a4cEnvID with input parameters RunWorkflowWithParameters(ctx context.Context, a4cAppID string, a4cEnvID string, workflowName string, parameters map[string]interface{}, timeout time.Duration) (*Execution, error) // Runs a workflow asynchronously with input parameters returning the execution id, results will be notified using the ExecutionCallback function. // Cancelling the context cancels the function that monitor the execution RunWorkflowAsyncWithParameters(ctx context.Context, a4cAppID string, a4cEnvID string, workflowName string, parameters map[string]interface{}, callback ExecutionCallback) (string, error) // Runs Alien4Cloud workflowName workflow for the given a4cAppID and a4cEnvID RunWorkflow(ctx context.Context, a4cAppID string, a4cEnvID string, workflowName string, timeout time.Duration) (*Execution, error) // Runs a workflow asynchronously returning the execution id, results will be notified using the ExecutionCallback function. // Cancelling the context cancels the function that monitor the execution RunWorkflowAsync(ctx context.Context, a4cAppID string, a4cEnvID string, workflowName string, callback ExecutionCallback) (string, error) // Returns the workflow execution for the given applicationID and environmentID GetLastWorkflowExecution(ctx context.Context, applicationID string, environmentID string) (*WorkflowExecution, error) // Returns executions // // - deploymentID allows to search executions of a specific deployment but may be empty // - query allows to search a specific execution but may be empty // - from and size allows to paginate results GetExecutions(ctx context.Context, deploymentID, query string, from, size int) ([]Execution, FacetedSearchResult, error) // GetExecutionByID returns details of a given execution // Returns an error if no execution with such ID was found GetExecutionByID(ctx context.Context, executionID string) (Execution, error) // GetExecution returns details of a given execution // Returns an error if no execution with such ID was found // // Deprecated: Prefer GetExecutionByID instead GetExecution(ctx context.Context, deploymentID, workflowName, executionID string) (Execution, error) // Cancels execution for given environmentID and executionID CancelExecution(ctx context.Context, environmentID string, executionID string) error }
DeploymentService is the interface to the service managing deployments
type EntrySchema ¶
type EntrySchema struct { Type string `json:"type"` Description string `json:"description,omitempty"` }
EntrySchema holds the definition of the type of an element in a list
type Environment ¶
type Environment struct { ID string `json:"id"` Name string `json:"name"` Status string `json:"status,omitempty"` ApplicationID string `json:"applicationId,omitempty"` CurrentVersionName string `json:"currentVersionName,omitempty"` DeployedVersion string `json:"deployedVersion,omitempty"` Description string `json:"description,omitempty"` EnvironmentType string `json:"environmentType,omitempty"` UserRoles map[string][]string `json:"userRoles,omitempty"` GroupRoles map[string][]string `json:"GroupRoles,omitempty"` }
Environment holds properties of an Alien4Cloud environment
type Event ¶
type Event struct { DeploymentID string `json:"deploymentId,omitempty"` Date Time `json:"date,omitempty"` DeploymentStatus string `json:"deploymentStatus,omitempty"` NodeTemplateId string `json:"nodeTemplateId,omitempty"` InstanceId string `json:"instanceId,omitempty"` InstanceState string `json:"instanceState,omitempty"` InstanceStatus string `json:"instanceStatus,omitempty"` Attributes map[string]string `json:"attributes,omitempty"` RuntimeProperties map[string]string `json:"runtimeProperties,omitempty"` PersistentProperties map[string]interface{} `json:"persistentProperties,omitempty"` Message string `json:"message,omitempty"` }
Event represents an event entry returned by the A4C REST API
type EventService ¶
type EventService interface { // Returns a given number of events for a given deployed application from a given index // Events are sorted by date in descending order. This call returns as well // the total number of events on this application GetEventsForApplicationEnvironment(ctx context.Context, environmentID string, fromIndex, size int) ([]Event, int, error) }
EventService is the interface to the service mamaging events
type Execution ¶
type Execution struct { ID string `json:"id"` DeploymentID string `json:"deploymentId"` WorkflowID string `json:"workflowId"` WorkflowName string `json:"workflowName"` DisplayWorkflowName string `json:"displayWorkflowName"` Status string `json:"status"` HasFailedTasks bool `json:"hasFailedTasks"` StartDate Time `json:"startDate,omitempty"` EndDate Time `json:"endDate,omitempty"` }
Execution hold properties of the execution of a workflow
type ExecutionCallback ¶
ExecutionCallback is a function call by asynchronous operations when an execution reaches a terminal state
type FacetedSearchResult ¶
type FacetedSearchResult struct { TotalResults int `json:"totalResults"` From int `json:"from"` To int `json:"to"` }
FacetedSearchResult allows to retrieve pagination information
type Group ¶
type Group struct { Name string `json:"name"` Email string `json:"email,omitempty"` Description string `json:"description,omitempty"` Users []string `json:"users,omitempty"` Roles []string `json:"roles,omitempty"` }
Group hosts an Alien4Cloud user properties
type Informations ¶
type Informations struct { Data map[string]map[string]struct { State string `json:"state"` Attributes map[string]string `json:"attributes"` } `json:"data"` Error Error `json:"error"` }
Informations represents information returned from a4c rest api
type LocationConfiguration ¶
type LocationConfiguration struct { ID string `json:"id"` CreationDate int64 `json:"creationDate,omitempty"` LastUpdateDate int64 `json:"lastUpdateDate,omitempty"` Dependencies []CSARDependency `json:"dependencies,omitempty"` EnvironmentType string `json:"environmentType,omitempty"` InfrastructureType string `json:"infrastructureType,omitempty"` MetaProperties map[string]string `json:"metaProperties,omitempty"` Modifiers []LocationModifierReference `json:"modifiers,omitempty"` Name string `json:"name,omitempty"` OrchestratorID string `json:"orchestratorId,omitempty"` SecretProviderConfiguration SecretProviderConfiguration `json:"secretProviderConfiguration,omitempty"` ApplicationPermissions map[string][]string `json:"applicationPermissions,omitempty"` EnvironmentPermissions map[string][]string `json:"environmentPermissions,omitempty"` EnvironmentTypePermissions map[string][]string `json:"environmentTypePermissions,omitempty"` GroupPermissions map[string][]string `json:"groupPermissions,omitempty"` UserPermissions map[string][]string `json:"userPermissions,omitempty"` }
LocationConfiguration holds a location configuration properties
type LocationMatch ¶
type LocationMatch struct { Location LocationConfiguration `json:"location"` Orchestrator Orchestrator `json:"orchestrator"` Ready bool `json:"ready"` Reasons interface{} `json:"reasons,omitempty"` }
LocationMatch holds details on a Location where an application can be deployed
type LocationModifierReference ¶
type LocationModifierReference struct { PluginID string `json:"pluginId"` BeanName string `json:"beanName"` Phase string `json:"phase,omitempty"` }
LocationModifierReference holds a reference to a location modifier
type LocationPoliciesPostRequestIn ¶
type LocationPoliciesPostRequestIn struct { GroupsToLocations struct { A4CAll string `json:"_A4C_ALL"` } `json:"groupsToLocations"` OrchestratorID string `json:"orchestratorId"` }
LocationPoliciesPostRequestIn is the representation of a request to set location policies of a topology
type Log ¶
type Log struct { ID string `json:"id"` DeploymentID string `json:"deploymentId"` DeploymentPaaSID string `json:"deploymentPaaSId"` Level string `json:"level"` Timestamp Time `json:"timestamp"` WorkflowID string `json:"workflowId"` ExecutionID string `json:"executionId"` NodeID string `json:"nodeId"` InstanceID string `json:"instanceId"` InterfaceName string `json:"interfaceName"` OperationName string `json:"operationName"` Content string `json:"content"` }
Log represents the log entry return by the a4c rest api
type LogFilter ¶
type LogFilter struct { Level []string `json:"level,omitempty"` WorkflowID []string `json:"workflowId,omitempty"` ExecutionID []string `json:"executionId,omitempty"` }
LogFilter represents rest api A4C logs
type LogService ¶
type LogService interface { // Returns the logs of the application and environment filtered GetLogsOfApplication(ctx context.Context, applicationID string, environmentID string, filters LogFilter, fromIndex int) ([]Log, int, error) }
LogService is the interface to the service mamaging logs
type Logs ¶
type Logs []Log
Logs a list of a4c logs
func (*Logs) UnmarshalJSON ¶
UnmarshalJSON unmarshals the a4c logs
type NodeTemplate ¶
type NodeTemplate struct { Name string `json:"name"` Type string `json:"type"` Tags []Tag `json:"tags,omitempty"` Properties []NodeTemplatePropertyValue `json:"properties,omitempty"` }
NodeTemplate is the representation a node template
type NodeTemplatePropertyValue ¶
type NodeTemplatePropertyValue struct { Key string `json:"key,omitempty"` Value PropertyValue `json:"value,omitempty"` }
NodeTemplatePropertyValue represents a node template property value
type Orchestrator ¶
type Orchestrator struct { ID string `json:"id"` Name string `json:"name"` PluginID string `json:"pluginId,omitempty"` PluginBean string `json:"pluginBean,omitempty"` DeploymentNamePattern string `json:"deploymentNamePattern,omitempty"` State string `json:"state,omitempty"` }
Orchestrator holds properties of an orchestrator
type OrchestratorService ¶
type OrchestratorService interface { // Returns the Alien4Cloud locations for orchestratorID GetOrchestratorLocations(ctx context.Context, orchestratorID string) ([]Location, error) // Returns the Alien4Cloud orchestrator ID from a given orchestator name GetOrchestratorIDbyName(ctx context.Context, orchestratorName string) (string, error) }
OrchestratorService is the interface to the service mamaging orchestrators
type ParsingErr ¶
type ParsingErr interface { error HasCriticalErrors() bool ParsingErrors() map[string][]ParsingError }
ParsingErr is an error returned in case of parsing error Those parsing errors could be critical or just informative HasCriticalErrors() allows to know if this error could be ignored
type ParsingError ¶
type ParsingError struct { ErrorLevel string `json:"errorLevel,omitempty"` ErrorCode string `json:"errorCode,omitempty"` Problem string `json:"problem,omitempty"` Context string `json:"context,omitempty"` Note string `json:"note,omitempty"` StartMark SimpleMark `json:"startMark,omitempty"` EndMark SimpleMark `json:"endMark,omitempty"` }
ParsingError is the representation of an A4C parsing error (typically used in CSAR parsing)
func (*ParsingError) String ¶
func (pe *ParsingError) String() string
type PropertyDefinition ¶
type PropertyDefinition struct { Type string `json:"type"` EntrySchema EntrySchema `json:"entrySchema,omitempty"` Required bool `json:"required,omitempty"` DefaultValue PropertyValue `json:"default,omitempty"` Description string `json:"description,omitempty"` SuggestionID string `json:"suggestionId,omitempty"` Password bool `json:"password,omitempty"` }
PropertyDefinition holds the definition of a Topology input property
type PropertyValue ¶
type PropertyValue struct { Definition bool `json:"definition,omitempty"` Value interface{} `json:"value,omitempty"` FunctionConcat string `json:"function_concat,omitempty"` Function string `json:"function,omitempty"` Parameters []interface{} `json:"parameters,omitempty"` }
PropertyValue holds the definition of a property value
type Retry ¶
type Retry func(client Client, request *http.Request, response *http.Response) (*http.Request, error)
Retry is a function called after sending a request. It allows to perform actions based on the given response before re-sending a request. A typical usecase is to automatically call the Client.Login() function when receiving a 403 Forbidden response.
It is possible to alter the request to be sent by returning an updated request. But in most cases the given original request can safely be returned as it. This framework take care of rewinding the request body before giving it to retry functions.
The retry algorithm is: - If a retry function returns an error the retry process is stopped and this error is returned - If a retry function returns a nil request the retry process continue and consider the next available retry function - If a retry function returns a non-nil request this request is used in a Client.Do() call
Note: It is critical that if the response body is read in a retry function it should not be closed and somehow rewind to the begining.
type RuntimeTopology ¶
type RuntimeTopology struct { Data struct { Topology struct { OutputAttributes map[string][]string } `json:"topology"` } `json:"data"` Error Error `json:"error"` }
RuntimeTopology represents runtime topology from a4c rest api
type SearchRequest ¶
type SearchRequest struct { Query string `json:"query,omitempty"` From int `json:"from"` Size int `json:"size"` Filters map[string][]string `json:"filters,omitempty"` }
SearchRequest is the representation of a request to search objects such as topologies, orchestrators in the A4C catalog
type SecretProviderConfiguration ¶
type SecretProviderConfiguration struct { PluginName string `json:"pluginName,omitempty"` Configuration interface{} `json:"configuration,omitempty"` }
SecretProviderConfiguration holds the configuraiton of a secret provider
type SimpleMark ¶
SimpleMark is a mark into a file (line+column)
type Time ¶
Time represents the timestamp field from A4C
func (Time) MarshalJSON ¶
MarshalJSON marshals a4c json time data and return the result
func (*Time) UnmarshalJSON ¶
UnmarshalJSON unmarshal a4c json time data and sets the Time
type Topology ¶
type Topology struct { Data struct { NodeTypes map[string]nodeType `json:"nodeTypes"` RelationshipTypes map[string]relationshipType `json:"relationshipTypes"` CapabilityTypes map[string]capabilityType `json:"capabilityTypes"` Topology struct { ArchiveName string `json:"archiveName"` ArchiveVersion string `json:"archiveVersion"` Description string `json:"description,omitempty"` NodeTemplates map[string]NodeTemplate `json:"nodeTemplates"` Inputs map[string]PropertyDefinition `json:"inputs,omitempty"` InputArtifacts map[string]DeploymentArtifact `json:"inputArtifacts,omitempty"` DeployerInputProperties map[string]PropertyValue `json:"deployerInputProperties,omitempty"` UploadedInputArtifacts map[string]DeploymentArtifact `json:"uploadedinputArtifacts,omitempty"` Workflows map[string]Workflow `json:"workflows,omitempty"` } `json:"topology"` } `json:"data"` }
Topology is the representation a topology template
type TopologyEditor ¶
type TopologyEditor interface {
// contains filtered or unexported methods
}
TopologyEditor is the representation a topology template editor
type TopologyEditorAddNode ¶
type TopologyEditorAddNode struct { TopologyEditorExecuteNodeRequest NodeTypeID string `json:"indexedNodeTypeId"` }
TopologyEditorAddNode is the representation of a request to set node of a topology
type TopologyEditorAddRelationships ¶
type TopologyEditorAddRelationships struct { TopologyEditorExecuteNodeRequest RelationshipName string `json:"relationshipName"` RelationshipType string `json:"relationshipType"` RelationshipVersion string `json:"relationshipVersion"` RequirementName string `json:"requirementName"` RequirementType string `json:"requirementType"` Target string `json:"target"` TargetedCapabilityName string `json:"targetedCapabilityName"` }
TopologyEditorAddRelationships is the representation of a request to set relationships of a topology
type TopologyEditorContext ¶
type TopologyEditorContext struct { AppID string EnvID string TopologyID string PreviousOperationID string }
TopologyEditorContext A4C topology editor context to store PreviousOperationID
type TopologyEditorExecuteNodeRequest ¶
type TopologyEditorExecuteNodeRequest struct { TopologyEditorExecuteRequest NodeName string `json:"nodeName"` }
TopologyEditorExecuteNodeRequest is the representation of a request to edit an application from a topology template for operation related to a node
type TopologyEditorExecuteRequest ¶
type TopologyEditorExecuteRequest struct { PreviousOperationID string `json:"previousOperationId,omitempty"` OperationType string `json:"type"` }
TopologyEditorExecuteRequest is the representation of a request to edit an application from a topology template
type TopologyEditorUpdateCapabilityProperty ¶
type TopologyEditorUpdateCapabilityProperty struct { TopologyEditorExecuteNodeRequest PropertyName string `json:"propertyName"` PropertyValue string `json:"propertyValue"` CapabilityName string `json:"capabilityName"` }
TopologyEditorUpdateCapabilityProperty is the representation of a request to update property of a topology
type TopologyEditorUpdateNodeProperty ¶
type TopologyEditorUpdateNodeProperty struct { TopologyEditorExecuteNodeRequest PropertyName string `json:"propertyName"` PropertyValue string `json:"propertyValue"` NodeTypeID string `json:"indexedNodeTypeId"` }
TopologyEditorUpdateNodeProperty is the representation of a request to execute the topology editor
type TopologyEditorUpdateNodePropertyComplexType ¶
type TopologyEditorUpdateNodePropertyComplexType struct { TopologyEditorExecuteNodeRequest PropertyName string `json:"propertyName"` PropertyValue map[string]interface{} `json:"propertyValue"` NodeTypeID string `json:"indexedNodeTypeId"` }
TopologyEditorUpdateNodePropertyComplexType is the representation of a request to update complex property of a topology
type TopologyEditorWorkflow ¶
type TopologyEditorWorkflow struct { TopologyEditorExecuteRequest WorkflowName string `json:"workflowName"` }
TopologyEditorWorkflow is the representation of a request to execute the topology editor
type TopologyService ¶
type TopologyService interface { // Returns the topology ID on a given application and environment GetTopologyID(ctx context.Context, appID string, envID string) (string, error) // Returns the topology template ID for the given topologyName GetTopologyTemplateIDByName(ctx context.Context, topologyName string) (string, error) // Returns Topology details for a given application and environment GetTopology(ctx context.Context, appID string, envID string) (*Topology, error) // Updates the property value (type string) of a component of an application UpdateComponentProperty(ctx context.Context, a4cCtx *TopologyEditorContext, componentName string, propertyName string, propertyValue string) error // Updates the property value (type tosca complex) of a component of an application UpdateComponentPropertyComplexType(ctx context.Context, a4cCtx *TopologyEditorContext, componentName string, propertyName string, propertyValue map[string]interface{}) error // Updates the property value of a capability related to a component of an application UpdateCapabilityProperty(ctx context.Context, a4cCtx *TopologyEditorContext, componentName string, propertyName string, propertyValue string, capabilityName string) error // Adds a new node in the A4C topology AddNodeInA4CTopology(ctx context.Context, a4cCtx *TopologyEditorContext, nodeTypeID string, nodeName string) error // Adds a new relationship in the A4C topology AddRelationship(ctx context.Context, a4cCtx *TopologyEditorContext, sourceNodeName string, targetNodeName string, relType string) error // Saves the topology context SaveA4CTopology(ctx context.Context, a4cCtx *TopologyEditorContext) error // Creates an empty workflow in the given topology CreateWorkflow(ctx context.Context, a4cCtx *TopologyEditorContext, workflowName string) error // Deletes a workflow in the given topology DeleteWorkflow(ctx context.Context, a4cCtx *TopologyEditorContext, workflowName string) error // Adds an activity to a workflow AddWorkflowActivity(ctx context.Context, a4cCtx *TopologyEditorContext, workflowName string, activity *WorkflowActivity) error // Adds a policy to the topology AddPolicy(ctx context.Context, a4cCtx *TopologyEditorContext, policyName, policyTypeID string) error // Adds targets to a previously created policy AddTargetsToPolicy(ctx context.Context, a4cCtx *TopologyEditorContext, policyName string, targets []string) error // Deletes a policy from the topology DeletePolicy(ctx context.Context, a4cCtx *TopologyEditorContext, policyName string) error // Returns a list of topologyIDs available topologies GetTopologies(ctx context.Context, query string) ([]BasicTopologyInfo, error) // Returns Topology details for a given TopologyID GetTopologyByID(ctx context.Context, a4cTopologyID string) (*Topology, error) }
TopologyService is the interface to the service mamaging topologies
type UpdateDeploymentTopologyRequest ¶
type UpdateDeploymentTopologyRequest struct { InputProperties map[string]interface{} `json:"inputProperties,omitempty"` ProviderDeploymentProperties map[string]string `json:"providerDeploymentProperties,omitempty"` }
UpdateDeploymentTopologyRequest holds a request to update inputs of a deployment topology
type User ¶
type User struct { UserName string `json:"username"` //Password string `json:"password,omitempty"` FirstName string `json:"firstName,omitempty"` LastName string `json:"lastName,omitempty"` Email string `json:"email,omitempty"` Roles []string `json:"roles,omitempty"` }
User hosts an Alien4Cloud user properties
type UserService ¶
type UserService interface { // CreateUser creates a user CreateUser(ctx context.Context, createRequest CreateUpdateUserRequest) error // UpdateUser updates a user parameters UpdateUser(ctx context.Context, userName string, updateRequest CreateUpdateUserRequest) error // GetUser returns the parameters of a user whose name is provided in argument GetUser(ctx context.Context, userName string) (User, error) // GetUsers returns the parameters of users whose names are provided in argument GetUsers(ctx context.Context, userNames []string) ([]User, error) // SearchUsers searches for users and returns an array of users as well as the // total number of users matching the search request SearchUsers(ctx context.Context, searchRequest SearchRequest) ([]User, int, error) // DeleteUser deletes a user DeleteUser(ctx context.Context, userName string) error // AddRole adds a role to a user AddRole(ctx context.Context, userName, role string) error // RemoveRole removes a role that was granted user RemoveRole(ctx context.Context, userName, role string) error // CreateGroup creates a group and returns its identifier CreateGroup(ctx context.Context, group Group) (string, error) // UpdateGroup updates a group parameters UpdateGroup(ctx context.Context, groupID string, group Group) error // GetGroup returns the parameters of a group whose identifier is provided in argument // returns nil if no such group was found GetGroup(ctx context.Context, groupID string) (Group, error) // GetGroups returns the parameters of groups whose identifiers are provided in argument GetGroups(ctx context.Context, groupIDs []string) ([]Group, error) // SearchGroups searches for groups and returns an array of groups as well as the // total number of groups matching the search request SearchGroups(ctx context.Context, searchRequest SearchRequest) ([]Group, int, error) // DeleteGroup deletes a group DeleteGroup(ctx context.Context, groupID string) error }
UserService is the interface to the service mamaging users and groups
type Version ¶
type Version struct { MajorVersion int `json:"majorVersion,omitempty"` MinorVersion int `json:"minorVersion,omitempty"` IncrementalVersion int `json:"incrementalVersion,omitempty"` BuildNumber int `json:"buildNumber,omitempty"` Qualifier string `json:"qualifier,omitempty"` }
Version represents a version with its decomposed fields
type Workflow ¶
type Workflow struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` Inputs map[string]PropertyDefinition `json:"inputs,omitempty"` Steps map[string]WorkflowStep `json:"steps,omitempty"` }
Workflow holds a workflow properties
type WorkflowActivity ¶
type WorkflowActivity struct {
// contains filtered or unexported fields
}
WorkflowActivity is a workflow activity payload.
It allows to create: - Inline workflows activities (Inline should be set) - Operation Call activities (InterfaceName and OperationName should be set) - Set state activities (StateName should be set)
func (*WorkflowActivity) AppendAfter ¶
func (wa *WorkflowActivity) AppendAfter(stepName string) *WorkflowActivity
AppendAfter allows to insert the activity after the given step name in the workflow
func (*WorkflowActivity) InlineWorkflow ¶
func (wa *WorkflowActivity) InlineWorkflow(inlineWorkflow string) *WorkflowActivity
InlineWorkflow allows to configure the workflow activity to be an inline workflow activity
func (*WorkflowActivity) InsertBefore ¶
func (wa *WorkflowActivity) InsertBefore(stepName string) *WorkflowActivity
InsertBefore allows to insert the activity before the given step name in the workflow
func (*WorkflowActivity) OperationCall ¶
func (wa *WorkflowActivity) OperationCall(target, targetRelationship, interfaceName, operationName string) *WorkflowActivity
OperationCall allows to configure the workflow activity to be an operation call activity targetRelationship is optional and applies only on relationships-related operations
func (*WorkflowActivity) SetState ¶
func (wa *WorkflowActivity) SetState(target, stateName string) *WorkflowActivity
SetState allows to configure the workflow activity to be an inline workflow call
type WorkflowExecution ¶
type WorkflowExecution struct { Execution Execution `json:"execution,omitempty"` StepStatus map[string]string `json:"stepStatus,omitempty"` StepInstances map[string][]WorkflowStepInstance `json:"stepInstances,omitempty"` }
WorkflowExecution represents rest api workflow execution
type WorkflowStep ¶
type WorkflowStep struct { Name string `json:"name,omitempty"` Target string `json:"target,omitempty"` OperationHost string `json:"operationHost,omitempty"` Activities []Activity `json:"activities,omitempty"` OnSuccess []string `json:"onSuccess,omitempty"` OnFailure []string `json:"onFailure,omitempty"` PrecedingSteps []string `json:"precedingSteps,omitempty"` }
WorkflowStep holds a workflow step properties
type WorkflowStepInstance ¶
type WorkflowStepInstance struct { ID string `json:"id,omitempty"` StepId string `json:"stepId,omitempty"` DeploymentId string `json:"deploymentId,omitempty"` ExecutionId string `json:"executionId,omitempty"` NodeId string `json:"nodeId,omitempty"` InstanceId string `json:"instanceId,omitempty"` TargetNodeId string `json:"targetNodeId,omitempty"` TargetInstanceId string `json:"targetInstanceId,omitempty"` OperationName string `json:"operationName,omitempty"` HasFailedTasks bool `json:"hasFailedTasks,omitempty"` Status string `json:"status,omitempty"` }
WorkflowStepInstance holds properties of a workflow step instance