// Code generated by sidekick. DO NOT EDIT.
//
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#if SqlBackupRunsService || SqlBackupsService || SqlDatabasesService || SqlInstancesService || SqlOperationsService || SqlSslCertsService || SqlUsersService
  import Foundation
  import GoogleCloudWkt

  /// Database instance export context.
  public struct ExportContext: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The path to the file in Google Cloud Storage where the export will be
    /// stored. The URI is in the form `gs://bucketName/fileName`. If the file
    /// already exists, the request succeeds, but the operation fails. If
    /// `fileType` is `SQL` and the filename ends with .gz,
    /// the contents are compressed.
    public var uri: Swift.String = Swift.String()

    /// Databases to be exported. <br /> `MySQL instances:` If
    /// `fileType` is `SQL` and no database is specified, all
    /// databases are exported, except for the `mysql` system database.
    /// If `fileType` is `CSV`, you can specify one database,
    /// either by using this property or by using the
    /// `csvExportOptions.selectQuery` property, which takes precedence
    /// over this property. <br /> `PostgreSQL instances:` If you don't specify a
    /// database by name, all user databases in the instance are exported.
    /// This excludes system databases and Cloud SQL databases used to manage
    /// internal operations. Exporting all user databases is only available for
    /// directory-formatted parallel export. If `fileType` is `CSV`,
    /// this database must match the one specified in the
    /// `csvExportOptions.selectQuery` property. <br /> `SQL Server
    /// instances:` You must specify one database to be exported, and the
    /// `fileType` must be `BAK`.
    public var databases: [Swift.String] = []

    /// This is always `sql#exportContext`.
    public var kind: Swift.String = Swift.String()

    /// Options for exporting data as SQL statements.
    public var sqlExportOptions: ExportContext.SqlExportOptions? = nil

    /// Options for exporting data as CSV. `MySQL` and `PostgreSQL`
    /// instances only.
    public var csvExportOptions: ExportContext.SqlCsvExportOptions? = nil

    /// The file type for the specified uri.
    public var fileType: SqlFileType = SqlFileType()

    /// Whether to perform a serverless export.
    public var offload: GoogleCloudWkt.BoolValue? = nil

    /// Options for exporting data as BAK files.
    public var bakExportOptions: ExportContext.SqlBakExportOptions? = nil

    /// Optional. Export parameters specific to SQL Server TDE certificates
    public var tdeExportOptions: ExportContext.SqlTdeExportOptions? = nil

    /// Initialize a new instance of `ExportContext`.
    public init() {}

    /// Use `config` to return a new instance of this object, with some fields updated.
    ///
    /// Commonly used to initialize the value, for example:
    ///
    /// ```
    /// let value = ExportContext().with { $0.uri = ... }
    /// ```
    public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
      var copy = self
      try config(&copy)
      return copy
    }

    public struct SqlCsvExportOptions: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// The select query used to extract the data.
      public var selectQuery: Swift.String = Swift.String()

      /// Specifies the character that should appear before a data character that
      /// needs to be escaped.
      public var escapeCharacter: Swift.String = Swift.String()

      /// Specifies the quoting character to be used when a data value is quoted.
      public var quoteCharacter: Swift.String = Swift.String()

      /// Specifies the character that separates columns within each row (line) of
      /// the file.
      public var fieldsTerminatedBy: Swift.String = Swift.String()

      /// This is used to separate lines. If a line does not contain all fields,
      /// the rest of the columns are set to their default values.
      public var linesTerminatedBy: Swift.String = Swift.String()

      /// Initialize a new instance of `SqlCsvExportOptions`.
      public init() {}

      /// Use `config` to return a new instance of this object, with some fields updated.
      ///
      /// Commonly used to initialize the value, for example:
      ///
      /// ```
      /// let value = SqlCsvExportOptions().with { $0.selectQuery = ... }
      /// ```
      public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
        var copy = self
        try config(&copy)
        return copy
      }

      public static var _anyTypeUrl: Swift.String {
        return "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlCsvExportOptions"
      }
      public init(fromAny any: GoogleCloudWkt.`Any`) throws {
        self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
      }
      public func _pack() throws -> GoogleCloudWkt.Struct {
        return try GoogleCloudWkt._slowAnySerialize(message: self)
      }
    }

    public struct SqlExportOptions: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Tables to export, or that were exported, from the specified database. If
      /// you specify tables, specify one and only one database. For PostgreSQL
      /// instances, you can specify only one table.
      public var tables: [Swift.String] = []

      /// Export only schemas.
      public var schemaOnly: GoogleCloudWkt.BoolValue? = nil

      public var mysqlExportOptions: ExportContext.SqlExportOptions.MysqlExportOptions? = nil

      /// Optional. The number of threads to use for parallel export.
      public var threads: GoogleCloudWkt.Int32Value? = nil

      /// Optional. Whether or not the export should be parallel.
      public var parallel: GoogleCloudWkt.BoolValue? = nil

      /// Optional. Options for exporting from a Cloud SQL for PostgreSQL instance.
      public var postgresExportOptions: ExportContext.SqlExportOptions.PostgresExportOptions? = nil

      /// Initialize a new instance of `SqlExportOptions`.
      public init() {}

      /// Use `config` to return a new instance of this object, with some fields updated.
      ///
      /// Commonly used to initialize the value, for example:
      ///
      /// ```
      /// let value = SqlExportOptions().with { $0.tables = ... }
      /// ```
      public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
        var copy = self
        try config(&copy)
        return copy
      }

      /// Options for exporting from MySQL.
      public struct MysqlExportOptions: Codable, Equatable, GoogleCloudWkt._AnyPackable,
        Sendable
      {
        /// Option to include SQL statement required to set up replication. If set
        /// to `1`, the dump file includes a CHANGE MASTER TO statement with the
        /// binary log coordinates, and --set-gtid-purged is set to ON. If set to
        /// `2`, the CHANGE MASTER TO statement is written as a SQL comment and
        /// has no effect. If set to any value other than `1`, --set-gtid-purged
        /// is set to OFF.
        public var masterData: GoogleCloudWkt.Int32Value? = nil

        /// Initialize a new instance of `MysqlExportOptions`.
        public init() {}

        /// Use `config` to return a new instance of this object, with some fields updated.
        ///
        /// Commonly used to initialize the value, for example:
        ///
        /// ```
        /// let value = MysqlExportOptions().with { $0.masterData = ... }
        /// ```
        public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
          var copy = self
          try config(&copy)
          return copy
        }

        public static var _anyTypeUrl: Swift.String {
          return
            "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions"
        }
        public init(fromAny any: GoogleCloudWkt.`Any`) throws {
          self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
        }
        public func _pack() throws -> GoogleCloudWkt.Struct {
          return try GoogleCloudWkt._slowAnySerialize(message: self)
        }
      }

      /// Options for exporting from a Cloud SQL for PostgreSQL instance.
      public struct PostgresExportOptions: Codable, Equatable, GoogleCloudWkt._AnyPackable,
        Sendable
      {
        /// Optional. Use this option to include DROP <code>&lt;object&gt;</code>
        /// SQL statements. Use these statements to delete database objects before
        /// running the import operation.
        public var clean: GoogleCloudWkt.BoolValue? = nil

        /// Optional. Option to include an IF EXISTS SQL statement with each DROP
        /// statement produced by clean.
        public var ifExists: GoogleCloudWkt.BoolValue? = nil

        /// Initialize a new instance of `PostgresExportOptions`.
        public init() {}

        /// Use `config` to return a new instance of this object, with some fields updated.
        ///
        /// Commonly used to initialize the value, for example:
        ///
        /// ```
        /// let value = PostgresExportOptions().with { $0.clean = ... }
        /// ```
        public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
          var copy = self
          try config(&copy)
          return copy
        }

        public static var _anyTypeUrl: Swift.String {
          return
            "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions"
        }
        public init(fromAny any: GoogleCloudWkt.`Any`) throws {
          self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
        }
        public func _pack() throws -> GoogleCloudWkt.Struct {
          return try GoogleCloudWkt._slowAnySerialize(message: self)
        }
      }

      public static var _anyTypeUrl: Swift.String {
        return "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlExportOptions"
      }
      public init(fromAny any: GoogleCloudWkt.`Any`) throws {
        self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
      }
      public func _pack() throws -> GoogleCloudWkt.Struct {
        return try GoogleCloudWkt._slowAnySerialize(message: self)
      }
    }

    /// Options for exporting BAK files (SQL Server-only)
    public struct SqlBakExportOptions: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Whether or not the export should be striped.
      public var striped: GoogleCloudWkt.BoolValue? = nil

      /// Option for specifying how many stripes to use for the export.
      /// If blank, and the value of the striped field is true,
      /// the number of stripes is automatically chosen.
      public var stripeCount: GoogleCloudWkt.Int32Value? = nil

      /// Type of this bak file will be export, FULL or DIFF, SQL Server only
      public var bakType: BakType = BakType()

      /// Deprecated: copy_only is deprecated. Use differential_base instead
      @available(*, deprecated)
      public var copyOnly: GoogleCloudWkt.BoolValue? = nil

      /// Whether or not the backup can be used as a differential base
      /// copy_only backup can not be served as differential base
      public var differentialBase: GoogleCloudWkt.BoolValue? = nil

      /// Optional. The begin timestamp when transaction log will be included in
      /// the export operation. [RFC 3339](https://tools.ietf.org/html/rfc3339)
      /// format (for example, `2023-10-01T16:19:00.094`) in UTC. When omitted, all
      /// available logs from the beginning of retention period will be included.
      /// Only applied to Cloud SQL for SQL Server.
      public var exportLogStartTime: GoogleCloudWkt.Timestamp? = nil

      /// Optional. The end timestamp when transaction log will be included in the
      /// export operation. [RFC 3339](https://tools.ietf.org/html/rfc3339) format
      /// (for example, `2023-10-01T16:19:00.094`) in UTC. When omitted, all
      /// available logs until current time will be included. Only applied to Cloud
      /// SQL for SQL Server.
      public var exportLogEndTime: GoogleCloudWkt.Timestamp? = nil

      /// Initialize a new instance of `SqlBakExportOptions`.
      public init() {}

      /// Use `config` to return a new instance of this object, with some fields updated.
      ///
      /// Commonly used to initialize the value, for example:
      ///
      /// ```
      /// let value = SqlBakExportOptions().with { $0.striped = ... }
      /// ```
      public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
        var copy = self
        try config(&copy)
        return copy
      }

      public static var _anyTypeUrl: Swift.String {
        return "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlBakExportOptions"
      }
      public init(fromAny any: GoogleCloudWkt.`Any`) throws {
        self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
      }
      public func _pack() throws -> GoogleCloudWkt.Struct {
        return try GoogleCloudWkt._slowAnySerialize(message: self)
      }
    }

    public struct SqlTdeExportOptions: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Required. Path to the TDE certificate public key
      /// in the form gs://bucketName/fileName.
      /// The instance must have write access to the bucket.
      /// Applicable only for SQL Server instances.
      public var certificatePath: Swift.String = Swift.String()

      /// Required. Path to the TDE certificate private key
      /// in the form gs://bucketName/fileName.
      /// The instance must have write access to the location.
      /// Applicable only for SQL Server instances.
      public var privateKeyPath: Swift.String = Swift.String()

      /// Required. Password that encrypts the private key.
      public var privateKeyPassword: Swift.String = Swift.String()

      /// Required. Certificate name.
      /// Applicable only for SQL Server instances.
      public var name: Swift.String = Swift.String()

      /// Initialize a new instance of `SqlTdeExportOptions`.
      public init() {}

      /// Use `config` to return a new instance of this object, with some fields updated.
      ///
      /// Commonly used to initialize the value, for example:
      ///
      /// ```
      /// let value = SqlTdeExportOptions().with { $0.certificatePath = ... }
      /// ```
      public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
        var copy = self
        try config(&copy)
        return copy
      }

      public static var _anyTypeUrl: Swift.String {
        return "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlTdeExportOptions"
      }
      public init(fromAny any: GoogleCloudWkt.`Any`) throws {
        self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
      }
      public func _pack() throws -> GoogleCloudWkt.Struct {
        return try GoogleCloudWkt._slowAnySerialize(message: self)
      }
    }

    public static var _anyTypeUrl: Swift.String {
      return "type.googleapis.com/google.cloud.sql.v1.ExportContext"
    }
    public init(fromAny any: GoogleCloudWkt.`Any`) throws {
      self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
    }
    public func _pack() throws -> GoogleCloudWkt.Struct {
      return try GoogleCloudWkt._slowAnySerialize(message: self)
    }
  }
#endif
