cps

package
v2.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// AcknowledgementAcknowledge parameter value
	AcknowledgementAcknowledge = "acknowledge"
	// AcknowledgementDeny parameter value
	AcknowledgementDeny = "deny"
)

Variables

View Source
var (
	// ErrGetChangeStatus is returned when GetChangeStatus fails
	ErrGetChangeStatus = errors.New("fetching change")
	// ErrCancelChange is returned when CancelChange fails
	ErrCancelChange = errors.New("canceling change")
	// ErrUpdateChange is returned when UpdateChange fails
	ErrUpdateChange = errors.New("updating change")
)
View Source
var (
	// ErrGetChangeLetsEncryptChallenges is returned when GetChangeLetsEncryptChallenges fails
	ErrGetChangeLetsEncryptChallenges = errors.New("fetching change for lets-encrypt-challenges")
	// ErrAcknowledgeLetsEncryptChallenges when AcknowledgeDVChallenges fails
	ErrAcknowledgeLetsEncryptChallenges = errors.New("acknowledging lets-encrypt-challenges")
)
View Source
var (
	// ErrListEnrollments is returned when ListEnrollments fails
	ErrListEnrollments = errors.New("fetching enrollments")
	// ErrGetEnrollment is returned when GetEnrollment fails
	ErrGetEnrollment = errors.New("fetching enrollment")
	// ErrCreateEnrollment is returned when CreateEnrollment fails
	ErrCreateEnrollment = errors.New("create enrollment")
	// ErrUpdateEnrollment is returned when UpdateEnrollment fails
	ErrUpdateEnrollment = errors.New("update enrollment")
	// ErrRemoveEnrollment is returned when RemoveEnrollment fails
	ErrRemoveEnrollment = errors.New("remove enrollment")
)
View Source
var (
	// ErrGetChangePreVerificationWarnings is returned when GetChangeLetsEncryptChallenges fails
	ErrGetChangePreVerificationWarnings = errors.New("fetching pre-verification-warnings")
	// ErrAcknowledgePreVerificationWarnings when AcknowledgeDVChallenges fails
	ErrAcknowledgePreVerificationWarnings = errors.New("acknowledging pre-verification-warnings")
)
View Source
var AllowedInputContentTypeHeader = map[AllowedInputType]string{
	AllowedInputTypeChangeManagementACK:            "application/vnd.akamai.cps.acknowledgement-with-hash.v1+json",
	AllowedInputTypeLetsEncryptChallengesCompleted: "application/vnd.akamai.cps.acknowledgement.v1+json",
	AllowedInputTypePostVerificationWarningsACK:    "application/vnd.akamai.cps.acknowledgement.v1+json",
	AllowedInputTypePreVerificationWarningsACK:     "application/vnd.akamai.cps.acknowledgement.v1+json",
	AllowedInputTypeThirdPartyCertAndTrustChain:    "application/vnd.akamai.cps.certificate-and-trust-chain.v1+json",
}

AllowedInputContentTypeHeader maps content type headers to specific allowed input type params

View Source
var (
	// ErrInvalidLocation is returned when there was an error while fetching ID from location response object
	ErrInvalidLocation = errors.New("location URL is invalid")
)
View Source
var (
	// ErrStructValidation is returned returned when given struct validation failed
	ErrStructValidation = errors.New("struct validation")
)

Functions

func GetIDFromLocation

func GetIDFromLocation(location string) (int, error)

GetIDFromLocation parse the link and returns the id

Types

type Acknowledgement

type Acknowledgement struct {
	Acknowledgement string `json:"acknowledgement"`
}

Acknowledgement is a request body of acknowledgement request

func (Acknowledgement) Validate

func (a Acknowledgement) Validate() error

Validate validates Acknowledgement

type AcknowledgementRequest

type AcknowledgementRequest struct {
	Acknowledgement
	EnrollmentID int
	ChangeID     int
}

AcknowledgementRequest contains params and body required to send acknowledgement. It is the same for all acknowledgement types (dv, pre-verification-warnings etc.)

func (AcknowledgementRequest) Validate

func (a AcknowledgementRequest) Validate() error

Validate validates AcknowledgementRequest

type AllowedInput

type AllowedInput struct {
	Info              string `json:"info"`
	RequiredToProceed bool   `json:"requiredToProceed"`
	Type              string `json:"type"`
	Update            string `json:"update"`
}

AllowedInput contains the resource locations (path) of data inputs allowed by this Change

