Skip to content

Commit

Permalink
Make RPCOptions fields pointers:
Browse files Browse the repository at this point in the history
This allows for the fields to not be
included when nil is various applications.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
  • Loading branch information
jacobweinstock committed Sep 28, 2023
1 parent eaffeb8 commit 71a983d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
8 changes: 4 additions & 4 deletions api/v1alpha1/provider_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ type RPCOptions struct {
LogNotificationsDisabled bool `json:"logNotificationsDisabled"`
// Request is the options used to create the rpc HTTP request.
// +optional
Request RequestOpts `json:"request"`
Request *RequestOpts `json:"request"`
// Signature is the options used for adding an HMAC signature to an HTTP request.
// +optional
Signature SignatureOpts `json:"signature"`
Signature *SignatureOpts `json:"signature"`
// HMAC is the options used to create a HMAC signature.
// +optional
HMAC HMACOpts `json:"hmac"`
HMAC *HMACOpts `json:"hmac"`
// Experimental options.
// +optional
Experimental ExperimentalOpts `json:"experimental"`
Experimental *ExperimentalOpts `json:"experimental"`
}

// RequestOpts are the options used when creating an HTTP request.
Expand Down
24 changes: 20 additions & 4 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion controller/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func createMachineWithRPC(secret *corev1.Secret) *v1alpha1.Machine {
ProviderOptions: &v1alpha1.ProviderOptions{
RPC: &v1alpha1.RPCOptions{
ConsumerURL: "http://127.0.0.1:7777",
HMAC: v1alpha1.HMACOpts{
HMAC: &v1alpha1.HMACOpts{
Secrets: v1alpha1.HMACSecrets{
"sha256": []corev1.SecretReference{
{
Expand Down
2 changes: 1 addition & 1 deletion controller/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func createTaskWithRPC(name string, action v1alpha1.Action, secret *corev1.Secre
ProviderOptions: &v1alpha1.ProviderOptions{
RPC: &v1alpha1.RPCOptions{
ConsumerURL: "http://127.0.0.1:7777",
HMAC: v1alpha1.HMACOpts{
HMAC: &v1alpha1.HMACOpts{
Secrets: v1alpha1.HMACSecrets{
"sha256": []corev1.SecretReference{
{
Expand Down

0 comments on commit 71a983d

Please sign in to comment.