digicert

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Stringify

func Stringify(message interface{}) string

Types

type APIError

type APIError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type AccessRole

type AccessRole struct {
	ID   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

type Certificate

type Certificate struct {
	ID                int      `json:"id,omitempty"`
	CommonName        string   `json:"common_name"`
	DNSNames          []string `json:"dns_names,omitempty"`
	CSR               string   `json:"csr"`
	OrganizationUnits []string `json:"organization_units,omitempty"`
	ServerPlatform    struct {
		ID int `json:"id"`
	} `json:"server_platform,omitempty"`
	SignatureHash string `json:"signature_hash"`
	ProfileOption string `json:"profile_option,omitempty"`
	Thumbprint    string `json:"thumbprint,omitempty"`
	SerialNumber  string `json:"serial_number,omitempty"`
}

func (Certificate) String

func (o Certificate) String() string

type CertificatesService

type CertificatesService service

func (*CertificatesService) GetPEMBundle

func (s *CertificatesService) GetPEMBundle(cert_id int) (*PEMBundle, *Response, error)

type Client

type Client struct {
	BaseURL *url.URL

	Users         *UsersService
	Orders        *OrdersService
	Organizations *OrganizationsService
	Products      *ProductsService
	Certificates  *CertificatesService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(apiKey string, httpClient HTTPClient, apiURL string) (*Client, error)

func (*Client) CheckResponse

func (c *Client) CheckResponse(resp *http.Response) error

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

type Contact

type Contact struct {
	UserID             int    `json:"user_id,omitempty"`
	ContactType        string `json:"contact_type,omitempty"`
	FirstName          string `json:"first_name,omitempty"`
	LastName           string `json:"last_name,omitempty"`
	Email              string `json:"email,omitempty"`
	JobTitle           string `json:"job_title,omitempty"`
	Telephone          string `json:"telephone,omitempty"`
	TelephoneExtension string `json:"telephone_extension,omitempty"`
}

type Container

type Container struct {
	ID         int    `json:"id,omitempty"`
	PublicID   string `json:"public_id,omitempty"`
	Name       string `json:"name,omitempty"`
	ParentID   int    `json:"parent_id,omitempty"`
	TemplateID int    `json:"template_id,omitempty"`
}

type ContainersService

type ContainersService service

type DigicertClient

type DigicertClient interface {
	NewRequest(string, string, interface{}) (*http.Request, error)
	Do(*http.Request, interface{}) (*Response, error)
}

type ErrorResponse

type ErrorResponse struct {
	*http.Response
	Errors []APIError `json:"errors"`
	// contains filtered or unexported fields
}

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

type NewOrder

type NewOrder struct {
	Certificate                 Certificate     `json:"certificate"`
	RenewedThumbprint           string          `json:"renewed_thumbprint,omitempty"`
	ValidityYears               int             `json:"validity_years,omitempty"`
	ValidityDays                int             `json:"validity_days,omitempty"`
	CustomExpirationDate        string          `json:"custom_expiration_date,omitempty"`
	Comments                    string          `json:"comments,omitempty"`
	AutoRenew                   int             `json:"auto_renew,omitempty"`
	CustomRenewalMessage        string          `json:"custom_renewal_message,omitempty"`
	DisableRenewalNotifications bool            `json:"disable_renewal_notifications"`
	AdditionalEmails            []string        `json:"additional_emails,omitempty"`
	RenewalOrderID              int             `json:"renewal_order_id,omitempty"`
	PaymentMethod               string          `json:"payment_method,omitempty"`
	PaymentProfile              *PaymentProfile `json:"payment_profile,omitempty"`
	DCVMethod                   string          `json:"dcv_method,omitempty"`
	SkipApproval                bool            `json:"skip_approval"`
	DisableCT                   bool            `json:"disable_ct"`
	Organization                Organization    `json:"organization"`
	Container                   *Container      `json:"container,omitempty"`
}

NOTE I'm not sure there is really a compelling reason to have this struct. Its original intent was to try to address some of the inconsistent behavior with the Digicert API, but in the end I'm starting to lean toward to just using the Order struct.

func InitializeOrder

func InitializeOrder() *NewOrder

type Order

type Order struct {
	ID                          int          `json:"id"`
	Certificate                 Certificate  `json:"certificate,omitempty"`
	ValidityYears               int          `json:"validity_years"`
	ValidityDays                int          `json:"validity_days"`
	CustomExpirationDate        string       `json:"custom_expiration_date,omitempty"`
	Comments                    string       `json:"comments,omitempty"`
	AutoRenew                   int          `json:"auto_renew,omitempty"`
	DisableRenewalNotifications bool         `json:"disable_renewal_notifications,omitempty"`
	RenewedOrderID              int          `json:"renewed_order_id,omitempty"`
	RenewalOfOrderID            int          `json:"renewal_of_order_id,omitempty"`
	PaymentMethod               string       `json:"payment_method,omitempty"`
	Status                      string       `json:"status,omitempty"`
	Organization                Organization `json:"organization"`
	OrganizationContact         *Contact     `json:"organization_contact,omitempty"`
	TechnicalContact            *Contact     `json:"technical_contact,omitempty"`
	// These two fields are perhaps candidates for their own structs. The
	// Digicert API is not consistent in what properties it returns!
	Requests     []*OrderRequest `json:"requests,omitempty"`
	CertficateID int             `json:"certificate_id,omitempty"`
	Product      Product
	Container    Container `json:"container,omitempty"`
}

func (Order) String

func (o Order) String() string

type OrderRequest

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

type OrdersService

type OrdersService service

func (*OrdersService) Create

func (s *OrdersService) Create(orderReq *NewOrder, orderType string) (*Order, *Response, error)

func (*OrdersService) CreateStandard

func (s *OrdersService) CreateStandard(orderReq *NewOrder) (*Order, *Response, error)

func (*OrdersService) CreateWildcard

func (s *OrdersService) CreateWildcard(orderReq *NewOrder) (*Order, *Response, error)

func (*OrdersService) Get

func (s *OrdersService) Get(order_id int) (*Order, *Response, error)

func (*OrdersService) List

func (s *OrdersService) List() ([]*Order, *Response, error)

type Organization

type Organization struct {
	ID          int        `json:"id,omitempty"` // NOTE: this value sometimes come back as as string?
	Status      string     `json:"status,omitempty"`
	Name        string     `json:"name,omitempty"`
	AssumedName string     `json:"assumed_name,omitempty"`
	DisplayName string     `json:"display_name,omitempty"`
	IsActive    bool       `json:"is_active,omitempty"`
	Address     string     `json:"address,omitempty"`
	Address2    string     `json:"address2,omitempty"`
	Zip         string     `json:"zip,omitempty"`
	City        string     `json:"city,omitempty"`
	State       string     `json:"state,omitempty"`
	Country     string     `json:"country,omitempty"`
	Telephone   string     `json:"telephone,omitempty"`
	Container   *Container `json:"container,omitempty"`
	Validations []struct {
		Type           string    `json:"type"`
		Name           string    `json:"name"`
		Description    string    `json:"description"`
		DateCreated    time.Time `json:"date_created,omitempty"`
		ValidatedUntil time.Time `json:"validated_until,omitempty"`
		Status         string    `json:"status"`
		VerifiedUsers  []struct {
			ID        int    `json:"id"`
			FirstName string `json:"first_name"`
			LastName  string `json:"last_name"`
		} `json:"verified_users,omitempty"`
	} `json:"validations,omitempty"`
	EvApprovers []struct {
		ID        int    `json:"id"`
		FirstName string `json:"first_name"`
		LastName  string `json:"last_name"`
	} `json:"ev_approvers,omitempty"`
	Contacts []*Contact `json:"contacts,omitempty"`
}

type OrganizationsService

type OrganizationsService service

func (*OrganizationsService) Get

func (s *OrganizationsService) Get(org_id int) (*Organization, *Response, error)

func (*OrganizationsService) List

func (s *OrganizationsService) List() (*[]Organization, *Response, error)

type PEM

type PEM struct {
	SubjectCommonName string `json:"subject_common_name"`
	PEM               string `json:"pem"`
}

type PEMBundle

type PEMBundle struct {
	PEMs []*PEM `json:"intermediates"`
}

type PaymentProfile

type PaymentProfile struct {
	ID           int    `json:"id,omitempty"`
	IsDefault    bool   `json:"is_default"`
	Status       string `json:"status,omitempty"`
	BillingEmail string `json:"billing_email,omitempty"`
}

type Product

type Product struct {
	GroupName            string
	NameID               string `json:"name_id"`
	Name                 string
	Type                 string
	AllowedContainerIDs  []int `json:"allowed_container_ids"`
	AllowedValidityYears []int `json:"allowed_validity_years"`
}

type ProductsService

type ProductsService service

func (*ProductsService) List

func (s *ProductsService) List() ([]*Product, *Response, error)

type Response

type Response struct {
	*http.Response
}

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp represents a time that can be unmarshalled from a JSON string formatted as either an RFC3339 or Unix timestamp. This is necessary for some fields since the GitHub API is inconsistent in how it represents times. All exported methods of time.Time can be called on Timestamp.

func (Timestamp) Equal

func (t Timestamp) Equal(u Timestamp) bool

Equal reports whether t and u are equal based on time.Equal

func (Timestamp) String

func (t Timestamp) String() string

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.

type User

type User struct {
	ID                      int          `json:"id,omitempty"`
	Username                string       `json:"username,omitempty"`
	AccountID               int          `json:"account_id,omitempty"` // CertCentral Account ID
	FirstName               string       `json:"first_name,omitempty"`
	LastName                string       `json:"last_name,omitempty"`
	Email                   string       `json:"email,omitempty"`
	JobTitle                string       `json:"job_title,omitempty"`
	Telephone               string       `json:"telephone,omitempty"`
	Status                  string       `json:"status,omitempty"`
	LastLoginDate           string       `json:"last_login_date,omitempty"`
	IsCertCentral           bool         `json:"is_cert_central,omitempty"`
	IsEnterprise            bool         `json:"is_enterprise,omitempty"`
	IsSAMLSSOOnly           bool         `json:"is_saml_sso_only,omitempty"`
	Type                    string       `json:"type,omitempty"`
	HasContainerAssignments bool         `json:"has_container_assignments,omitempty"`
	AccessRoles             []AccessRole `json:"access_roles,omitempty"`
	Container               *Container   `json:"container,omitempty"`
	ContainerIDAssignments  []int        `json:"container_id_assignments,omitempty"`
}

func (User) String

func (u User) String() string

type UsersService

type UsersService service

func (*UsersService) Create

func (s *UsersService) Create(user *User) (*User, *Response, error)

func (*UsersService) Delete

func (s *UsersService) Delete(user *User) (*User, *Response, error)

func (*UsersService) Edit

func (s *UsersService) Edit(user *User) (*User, *Response, error)

func (*UsersService) Get

func (s *UsersService) Get(id int) (*User, *Response, error)

func (*UsersService) GetMe

func (s *UsersService) GetMe() (*User, *Response, error)

func (*UsersService) List

func (s *UsersService) List() ([]*User, *Response, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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