type AllowedInputType

type AllowedInputType string

AllowedInputType represents allowedInputTypeParam used for fetching and updating changes

const (
	// AllowedInputTypeChangeManagementACK parameter value
	AllowedInputTypeChangeManagementACK AllowedInputType = "change-management-ack"
	// AllowedInputTypeLetsEncryptChallengesCompleted parameter value
	AllowedInputTypeLetsEncryptChallengesCompleted AllowedInputType = "lets-encrypt-challenges-completed"
	// AllowedInputTypePostVerificationWarningsACK parameter value
	AllowedInputTypePostVerificationWarningsACK AllowedInputType = "post-verification-warnings-ack"
	// AllowedInputTypePreVerificationWarningsACK parameter value
	AllowedInputTypePreVerificationWarningsACK AllowedInputType = "pre-verification-warnings-ack"
	// AllowedInputTypeThirdPartyCertAndTrustChain parameter value
	AllowedInputTypeThirdPartyCertAndTrustChain AllowedInputType = "third-party-cert-and-trust-chain"
)

type AuthenticationOptions

type AuthenticationOptions struct {
	OCSP               *OCSP `json:"ocsp,omitempty"`
	SendCAListToClient *bool `json:"sendCaListToClient,omitempty"`
}

AuthenticationOptions contain the configuration options for the selected trust chain

type CPS

CPS is the cps api interface

func Client

func Client(sess session.Session, opts ...Option) CPS

Client returns a new cps Client instance with the specified controller

type CSR

type CSR struct {
	C    string   `json:"c,omitempty"`
	CN   string   `json:"cn"`
	L    string   `json:"l,omitempty"`
	O    string   `json:"o,omitempty"`
	OU   string   `json:"ou,omitempty"`
	SANS []string `json:"sans,omitempty"`
	ST   string   `json:"st,omitempty"`
}

CSR is a Certificate Signing Request object

func (CSR) Validate

func (c CSR) Validate() error

Validate performs validation on Enrollment

type CancelChangeRequest

type CancelChangeRequest struct {
	EnrollmentID int
	ChangeID     int
}

CancelChangeRequest contains params required to send CancelChange request

func (CancelChangeRequest) Validate

func (c CancelChangeRequest) Validate() error

Validate validates CancelChangeRequest

type CancelChangeResponse

type CancelChangeResponse struct {
	Change string `json:"change"`
}

CancelChangeResponse is a response object returned from CancelChange request

type Certificate

type Certificate struct {
	Certificate string `json:"certificate"`
	TrustChain  string `json:"trustChain"`
}

Certificate is a digital certificate object

func (Certificate) Validate

func (c Certificate) Validate() error

Validate validates Certificate

type Challenges

type Challenges struct {
	Error             string              `json:"error"`
	FullPath          string              `json:"fullPath"`
	RedirectFullPath  string              `json:"redirectFullPath"`
	ResponseBody      string              `json:"responseBody"`
	Status            string              `json:"status"`
	Token             string              `json:"token"`
	Type              string              `json:"type"`
	ValidationRecords []ValidationRecords `json:"validationRecords"`
}

Challenges contains domain information of a specific domain to be validated

type Change

type Change struct {
	AllowedInput []AllowedInput `json:"allowedInput"`
	StatusInfo   *StatusInfo    `json:"statusInfo"`
}

Change contains change status information

type ChangeOperations

ChangeOperations is a CPS change API interface

type ClientFunc

type ClientFunc func(sess session.Session, opts ...Option) CPS

ClientFunc is a cps client new method, this can used for mocking

type ClientMutualAuthentication

type ClientMutualAuthentication struct {
	AuthenticationOptions *AuthenticationOptions `json:"authenticationOptions,omitempty"`
	SetID                 string                 `json:"setId,omitempty"`
}

ClientMutualAuthentication specifies the trust chain that is used to verify client certificates and some configuration options

type Contact

type Contact struct {
	AddressLineOne   string `json:"addressLineOne,omitempty"`
	AddressLineTwo   string `json:"addressLineTwo,omitempty"`
	City             string `json:"city,omitempty"`
	Country          string `json:"country,omitempty"`
	Email            string `json:"email,omitempty"`
	FirstName        string `json:"firstName,omitempty"`
	LastName         string `json:"lastName,omitempty"`
	OrganizationName string `json:"organizationName,omitempty"`
	Phone            string `json:"phone,omitempty"`
	PostalCode       string `json:"postalCode,omitempty"`
	Region           string `json:"region,omitempty"`
	Title            string `json:"title,omitempty"`
}

