@@ -8772,6 +8772,10 @@ pub enum CopyLegacyOption {
87728772 Null ( String ) ,
87738773 /// CSV ...
87748774 Csv ( Vec < CopyLegacyCsvOption > ) ,
8775+ /// IAM_ROLE { DEFAULT | 'arn:aws:iam::123456789:role/role1' }
8776+ IamRole ( IamRoleKind ) ,
8777+ /// IGNOREHEADER \[ AS \] number_rows
8778+ IgnoreHeader ( u64 ) ,
87758779}
87768780
87778781impl fmt:: Display for CopyLegacyOption {
@@ -8781,7 +8785,37 @@ impl fmt::Display for CopyLegacyOption {
87818785 Binary => write ! ( f, "BINARY" ) ,
87828786 Delimiter ( char) => write ! ( f, "DELIMITER '{char}'" ) ,
87838787 Null ( string) => write ! ( f, "NULL '{}'" , value:: escape_single_quote_string( string) ) ,
8784- Csv ( opts) => write ! ( f, "CSV {}" , display_separated( opts, " " ) ) ,
8788+ Csv ( opts) => {
8789+ write ! ( f, "CSV" ) ?;
8790+ if !opts. is_empty ( ) {
8791+ write ! ( f, " {}" , display_separated( opts, " " ) ) ?;
8792+ }
8793+ Ok ( ( ) )
8794+ }
8795+ IamRole ( role) => write ! ( f, "IAM_ROLE {role}" ) ,
8796+ IgnoreHeader ( num_rows) => write ! ( f, "IGNOREHEADER {num_rows}" ) ,
8797+ }
8798+ }
8799+ }
8800+
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}'" ) ,
87858819 }
87868820 }
87878821}
0 commit comments