Documentation
¶
Overview ¶
Copyright 2021 William Perron. All rights reserved. MIT License.
Copyright 2021 William Perron. All rights reserved. MIT License.
Copyright 2021 William Perron. All rights reserved. MIT License.
Copyright 2021 William Perron. All rights reserved. MIT License.
Index ¶
- Constants
- type Certificate
- type Client
- func (c *Client) AddDomain(projectID string, newDomain Domain) (Domain, error)
- func (c *Client) CreateProject(name string, envVars NewEnvVars) (Project, error)
- func (c *Client) CurrentUser() (User, error)
- func (c *Client) DeleteDomain(projectID, domainName string) error
- func (c *Client) DeleteProject(projectID string) error
- func (c *Client) GetDeployment(projectID string, deploymentID string) (Deployment, error)
- func (c *Client) GetDomain(projectID, domainName string) (Domain, error)
- func (c *Client) GetLogs(projectID string, deploymentID string) (interface{}, error)
- func (c *Client) GetProject(projectID string) (Project, error)
- func (c *Client) LinkProject(req LinkProjectRequest) (Project, error)
- func (c *Client) ListDeployments(projectID string, pageOpts PageOptions) ([]Deployment, PagingInfo, error)
- func (c *Client) ListDomains(projectID string) ([]Domain, error)
- func (c *Client) ListProjects() ([]Project, error)
- func (c *Client) NewProjectDeployment(projectID string, depl NewDeploymentRequest) (Deployment, error)
- func (c *Client) ProvisionCertificateAutomatic(projectID, domainName string) error
- func (c *Client) ProvisionCertificateManual(projectID, domainName string, certificateChain string, privateKey string) error
- func (c *Client) Unlink(projectID string) error
- func (c *Client) UpdateEnvVars(projectID string, newVars NewEnvVars) error
- func (c *Client) UpdateProject(projectID string, newName string) error
- func (c *Client) VerifyDomain(projectID, domainName string) error
- type CommitInfo
- type CreateProjectRequest
- type Deployment
- type Domain
- type DomainMapping
- type EnvVars
- type GitHubLink
- type LinkProjectRequest
- type NewDeploymentRequest
- type NewEnvVars
- type PageOptions
- type PagingInfo
- type Project
- type ProvisioningAttempt
- type Repository
- type UpdateProjectRequest
- type User
Constants ¶
const ( TLSCipherRsa = "rsa" TLSCipherEc = "ec" TLSStrategyAutomatic = "automatic" TLSStrategyManual = "manual" )
Possible values for the Certificates property of the Domain struct
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Certificate ¶ added in v0.2.1
type Client ¶
Client is a simple wrapper around the std HTTP client used for the Deploy sdk.
func (*Client) AddDomain ¶
AddDomain adds a custom domain name to the project. This is typically followed by the VerifyDomain function
func (*Client) CreateProject ¶
func (c *Client) CreateProject(name string, envVars NewEnvVars) (Project, error)
CreateProject creates a new project with the given name.
func (*Client) CurrentUser ¶
CurrentUser returns the currently signed in User, the owner of the Token used by the client sdk.
func (*Client) DeleteDomain ¶
DeleteDomain removes a custom domain name associated with a project.
This action only removes the custom domain name resolution on the Deploy side. The DNS records will still have to be removed on the user's registrar.
func (*Client) DeleteProject ¶
DeleteProject deletes a Project and all of its associated Deployments.
func (*Client) GetDeployment ¶
func (c *Client) GetDeployment(projectID string, deploymentID string) (Deployment, error)
GetDeployment returns the information about a given Deployment.
func (*Client) GetDomain ¶
GetDomain returns the information about a given custom domain name.
This is typically used to retrieve the information about the different records that must be created by the user to properly verify the domain.
func (*Client) GetProject ¶
GetProject returns the information about a given Project.
func (*Client) LinkProject ¶ added in v0.2.0
func (c *Client) LinkProject(req LinkProjectRequest) (Project, error)
func (*Client) ListDeployments ¶
func (c *Client) ListDeployments(projectID string, pageOpts PageOptions) ([]Deployment, PagingInfo, error)
ListDeployments returns a slice of Deployments owned by the current User for a given Project.
func (*Client) ListDomains ¶
ListDomains returns a list of all the custom domain names associated to the Project.
func (*Client) ListProjects ¶
ListProjects returns a slice of Projects owned by the current User.
func (*Client) NewProjectDeployment ¶
func (c *Client) NewProjectDeployment(projectID string, depl NewDeploymentRequest) (Deployment, error)
NewProjectDeployment creates a new Deployment for a Project. The URL param is the URL of the source code used for the deployment. The URL needs to be publicly available.
Note that this function is not needed to create a new Deployment for a Project linked to a GitHub repository.
func (*Client) ProvisionCertificateAutomatic ¶ added in v0.3.0
ProvisionCertificateAutomatic automatically provisions a valid TLS certificate for a custom domain name.
func (*Client) ProvisionCertificateManual ¶ added in v0.3.0
func (c *Client) ProvisionCertificateManual(projectID, domainName string, certificateChain string, privateKey string) error
ProvisionCertificateManual adds a custom TLS certificate for a custom domain name.
func (*Client) Unlink ¶
Unlink removes the GitHub integration of a given project.
This only affects future Deployments. Any active Deployment that was created when the GitHub repository was linked will still be active.
func (*Client) UpdateEnvVars ¶
func (c *Client) UpdateEnvVars(projectID string, newVars NewEnvVars) error
UpdateEnvVars overwrites the environment variables of a given Project.
func (*Client) UpdateProject ¶
UpdateProject modifies an existing Project.
func (*Client) VerifyDomain ¶
VerifyDomain sends the signal to Deploy to verify the DNS records for custom domain names. The DNS records must exist prior to starting the verification process. Deploy will not create these for you.
type CommitInfo ¶
type CommitInfo struct { Hash string `json:"hash"` Message string `json:"message"` AuthorName string `json:"authorName"` AuthorEmail string `json:"authorEmail"` AuthorGitHubUsername string `json:"authorGithubUsername,omitempty"` URL string `json:"url,omitempty"` }
A CommitInfo is used for Projects linked to a GitHub repository. It contains the information about the commit that triggered a new Deployment for the Project.
type CreateProjectRequest ¶
type CreateProjectRequest struct { Name string `json:"name"` EnvVars NewEnvVars `json:"envVars"` }
CreateProjectRequest is the expected request body schema for the CreateProject function.
type Deployment ¶
type Deployment struct { ID string `json:"id"` URL string `json:"url"` DomainMappings []DomainMapping `json:"domainMappings"` RelatedCommit *CommitInfo `json:"relatedCommit,omitempty"` Project *Project `json:"project"` ProjectID string `json:"projectId"` EnvVars EnvVars `json:"envVars"` UpdatedAt string `json:"updatedAt"` CreatedAt string `json:"createdAt"` }
A Deployment is an immutable version of a Project's source code.
Each Deployment contains a URL to the source code's entrypoint, the auto generated domain name that was created for the Deployment and a copy of the environment variables of the project when the Deployment was created.
If the project is linked to a GitHub repository, it will also contain a CommitInfo containing the summary of the commit.
A Deployment also has a circular reference to a Project. The Project property is only set when accessing the Deployment directly in the API, otherwise it is omitted.
type Domain ¶
type Domain struct { Domain string `json:"domain"` Token string `json:"token,omitempty"` IsValidated bool `json:"isValidated,omitempty"` Certificates []Certificate `json:"certificates,omitempty"` ProvisioningAttempts []ProvisioningAttempt `json:"provisioningAttempts,omitempty"` ProjectID string `json:"projectId,omitempty"` UpdatedAt string `json:"updatedAt,omitempty"` CreatedAt string `json:"createdAt,omitempty"` }
A Domain is a custom domain name for a Project.
type DomainMapping ¶
type DomainMapping struct { Domain string `json:"domain"` UpdatedAt string `json:"updatedAt"` CreatedAt string `json:"createdAt"` }
A DomainMapping is a simple struct containing to immutable domain name of a Deployment.
type EnvVars ¶
type EnvVars []string
EnvVars is a simple map used to created environment variables in a Project.
type GitHubLink ¶
type GitHubLink struct { Repository Repository `json:"repository"` Entrypoint string `json:"entrypoint"` UpdatedAt string `json:"updatedAt"` CreatedAt string `json:"createdAt"` }
A GitHubLink is used in a Project to link it to a GitHub repository. it contains a Repository struct and an entrypoint corresponding to the source code file used as the entrypoint of the project.
type LinkProjectRequest ¶ added in v0.2.0
type LinkProjectRequest struct { ProjectID string `json:"projectId"` Organization string `json:"organization"` Repo string `json:"repo"` Entrypoint string `json:"entrypoint"` }
LinkProjectRequest is the expected request body schema for the LinkProject function.
type NewDeploymentRequest ¶
type NewDeploymentRequest struct { URL string `json:"url"` Production bool `json:"production,omitempty"` }
NewDeploymentRequest is the expected request body schema for the NewProjectDeployment function.
type NewEnvVars ¶ added in v0.3.1
NewEnvVars is the expected request body schema for the NewEnvVars function.
type PageOptions ¶
PageOptions defines the parameters used when requesting a paginated resource.
type PagingInfo ¶
type PagingInfo struct { Page int `json:"page"` Count int `json:"count"` Limit int `json:"limit"` TotalCount int `json:"totalCount"` TotalPages int `json:"totalPages"` }
PagingInfo is the structure returned by the API for paginated resources.
type Project ¶
type Project struct { ID string `json:"id"` Name string `json:"name"` Git *GitHubLink `json:"git,omitempty"` ProductionDeployment *Deployment `json:"productionDeployment,omitempty"` HasProductionDeployment bool `json:"hasProductionDeployment"` EnvVars EnvVars `json:"envVars"` UpdatedAt string `json:"updatedAt"` CreatedAt string `json:"createdAt"` }
A Project represents a Deploy project.
Projects can be linked to a public GitHub repository or point directly to a publicly accessible URL. The Project resource contains certain global settings like the name of the project, domain names and environment variables. Projects are made up of Deployments. Every time the source URL is updated or a commit is pushed to the default branch on GitHub, a new Deployment is created and the 'production' deployment is updated.
The ProductionDeployment property is a pointer to the Deployment object that represents the latest version of the project. When a project is first created this value is nil and HasProductionDeployment is set to `false`.
The Git property is only set if the project is linked to a GitHub repository, otherwise it is nil.
A Project also has a circular reference to a Deployment. The Deployment property is only set when accessing the Project directly in the API, otherwise it is omitted.
type ProvisioningAttempt ¶ added in v0.2.1
type Repository ¶
A Repository is a simple structure containing the information identifying the GitHub repository.
type UpdateProjectRequest ¶
type UpdateProjectRequest struct {
Name string `json:"name"`
}
UpdateProjectRequest is the expected request body schema for the UpdateProject function.
type User ¶
type User struct { ID string `json:"id"` Login string `json:"login"` Name string `json:"name"` AvatarURL string `json:"avatarUrl"` GitHubID int `json:"githubId"` IsAdmin bool `json:"isAdmin"` IsBlocked bool `json:"isBlocked"` UpdatedAt time.Time `json:"updatedAt"` CreatedAt time.Time `json:"createdAt"` }
A User of the Deploy platform.