@@ -8570,8 +8570,8 @@ pub enum CopyLegacyOption {
85708570 Null ( String ) ,
85718571 /// CSV ...
85728572 Csv ( Vec < CopyLegacyCsvOption > ) ,
8573- /// IAM_ROLE { default | 'arn:aws:iam::123456789:role/role1' }
8574- IamRole ( Option < String > ) ,
8573+ /// IAM_ROLE { DEFAULT | 'arn:aws:iam::123456789:role/role1' }
8574+ IamRole ( IamRoleKind ) ,
85758575 /// IGNOREHEADER \[ AS \] number_rows
85768576 IgnoreHeader ( u64 ) ,
85778577}
@@ -8590,18 +8590,34 @@ impl fmt::Display for CopyLegacyOption {
85908590 }
85918591 Ok ( ( ) )
85928592 }
8593- IamRole ( role) => {
8594- write ! ( f, "IAM_ROLE" ) ?;
8595- match role {
8596- Some ( role) => write ! ( f, " '{role}'" ) ,
8597- None => write ! ( f, " default" ) ,
8598- }
8599- }
8593+ IamRole ( role) => write ! ( f, "IAM_ROLE {role}" ) ,
86008594 IgnoreHeader ( num_rows) => write ! ( f, "IGNOREHEADER {num_rows}" ) ,
86018595 }
86028596 }
86038597}
86048598
8599+ /// An `IAM_ROLE` option in the AWS ecosystem
8600+ ///
8601+ /// [Redshift COPY](https://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-authorization.html#copy-iam-role)
8602+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
8603+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
8604+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
8605+ pub enum IamRoleKind {
8606+ /// Default role
8607+ Default ,
8608+ /// Specific role ARN, for example: `arn:aws:iam::123456789:role/role1`
8609+ Arn ( String ) ,
8610+ }
8611+
8612+ impl fmt:: Display for IamRoleKind {
8613+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
8614+ match self {
8615+ IamRoleKind :: Default => write ! ( f, "DEFAULT" ) ,
8616+ IamRoleKind :: Arn ( arn) => write ! ( f, "'{arn}'" ) ,
8617+ }
8618+ }
8619+ }
8620+
86058621/// A `CSV` option in `COPY` statement before PostgreSQL version 9.0.
86068622///
86078623/// <https://www.postgresql.org/docs/8.4/sql-copy.html>
0 commit comments