@@ -8801,6 +8801,10 @@ pub enum CopyLegacyOption {
88018801 Null ( String ) ,
88028802 /// CSV ...
88038803 Csv ( Vec < CopyLegacyCsvOption > ) ,
8804+ /// IAM_ROLE { DEFAULT | 'arn:aws:iam::123456789:role/role1' }
8805+ IamRole ( IamRoleKind ) ,
8806+ /// IGNOREHEADER \[ AS \] number_rows
8807+ IgnoreHeader ( u64 ) ,
88048808}
88058809
88068810impl fmt:: Display for CopyLegacyOption {
@@ -8810,7 +8814,37 @@ impl fmt::Display for CopyLegacyOption {
88108814 Binary => write ! ( f, "BINARY" ) ,
88118815 Delimiter ( char) => write ! ( f, "DELIMITER '{char}'" ) ,
88128816 Null ( string) => write ! ( f, "NULL '{}'" , value:: escape_single_quote_string( string) ) ,
8813- Csv ( opts) => write ! ( f, "CSV {}" , display_separated( opts, " " ) ) ,
8817+ Csv ( opts) => {
8818+ write ! ( f, "CSV" ) ?;
8819+ if !opts. is_empty ( ) {
8820+ write ! ( f, " {}" , display_separated( opts, " " ) ) ?;
8821+ }
8822+ Ok ( ( ) )
8823+ }
8824+ IamRole ( role) => write ! ( f, "IAM_ROLE {role}" ) ,
8825+ IgnoreHeader ( num_rows) => write ! ( f, "IGNOREHEADER {num_rows}" ) ,
8826+ }
8827+ }
8828+ }
8829+
8830+ /// An `IAM_ROLE` option in the AWS ecosystem
8831+ ///
8832+ /// [Redshift COPY](https://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-authorization.html#copy-iam-role)
8833+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
8834+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
8835+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
8836+ pub enum IamRoleKind {
8837+ /// Default role
8838+ Default ,
8839+ /// Specific role ARN, for example: `arn:aws:iam::123456789:role/role1`
8840+ Arn ( String ) ,
8841+ }
8842+
8843+ impl fmt:: Display for IamRoleKind {
8844+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
8845+ match self {
8846+ IamRoleKind :: Default => write ! ( f, "DEFAULT" ) ,
8847+ IamRoleKind :: Arn ( arn) => write ! ( f, "'{arn}'" ) ,
88148848 }
88158849 }
88168850}
0 commit comments