Contact contains contact information

type CreateEnrollmentRequest

type CreateEnrollmentRequest struct {
	Enrollment
	ContractID       string
	DeployNotAfter   string
	DeployNotBefore  string
	AllowDuplicateCN bool
}

CreateEnrollmentRequest contains request body and path parameters used to create an enrollment

func (CreateEnrollmentRequest) Validate

func (e CreateEnrollmentRequest) Validate() error

Validate performs validation on CreateEnrollmentRequest

type CreateEnrollmentResponse

type CreateEnrollmentResponse struct {
	ID         int
	Enrollment string   `json:"enrollment"`
	Changes    []string `json:"changes"`
}

CreateEnrollmentResponse contains response body returned after successful enrollment creation

type DNSNameSettings

type DNSNameSettings struct {
	CloneDNSNames bool     `json:"cloneDnsNames"`
	DNSNames      []string `json:"dnsNames,omitempty"`
}

DNSNameSettings contain DNS name setting in given network configuration

type DV

type DV struct {
	Challenges         []Challenges `json:"challenges"`
	Domain             string       `json:"domain"`
	Error              string       `json:"error"`
	Expires            string       `json:"expires"`
	RequestTimestamp   string       `json:"requestTimestamp"`
	Status             string       `json:"status"`
	ValidatedTimestamp string       `json:"validatedTimestamp"`
	ValidationStatus   string       `json:"validationStatus"`
}

DV is a Domain Validation entity

type DVArray

type DVArray struct {
	DV []DV `json:"dv"`
}

DVArray is an array of DV objects

type DVChallenges

type DVChallenges interface {
	// GetChangeLetsEncryptChallenges gets detailed information about Domain Validation challenges
	//
	// See: https://developer.akamai.com/api/core_features/certificate_provisioning_system/v2.html#getallowedinputtypeforinfo
	GetChangeLetsEncryptChallenges(context.Context, GetChangeRequest) (*DVArray, error)

	// AcknowledgeDVChallenges sends acknowledgement request to CPS informing that the validation is completed
	//
	// See: https://developer.akamai.com/api/core_features/certificate_provisioning_system/v2.html#acknowledgement
	AcknowledgeDVChallenges(context.Context, AcknowledgementRequest) error
}

DVChallenges is a CPS DV challenges API interface

type DeploymentSchedule

type DeploymentSchedule struct {
	NotAfter  string `json:"notAfter,omitempty"`
	NotBefore string `json:"notBefore,omitempty"`
}

DeploymentSchedule contains the schedule for when you want this change deploy

type Enrollment

type Enrollment struct {
	AdminContact                   *Contact              `json:"adminContact"`
	AutoRenewalStartTime           string                `json:"autoRenewalStartTime,omitempty"`
	CertificateChainType           string                `json:"certificateChainType,omitempty"`
	CertificateType                string                `json:"certificateType"`
	ChangeManagement               bool                  `json:"changeManagement"`
	CSR                            *CSR                  `json:"csr"`
	EnableMultiStackedCertificates bool                  `json:"enableMultiStackedCertificates"`
	Location                       string                `json:"location,omitempty"`
	MaxAllowedSanNames             int                   `json:"maxAllowedSanNames,omitempty"`
	MaxAllowedWildcardSanNames     int                   `json:"maxAllowedWildcardSanNames,omitempty"`
	NetworkConfiguration           *NetworkConfiguration `json:"networkConfiguration"`
	Org                            *Org                  `json:"org"`
	PendingChanges                 []string              `json:"pendingChanges,omitempty"`
	RA                             string                `json:"ra"`
	SignatureAlgorithm             string                `json:"signatureAlgorithm,omitempty"`
	TechContact                    *Contact              `json:"techContact"`
	ThirdParty                     *ThirdParty           `json:"thirdParty,omitempty"`
	ValidationType                 string                `json:"validationType"`
}

Enrollment represents a CPS enrollment object. It is used both as a request body for enrollment creation and response body while fetching enrollment by ID

func (Enrollment) Validate

func (e Enrollment) Validate() error

Validate performs validation on Enrollment

type Enrollments

Enrollments is a CPS enrollments API interface

type Error

