-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from jacobweinstock/provider-opts
Update API with per provider opts:
- Loading branch information
Showing
11 changed files
with
531 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
"net/http" | ||
|
||
corev1 "k8s.io/api/core/v1" | ||
) | ||
|
||
// RedfishOptions contains the redfish provider specific options. | ||
type RedfishOptions struct { | ||
// Port that redfish will use for calls. | ||
Port int `json:"port"` | ||
} | ||
|
||
// IPMITOOLOptions contains the ipmitool provider specific options. | ||
type IPMITOOLOptions struct { | ||
// Port that ipmitool will use for calls. | ||
Port int `json:"port"` | ||
// CipherSuite that ipmitool will use for calls. | ||
CipherSuite string `json:"cipherSuite"` | ||
} | ||
|
||
// IntelAMTOptions contains the intelAMT provider specific options. | ||
type IntelAMTOptions struct { | ||
// Port that intelAMT will use for calls. | ||
Port int `json:"port"` | ||
} | ||
|
||
// HMACAlgorithm is a type for HMAC algorithms. | ||
type HMACAlgorithm string | ||
|
||
// HMACSecrets holds per Algorithm slice secrets. | ||
// These secrets will be used to create HMAC signatures. | ||
type HMACSecrets map[HMACAlgorithm][]corev1.SecretReference | ||
|
||
// RPCOptions defines the configurable options to use when sending rpc notifications. | ||
type RPCOptions struct { | ||
// ConsumerURL is the URL where an rpc consumer/listener is running | ||
// and to which we will send and receive all notifications. | ||
ConsumerURL string `json:"consumerURL"` | ||
// LogNotificationsDisabled determines whether responses from rpc consumer/listeners will be logged or not. | ||
LogNotificationsDisabled bool `json:"logNotificationsDisabled"` | ||
// Request is the options used to create the rpc HTTP request. | ||
Request RequestOpts `json:"request"` | ||
// Signature is the options used for adding an HMAC signature to an HTTP request. | ||
Signature SignatureOpts `json:"signature"` | ||
// HMAC is the options used to create a HMAC signature. | ||
HMAC HMACOpts `json:"hmac"` | ||
// Experimental options. | ||
Experimental ExperimentalOpts `json:"experimental"` | ||
} | ||
|
||
// RequestOpts are the options used when creating an HTTP request. | ||
type RequestOpts struct { | ||
// HTTPContentType is the content type to use for the rpc request notification. | ||
HTTPContentType string `json:"httpContentType"` | ||
// HTTPMethod is the HTTP method to use for the rpc request notification. | ||
HTTPMethod string `json:"httpMethod"` | ||
// StaticHeaders are predefined headers that will be added to every request. | ||
StaticHeaders http.Header `json:"staticHeaders"` | ||
// TimestampFormat is the time format for the timestamp header. | ||
TimestampFormat string `json:"timestampFormat"` | ||
// TimestampHeader is the header name that should contain the timestamp. Example: X-BMCLIB-Timestamp | ||
TimestampHeader string `json:"timestampHeader"` | ||
} | ||
|
||
// SignatureOpts are the options used for adding an HMAC signature to an HTTP request. | ||
type SignatureOpts struct { | ||
// HeaderName is the header name that should contain the signature(s). Example: X-BMCLIB-Signature | ||
HeaderName string `json:"headerName"` | ||
// AppendAlgoToHeaderDisabled decides whether to append the algorithm to the signature header or not. | ||
// Example: X-BMCLIB-Signature becomes X-BMCLIB-Signature-256 | ||
// When set to true, a header will be added for each algorithm. Example: X-BMCLIB-Signature-256 and X-BMCLIB-Signature-512 | ||
AppendAlgoToHeaderDisabled bool `json:"appendAlgoToHeaderDisabled"` | ||
// IncludedPayloadHeaders are headers whose values will be included in the signature payload. Example: X-BMCLIB-My-Custom-Header | ||
// All headers will be deduplicated. | ||
IncludedPayloadHeaders []string `json:"includedPayloadHeaders"` | ||
} | ||
|
||
// HMACOpts are the options used to create an HMAC signature. | ||
type HMACOpts struct { | ||
// PrefixSigDisabled determines whether the algorithm will be prefixed to the signature. Example: sha256=abc123 | ||
PrefixSigDisabled bool `json:"prefixSigDisabled"` | ||
// Secrets are a map of algorithms to secrets used for signing. | ||
Secrets HMACSecrets `json:"secrets"` | ||
} | ||
|
||
// ExperimentalOpts are options we're still learning about and should be used carefully. | ||
type ExperimentalOpts struct { | ||
// CustomRequestPayload must be in json. | ||
CustomRequestPayload string `json:"customRequestPayload"` | ||
// DotPath is the path to the json object where the bmclib RequestPayload{} struct will be embedded. For example: object.data.body | ||
DotPath string `json:"dotPath"` | ||
} |
Oops, something went wrong.