client

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

README

Qwilt CDN Sites API Client (Go)

A Go library for the Qwilt Sites API

Documentation

Overview

Package client

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Copyright (c) 2024 Qwilt Inc.

Package client

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Copyright (c) 2024 Qwilt Inc.

Index

Constants

View Source
const ACCEPTANCE_STATUS_DISMISSED = "Dismissed"
View Source
const ACCEPTANCE_STATUS_INVALID = "Invalid"
View Source
const ACCEPTANCE_STATUS_PENDING = "Pending"
View Source
const ACCEPTANCE_TIMEOUT = 180 * time.Second
View Source
const TARGET_GA = "ga"
View Source
const TARGET_STAGING = "staging"

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResponse

type AuthResponse struct {
	Username string
	Token    string
}

AuthResponse -

type AuthStruct

type AuthStruct struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

AuthStruct -

type CertificatesClient

type CertificatesClient struct {
	*Client
	// contains filtered or unexported fields
}

func NewCertificatesClient

func NewCertificatesClient(client *Client) *CertificatesClient

func (*CertificatesClient) CreateCertificate

func (c *CertificatesClient) CreateCertificate(cert api.CertificateCreateRequest) (*api.Certificate, error)

CreateCertificate - Create new certificate

func (*CertificatesClient) DeleteCertificate

func (c *CertificatesClient) DeleteCertificate(certId types.Int64) error

DeleteCertificate - Deletes a certificate

func (*CertificatesClient) GetCertificate

func (c *CertificatesClient) GetCertificate(certId types.Int64, detailed bool) (*api.Certificate, error)

GetCertificate - Returns certificate details

func (*CertificatesClient) GetCertificates

func (c *CertificatesClient) GetCertificates(detailed bool) ([]api.Certificate, error)

GetCertificates - Returns list of sites

func (*CertificatesClient) UpdateCertificate

func (c *CertificatesClient) UpdateCertificate(certId int64, site api.CertificateUpdateRequest) (*api.Certificate, error)

UpdateCertificate - Update cert details

type Client

type Client struct {
	HTTPClient *http.Client
	Token      string
	XApiToken  string
	Auth       AuthStruct
	// contains filtered or unexported fields
}

Client -

func NewClient

func NewClient(envType,
	username,
	password,
	xApiToken string) (*Client, error)

NewClient -

func (*Client) SignIn

func (c *Client) SignIn() (*AuthResponse, error)

SignIn - Get a new token for user

type EndpointBuilder

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

func NewEndpointBuilder

func NewEndpointBuilder(envType string) EndpointBuilder

func (EndpointBuilder) Build

func (e EndpointBuilder) Build(name string) string

type PublishOpsClient

type PublishOpsClient struct {
	*Client
	// contains filtered or unexported fields
}

func NewPublishOpsClient

func NewPublishOpsClient(target string, client *Client) *PublishOpsClient

func (*PublishOpsClient) Cancel

func (c *PublishOpsClient) Cancel(siteId string, publishId string) error

Cancel - Cancel an ongoing publish operation

func (*PublishOpsClient) FindLatestPubOp

func (c *PublishOpsClient) FindLatestPubOp(siteId string, revisionId string) (*api.PubOp, error)

FindPubOp - Returns latest publishing operation for site

func (*PublishOpsClient) GetAndWaitForPubOpAcceptance

func (c *PublishOpsClient) GetAndWaitForPubOpAcceptance(siteId string, publishId string, timeout time.Duration) (*api.PubOp, error)

GetAndWaitForPubOpAcceptance - Returns details on a publishing operation after waitingfor it to completevalidation step

func (*PublishOpsClient) GetPubOp

func (c *PublishOpsClient) GetPubOp(siteId string, publishId string) (*api.PubOp, error)

GetPubOp - Returns details on a publishing operation

func (*PublishOpsClient) GetPubOps

func (c *PublishOpsClient) GetPubOps(siteId string, isActive bool, publishState string) ([]api.PubOp, error)

GetPubOps - Returns list of publishing operations

func (*PublishOpsClient) GetSitePubStatus

func (c *PublishOpsClient) GetSitePubStatus(siteId string) (string, string, error)

GetSitePubStatus - Get a site's publishing status

func (*PublishOpsClient) Publish

