Skip to content

Commit

Permalink
feat: update generated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot committed Oct 26, 2023
1 parent a1119e5 commit 27218ae
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions api/secret/v1alpha1/secret_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,39 @@ func (enum *Product) UnmarshalJSON(data []byte) error {
return nil
}

type SecretEphemeralAction string

const (
SecretEphemeralActionUnknownEphemeralAction = SecretEphemeralAction("unknown_ephemeral_action")
// After expiration, the secret and all its versions will be deleted.
SecretEphemeralActionDeleteSecret = SecretEphemeralAction("delete_secret")
// After expiration, all versions of the secret will be disabled.
SecretEphemeralActionDisableSecret = SecretEphemeralAction("disable_secret")
)

func (enum SecretEphemeralAction) String() string {
if enum == "" {
// return default value if empty
return "unknown_ephemeral_action"
}
return string(enum)
}

func (enum SecretEphemeralAction) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}

func (enum *SecretEphemeralAction) UnmarshalJSON(data []byte) error {
tmp := ""

if err := json.Unmarshal(data, &tmp); err != nil {
return err
}

*enum = SecretEphemeralAction(SecretEphemeralAction(tmp).String())
return nil
}

type SecretStatus string

const (
Expand Down Expand Up @@ -339,6 +372,16 @@ type Secret struct {
// Path: location of the secret in the directory structure.
Path string `json:"path"`

// ExpiresAt: (Optional.) Date on which the secret will be deleted or deactivated.
ExpiresAt *time.Time `json:"expires_at"`

// EphemeralAction: see `Secret.EphemeralAction` enum for description of values.
// Default value: unknown_ephemeral_action
EphemeralAction SecretEphemeralAction `json:"ephemeral_action"`

// IsEphemeral: returns `true` for secrets that are ephemeral.
IsEphemeral bool `json:"is_ephemeral"`

// Region: region of the secret.
Region scw.Region `json:"region"`
}
Expand Down Expand Up @@ -445,6 +488,13 @@ type CreateSecretRequest struct {

// Path: (Optional.) Location of the secret in the directory structure. If not specified, the path is `/`.
Path *string `json:"path,omitempty"`

// ExpiresAt: (Optional.) Date on which the secret will be deleted or deactivated.
ExpiresAt *time.Time `json:"expires_at,omitempty"`

// EphemeralAction: action to be taken when the secret expires.
// Default value: unknown_ephemeral_action
EphemeralAction SecretEphemeralAction `json:"ephemeral_action"`
}

// CreateSecretVersionRequest: create secret version request.
Expand Down Expand Up @@ -757,6 +807,9 @@ type ListSecretsRequest struct {

// Path: filter by path (optional).
Path *string `json:"-"`

// IsEphemeral: filter by ephemeral / not ephemeral (optional).
IsEphemeral *bool `json:"-"`
}

// ListSecretsResponse: list secrets response.
Expand Down Expand Up @@ -1104,6 +1157,7 @@ func (s *API) ListSecrets(req *ListSecretsRequest, opts ...scw.RequestOption) (*
parameter.AddToQuery(query, "name", req.Name)
parameter.AddToQuery(query, "is_managed", req.IsManaged)
parameter.AddToQuery(query, "path", req.Path)
parameter.AddToQuery(query, "is_ephemeral", req.IsEphemeral)

if fmt.Sprint(req.Region) == "" {
return nil, errors.New("field Region cannot be empty in request")
Expand Down

0 comments on commit 27218ae

Please sign in to comment.