module

package
v0.0.0-...-bb2f907 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CaCertAlreadyExists             string = "caCert already exists"
	CaCertNotFound                  string = "caCert not found"
	CaCertClusterGroupAlreadyExists string = "caCert cluster group already exists"
	CaCertClusterGroupNotFound      string = "caCert cluster group not found"
	CaCertLogicalCloudAlreadyExists string = "caCert logical cloud already exists"
	CaCertLogicalCloudNotFound      string = "caCert logical cloud not found"
	KeyNotFound                     string = "certificate key not found"
)

caCert errors

Variables

This section is empty.

Functions

func AddInstruction

func AddInstruction(ctx context.Context, appContext appcontext.AppContext, handle interface{}, resOrder []string) error

AddInstruction add resource order instruction to the appContext

func AddResource

func AddResource(ctx context.Context, appContext appcontext.AppContext, resource, handle interface{}, name string) error

AddResource add resource to the appContext

func GetAppContextStatus

func GetAppContextStatus(ctx context.Context, key interface{}) (string, appcontext.StatusValue, error)

GetAppContextStatus returns the appContextID

func GetClusters

func GetClusters(ctx context.Context, group ClusterGroup, project, logicalcloud string) (clusters []string, err error)

GetClusters returns the list of clusters based on the logicalcloud and scope

func GetValue

func GetValue(val interface{}) (string, error)

GetKeyValue returns the value of a key from a json encoded struct

func ResourceName

func ResourceName(name, kind string) string

ResourceName generates the name for a given resource

func RetrieveAppContext

func RetrieveAppContext(stream readynotify.ReadyNotify_AlertClient, client readynotify.ReadyNotifyClient) string

RetrieveAppContext retrieve the appContext from the stream

Types

type Algorithm

type Algorithm struct {
	PublicKeyAlgorithm string `json:"publicKeyAlgorithm,omitempty"`
	SignatureAlgorithm string `json:"signatureAlgorithm,omitempty"`
}

Algorithm holds the caCert algorithm details

type CaCert

type CaCert struct {
	MetaData types.Metadata `json:"metadata"`
	Spec     CaCertSpec     `json:"spec"`
}

CaCert holds the caCert details

type CaCertAppContext

type CaCertAppContext struct {
	AppContext appcontext.AppContext
	AppHandle  interface{}
	AppName    string
	ClientName string
	ContextID  string
	Resorder   []string
}

CaCertAppContext holds the caCert appCtx details

func (*CaCertAppContext) CallRsyncInstall

func (certAppContext *CaCertAppContext) CallRsyncInstall(ctx context.Context) error

CallRsyncInstall invokes the resource synchronizer to deploy the resources on the edge cluster

func (*CaCertAppContext) CallRsyncUninstall

func (certAppContext *CaCertAppContext) CallRsyncUninstall(ctx context.Context) error

CallRsyncUninstall invokes the resource synchronizer to delete the resources from the edge cluster

func (*CaCertAppContext) InitAppContext

func (certAppContext *CaCertAppContext) InitAppContext(ctx context.Context) error

InitAppContext initializes a new caCert appContext

type CaCertClient

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

CaCertClient holds the client properties

func NewCaCertClient

func NewCaCertClient(dbKey interface{}) *CaCertClient

NewCertClients returns an instance of the CaCertClient which implements the Manager

func (*CaCertClient) CreateCert

func (c *CaCertClient) CreateCert(ctx context.Context, cert CaCert, failIfExists bool) (CaCert, bool, error)

CreateCert creates a caCert

func (*CaCertClient) DeleteCert

func (c *CaCertClient) DeleteCert(ctx context.Context) error

DeleteCert deletes a caCert

func (*CaCertClient) GetAllCert

func (c *CaCertClient) GetAllCert(ctx context.Context) ([]CaCert, error)

GetAllCert

func (*CaCertClient) GetCert

func (c *CaCertClient) GetCert(ctx context.Context) (CaCert, error)

GetCert returns the caCert

func (*CaCertClient) UpdateCert

func (c *CaCertClient) UpdateCert(ctx context.Context, cert CaCert) error

UpdateCert update the caCert

func (*CaCertClient) VerifyStateBeforeDelete

