Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
34 changes: 30 additions & 4 deletions accountorigin.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,16 @@ func (u OriginRequestUnionParam) GetPrefix() *string {
return nil
}

// Returns a pointer to the underlying variant's property, if present.
func (u OriginRequestUnionParam) GetUseIamRole() *bool {
if vt := u.OfS3; vt != nil && vt.UseIamRole.Valid() {
return &vt.UseIamRole.Value
} else if vt := u.OfCloudinaryBackup; vt != nil && vt.UseIamRole.Valid() {
return &vt.UseIamRole.Value
}
return nil
}

// Returns a pointer to the underlying variant's property, if present.
func (u OriginRequestUnionParam) GetBaseURL() *string {
if vt := u.OfWebFolder; vt != nil {
Expand All @@ -424,20 +434,23 @@ func init() {

// The properties AccessKey, Bucket, Name, SecretKey, Type are required.
type OriginRequestS3Param struct {
// Access key for the bucket.
// Access key for the bucket. When `useIAMRole` is `true`, send an empty string.
AccessKey string `json:"accessKey" api:"required"`
// S3 bucket name.
Bucket string `json:"bucket" api:"required"`
// Display name of the origin.
Name string `json:"name" api:"required"`
// Secret key for the bucket.
// Secret key for the bucket. When `useIAMRole` is `true`, send an empty string.
SecretKey string `json:"secretKey" api:"required"`
// URL used in the Canonical header (if enabled).
BaseURLForCanonicalHeader param.Opt[string] `json:"baseUrlForCanonicalHeader,omitzero" format:"uri"`
// Whether to send a Canonical header.
IncludeCanonicalHeader param.Opt[bool] `json:"includeCanonicalHeader,omitzero"`
// Path prefix inside the bucket.
Prefix param.Opt[string] `json:"prefix,omitzero"`
// Use IAM role for authentication instead of access/secret keys. When set to
// `true`, send an empty string for both `accessKey` and `secretKey`.
UseIamRole param.Opt[bool] `json:"useIAMRole,omitzero"`
// This field can be elided, and will marshal its zero value as "S3".
Type constant.S3 `json:"type" default:"S3"`
paramObj
Expand Down Expand Up @@ -486,20 +499,23 @@ func (r *OriginRequestS3CompatibleParam) UnmarshalJSON(data []byte) error {

// The properties AccessKey, Bucket, Name, SecretKey, Type are required.
type OriginRequestCloudinaryBackupParam struct {
// Access key for the bucket.
// Access key for the bucket. When `useIAMRole` is `true`, send an empty string.
AccessKey string `json:"accessKey" api:"required"`
// S3 bucket name.
Bucket string `json:"bucket" api:"required"`
// Display name of the origin.
Name string `json:"name" api:"required"`
// Secret key for the bucket.
// Secret key for the bucket. When `useIAMRole` is `true`, send an empty string.
SecretKey string `json:"secretKey" api:"required"`
// URL used in the Canonical header (if enabled).
BaseURLForCanonicalHeader param.Opt[string] `json:"baseUrlForCanonicalHeader,omitzero" format:"uri"`
// Whether to send a Canonical header.
IncludeCanonicalHeader param.Opt[bool] `json:"includeCanonicalHeader,omitzero"`
// Path prefix inside the bucket.
Prefix param.Opt[string] `json:"prefix,omitzero"`
// Use IAM role for authentication instead of access/secret keys. When set to
// `true`, send an empty string for both `accessKey` and `secretKey`.
UseIamRole param.Opt[bool] `json:"useIAMRole,omitzero"`
// This field can be elided, and will marshal its zero value as
// "CLOUDINARY_BACKUP".
Type constant.CloudinaryBackup `json:"type" default:"CLOUDINARY_BACKUP"`
Expand Down Expand Up @@ -661,6 +677,7 @@ type OriginResponseUnion struct {
// "GCS", "AZURE_BLOB", "AKENEO_PIM".
Type string `json:"type"`
BaseURLForCanonicalHeader string `json:"baseUrlForCanonicalHeader"`
UseIamRole bool `json:"useIAMRole"`
// This field is from variant [OriginResponseS3Compatible].
Endpoint string `json:"endpoint"`
// This field is from variant [OriginResponseS3Compatible].
Expand All @@ -682,6 +699,7 @@ type OriginResponseUnion struct {
Prefix respjson.Field
Type respjson.Field
BaseURLForCanonicalHeader respjson.Field
UseIamRole respjson.Field
Endpoint respjson.Field
S3ForcePathStyle respjson.Field
BaseURL respjson.Field
Expand Down Expand Up @@ -806,6 +824,9 @@ type OriginResponseS3 struct {
Type constant.S3 `json:"type" default:"S3"`
// URL used in the Canonical header (if enabled).
BaseURLForCanonicalHeader string `json:"baseUrlForCanonicalHeader" format:"uri"`
// Whether the origin authenticates using an IAM role instead of access/secret
// keys.
UseIamRole bool `json:"useIAMRole"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Expand All @@ -815,6 +836,7 @@ type OriginResponseS3 struct {
Prefix respjson.Field
Type respjson.Field
BaseURLForCanonicalHeader respjson.Field
UseIamRole respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
Expand Down Expand Up @@ -882,6 +904,9 @@ type OriginResponseCloudinaryBackup struct {
Type constant.CloudinaryBackup `json:"type" default:"CLOUDINARY_BACKUP"`
// URL used in the Canonical header (if enabled).
BaseURLForCanonicalHeader string `json:"baseUrlForCanonicalHeader" format:"uri"`
// Whether the origin authenticates using an IAM role instead of access/secret
// keys.
UseIamRole bool `json:"useIAMRole"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Expand All @@ -891,6 +916,7 @@ type OriginResponseCloudinaryBackup struct {
Prefix respjson.Field
Type respjson.Field
BaseURLForCanonicalHeader respjson.Field
UseIamRole respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
Expand Down
2 changes: 2 additions & 0 deletions accountorigin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func TestAccountOriginNewWithOptionalParams(t *testing.T) {
BaseURLForCanonicalHeader: imagekit.String("https://cdn.example.com"),
IncludeCanonicalHeader: imagekit.Bool(false),
Prefix: imagekit.String("images"),
UseIamRole: imagekit.Bool(true),
},
},
})
Expand Down Expand Up @@ -76,6 +77,7 @@ func TestAccountOriginUpdateWithOptionalParams(t *testing.T) {
BaseURLForCanonicalHeader: imagekit.String("https://cdn.example.com"),
IncludeCanonicalHeader: imagekit.Bool(false),
Prefix: imagekit.String("images"),
UseIamRole: imagekit.Bool(true),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion shared/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -4311,7 +4311,7 @@ type TransformationParam struct {
//
// - `co-color` - Color to apply (e.g., `red`, `blue`, `FF0022`). Default is gray
// color.
// - `in-intensity` - Intensity of the color (0-100). Default is 35. See
// - `in-intensity` - Intensity of the color (0-100). Default is 100. See
// [Colorize](https://imagekit.io/docs/effects-and-enhancements#colorize---e-colorize).
Colorize param.Opt[string] `json:"colorize,omitzero"`
// Indicates whether the output image should retain the original color profile. See
Expand Down
Loading