func (c *PublishOpsClient) Publish(siteId string, revisionId string, target string) (*api.PubOp, error)

Publish - Publish a site

func (*PublishOpsClient) Republish

func (c *PublishOpsClient) Republish(siteId string, target string) (*api.PubOp, error)

Republish - Republish the active configuration version

func (*PublishOpsClient) Unpublish

func (c *PublishOpsClient) Unpublish(siteId string, target string) (*api.PubOp, error)

Unpublish - Unpublish a site

type SiteCertificatesClient

type SiteCertificatesClient struct {
	*Client
	// contains filtered or unexported fields
}

SiteCertificatesClient -

func NewSiteCertificatesClient

func NewSiteCertificatesClient(target string, client *Client) *SiteCertificatesClient

func (*SiteCertificatesClient) GetSiteCertificates

func (c *SiteCertificatesClient) GetSiteCertificates(siteId string, revisionId string) ([]api.SiteCertificateResponse, error)

GetSiteCertficates - Returns list of site certificates

func (*SiteCertificatesClient) LinkSiteCertificate

func (c *SiteCertificatesClient) LinkSiteCertificate(siteId string, certId string) (*api.SiteCertificateResponse, error)

LinkSiteCertificate - links a site to a certificate

func (*SiteCertificatesClient) UnLinkSiteCertificate

func (c *SiteCertificatesClient) UnLinkSiteCertificate(siteId string, certId string) error

LinkSiteCertificate - links asite to a certificate

type SiteClient

type SiteClient struct {
	*Client
	// contains filtered or unexported fields
}

func NewSiteClient

func NewSiteClient(target string, client *Client) *SiteClient

func (*SiteClient) CreateSite

func (c *SiteClient) CreateSite(site api.SiteCreateRequest) (*api.Site, error)

CreateSite - Create new site

func (*SiteClient) DeleteAndRenameSite

func (c *SiteClient) DeleteAndRenameSite(siteId string, siteName string) error

DeleteAndRenameSite - Deletes a site so we can reuse the name later

This adds "DELETED <unixtimestamp>" to the end of the site name to make it unique

func (*SiteClient) DeleteSite

func (c *SiteClient) DeleteSite(siteId string) error

DeleteSite - Deletes a site

func (*SiteClient) GetSite

func (c *SiteClient) GetSite(siteId string, target string, includeActiveLastPub bool, includeDeletedSites bool) (*api.Site, error)

GetSite - Returns site details

func (*SiteClient) GetSites

func (c *SiteClient) GetSites(includeActiveLastPub bool, includeDeletedSites bool) ([]api.Site, error)

GetSites - Returns list of sites

func (*SiteClient) UpdateSite

func (c *SiteClient) UpdateSite(siteId string, site api.SiteUpdateRequest) (*api.Site, error)

UpdateSite - Update site details

type SiteClientFacade

type SiteClientFacade struct {
	*PublishOpsClient
	*SiteClient
	*SiteConfigurationClient
	*SiteCertificatesClient
	ApiEndpoint string
}

SiteClientFacade -

func NewSiteFacadeClient

func NewSiteFacadeClient(target string, client *Client) *SiteClientFacade

Decorator on top of Client type

type SiteConfigurationClient

type SiteConfigurationClient struct {
	*Client
	// contains filtered or unexported fields
}

SiteConfigurationClient -

func NewSiteConfigurationClient

func NewSiteConfigurationClient(target string, client *Client) *SiteConfigurationClient

func (*SiteConfigurationClient) CreateSiteConfig

func (c *SiteConfigurationClient) CreateSiteConfig(siteId string, siteConfigVersion api.SiteConfigAddRequest) (*api.SiteConfigVersion, error)

CreateSiteConfig - Add a new site configuration

func (*SiteConfigurationClient) GetSiteConfig

func (c *SiteConfigurationClient) GetSiteConfig(siteId string, revisionId string, truncateHostIndex bool) (*api.SiteConfigVersion, error)

GetSiteConfig - Returns site details

func (*SiteConfigurationClient) GetSiteConfigs

func (c *SiteConfigurationClient) GetSiteConfigs(siteId string, truncateHostIndex bool) ([]api.SiteConfigVersion, error)

GetSiteConfigs - Returns list of site configurations

Jump to

Keyboard shortcuts

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