@@ -8772,8 +8772,8 @@ pub enum CopyLegacyOption {
87728772 Null ( String ) ,
87738773 /// CSV ...
87748774 Csv ( Vec < CopyLegacyCsvOption > ) ,
8775- /// IAM_ROLE { default | 'arn:aws:iam::123456789:role/role1' }
8776- IamRole ( Option < String > ) ,
8775+ /// IAM_ROLE { DEFAULT | 'arn:aws:iam::123456789:role/role1' }
8776+ IamRole ( IamRoleKind ) ,
87778777 /// IGNOREHEADER \[ AS \] number_rows
87788778 IgnoreHeader ( u64 ) ,
87798779}
@@ -8792,18 +8792,34 @@ impl fmt::Display for CopyLegacyOption {
87928792 }
87938793 Ok ( ( ) )
87948794 }
8795- IamRole ( role) => {
8796- write ! ( f, "IAM_ROLE" ) ?;
8797- match role {
8798- Some ( role) => write ! ( f, " '{role}'" ) ,
8799- None => write ! ( f, " default" ) ,
8800- }
8801- }
8795+ IamRole ( role) => write ! ( f, "IAM_ROLE {role}" ) ,
88028796 IgnoreHeader ( num_rows) => write ! ( f, "IGNOREHEADER {num_rows}" ) ,
88038797 }
88048798 }
88058799}
88068800
8801+ /// An `IAM_ROLE` option in the AWS ecosystem
8802+ ///
8803+ /// [Redshift COPY](https://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-authorization.html#copy-iam-role)
8804+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
8805+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
8806+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
8807+ pub enum IamRoleKind {
8808+ /// Default role
8809+ Default ,
8810+ /// Specific role ARN, for example: `arn:aws:iam::123456789:role/role1`
8811+ Arn ( String ) ,
8812+ }
8813+
8814+ impl fmt:: Display for IamRoleKind {
8815+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
8816+ match self {
8817+ IamRoleKind :: Default => write ! ( f, "DEFAULT" ) ,
8818+ IamRoleKind :: Arn ( arn) => write ! ( f, "'{arn}'" ) ,
8819+ }
8820+ }
8821+ }
8822+
88078823/// A `CSV` option in `COPY` statement before PostgreSQL version 9.0.
88088824///
88098825/// <https://www.postgresql.org/docs/8.4/sql-copy.html>
0 commit comments