Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update spec.go
  • Loading branch information
bbernays committed Dec 23, 2022
commit e98d6a4e25b6fac5f4d044d540553346fcedb21d
33 changes: 27 additions & 6 deletions plugins/source/aws/client/spec.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package client

import "fmt"

type Account struct {
ID string `json:"id"`
AccountName string `json:"account_name,omitempty"`
Expand All @@ -23,10 +25,29 @@ type AwsOrg struct {
}

type Spec struct {
Regions []string `json:"regions,omitempty"`
Accounts []Account `json:"accounts"`
Organization *AwsOrg `json:"org"`
AWSDebug bool `json:"aws_debug,omitempty"`
MaxRetries *int `json:"max_retries,omitempty"`
MaxBackoff *int `json:"max_backoff,omitempty"`
Regions []string `json:"regions,omitempty"`
Accounts []Account `json:"accounts"`
Organization *AwsOrg `json:"org"`
AWSDebug bool `json:"aws_debug,omitempty"`
MaxRetries *int `json:"max_retries,omitempty"`
MaxBackoff *int `json:"max_backoff,omitempty"`
EndpointURL string `json:"custom_endpoint_url,omitempty"`
HostnameImmutable *bool `json:"custom_endpoint_hostname_immutable,omitempty"`
PartitionID string `json:"custom_endpoint_partition_id,omitempty"`
SigningRegion string `json:"custom_endpoint_signing_region,omitempty"`
}

func (s *Spec) Validate() error {
if s.EndpointURL != "" {
if s.PartitionID == "" {
return fmt.Errorf("custom_endpoint_partition_id is required when custom_endpoint_url is set")
}
if s.SigningRegion == "" {
return fmt.Errorf("custom_endpoint_signing_region is required when custom_endpoint_url is set")
}
if s.HostnameImmutable == nil {
return fmt.Errorf("custom_endpoint_hostname_immutable is required when custom_endpoint_url is set")
}
}
return nil
}