type Error struct {
	Type          string          `json:"type"`
	Title         string          `json:"title"`
	Detail        string          `json:"detail"`
	Instance      string          `json:"instance,omitempty"`
	BehaviorName  string          `json:"behaviorName,omitempty"`
	ErrorLocation string          `json:"errorLocation,omitempty"`
	StatusCode    int             `json:"statusCode,omitempty"`
	Errors        json.RawMessage `json:"errors,omitempty"`
	Warnings      json.RawMessage `json:"warnings,omitempty"`
}

Error is a cps error interface

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(target error) bool

Is handles error comparisons

type GetChangeRequest

type GetChangeRequest struct {
	EnrollmentID int
	ChangeID     int
}

GetChangeRequest contains params required to fetch a specific change (e.g. DV challenges) It is the same for all GET change requests

func (GetChangeRequest) Validate

func (c GetChangeRequest) Validate() error

Validate validates GetChangeRequest

type GetChangeStatusRequest

type GetChangeStatusRequest struct {
	EnrollmentID int
	ChangeID     int
}

GetChangeStatusRequest contains params required to perform GetChangeStatus

func (GetChangeStatusRequest) Validate

func (c GetChangeStatusRequest) Validate() error

Validate validates GetChangeStatusRequest

type GetEnrollmentRequest

type GetEnrollmentRequest struct {
	EnrollmentID int
}

GetEnrollmentRequest contains ID of an enrollment that is to be fetched with GetEnrollment

func (GetEnrollmentRequest) Validate

func (e GetEnrollmentRequest) Validate() error

Validate performs validation on GetEnrollmentRequest

type ListEnrollmentsRequest added in v2.15.0

type ListEnrollmentsRequest struct {
	ContractID string
}

ListEnrollmentsRequest contains Contract ID of enrollments that are to be fetched with ListEnrollments

func (ListEnrollmentsRequest) Validate added in v2.15.0

func (e ListEnrollmentsRequest) Validate() error

Validate performs validation on ListEnrollmentRequest

type ListEnrollmentsResponse added in v2.15.0

type ListEnrollmentsResponse struct {
	Enrollments []Enrollment `json:"enrollments"`
}

ListEnrollmentsResponse represents list of CPS enrollment objects under given contractId. It is used as a response body while fetching enrollments by contractId

type NetworkConfiguration

type NetworkConfiguration struct {
	ClientMutualAuthentication *ClientMutualAuthentication `json:"clientMutualAuthentication,omitempty"`
	DisallowedTLSVersions      []string                    `json:"disallowedTlsVersions,omitempty"`
	DNSNameSettings            *DNSNameSettings            `json:"dnsNameSettings,omitempty"`
	Geography                  string                      `json:"geography,omitempty"`
	MustHaveCiphers            string                      `json:"mustHaveCiphers,omitempty"`
	OCSPStapling               OCSPStapling                `json:"ocspStapling,omitempty"`
	PreferredCiphers           string                      `json:"preferredCiphers,omitempty"`
	QuicEnabled                bool                        `json:"quicEnabled"`
	SecureNetwork              string                      `json:"secureNetwork,omitempty"`
	SNIOnly                    bool                        `json:"sniOnly"`
}

NetworkConfiguration contains settings that specify any network information and TLS Metadata you want CPS to use to push the completed certificate to the network

func (NetworkConfiguration) Validate

func (n NetworkConfiguration) Validate() error

Validate performs validation on NetworkConfiguration

type OCSP

type OCSP struct {
	Enabled *bool `json:"enabled,omitempty"`
}

OCSP specifies whether you want to enable ocsp stapling for client certificates

type OCSPStapling

type OCSPStapling string

OCSPStapling is used to enable OCSP stapling for an enrollment

const (
	// OCSPStaplingOn parameter value
	OCSPStaplingOn OCSPStapling = "on"
	// OCSPStaplingOff parameter value
	OCSPStaplingOff OCSPStapling = "off"
	// OCSPStaplingNotSet parameter value
	OCSPStaplingNotSet OCSPStapling = "not-set"
)

type Option

type Option func(*cps)

Option defines a CPS option

type Org

type Org struct {
	AddressLineOne string `json:"addressLineOne,omitempty"`
	AddressLineTwo string `json:"addressLineTwo,omitempty"`
	City           string `json:"city,omitempty"`
	Country        string `json:"country,omitempty"`
	Name           string `json:"name,omitempty"`
	Phone          string `json:"phone,omitempty"`
	PostalCode     string `json:"postalCode,omitempty"`
	Region         string `json:"region,omitempty"`
}

