porcelain

package
v2.33.2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSyncFileLimit         = 500
	DefaultConcurrentUploadLimit = 10
	DefaultRetryAttempts         = 3
)

Variables

View Source
var Default = NewHTTPClient(nil)

Default netlify HTTP client.

Functions

This section is empty.

Types

type CustomTLSCertificate

type CustomTLSCertificate struct {
	Certificate    string
	Key            string
	CACertificates string
}

CustomTLSCertificate holds information about custom TLS certificates.

type DeployObserver

type DeployObserver interface {
	OnSetupWalk() error
	OnSuccessfulStep(*FileBundle) error
	OnSuccessfulWalk(*models.DeployFiles) error
	OnFailedWalk()

	OnSetupDelta(*models.DeployFiles) error
	OnSuccessfulDelta(*models.DeployFiles, *models.Deploy) error
	OnFailedDelta(*models.DeployFiles)

	OnSetupUpload(*FileBundle) error
	OnSuccessfulUpload(*FileBundle) error
	OnFailedUpload(*FileBundle)
}

type DeployOptions

type DeployOptions struct {
	SiteID            string
	Dir               string
	FunctionsDir      string
	EdgeFunctionsDir  string
	EdgeRedirectsDir  string
	BuildDir          string
	LargeMediaEnabled bool

	IsDraft   bool
	SkipRetry bool

	Title             string
	Branch            string
	CommitRef         string
	Framework         string
	FrameworkVersion  string
	UploadTimeout     time.Duration
	PreProcessTimeout time.Duration

	Observer DeployObserver
	// contains filtered or unexported fields
}

DeployOptions holds the option for creating a new deploy

type DeployWarner

type DeployWarner interface {
	OnWalkWarning(path, msg string)
}

type FileBundle

type FileBundle struct {
	Name             string
	Sum              string
	Runtime          string
	Size             *int64 `json:"size,omitempty"`
	FunctionMetadata *FunctionMetadata

	// Path OR Buffer should be populated
	Path   string
	Buffer io.ReadSeeker
}

func (*FileBundle) Close

func (f *FileBundle) Close() error

func (*FileBundle) Read

func (f *FileBundle) Read(p []byte) (n int, err error)

func (*FileBundle) Seek

func (f *FileBundle) Seek(offset int64, whence int) (int64, error)

type FunctionMetadata

type FunctionMetadata struct {
	InvocationMode string
	Timeout        int64
}

type Netlify

type Netlify struct {
	*plumbing.Netlify
	// contains filtered or unexported fields
}

Netlify is a client for netlify

func New

func New(transport runtime.ClientTransport, formats strfmt.Registry) *Netlify

New creates a new netlify client.

func NewHTTPClient

func NewHTTPClient(formats strfmt.Registry) *Netlify

NewHTTPClient creates a new netlify HTTP client.

func NewRetryable

func NewRetryable(transport runtime.ClientTransport, formats strfmt.Registry, attempts int) *Netlify

NewRetryable creates a new netlify client with a number of attempts for rate limits.

func NewRetryableHTTPClient

func NewRetryableHTTPClient(formats strfmt.Registry, attempts int) *Netlify

NewRetryableHTTPClient creates a new netlify HTTP client with a number of attempts for rate limits.

func (*Netlify) AddSiteAsset

func (*Netlify) ConfigureSiteTLSCertificate

func (n *Netlify) ConfigureSiteTLSCertificate(ctx context.Context, siteID string, cert *CustomTLSCertificate) (*models.SniCertificate, error)

ConfigureSiteTLSCertificate provisions a TLS certificate for a site with a custom domain. It uses Let's Encrypt if the certificate is empty.

func (*Netlify) CreateDeployKey

func (n *Netlify) CreateDeployKey(ctx context.Context) (*models.DeployKey, error)

func (*Netlify) CreateSite

func (n *Netlify) CreateSite(ctx context.Context, site *models.SiteSetup, configureDNS bool, httpClient *http.Client, timeout time.Duration) (*models.Site, error)

CreateSite creates a new site.

func (*Netlify) CreateTicket

func (n *Netlify) CreateTicket(ctx context.Context, clientID string) (*models.Ticket, error)

Create a login ticket to authenticate a user

func (*Netlify) DeleteSite

func (n *Netlify) DeleteSite(ctx context.Context, siteID string) error

DeleteSite deletes a site.

func (*Netlify) DeploySite

func (n *Netlify) DeploySite(ctx context.Context, options DeployOptions, httpClient *http.Client, timeout time.Duration) (*models.Deploy, error)

DeploySite creates a new deploy for a site given a directory in the filesystem. It uploads the necessary files that changed between deploys.

func (*Netlify) DoDeploy

func (n *Netlify) DoDeploy(ctx context.Context, options *DeployOptions, deploy *models.Deploy, httpClient *http.Client, timeout time.Duration) (*models.Deploy, error)