func (c *CaCertClient) VerifyStateBeforeDelete(ctx context.Context, cert, lifecycle string) error

VerifyStateBeforeDelete verifies a caCert can be deleted or not

func (*CaCertClient) VerifyStateBeforeUpdate

func (c *CaCertClient) VerifyStateBeforeUpdate(ctx context.Context, cert, lifecycle string) error

VerifyStateBeforeUpdate verifies a caCert can be updated or not

type CaCertManager

type CaCertManager interface {
	CreateCert(ctx context.Context, cert CaCert, failIfExists bool) (CaCert, bool, error)
	DeleteCert(ctx context.Context) error
	GetAllCert(ctx context.Context) ([]CaCert, error)
	GetCert(ctx context.Context) (CaCert, error)
}

CaCertManager exposes all the caCert functionalities

type CaCertSpec

type CaCertSpec struct {
	Certificate            Certificate            `json:"certificate" yaml:"certificate"`       // represent the certificate info
	CertificateSigningInfo CertificateSigningInfo `json:"csrInfo" yaml:"csrInfo"`               // represent the certificate signining request(CSR) info
	Duration               string                 `json:"duration,omitempty"`                   // duration of the certificate
	IsCA                   bool                   `json:"isCA,omitempty" yaml:"isCA,omitempty"` // specifies the cert is a CA or not
	IssuerRef              certissuer.IssuerRef   `json:"issuerRef"`                            // the details of the issuer for signing the certificate request
	IssuingCluster         IssuingClusterInfo     `json:"issuingCluster"`                       // the details of the issuing cluster
}

CertSpec holds the caCert signing details

type CaCertStatus

type CaCertStatus struct {
	ClusterProvider           string `json:"clusterProvider,omitempty"`
	Project                   string `json:"project,omitempty"`
	status.CaCertStatusResult `json:",inline"`
}

CaCertStatus holds the caCert status details

type Certificate

type Certificate struct {
	CommonName string `json:"commonName,omitempty"` // common name to be used on the certificate
}

Certificate holds the certificate details

type CertificateSigningInfo

type CertificateSigningInfo struct {
	KeySize        int       `json:"keySize,omitempty"`
	Version        int       `json:"version,omitempty"`
	DNSNames       []string  `json:"dnsNames,omitempty"`
	EmailAddresses []string  `json:"emailAddresses,omitempty"`
	KeyUsages      []string  `json:"keyUsages,omitempty"` // certificate usages
	Algorithm      Algorithm `json:"algorithm"`
	Subject        Subject   `json:"subject"`
}

CertificateSigningInfo holds the csr data

type ClusterGroup

type ClusterGroup struct {
	MetaData types.Metadata   `json:"metadata"`
	Spec     ClusterGroupSpec `json:"spec"`
}

ClusterGroup holds the caCert clusterGroup details

type ClusterGroupClient

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

ClusterGroupClient holds the client properties

func NewClusterGroupClient

func NewClusterGroupClient(dbKey interface{}) *ClusterGroupClient

NewClusterGroupClient returns an instance of the ClusterGroupClient which implements the Manager

func (*ClusterGroupClient) CreateClusterGroup

func (c *ClusterGroupClient) CreateClusterGroup(ctx context.Context, group ClusterGroup, failIfExists bool) (ClusterGroup, bool, error)

CreateClusterGroup creates a clusterGroup

func (*ClusterGroupClient) DeleteClusterGroup

func (c *ClusterGroupClient) DeleteClusterGroup(ctx context.Context) error

DeleteClusterGroup deletes a clusterGroup

func (*ClusterGroupClient) GetAllClusterGroups

func (c *ClusterGroupClient) GetAllClusterGroups(ctx context.Context) ([]ClusterGroup, error)

GetAllClusterGroups returns all the clusterGroup

func (*ClusterGroupClient) GetClusterGroup

func (c *ClusterGroupClient) GetClusterGroup(ctx context.Context) (ClusterGroup, error)

GetClusterGroup returns the clusterGroup

type ClusterGroupManager

type ClusterGroupManager interface {
	CreateClusterGroup(ctx context.Context, cluster ClusterGroup, failIfExists bool) (ClusterGroup, bool, error)
	DeleteClusterGroup(ctx context.Context) error
	GetAllClusterGroups(ctx context.Context) ([]ClusterGroup, error)
	GetClusterGroup(ctx context.Context) (ClusterGroup, error)
}