Org represents organization information

type PreVerification

type PreVerification interface {
	// GetChangePreVerificationWarnings gets detailed information about Domain Validation challenges
	//
	// See: https://developer.akamai.com/api/core_features/certificate_provisioning_system/v2.html#getallowedinputtypeforinfo
	GetChangePreVerificationWarnings(ctx context.Context, params GetChangeRequest) (*PreVerificationWarnings, error)

	// AcknowledgePreVerificationWarnings sends acknowledgement request to CPS informing that the warnings should be ignored
	//
	// See: https://developer.akamai.com/api/core_features/certificate_provisioning_system/v2.html#acknowledgement
	AcknowledgePreVerificationWarnings(context.Context, AcknowledgementRequest) error
}

PreVerification is a CPS API enabling management of pre-verification-warnings

type PreVerificationWarnings

type PreVerificationWarnings struct {
	Warnings string `json:"warnings"`
}

PreVerificationWarnings is a response object containing all warnings encountered during enrollment pre-verification

type RemoveEnrollmentRequest

type RemoveEnrollmentRequest struct {
	EnrollmentID              int
	AllowCancelPendingChanges *bool
	DeployNotAfter            string
	DeployNotBefore           string
}

RemoveEnrollmentRequest contains parameters necessary to send a RemoveEnrollment request

func (RemoveEnrollmentRequest) Validate

func (e RemoveEnrollmentRequest) Validate() error

Validate performs validation on RemoveEnrollmentRequest

type RemoveEnrollmentResponse

type RemoveEnrollmentResponse struct {
	Enrollment string   `json:"enrollment"`
	Changes    []string `json:"changes"`
}

RemoveEnrollmentResponse contains response body returned after successful enrollment deletion

type StatusInfo

type StatusInfo struct {
	DeploymentSchedule *DeploymentSchedule `json:"deploymentSchedule"`
	Description        string              `json:"description"`
	Error              *StatusInfoError    `json:"error,omitempty"`
	State              string              `json:"state"`
	Status             string              `json:"status"`
}

StatusInfo contains he tstatus for this Change at this time

type StatusInfoError

type StatusInfoError struct {
	Code        string `json:"code"`
	Description string `json:"description"`
	Timestamp   string `json:"timestamp"`
}

StatusInfoError contains error information for this Change

type ThirdParty

type ThirdParty struct {
	ExcludeSANS bool `json:"excludeSans"`
}

ThirdParty specifies that you want to use a third party certificate

func (ThirdParty) Validate

func (t ThirdParty) Validate() error

Validate performs validation on ThirdParty

type UpdateChangeRequest

type UpdateChangeRequest struct {
	Certificate
	EnrollmentID          int
	ChangeID              int
	AllowedInputTypeParam AllowedInputType
}

UpdateChangeRequest contains params and body required to send UpdateChange request

func (UpdateChangeRequest) Validate

func (c UpdateChangeRequest) Validate() error

Validate validates UpdateChangeRequest

type UpdateChangeResponse

type UpdateChangeResponse struct {
	Change string `json:"change"`
}

UpdateChangeResponse is a response object returned from UpdateChange request

type UpdateEnrollmentRequest

type UpdateEnrollmentRequest struct {
	Enrollment
	EnrollmentID              int
	AllowCancelPendingChanges *bool
	AllowStagingBypass        *bool
	DeployNotAfter            string
	DeployNotBefore           string
	ForceRenewal              *bool
	RenewalDateCheckOverride  *bool
}

UpdateEnrollmentRequest contains request body and path parameters used to update an enrollment

func (UpdateEnrollmentRequest) Validate

func (e UpdateEnrollmentRequest) Validate() error

Validate performs validation on UpdateEnrollmentRequest

type UpdateEnrollmentResponse

type UpdateEnrollmentResponse struct {
	ID         int
	Enrollment string   `json:"enrollment"`
	Changes    []string `json:"changes"`
}

UpdateEnrollmentResponse contains response body returned after successful enrollment update

type ValidationRecords

type ValidationRecords struct {
	Authorities []string `json:"authorities"`
	Hostname    string   `json:"hostname"`
	Port        string   `json:"port"`
	ResolvedIP  []string `json:"resolvedIp"`
	TriedIP     string   `json:"triedIp"`
	URL         string   `json:"url"`
	UsedIP      string   `json:"usedIp"`
}

ValidationRecords represents validation attempt

Jump to

Keyboard shortcuts

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