acmgo

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2021 License: MIT Imports: 7 Imported by: 0

README

acmgo

acmgo is a simple package for using AWS Certificate Manager from applications implimented Golang.

Features

  • List Certificates
  • Get a Certificate
TODO
  • Publish Certificate
  • Delete Certificate

Example

package main

import (
	"fmt"

	"github.com/michimani/acmgo"
)

func main() {
	acmg, err := acmgo.NewACMgo("ap-northeast-1")
	if err != nil {
		fmt.Println(err.Error())
		return
	}

	certificates, err := acmgo.ListCertificates(acmg.Client)
	if err != nil {
		fmt.Println(err.Error())
	}

	for _, c := range certificates {
		fmt.Println(c.Arn)
	}
	return
}
$ go run main.go

arn:aws:acm:ap-northeast-1:000000000000:certificate/00000000-xxxx-xxxx-0000-xxxxxxxxxxxx
arn:aws:acm:ap-northeast-1:000000000000:certificate/00000001-xxxx-xxxx-0000-xxxxxxxxxxxx
arn:aws:acm:ap-northeast-1:000000000000:certificate/00000002-xxxx-xxxx-0000-xxxxxxxxxxxx
arn:aws:acm:ap-northeast-1:000000000000:certificate/00000003-xxxx-xxxx-0000-xxxxxxxxxxxx
arn:aws:acm:ap-northeast-1:000000000000:certificate/00000004-xxxx-xxxx-0000-xxxxxxxxxxxx

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteCertificate added in v0.3.0

func DeleteCertificate(api ACMDeleteCertificateAPI, arn string) error

DeleteCertificate returns an error if deleting the certificate fails.

func ListCertificateSummaries

func ListCertificateSummaries(api ACMListCertificatesAPI) ([]types.CertificateSummary, error)

ListCertificateSummaries returns a list of certificate summary.

Types

type ACMAPI

ACMAPI is an interface that defines ACM API.

type ACMDeleteCertificateAPI added in v0.3.0

type ACMDeleteCertificateAPI interface {
	DeleteCertificate(ctx context.Context, params *acm.DeleteCertificateInput, optFns ...func(*acm.Options)) (*acm.DeleteCertificateOutput, error)
}

ACMDeleteCertificateAPI is an interface that defines the set of ACM API operations required by the DeleteCertificate function.

type ACMDescribeCertificateAPI

type ACMDescribeCertificateAPI interface {
	DescribeCertificate(ctx context.Context, params *acm.DescribeCertificateInput, optFns ...func(*acm.Options)) (*acm.DescribeCertificateOutput, error)
}

ACMDescribeCertificateAPI is an interface that defines the set of ACM API operations required by the DescribeCertificate function.

type ACMListCertificatesAPI

type ACMListCertificatesAPI interface {
	ListCertificates(ctx context.Context, params *acm.ListCertificatesInput, optFns ...func(*acm.Options)) (*acm.ListCertificatesOutput, error)
}

ACMListCertificatesAPI is an interface that defines the set of ACM API operations required by the ListCertificates function.

type ACMgo

type ACMgo struct {
	Client *acm.Client
	Region string
}

ACMgo is a structure that wraps an ACM client.

func NewACMgo

func NewACMgo(region string) (*ACMgo, error)

NewACMgo returns a new ACMgo object.

type Certificate

type Certificate struct {
	Arn           string
	Region        string
	DomainName    string
	Type          types.CertificateType
	Status        types.CertificateStatus
	FailureReason types.FailureReason
}

Certificate is a structure that represents a Certificate.

func GetCertificate

func GetCertificate(api ACMDescribeCertificateAPI, arn string) (Certificate, error)

GetCertificate returns the details of the certificate.

func ListCertificates

func ListCertificates(api ACMAPI) ([]Certificate, error)

ListCertificates returns list of certificate.

type MockACMAPI added in v0.2.0

type MockACMAPI struct {
	DescribeCertificateAPI MockACMDescribeCertificateAPI
	ListCertificatesAPI    MockACMListCertificatesAPI
	DeleteCertificateAPI   MockACMDeleteCertificateAPI
}

MockACMAPI is a struct that represents an ACM client.

func GenerateMockACMAPI added in v0.2.0

func GenerateMockACMAPI(mockParams []MockParams) MockACMAPI

GenerateMockACMAPI return MockACMAPI.

func (MockACMAPI) DeleteCertificate added in v0.3.0

func (m MockACMAPI) DeleteCertificate(ctx context.Context, params *acm.DeleteCertificateInput, optFns ...func(*acm.Options)) (*acm.DeleteCertificateOutput, error)

DeleteCertificate returns a function that mock original of ACM DeleteCertificate.

func (MockACMAPI) DescribeCertificate added in v0.2.0

func (m MockACMAPI) DescribeCertificate(ctx context.Context, params *acm.DescribeCertificateInput, optFns ...func(*acm.Options)) (*acm.DescribeCertificateOutput, error)

DescribeCertificate returns a function that mock original of ACM DescribeCertificate.

func (MockACMAPI) ListCertificates added in v0.2.0

func (m MockACMAPI) ListCertificates(ctx context.Context, params *acm.ListCertificatesInput, optFns ...func(*acm.Options)) (*acm.ListCertificatesOutput, error)

ListCertificates returns a function that mock original of ACM ListCertificates.

type MockACMDeleteCertificateAPI added in v0.3.0

type MockACMDeleteCertificateAPI func(ctx context.Context, params *acm.DeleteCertificateInput, optFns ...func(*acm.Options)) (*acm.DeleteCertificateOutput, error)

MockACMDeleteCertificateAPI is a type that represents a function that mock ACM's DeleteCertificate.

func GenerateMockACMDeleteCertificateAPI added in v0.3.0

func GenerateMockACMDeleteCertificateAPI(MockParams []MockParams) MockACMDeleteCertificateAPI

GenerateMockACMDeleteCertificateAPI returns MockACMDeleteCertificateAPI

type MockACMDescribeCertificateAPI

type MockACMDescribeCertificateAPI func(ctx context.Context, params *acm.DescribeCertificateInput, optFns ...func(*acm.Options)) (*acm.DescribeCertificateOutput, error)

MockACMDescribeCertificateAPI is a type that represents a function that mock ACM's DescribeCertificate.

func GenerateMockACMDescribeCertificateAPI

func GenerateMockACMDescribeCertificateAPI(mockParams []MockParams) MockACMDescribeCertificateAPI

GenerateMockACMDescribeCertificateAPI returns MockACMDescribeCertificateAPI.

type MockACMListCertificatesAPI

type MockACMListCertificatesAPI func(ctx context.Context, params *acm.ListCertificatesInput, optFns ...func(*acm.Options)) (*acm.ListCertificatesOutput, error)

MockACMListCertificatesAPI is a type that represents a function that mock ACM's ListCertificates.

func GenerateMockACMListCertificatesAPI added in v0.2.0

func GenerateMockACMListCertificatesAPI(mockParams []MockParams) MockACMListCertificatesAPI

GenerateMockACMListCertificatesAPI returns MockACMDescribeCertificateAPI.

type MockParams added in v0.2.0

type MockParams struct {
	Arn             string
	DomainName      string
	Status          string
	CertificateType string
	FailureReason   string
	Count           int
}

MockParams is a structure with the elements needed to generate a mock.

Jump to

Keyboard shortcuts

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