ClusterGroupManager exposes all the clusterGroup functionalities

type ClusterGroupSpec

type ClusterGroupSpec struct {
	Label    string `json:"label,omitempty"`   // define the set of cluster(s)
	Cluster  string `json:"cluster,omitempty"` // define the specific cluster
	Provider string `json:"clusterProvider"`   // define the clusterProvider
	Scope    string `json:"scope"`             // specifies which field should be used to identify the cluster(s)
}

ClusterGroupSpec holds the cluster details

type DBKey

type DBKey struct {
	Cert            string `json:"caCert"`
	Cluster         string `json:"caCertCluster"`
	ClusterProvider string `json:"caCertClusterProvider"`
	ContextID       string `json:"caCertContextID"`
}

DBKey represents the resources associated with a private key

type IssuingClusterInfo

type IssuingClusterInfo struct {
	Cluster         string `json:"cluster"`         // name of the cluster
	ClusterProvider string `json:"clusterProvider"` // name of the clusterProvider
}

IssuingClusterInfo holds the certificate issuing cluster details

type Key

type Key struct {
	Name string
	Val  string `encrypted:""`
}

Key holds the private keydetails

type KeyClient

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

KeyClient holds the client properties

func NewKeyClient

func NewKeyClient(dbKey interface{}) *KeyClient

NewKeyClient returns an instance of the KeyClient which implements the Manager

func (*KeyClient) Delete

func (c *KeyClient) Delete(ctx context.Context) error

Delete key from mongo

func (*KeyClient) Get

func (c *KeyClient) Get(ctx context.Context) (Key, error)

Get key from mongo

func (*KeyClient) Save

func (c *KeyClient) Save(ctx context.Context, pk Key) error

Save key in the mongo

type KeyManager

type KeyManager interface {
	Save(ctx context.Context, pk string) error
	Delete(ctx context.Context, key interface{}) error
	Get(ctx context.Context, key interface{}) (CaCert, error)
}

KeyManager exposes all the private key functionalities

type Locale

type Locale struct {
	Country       []string `json:"country,omitempty"`
	Locality      []string `json:"locality,omitempty"`
	PostalCode    []string `json:"postalCode,omitempty"`
	Province      []string `json:"province,omitempty"`
	StreetAddress []string `json:"streetAddress,omitempty"`
}

Locale holds the caCert location details

type Names

type Names struct {
	CommonNamePrefix string `json:"commonNamePrefix"`
	CommonName       string
}

Names holds the caCert name details

type Organization

type Organization struct {
	Names []string `json:"names,omitempty"`
	Units []string `json:"units,omitempty"`
}

Organization holds the caCert organization details

type StateClient

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

StateClient holds the client properties

func NewStateClient

func NewStateClient(dbKey interface{}) *StateClient

NewStateClient returns an instance of the StateClient which implements the Manager

func (*StateClient) Create

func (c *StateClient) Create(ctx context.Context, contextID string) error

Create the stateInfo resource in mongo

func (*StateClient) Delete

func (c *StateClient) Delete(ctx context.Context) error

Delete the stateInfo

func (*StateClient) Get

Get the stateInfo from mongo

func (*StateClient) Update

func (c *StateClient) Update(ctx context.Context, newState state.StateValue,
	contextID string, createIfNotExists bool) error

Update the stateInfo

func (*StateClient) VerifyState

func (sc *StateClient) VerifyState(ctx context.Context, event common.EmcoEvent) (string, error)

VerifyState verifies the enrollment\distribution state

type StateManager

type StateManager interface {
	Create(ctx context.Context, contextID string) error
	Get(ctx context.Context) (state.StateInfo, error)
	Update(ctx context.Context, newState state.StateValue, contextID string, createIfNotExists bool) error
}

StateManager exposes all the caCert state functionalities

type Subject

type Subject struct {
	Locale       Locale       `json:"locale"`
	Names        Names        `json:"names"`
	Organization Organization `json:"organization"`
}

Subject holds the caCert subject details

Jump to

Keyboard shortcuts

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