Documentation
¶
Overview ¶
Package apiclient/provisioning implements the interaction model described in https://github.com/veraison/veraison/tree/main/docs/api/endorsement-provisioning
Submit ¶
The whole API client exchange is handled via a single invocation of the Run() method.
The user creates a SubmitConfig object supplying the URL of the /submit endpoint:
cfg := SubmitConfig{
SubmitURI: "http://veraison.example/endorsement-provisioning/v1/submit",
}
The user can also supply a custom Client object, for example to appropriately configure the underlying TLS transport:
cfg.Client = &Client{
HTTPClient: http.Client{
Transport: myTLSConfig,
}
}
The user can also request to explicitly delete the session resource at the server instead of letting it expire:
cfg.DeleteSession = true
Then the Run method is invoked on the instantiated SubmitConfig object to trigger the protocol FSM, hiding any details about the synchronus / async nature of the underlying exchange. The user must supply the byte buffer containing the serialized endorsement, and the associated media type:
err := cfg.Run(corimBuf, "application/corim+cbor")
On success err is nil.
Index ¶
- type SubmitConfig
- func (cfg SubmitConfig) Run(endorsement []byte, mediaType string) error
- func (cfg *SubmitConfig) SetAuth(a auth.IAuthenticator)
- func (cfg *SubmitConfig) SetCerts(paths []string)
- func (cfg *SubmitConfig) SetClient(client *common.Client) error
- func (cfg *SubmitConfig) SetDeleteSession(session bool)
- func (cfg *SubmitConfig) SetIsInsecure(val bool)
- func (cfg *SubmitConfig) SetSubmitURI(uri string) error
- type SubmitSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SubmitConfig ¶
type SubmitConfig struct {
CACerts []string // paths to CA certs to be used in addition to system certs for TLS connections
Client *common.Client // HTTP(s) client connection configuration
SubmitURI string // URI of the /submit endpoint
Auth auth.IAuthenticator // when set, Auth supplies the Authorization header for requests
DeleteSession bool // explicitly DELETE the session object after we are done
UseTLS bool // use TLS for server connections
IsInsecure bool // allow insecure server connections (only matters when UseTLS is true)
}
SubmitConfig holds the context of an endorsement submission API session
func (SubmitConfig) Run ¶
func (cfg SubmitConfig) Run(endorsement []byte, mediaType string) error
Run implements the endorsement submission API. If the session does not complete synchronously, this call will block until either the session state moves out of the processing state, or the MaxAttempts*PollPeriod threshold is hit.
func (*SubmitConfig) SetAuth ¶ added in v0.2.0
func (cfg *SubmitConfig) SetAuth(a auth.IAuthenticator)
SetAuth sets the IAuthenticator that will be used
func (*SubmitConfig) SetCerts ¶ added in v0.3.0
func (cfg *SubmitConfig) SetCerts(paths []string)
SetCerts sets the CACerts parameter to the specified paths
func (*SubmitConfig) SetClient ¶ added in v0.0.2
func (cfg *SubmitConfig) SetClient(client *common.Client) error
SetClient sets the HTTP(s) client connection configuration
func (*SubmitConfig) SetDeleteSession ¶ added in v0.0.2
func (cfg *SubmitConfig) SetDeleteSession(session bool)
SetDeleteSession instruct to DELETE the session object after it is complete
func (*SubmitConfig) SetIsInsecure ¶ added in v0.3.0
func (cfg *SubmitConfig) SetIsInsecure(val bool)
SetIsInsecure sets the IsInsecure parameter using the supplied val
func (*SubmitConfig) SetSubmitURI ¶ added in v0.0.2
func (cfg *SubmitConfig) SetSubmitURI(uri string) error
SetSubmitURI sets the URI Parameter
type SubmitSession ¶
type SubmitSession struct {
Status string `json:"status"`
Expiry string `json:"expiry"`
FailureReason *string `json:"failure-reason"`
}
SubmitSession models the application/vnd.veraison.provisioning-session+json media type