DoDeploy deploys the changes for a site given a directory in the filesystem. It uploads the necessary files that changed between deploys.

func (*Netlify) ExchangeTicket

func (n *Netlify) ExchangeTicket(ctx context.Context, ticketID string) (*models.AccessToken, error)

func (*Netlify) GetDeploy

func (n *Netlify) GetDeploy(ctx context.Context, deployID string, httpClient *http.Client, timeout time.Duration) (*models.Deploy, error)

GetDeploy returns a deploy.

func (*Netlify) GetSite

func (n *Netlify) GetSite(ctx context.Context, siteID string) (*models.Site, error)

GetSite returns a site.

func (*Netlify) GetSiteAssetPublicSignature

func (n *Netlify) GetSiteAssetPublicSignature(ctx context.Context, params *operations.GetSiteAssetPublicSignatureParams) (*models.AssetPublicSignature, error)

func (*Netlify) GetSiteTLSCertificate

func (n *Netlify) GetSiteTLSCertificate(ctx context.Context, siteID string) (*models.SniCertificate, error)

GetSiteTLSCertificate shows the TLS certificate configured for a site.

func (*Netlify) ListFormSubmissions

func (n *Netlify) ListFormSubmissions(ctx context.Context, formID string) ([]*models.Submission, error)

ListFormSubmissions lists the forms submissions of a particular form

func (*Netlify) ListFormsBySiteId

func (n *Netlify) ListFormsBySiteId(ctx context.Context, siteID string) ([]*models.Form, error)

ListFormsBySiteId lists the forms of a particular site

func (*Netlify) ListSiteAssets

func (n *Netlify) ListSiteAssets(ctx context.Context, params *operations.ListSiteAssetsParams) ([]*models.Asset, error)

func (*Netlify) ListSites

func (n *Netlify) ListSites(ctx context.Context, params *operations.ListSitesParams) ([]*models.Site, error)

ListSites lists the sites a user has access to.

func (*Netlify) SetConcurrentUploadLimit

func (n *Netlify) SetConcurrentUploadLimit(limit int)

func (*Netlify) SetSyncFileLimit

func (n *Netlify) SetSyncFileLimit(limit int)

func (*Netlify) ShowSiteAssetInfo

func (n *Netlify) ShowSiteAssetInfo(ctx context.Context, params *operations.GetSiteAssetInfoParams, showSignature bool) (*models.Asset, error)

func (*Netlify) ShowTicket

func (n *Netlify) ShowTicket(ctx context.Context, ticketID string) (*models.Ticket, error)

func (*Netlify) UpdateSite

func (n *Netlify) UpdateSite(ctx context.Context, site *models.SiteSetup) (*models.Site, error)

UpdateSite modifies an existent site.

func (*Netlify) UpdateSiteAsset

func (n *Netlify) UpdateSiteAsset(ctx context.Context, params *operations.UpdateSiteAssetParams) (*models.Asset, error)

func (*Netlify) UploadNewSiteAsset

func (n *Netlify) UploadNewSiteAsset(ctx context.Context, asset *SiteAsset) (*models.Asset, error)

func (*Netlify) WaitUntilDeployLive

func (n *Netlify) WaitUntilDeployLive(ctx context.Context, d *models.Deploy) (*models.Deploy, error)

WaitUntilDeployLive blocks until the deploy is in the "ready" state. At this point, the deploy is ready to receive traffic to all of its URLs.

func (*Netlify) WaitUntilDeployProcessed

func (n *Netlify) WaitUntilDeployProcessed(ctx context.Context, d *models.Deploy) (*models.Deploy, error)

WaitUntilDeployProcessed blocks until the deploy is in the "processed" state. At this point, the deploy is ready to receive traffic via its permalink.

func (*Netlify) WaitUntilDeployReady

func (n *Netlify) WaitUntilDeployReady(ctx context.Context, d *models.Deploy) (*models.Deploy, error)

WaitUntilDeployReady blocks until the deploy is in the "prepared" or "ready" state.

func (*Netlify) WaitUntilTLSCertificateReady

func (n *Netlify) WaitUntilTLSCertificateReady(ctx context.Context, siteID string, cert *models.SniCertificate) (*models.SniCertificate, error)

WaitUntilTLSCertificateReady checks the state of a site's certificate. It waits until the state is "issued", for Let's Encrypt certificates or "custom", which means that the certificate was provided by the user.

func (*Netlify) WaitUntilTicketAuthorized

func (n *Netlify) WaitUntilTicketAuthorized(ctx context.Context, ticket *models.Ticket) (*models.Ticket, error)

type SiteAsset

type SiteAsset struct {
	SiteID  string
	Name    string
	Size    int64
	Private bool
	Body    io.ReadSeeker
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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