api

package
v0.0.0-...-2263012 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Manages credential-type artifacts

Index

Constants

View Source
const Endpoint string = "https://api.massdriver.cloud/api/"

Variables

This section is empty.

Functions

func NewClient

func NewClient(endpoint string, apiKey string) graphql.Client

func NewMutationError

func NewMutationError(msg string, validationErrors []MutationValidationError) error

Types

type Artifact

type Artifact struct {
	Name string
	ID   string
}

func CreateArtifact

func CreateArtifact(client graphql.Client, orgID string, artifactName string, artifactType string, artifactData map[string]interface{}, artifactSpecs map[string]interface{}) (*Artifact, error)

func ListCredentials

func ListCredentials(client graphql.Client, orgID string, artifactType string) ([]*Artifact, error)

Get the first page of credentials for an artifact type

type ArtifactDefinition

type ArtifactDefinition struct {
	Name string
}

func ListCredentialTypes

func ListCredentialTypes() []*ArtifactDefinition

List supported credential types

type ArtifactDefinitionWithSchema

type ArtifactDefinitionWithSchema struct {
	Name   string
	Schema map[string]interface{}
}

func GetArtifactDefinitions

func GetArtifactDefinitions(client graphql.Client, orgID string) ([]ArtifactDefinitionWithSchema, error)

type ContainerRepository

type ContainerRepository struct {
	Token         string
	RepositoryURI string
}

func GetContainerRepository

func GetContainerRepository(client graphql.Client, artifactID, orgID, imageName, location string) (*ContainerRepository, error)

type ContainerRepositoryInput

type ContainerRepositoryInput struct {
	Location  string `json:"location"`
	ImageName string `json:"imageName"`
}

Arguments required to get container repositories

func (*ContainerRepositoryInput) GetImageName

func (v *ContainerRepositoryInput) GetImageName() string

GetImageName returns ContainerRepositoryInput.ImageName, and is useful for accessing the field via an interface.

func (*ContainerRepositoryInput) GetLocation

func (v *ContainerRepositoryInput) GetLocation() string

GetLocation returns ContainerRepositoryInput.Location, and is useful for accessing the field via an interface.

type Credential

type Credential struct {
	ArtifactDefinitionType string `json:"artifactDefinitionType"`
	ArtifactId             string `json:"artifactId"`
}

func (*Credential) GetArtifactDefinitionType

func (v *Credential) GetArtifactDefinitionType() string

GetArtifactDefinitionType returns Credential.ArtifactDefinitionType, and is useful for accessing the field via an interface.

func (*Credential) GetArtifactId

func (v *Credential) GetArtifactId() string

GetArtifactId returns Credential.ArtifactId, and is useful for accessing the field via an interface.

type Deployment

type Deployment struct {
	ID     string `json:"id"`
	Status string `json:"status"`
}

func DeployPackage

func DeployPackage(client graphql.Client, orgID, targetID, manifestID, message string) (*Deployment, error)

func GetDeployment

func GetDeployment(client graphql.Client, orgID string, id string) (*Deployment, error)

type Environment

type Environment struct {
	ID   string
	Slug string
	URL  string
}

func DecommissionPreviewEnvironment

func DecommissionPreviewEnvironment(client graphql.Client, orgID string, projectTargetSlugOrTargetID string) (*Environment, error)

func DeployPreviewEnvironment

func DeployPreviewEnvironment(client graphql.Client, orgID string, projectID string, credentials []Credential, packageParams map[string]interface{}, ciContext map[string]interface{}) (*Environment, error)

type Manifest

type Manifest struct {
	ID string
}

type MutationError

type MutationError struct {
	Err      string
	Messages []MutationValidationError
}

func (*MutationError) Error

func (m *MutationError) Error() string

type MutationValidationError

type MutationValidationError struct {
	// A friendly error message, appropriate for display to the end user.
	//
	// The message is interpolated to include the appropriate variables.
	//
	// Example: `Username must be at least 10 characters`
	//
	// This message may change without notice, so we do not recommend you match against the text.
	// Instead, use the *code* field for matching.
	Message string `json:"message"`
}

MutationValidationError includes the requested fields of the GraphQL type ValidationMessage. The GraphQL type's documentation follows.

Validation messages are returned when mutation input does not meet the requirements. While client-side validation is highly recommended to provide the best User Experience, All inputs will always be validated server-side.

Some examples of validations are:

* Username must be at least 10 characters * Email field does not contain an email address * Birth Date is required

While GraphQL has support for required values, mutation data fields are always set to optional in our API. This allows 'required field' messages to be returned in the same manner as other validations. The only exceptions are id fields, which may be required to perform updates or deletes.

func (*MutationValidationError) GetMessage

func (v *MutationValidationError) GetMessage() string

GetMessage returns MutationValidationError.Message, and is useful for accessing the field via an interface.

type Package

type Package struct {
	ID         string
	NamePrefix string
	Params     map[string]interface{}
	Manifest   Manifest
	Target     Target
}

func ConfigurePackage

func ConfigurePackage(client graphql.Client, orgID string, targetID string, manifestID string, params map[string]interface{}) (*Package, error)

func GetPackageByName

func GetPackageByName(client graphql.Client, orgID string, name string) (*Package, error)

type PreviewConfig

type PreviewConfig struct {
	ProjectSlug string                    `json:"projectSlug"`
	Credentials []Credential              `json:"credentials"`
	Packages    map[string]PreviewPackage `json:"packages"`
}

func (*PreviewConfig) GetCredentials

func (p *PreviewConfig) GetCredentials() []Credential

type PreviewEnvironmentInput

type PreviewEnvironmentInput struct {
	Credentials           []Credential           `json:"credentials"`
	PackageConfigurations map[string]interface{} `json:"-"`
	// CI Context
	CiContext map[string]interface{} `json:"-"`
}

func (*PreviewEnvironmentInput) GetCiContext

func (v *PreviewEnvironmentInput) GetCiContext() map[string]interface{}

GetCiContext returns PreviewEnvironmentInput.CiContext, and is useful for accessing the field via an interface.

func (*PreviewEnvironmentInput) GetCredentials

func (v *PreviewEnvironmentInput) GetCredentials() []Credential

GetCredentials returns PreviewEnvironmentInput.Credentials, and is useful for accessing the field via an interface.

func (*PreviewEnvironmentInput) GetPackageConfigurations

func (v *PreviewEnvironmentInput) GetPackageConfigurations() map[string]interface{}

GetPackageConfigurations returns PreviewEnvironmentInput.PackageConfigurations, and is useful for accessing the field via an interface.

func (*PreviewEnvironmentInput) MarshalJSON

func (v *PreviewEnvironmentInput) MarshalJSON() ([]byte, error)

func (*PreviewEnvironmentInput) UnmarshalJSON

func (v *PreviewEnvironmentInput) UnmarshalJSON(b []byte) error

type PreviewPackage

type PreviewPackage struct {
	Params           map[string]interface{} `json:"params"`
	Secrets          []Secret               `json:"secrets,omitempty"`
	RemoteReferences []RemoteRef            `json:"remoteReferences,omitempty"`
}

type Project

type Project struct {
	ID            string
	Slug          string
	DefaultParams map[string]interface{}
}

func GetProject

func GetProject(client graphql.Client, orgID string, idOrSlug string) (*Project, error)

func (*Project) GetDefaultParams

func (p *Project) GetDefaultParams() map[string]PreviewPackage

type RemoteRef

type RemoteRef struct {
	ArtifactID string `json:"artifactId"`
	Field      string `json:"field"`
}

type Secret

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

type Target

type Target struct {
	ID string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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