From c155085f66f2f73de7e7a47977e037441bcc27d5 Mon Sep 17 00:00:00 2001 From: Nolan Eastin Date: Tue, 18 Aug 2026 17:00:31 +0000 Subject: [PATCH] feat(storage): regenerate storage v2 using included ids --- librarian.yaml | 23 +- .../generated/Storage/AppendObjectSpec.swift | 83 ------ .../generated/Storage/BidiReadHandle.swift | 54 ---- .../Storage/BidiReadObjectError.swift | 53 ---- .../BidiReadObjectRedirectedError.swift | 59 ---- .../Storage/BidiReadObjectRequest.swift | 65 ----- .../Storage/BidiReadObjectResponse.swift | 71 ----- .../Storage/BidiReadObjectSpec.swift | 101 ------- .../generated/Storage/BidiWriteHandle.swift | 54 ---- .../BidiWriteObjectRedirectedError.swift | 65 ----- .../Storage/BidiWriteObjectRequest.swift | 223 --------------- .../Storage/BidiWriteObjectResponse.swift | 117 -------- .../Storage/CancelResumableWriteRequest.swift | 56 ---- .../CancelResumableWriteResponse.swift | 50 ---- .../generated/Storage/ChecksummedData.swift | 73 ----- .../generated/Storage/ContentRange.swift | 58 ---- .../generated/Storage/ObjectRangeData.swift | 62 ----- .../Storage/QueryWriteStatusRequest.swift | 60 ---- .../Storage/QueryWriteStatusResponse.swift | 114 -------- .../generated/Storage/ReadObjectRequest.swift | 112 -------- .../Storage/ReadObjectResponse.swift | 71 ----- .../generated/Storage/ReadRange.swift | 76 ----- .../generated/Storage/ReadRangeError.swift | 56 ---- .../generated/Storage/ServiceConstants.swift | 261 ------------------ .../Storage/StartResumableWriteRequest.swift | 66 ----- .../Storage/StartResumableWriteResponse.swift | 59 ---- .../generated/Storage/Storage+Logging.swift | 255 +++++++++++++++++ .../generated/Storage/Storage+Retry.swift | 247 +++++++++++++++++ .../generated/Storage/Storage+Stub.swift | 79 ++++++ .../generated/Storage/Storage+Transport.swift | 225 +++++++++++++++ .../Storage/WriteObjectRequest.swift | 188 ------------- .../Storage/WriteObjectResponse.swift | 112 -------- .../generated/Storage/WriteObjectSpec.swift | 89 ------ .../StorageControl+Transport.swift | 4 + 34 files changed, 829 insertions(+), 2512 deletions(-) delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/AppendObjectSpec.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadHandle.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectError.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectRedirectedError.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectRequest.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectResponse.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectSpec.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteHandle.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteObjectRedirectedError.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteObjectRequest.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteObjectResponse.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/CancelResumableWriteRequest.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/CancelResumableWriteResponse.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/ChecksummedData.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/ContentRange.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/ObjectRangeData.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/QueryWriteStatusRequest.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/QueryWriteStatusResponse.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadObjectRequest.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadObjectResponse.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadRange.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadRangeError.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/ServiceConstants.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/StartResumableWriteRequest.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/StartResumableWriteResponse.swift create mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Logging.swift create mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Retry.swift create mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Stub.swift create mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Transport.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/WriteObjectRequest.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/WriteObjectResponse.swift delete mode 100644 packages/storage/Sources/GoogleCloudStorage/generated/Storage/WriteObjectSpec.swift diff --git a/librarian.yaml b/librarian.yaml index 063e3b87a..1f1107383 100644 --- a/librarian.yaml +++ b/librarian.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. language: swift -version: v0.37.1-0.20260818164449-1ea77db57690 +version: v0.37.1-0.20260818165642-858b4d49dc61 repo: googleapis/google-cloud-swift sources: conformance: @@ -1044,10 +1044,25 @@ libraries: - ../../type/date.proto - ../../type/expr.proto - output: packages/storage/Sources/GoogleCloudStorage/generated/Storage + service_config: google/storage/v2/storage_v2.yaml api_path: google/storage/v2 - module_type: default - skipped_ids: - - .google.storage.v2.Storage + module_type: grpc-client + included_ids: + - .google.storage.v2.Storage.DeleteBucket + - .google.storage.v2.Storage.GetBucket + - .google.storage.v2.Storage.CreateBucket + - .google.storage.v2.Storage.ListBuckets + - .google.storage.v2.Storage.LockBucketRetentionPolicy + - .google.storage.v2.Storage.UpdateBucket + - .google.storage.v2.Storage.ComposeObject + - .google.storage.v2.Storage.DeleteObject + - .google.storage.v2.Storage.RestoreObject + - .google.storage.v2.Storage.GetObject + - .google.storage.v2.Storage.UpdateObject + - .google.storage.v2.Storage.ListObjects + - .google.storage.v2.Storage.RewriteObject + - .google.storage.v2.Storage.MoveObject + module_path: StorageProtos - output: packages/storage/Sources/GoogleCloudStorage/generated/Storage/Convert/Storage api_path: google/storage/v2 module_type: convert-swift diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/AppendObjectSpec.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/AppendObjectSpec.swift deleted file mode 100644 index 177f1e132..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/AppendObjectSpec.swift +++ /dev/null @@ -1,83 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Describes an attempt to append to an object, possibly over multiple requests. -public struct AppendObjectSpec: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Required. The name of the bucket containing the object to write. - public var bucket: Swift.String = Swift.String() - - /// Required. The name of the object to open for writing. - public var object: Swift.String = Swift.String() - - /// Required. The generation number of the object to open for writing. - public var generation: Swift.Int64 = Swift.Int64() - - /// Makes the operation conditional on whether the object's current - /// metageneration matches the given value. - /// - /// Note that metageneration preconditions are only checked if `write_handle` - /// is empty. - public var ifMetagenerationMatch: Swift.Int64? = nil - - /// Makes the operation conditional on whether the object's current - /// metageneration does not match the given value. - /// - /// Note that metageneration preconditions are only checked if `write_handle` - /// is empty. - public var ifMetagenerationNotMatch: Swift.Int64? = nil - - /// An optional routing token that influences request routing for the stream. - /// Must be provided if a `BidiWriteObjectRedirectedError` is returned. - public var routingToken: Swift.String? = nil - - /// An optional write handle returned from a previous BidiWriteObjectResponse - /// message or a BidiWriteObjectRedirectedError error. - /// - /// Note that metageneration preconditions are only checked if `write_handle` - /// is empty. - public var writeHandle: BidiWriteHandle? = nil - - /// Initialize a new instance of `AppendObjectSpec`. - 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 = AppendObjectSpec().with { $0.bucket = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.AppendObjectSpec" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadHandle.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadHandle.swift deleted file mode 100644 index 69592bc54..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadHandle.swift +++ /dev/null @@ -1,54 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// `BidiReadHandle` contains a handle from a previous `BiDiReadObject` -/// invocation. The client can use this instead of `BidiReadObjectSpec` as an -/// optimized way of opening subsequent bidirectional streams to the same object. -public struct BidiReadHandle: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Required. Opaque value describing a previous read. - public var handle: Foundation.Data = Foundation.Data() - - /// Initialize a new instance of `BidiReadHandle`. - 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 = BidiReadHandle().with { $0.handle = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.BidiReadHandle" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectError.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectError.swift deleted file mode 100644 index 8716a532a..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectError.swift +++ /dev/null @@ -1,53 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Error extension proto containing details for all outstanding reads on the -/// failed stream -public struct BidiReadObjectError: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// The error code for each outstanding read_range - public var readRangeErrors: [ReadRangeError] = [] - - /// Initialize a new instance of `BidiReadObjectError`. - 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 = BidiReadObjectError().with { $0.readRangeErrors = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.BidiReadObjectError" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectRedirectedError.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectRedirectedError.swift deleted file mode 100644 index 3a309f4d8..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectRedirectedError.swift +++ /dev/null @@ -1,59 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Error proto containing details for a redirected read. This error might be -/// attached as details for an ABORTED response to BidiReadObject. -public struct BidiReadObjectRedirectedError: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// The read handle for the redirected read. If set, the client might use this - /// in the BidiReadObjectSpec when retrying the read stream. - public var readHandle: BidiReadHandle? = nil - - /// The routing token the client must use when retrying the read stream. - /// This value must be provided in the header `x-goog-request-params`, with key - /// `routing_token` and this string verbatim as the value. - public var routingToken: Swift.String? = nil - - /// Initialize a new instance of `BidiReadObjectRedirectedError`. - 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 = BidiReadObjectRedirectedError().with { $0.readHandle = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.BidiReadObjectRedirectedError" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectRequest.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectRequest.swift deleted file mode 100644 index 26fb4de08..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectRequest.swift +++ /dev/null @@ -1,65 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Request message for -/// [BidiReadObject][google.storage.v2.Storage.BidiReadObject]. -/// -/// [google.storage.v2.Storage.BidiReadObject]: -public struct BidiReadObjectRequest: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Optional. The first message of each stream should set this field. If this - /// is not the first message, an error is returned. Describes the object to - /// read. - public var readObjectSpec: BidiReadObjectSpec? = nil - - /// Optional. Provides a list of 0 or more (up to 100) ranges to read. If a - /// single range is large enough to require multiple responses, they are - /// delivered in increasing offset order. There are no ordering guarantees - /// across ranges. When no ranges are provided, the response message - /// doesn't include `ObjectRangeData`. For full object downloads, the - /// offset and size can be set to `0`. - public var readRanges: [ReadRange] = [] - - /// Initialize a new instance of `BidiReadObjectRequest`. - 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 = BidiReadObjectRequest().with { $0.readObjectSpec = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.BidiReadObjectRequest" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectResponse.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectResponse.swift deleted file mode 100644 index 9f253244f..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectResponse.swift +++ /dev/null @@ -1,71 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Response message for -/// [BidiReadObject][google.storage.v2.Storage.BidiReadObject]. -/// -/// [google.storage.v2.Storage.BidiReadObject]: -public struct BidiReadObjectResponse: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// A portion of the object's data. The service might leave data - /// empty for any given `ReadResponse`. This enables the service to inform the - /// client that the request is still live while it is running an operation to - /// generate more data. - /// The service might pipeline multiple responses belonging to different read - /// requests. Each `ObjectRangeData` entry has a `read_id` that is set - /// to the same value as the corresponding source read request. - public var objectDataRanges: [ObjectRangeData] = [] - - /// Metadata of the object whose media is being returned. - /// Only populated in the first response in the stream and not populated when - /// the stream is opened with a read handle. - public var metadata: Object? = nil - - /// This field is periodically refreshed, however it might not be set in - /// every response. It allows the client to more efficiently open subsequent - /// bidirectional streams to the same object. - public var readHandle: BidiReadHandle? = nil - - /// Initialize a new instance of `BidiReadObjectResponse`. - 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 = BidiReadObjectResponse().with { $0.objectDataRanges = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.BidiReadObjectResponse" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectSpec.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectSpec.swift deleted file mode 100644 index ec70ef948..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiReadObjectSpec.swift +++ /dev/null @@ -1,101 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Describes the object to read in a BidiReadObject request. -public struct BidiReadObjectSpec: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Required. The name of the bucket containing the object to read. - public var bucket: Swift.String = Swift.String() - - /// Required. The name of the object to read. - public var object: Swift.String = Swift.String() - - /// Optional. If present, selects a specific revision of this object (as - /// opposed to the latest version, the default). - public var generation: Swift.Int64 = Swift.Int64() - - /// Makes the operation conditional on whether the object's current generation - /// matches the given value. Setting to 0 makes the operation succeed only if - /// there are no live versions of the object. - public var ifGenerationMatch: Swift.Int64? = nil - - /// Makes the operation conditional on whether the object's live generation - /// does not match the given value. If no live object exists, the precondition - /// fails. Setting to 0 makes the operation succeed only if there is a live - /// version of the object. - public var ifGenerationNotMatch: Swift.Int64? = nil - - /// Makes the operation conditional on whether the object's current - /// metageneration matches the given value. - public var ifMetagenerationMatch: Swift.Int64? = nil - - /// Makes the operation conditional on whether the object's current - /// metageneration does not match the given value. - public var ifMetagenerationNotMatch: Swift.Int64? = nil - - /// Optional. A set of parameters common to Storage API requests concerning an - /// object. - public var commonObjectRequestParams: CommonObjectRequestParams? = nil - - /// Mask specifying which fields to read. - /// The `checksummed_data` field and its children are always present. - /// If no mask is specified, it defaults to all fields except `metadata. - /// owner` and `metadata.acl`. - /// `*` might be used to mean "all fields". - /// As per https://google.aip.dev/161, this field is deprecated. - /// As an alternative, `grpc metadata` can be used: - @available(*, deprecated) - public var readMask: GoogleCloudWkt.FieldMask? = nil - - /// The client can optionally set this field. The read handle is an optimized - /// way of creating new streams. Read handles are generated and periodically - /// refreshed from prior reads. - public var readHandle: BidiReadHandle? = nil - - /// The routing token that influences request routing for the stream. Must be - /// provided if a BidiReadObjectRedirectedError is returned. - public var routingToken: Swift.String? = nil - - /// Initialize a new instance of `BidiReadObjectSpec`. - 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 = BidiReadObjectSpec().with { $0.bucket = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.BidiReadObjectSpec" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteHandle.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteHandle.swift deleted file mode 100644 index 631198011..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteHandle.swift +++ /dev/null @@ -1,54 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// `BidiWriteHandle` contains a handle from a previous `BidiWriteObject` -/// invocation. The client can use this instead of `BidiReadObjectSpec` as an -/// optimized way of opening subsequent bidirectional streams to the same object. -public struct BidiWriteHandle: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Required. Opaque value describing a previous write. - public var handle: Foundation.Data = Foundation.Data() - - /// Initialize a new instance of `BidiWriteHandle`. - 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 = BidiWriteHandle().with { $0.handle = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.BidiWriteHandle" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteObjectRedirectedError.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteObjectRedirectedError.swift deleted file mode 100644 index cc30ed250..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteObjectRedirectedError.swift +++ /dev/null @@ -1,65 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Error proto containing details for a redirected write. This error might be -/// attached as details for an ABORTED response to BidiWriteObject. -public struct BidiWriteObjectRedirectedError: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// The routing token the client must use when retrying the write stream. - /// This value must be provided in the header `x-goog-request-params`, with key - /// `routing_token` and this string verbatim as the value. - public var routingToken: Swift.String? = nil - - /// Opaque value describing a previous write. If set, the client must use this - /// in an AppendObjectSpec first_message when retrying the write stream. If not - /// set, clients might retry the original request. - public var writeHandle: BidiWriteHandle? = nil - - /// The generation of the object that triggered the redirect. This is set - /// iff `write_handle` is set. If set, the client must use this in an - /// `AppendObjectSpec` first_message when retrying the write stream. - public var generation: Swift.Int64? = nil - - /// Initialize a new instance of `BidiWriteObjectRedirectedError`. - 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 = BidiWriteObjectRedirectedError().with { $0.routingToken = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.BidiWriteObjectRedirectedError" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteObjectRequest.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteObjectRequest.swift deleted file mode 100644 index fbe69b322..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteObjectRequest.swift +++ /dev/null @@ -1,223 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Request message for -/// [BidiWriteObject][google.storage.v2.Storage.BidiWriteObject]. -/// -/// [google.storage.v2.Storage.BidiWriteObject]: -public struct BidiWriteObjectRequest: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Required. The offset from the beginning of the object at which the data - /// should be written. - /// - /// In the first `WriteObjectRequest` of a `WriteObject()` action, it - /// indicates the initial offset for the `Write()` call. The value must be - /// equal to the `persisted_size` that a call to `QueryWriteStatus()` would - /// return (0 if this is the first write to the object). - /// - /// On subsequent calls, this value must be no larger than the sum of the - /// first `write_offset` and the sizes of all `data` chunks sent previously on - /// this stream. - /// - /// An invalid value causes an error. - public var writeOffset: Swift.Int64 = Swift.Int64() - - /// Optional. Checksums for the complete object. If the checksums computed by - /// the service don't match the specified checksums the call fails. May be - /// provided in the last request (with finish_write set). For non-appendable - /// objects only, may also be provided in the first request. - public var objectChecksums: ObjectChecksums? = nil - - /// Optional. For each `BidiWriteObjectRequest` where `state_lookup` is `true` - /// or the client closes the stream, the service sends a - /// `BidiWriteObjectResponse` containing the current persisted size. The - /// persisted size sent in responses covers all the bytes the server has - /// persisted thus far and can be used to decide what data is safe for the - /// client to drop. Note that the object's current size reported by the - /// `BidiWriteObjectResponse` might lag behind the number of bytes written by - /// the client. This field is ignored if `finish_write` is set to true. - public var stateLookup: Swift.Bool = Swift.Bool() - - /// Optional. Persists data written on the stream, up to and including the - /// current message, to permanent storage. This option should be used sparingly - /// as it might reduce performance. Ongoing writes are periodically persisted - /// on the server even when `flush` is not set. This field is ignored if - /// `finish_write` is set to true since there's no need to checkpoint or flush - /// if this message completes the write. - public var flush: Swift.Bool = Swift.Bool() - - /// Optional. If `true`, this indicates that the write is complete. Sending any - /// `WriteObjectRequest`s subsequent to one in which `finish_write` is `true` - /// causes an error. - /// For a non-resumable write (where the `upload_id` was not set in the first - /// message), it is an error not to set this field in the final message of the - /// stream. - public var finishWrite: Swift.Bool = Swift.Bool() - - /// Optional. A set of parameters common to Storage API requests concerning an - /// object. - public var commonObjectRequestParams: CommonObjectRequestParams? = nil - - /// The first message of each stream should set one of the following. - public var firstMessage: OneOf_FirstMessage? = nil - - /// A portion of the data for the object. - public var data: OneOf_Data? = nil - - /// Initialize a new instance of `BidiWriteObjectRequest`. - 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 = BidiWriteObjectRequest().with { $0.uploadId = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - private enum CodingKeys: Swift.String, CodingKey { - case uploadId = "uploadId" - case writeObjectSpec = "writeObjectSpec" - case appendObjectSpec = "appendObjectSpec" - case writeOffset = "writeOffset" - case checksummedData = "checksummedData" - case objectChecksums = "objectChecksums" - case stateLookup = "stateLookup" - case flush = "flush" - case finishWrite = "finishWrite" - case commonObjectRequestParams = "commonObjectRequestParams" - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - self.writeOffset = try container.decode(Swift.Int64.self, forKey: .writeOffset) - self.objectChecksums = try container.decodeIfPresent( - ObjectChecksums.self, forKey: .objectChecksums) - self.stateLookup = try container.decode(Swift.Bool.self, forKey: .stateLookup) - self.flush = try container.decode(Swift.Bool.self, forKey: .flush) - self.finishWrite = try container.decode(Swift.Bool.self, forKey: .finishWrite) - self.commonObjectRequestParams = try container.decodeIfPresent( - CommonObjectRequestParams.self, forKey: .commonObjectRequestParams) - - var firstMessage: OneOf_FirstMessage? = nil - let firstMessageCheckAndSet = { - if firstMessage != nil { - throw DecodingError.dataCorrupted( - DecodingError.Context( - codingPath: decoder.codingPath, - debugDescription: "Multiple values set for oneof 'firstMessage'")) - } - firstMessage = $0 - } - if let uploadId = try container.decodeIfPresent(Swift.String.self, forKey: .uploadId) { - try firstMessageCheckAndSet(.uploadId(uploadId)) - } - if let writeObjectSpec = try container.decodeIfPresent( - WriteObjectSpec?.self, forKey: .writeObjectSpec) - { - try firstMessageCheckAndSet(.writeObjectSpec(writeObjectSpec)) - } - if let appendObjectSpec = try container.decodeIfPresent( - AppendObjectSpec?.self, forKey: .appendObjectSpec) - { - try firstMessageCheckAndSet(.appendObjectSpec(appendObjectSpec)) - } - self.firstMessage = firstMessage - - var data: OneOf_Data? = nil - let dataCheckAndSet = { - if data != nil { - throw DecodingError.dataCorrupted( - DecodingError.Context( - codingPath: decoder.codingPath, debugDescription: "Multiple values set for oneof 'data'" - )) - } - data = $0 - } - if let checksummedData = try container.decodeIfPresent( - ChecksummedData?.self, forKey: .checksummedData) - { - try dataCheckAndSet(.checksummedData(checksummedData)) - } - self.data = data - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(self.writeOffset, forKey: .writeOffset) - try container.encode(self.objectChecksums, forKey: .objectChecksums) - try container.encode(self.stateLookup, forKey: .stateLookup) - try container.encode(self.flush, forKey: .flush) - try container.encode(self.finishWrite, forKey: .finishWrite) - try container.encode(self.commonObjectRequestParams, forKey: .commonObjectRequestParams) - - if let choice = self.firstMessage { - switch choice { - case .uploadId(let value): - try container.encode(value, forKey: .uploadId) - case .writeObjectSpec(let value): - try container.encode(value, forKey: .writeObjectSpec) - case .appendObjectSpec(let value): - try container.encode(value, forKey: .appendObjectSpec) - } - } - - if let choice = self.data { - switch choice { - case .checksummedData(let value): - try container.encode(value, forKey: .checksummedData) - } - } - } - - /// The first message of each stream should set one of the following. - public enum OneOf_FirstMessage: Codable, Equatable, Sendable { - /// For resumable uploads. This should be the `upload_id` returned from a - /// call to `StartResumableWriteResponse`. - case uploadId(Swift.String) - /// For non-resumable uploads. Describes the overall upload, including the - /// destination bucket and object name, preconditions, etc. - indirect case writeObjectSpec(WriteObjectSpec?) - /// For appendable uploads. Describes the object to append to. - indirect case appendObjectSpec(AppendObjectSpec?) - } - - /// A portion of the data for the object. - public enum OneOf_Data: Codable, Equatable, Sendable { - /// The data to insert. If a crc32c checksum is provided that doesn't match - /// the checksum computed by the service, the request fails. - indirect case checksummedData(ChecksummedData?) - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.BidiWriteObjectRequest" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteObjectResponse.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteObjectResponse.swift deleted file mode 100644 index f33c118c3..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/BidiWriteObjectResponse.swift +++ /dev/null @@ -1,117 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Response message for BidiWriteObject. -public struct BidiWriteObjectResponse: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// If persisted_size is set, contains checksums of persisted data. - public var persistedDataChecksums: ObjectChecksums? = nil - - /// An optional write handle that is returned periodically in response - /// messages. Clients should save it for later use in establishing a new stream - /// if a connection is interrupted. - public var writeHandle: BidiWriteHandle? = nil - - /// The response sets one of the following. - public var writeStatus: OneOf_WriteStatus? = nil - - /// Initialize a new instance of `BidiWriteObjectResponse`. - 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 = BidiWriteObjectResponse().with { $0.persistedSize = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - private enum CodingKeys: Swift.String, CodingKey { - case persistedSize = "persistedSize" - case resource = "resource" - case persistedDataChecksums = "persistedDataChecksums" - case writeHandle = "writeHandle" - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - self.persistedDataChecksums = try container.decodeIfPresent( - ObjectChecksums.self, forKey: .persistedDataChecksums) - self.writeHandle = try container.decodeIfPresent(BidiWriteHandle.self, forKey: .writeHandle) - - var writeStatus: OneOf_WriteStatus? = nil - let writeStatusCheckAndSet = { - if writeStatus != nil { - throw DecodingError.dataCorrupted( - DecodingError.Context( - codingPath: decoder.codingPath, - debugDescription: "Multiple values set for oneof 'writeStatus'")) - } - writeStatus = $0 - } - if let persistedSize = try container.decodeIfPresent(Swift.Int64.self, forKey: .persistedSize) { - try writeStatusCheckAndSet(.persistedSize(persistedSize)) - } - if let resource = try container.decodeIfPresent(Object?.self, forKey: .resource) { - try writeStatusCheckAndSet(.resource(resource)) - } - self.writeStatus = writeStatus - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(self.persistedDataChecksums, forKey: .persistedDataChecksums) - try container.encode(self.writeHandle, forKey: .writeHandle) - - if let choice = self.writeStatus { - switch choice { - case .persistedSize(let value): - try container.encode(value, forKey: .persistedSize) - case .resource(let value): - try container.encode(value, forKey: .resource) - } - } - } - - /// The response sets one of the following. - public enum OneOf_WriteStatus: Codable, Equatable, Sendable { - /// The total number of bytes that have been processed for the given object - /// from all `WriteObject` calls. Only set if the upload has not finalized. - case persistedSize(Swift.Int64) - /// A resource containing the metadata for the uploaded object. Only set if - /// the upload has finalized. - indirect case resource(Object?) - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.BidiWriteObjectResponse" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/CancelResumableWriteRequest.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/CancelResumableWriteRequest.swift deleted file mode 100644 index 9fc1f6c5e..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/CancelResumableWriteRequest.swift +++ /dev/null @@ -1,56 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Request message for -/// [CancelResumableWrite][google.storage.v2.Storage.CancelResumableWrite]. -/// -/// [google.storage.v2.Storage.CancelResumableWrite]: -public struct CancelResumableWriteRequest: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Required. The upload_id of the resumable upload to cancel. This should be - /// copied from the `upload_id` field of `StartResumableWriteResponse`. - public var uploadId: Swift.String = Swift.String() - - /// Initialize a new instance of `CancelResumableWriteRequest`. - 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 = CancelResumableWriteRequest().with { $0.uploadId = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.CancelResumableWriteRequest" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/CancelResumableWriteResponse.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/CancelResumableWriteResponse.swift deleted file mode 100644 index 7276208be..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/CancelResumableWriteResponse.swift +++ /dev/null @@ -1,50 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Empty response message for canceling an in-progress resumable upload, is -/// extended as needed. -public struct CancelResumableWriteResponse: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Initialize a new instance of `CancelResumableWriteResponse`. - 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 = CancelResumableWriteResponse().with { $0. = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.CancelResumableWriteResponse" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ChecksummedData.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ChecksummedData.swift deleted file mode 100644 index ae38dbf3f..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ChecksummedData.swift +++ /dev/null @@ -1,73 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Message used to convey content being read or written, along with an optional -/// checksum. -public struct ChecksummedData: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Optional. The data. - public var content: Foundation.Data = Foundation.Data() - - /// If set, the CRC32C digest of the content field. - public var crc32C: Swift.UInt32? = nil - - /// Initialize a new instance of `ChecksummedData`. - 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 = ChecksummedData().with { $0.content = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - private enum CodingKeys: Swift.String, CodingKey { - case content = "content" - case crc32C = "crc32c" - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - self.content = try container.decode(Foundation.Data.self, forKey: .content) - self.crc32C = try container.decodeIfPresent(Swift.UInt32.self, forKey: .crc32C) - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(self.content, forKey: .content) - try container.encode(self.crc32C, forKey: .crc32C) - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.ChecksummedData" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ContentRange.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ContentRange.swift deleted file mode 100644 index c57d51456..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ContentRange.swift +++ /dev/null @@ -1,58 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Specifies a requested range of bytes to download. -public struct ContentRange: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// The starting offset of the object data. This value is inclusive. - public var start: Swift.Int64 = Swift.Int64() - - /// The ending offset of the object data. This value is exclusive. - public var end: Swift.Int64 = Swift.Int64() - - /// The complete length of the object data. - public var completeLength: Swift.Int64 = Swift.Int64() - - /// Initialize a new instance of `ContentRange`. - 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 = ContentRange().with { $0.start = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.ContentRange" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ObjectRangeData.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ObjectRangeData.swift deleted file mode 100644 index 21b104f95..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ObjectRangeData.swift +++ /dev/null @@ -1,62 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Contains data and metadata for a range of an object. -public struct ObjectRangeData: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// A portion of the data for the object. - public var checksummedData: ChecksummedData? = nil - - /// The `ReadRange` describes the content being returned with `read_id` set to - /// the corresponding `ReadObjectRequest` in the stream. Multiple - /// `ObjectRangeData` messages might have the same read_id but increasing - /// offsets. `ReadObjectResponse` messages with the same `read_id` are - /// guaranteed to be delivered in increasing offset order. - public var readRange: ReadRange? = nil - - /// If set, indicates there are no more bytes to read for the given ReadRange. - public var rangeEnd: Swift.Bool = Swift.Bool() - - /// Initialize a new instance of `ObjectRangeData`. - 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 = ObjectRangeData().with { $0.checksummedData = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.ObjectRangeData" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/QueryWriteStatusRequest.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/QueryWriteStatusRequest.swift deleted file mode 100644 index 540b77fc0..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/QueryWriteStatusRequest.swift +++ /dev/null @@ -1,60 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Request object for -/// [QueryWriteStatus][google.storage.v2.Storage.QueryWriteStatus]. -/// -/// [google.storage.v2.Storage.QueryWriteStatus]: -public struct QueryWriteStatusRequest: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Required. The name of the resume token for the object whose write status is - /// being requested. - public var uploadId: Swift.String = Swift.String() - - /// Optional. A set of parameters common to Storage API requests concerning an - /// object. - public var commonObjectRequestParams: CommonObjectRequestParams? = nil - - /// Initialize a new instance of `QueryWriteStatusRequest`. - 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 = QueryWriteStatusRequest().with { $0.uploadId = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.QueryWriteStatusRequest" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/QueryWriteStatusResponse.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/QueryWriteStatusResponse.swift deleted file mode 100644 index 5a4581f3d..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/QueryWriteStatusResponse.swift +++ /dev/null @@ -1,114 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Response object for -/// [QueryWriteStatus][google.storage.v2.Storage.QueryWriteStatus]. -/// -/// [google.storage.v2.Storage.QueryWriteStatus]: -public struct QueryWriteStatusResponse: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// If persisted_size is set, contains checksums of persisted data. - public var persistedDataChecksums: ObjectChecksums? = nil - - /// The response sets one of the following. - public var writeStatus: OneOf_WriteStatus? = nil - - /// Initialize a new instance of `QueryWriteStatusResponse`. - 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 = QueryWriteStatusResponse().with { $0.persistedSize = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - private enum CodingKeys: Swift.String, CodingKey { - case persistedSize = "persistedSize" - case resource = "resource" - case persistedDataChecksums = "persistedDataChecksums" - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - self.persistedDataChecksums = try container.decodeIfPresent( - ObjectChecksums.self, forKey: .persistedDataChecksums) - - var writeStatus: OneOf_WriteStatus? = nil - let writeStatusCheckAndSet = { - if writeStatus != nil { - throw DecodingError.dataCorrupted( - DecodingError.Context( - codingPath: decoder.codingPath, - debugDescription: "Multiple values set for oneof 'writeStatus'")) - } - writeStatus = $0 - } - if let persistedSize = try container.decodeIfPresent(Swift.Int64.self, forKey: .persistedSize) { - try writeStatusCheckAndSet(.persistedSize(persistedSize)) - } - if let resource = try container.decodeIfPresent(Object?.self, forKey: .resource) { - try writeStatusCheckAndSet(.resource(resource)) - } - self.writeStatus = writeStatus - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(self.persistedDataChecksums, forKey: .persistedDataChecksums) - - if let choice = self.writeStatus { - switch choice { - case .persistedSize(let value): - try container.encode(value, forKey: .persistedSize) - case .resource(let value): - try container.encode(value, forKey: .resource) - } - } - } - - /// The response sets one of the following. - public enum OneOf_WriteStatus: Codable, Equatable, Sendable { - /// The total number of bytes that have been processed for the given object - /// from all `WriteObject` calls. This is the correct value for the - /// 'write_offset' field to use when resuming the `WriteObject` operation. - /// Only set if the upload has not finalized. - case persistedSize(Swift.Int64) - /// A resource containing the metadata for the uploaded object. Only set if - /// the upload has finalized. - indirect case resource(Object?) - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.QueryWriteStatusResponse" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadObjectRequest.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadObjectRequest.swift deleted file mode 100644 index adfdb8038..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadObjectRequest.swift +++ /dev/null @@ -1,112 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Request message for [ReadObject][google.storage.v2.Storage.ReadObject]. -/// -/// [google.storage.v2.Storage.ReadObject]: -public struct ReadObjectRequest: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Required. The name of the bucket containing the object to read. - public var bucket: Swift.String = Swift.String() - - /// Required. The name of the object to read. - public var object: Swift.String = Swift.String() - - /// Optional. If present, selects a specific revision of this object (as - /// opposed to the latest version, the default). - public var generation: Swift.Int64 = Swift.Int64() - - /// Optional. The offset for the first byte to return in the read, relative to - /// the start of the object. - /// - /// A negative `read_offset` value is interpreted as the number of bytes - /// back from the end of the object to be returned. For example, if an object's - /// length is `15` bytes, a `ReadObjectRequest` with `read_offset` = `-5` and - /// `read_limit` = `3` would return bytes `10` through `12` of the object. - /// Requesting a negative offset with magnitude larger than the size of the - /// object returns the entire object. - public var readOffset: Swift.Int64 = Swift.Int64() - - /// Optional. The maximum number of `data` bytes the server is allowed to - /// return in the sum of all `Object` messages. A `read_limit` of zero - /// indicates that there is no limit, and a negative `read_limit` causes an - /// error. - /// - /// If the stream returns fewer bytes than allowed by the `read_limit` and no - /// error occurred, the stream includes all data from the `read_offset` to the - /// end of the resource. - public var readLimit: Swift.Int64 = Swift.Int64() - - /// Makes the operation conditional on whether the object's current generation - /// matches the given value. Setting to 0 makes the operation succeed only if - /// there are no live versions of the object. - public var ifGenerationMatch: Swift.Int64? = nil - - /// Makes the operation conditional on whether the object's live generation - /// does not match the given value. If no live object exists, the precondition - /// fails. Setting to 0 makes the operation succeed only if there is a live - /// version of the object. - public var ifGenerationNotMatch: Swift.Int64? = nil - - /// Makes the operation conditional on whether the object's current - /// metageneration matches the given value. - public var ifMetagenerationMatch: Swift.Int64? = nil - - /// Makes the operation conditional on whether the object's current - /// metageneration does not match the given value. - public var ifMetagenerationNotMatch: Swift.Int64? = nil - - /// Optional. A set of parameters common to Storage API requests concerning an - /// object. - public var commonObjectRequestParams: CommonObjectRequestParams? = nil - - /// Mask specifying which fields to read. - /// The `checksummed_data` field and its children are always present. - /// If no mask is specified, it defaults to all fields except `metadata. - /// owner` and `metadata.acl`. - /// `*` might be used to mean "all fields". - public var readMask: GoogleCloudWkt.FieldMask? = nil - - /// Initialize a new instance of `ReadObjectRequest`. - 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 = ReadObjectRequest().with { $0.bucket = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.ReadObjectRequest" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadObjectResponse.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadObjectResponse.swift deleted file mode 100644 index 903580d91..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadObjectResponse.swift +++ /dev/null @@ -1,71 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Response message for [ReadObject][google.storage.v2.Storage.ReadObject]. -/// -/// [google.storage.v2.Storage.ReadObject]: -public struct ReadObjectResponse: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// A portion of the data for the object. The service might leave `data` - /// empty for any given `ReadResponse`. This enables the service to inform the - /// client that the request is still live while it is running an operation to - /// generate more data. - public var checksummedData: ChecksummedData? = nil - - /// The checksums of the complete object. If the object is downloaded in full, - /// the client should compute one of these checksums over the downloaded object - /// and compare it against the value provided here. - public var objectChecksums: ObjectChecksums? = nil - - /// If `read_offset` and or `read_limit` is specified on the - /// `ReadObjectRequest`, `ContentRange` is populated on the first - /// `ReadObjectResponse` message of the read stream. - public var contentRange: ContentRange? = nil - - /// Metadata of the object whose media is being returned. - /// Only populated in the first response in the stream. - public var metadata: Object? = nil - - /// Initialize a new instance of `ReadObjectResponse`. - 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 = ReadObjectResponse().with { $0.checksummedData = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.ReadObjectResponse" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadRange.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadRange.swift deleted file mode 100644 index d1eb873b0..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadRange.swift +++ /dev/null @@ -1,76 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Describes a range of bytes to read in a `BidiReadObjectRanges` request. -public struct ReadRange: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Required. The offset for the first byte to return in the read, relative to - /// the start of the object. - /// - /// A negative read_offset value is interpreted as the number of bytes - /// back from the end of the object to be returned. For example, if an object's - /// length is 15 bytes, a `ReadObjectRequest` with `read_offset` = -5 and - /// `read_length` = 3 would return bytes 10 through 12 of the object. - /// Requesting a negative offset with magnitude larger than the size of the - /// object is equivalent to `read_offset` = 0. A `read_offset` larger than the - /// size of the object results in an `OutOfRange` error. - public var readOffset: Swift.Int64 = Swift.Int64() - - /// Optional. The maximum number of data bytes the server is allowed to return - /// across all response messages with the same `read_id`. A `read_length` of - /// zero indicates to read until the resource end, and a negative `read_length` - /// causes an `OutOfRange` error. If the stream returns fewer bytes than - /// allowed by the `read_length` and no error occurred, the stream includes all - /// data from the `read_offset` to the resource end. - public var readLength: Swift.Int64 = Swift.Int64() - - /// Required. Read identifier provided by the client. When the client issues - /// more than one outstanding `ReadRange` on the same stream, responses can be - /// mapped back to their corresponding requests using this value. Clients must - /// ensure that all outstanding requests have different read_id values. The - /// server might close the stream with an error if this condition is not met. - public var readId: Swift.Int64 = Swift.Int64() - - /// Initialize a new instance of `ReadRange`. - 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 = ReadRange().with { $0.readOffset = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.ReadRange" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadRangeError.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadRangeError.swift deleted file mode 100644 index 58a78e61b..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ReadRangeError.swift +++ /dev/null @@ -1,56 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt -import GoogleRpc - -/// Error extension proto containing details for a single range read -public struct ReadRangeError: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// The id of the corresponding read_range - public var readId: Swift.Int64 = Swift.Int64() - - /// The status which should be an enum value of [google.rpc.Code]. - public var status: GoogleRpc.Status? = nil - - /// Initialize a new instance of `ReadRangeError`. - 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 = ReadRangeError().with { $0.readId = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.ReadRangeError" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ServiceConstants.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ServiceConstants.swift deleted file mode 100644 index a36d65fab..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/ServiceConstants.swift +++ /dev/null @@ -1,261 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Shared constants. -public struct ServiceConstants: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Initialize a new instance of `ServiceConstants`. - 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 = ServiceConstants().with { $0. = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - /// A collection of constant values meaningful to the Storage API. - public enum Values: Codable, Equatable, Sendable { - /// Unused. Proto3 requires first enum to be 0. - case unspecified - /// The maximum number of custom attributes per NotificationConfigs. - case maxNotificationCustomAttributes - /// The maximum number of days for which a token returned by the - /// GetListObjectsSplitPoints RPC is valid. - case splitTokenMaxValidDays - /// The maximum character length of the key or value in a bucket - /// label map. - case maxLabelsKeyValueLength - /// The maximum number of key/value entries per bucket label. - case maxLabelsEntriesCount - /// The maximum number of LifecycleRules that can be registered for a given - /// bucket. - case maxLifecycleRulesPerBucket - /// The maximum byte size of the key or value in a bucket label - /// map. - case maxLabelsKeyValueBytes - /// The maximum length of a custom attribute key included in - /// NotificationConfig. - case maxNotificationCustomAttributeKeyLength - /// The maximum number of object IDs that can be included in a - /// DeleteObjectsRequest. - case maxObjectIdsPerDeleteObjectsRequest - /// The maximum length field name that can be sent in a single - /// custom metadata field. - /// 1 KiB. - case maxCustomMetadataFieldNameBytes - /// The maximum length field value that can be sent in a single - /// custom_metadata field. - /// 4 KiB. - case maxCustomMetadataFieldValueBytes - /// The maximum total bytes that can be populated into all field names and - /// values of the custom_metadata for one object. - /// 8 KiB. - case maxCustomMetadataTotalSizeBytes - /// The maximum total bytes that can be populated into all bucket metadata - /// fields. - /// 20 KiB. - case maxBucketMetadataTotalSizeBytes - /// The maximum size chunk that can be returned in a single - /// `ReadRequest`. - /// 2 MiB. - case maxReadChunkBytes - /// The maximum size of an object in MB - whether written in a single stream - /// or composed from multiple other objects. - /// 5 TiB. - case maxObjectSizeMb - /// Encodes an unknown integer value. - /// - /// The most common cause for an unknown values is for the service to send - /// a value unknown to the library. We recommend you update your library to - /// the latest version. - case unknownIntValue(Int) - /// Encodes an unknown string value. - /// - /// The most common cause for an unknown values is for the service to send - /// a value unknown to the library. We recommend you update your library to - /// the latest version. - case unknownStringValue(String) - - public init() { - self = .unspecified - } - - /// Returns the integer value associated with the enumeration. - /// - /// If the enumeration was initialized with an unknown string value, this returns `nil`. - public var intValue: Int? { - switch self { - case .unspecified: return 0 - case .maxNotificationCustomAttributes: return 5 - case .splitTokenMaxValidDays: return 14 - case .maxLabelsKeyValueLength: return 63 - case .maxLabelsEntriesCount: return 64 - case .maxLifecycleRulesPerBucket: return 100 - case .maxLabelsKeyValueBytes: return 128 - case .maxNotificationCustomAttributeKeyLength: return 256 - case .maxObjectIdsPerDeleteObjectsRequest: return 1000 - case .maxCustomMetadataFieldNameBytes: return 1024 - case .maxCustomMetadataFieldValueBytes: return 4096 - case .maxCustomMetadataTotalSizeBytes: return 8192 - case .maxBucketMetadataTotalSizeBytes: return 20480 - case .maxReadChunkBytes: return 2097152 - case .maxObjectSizeMb: return 5242880 - case .unknownIntValue(let v): return v - case .unknownStringValue: return nil - } - } - - /// Returns the string value (or name) associated with the enumeration. - /// - /// If the enumeration was initialized with an unknown integer value, this returns `nil`. - public var stringValue: Swift.String? { - switch self { - case .unspecified: return "VALUES_UNSPECIFIED" - case .maxNotificationCustomAttributes: return "MAX_NOTIFICATION_CUSTOM_ATTRIBUTES" - case .splitTokenMaxValidDays: return "SPLIT_TOKEN_MAX_VALID_DAYS" - case .maxLabelsKeyValueLength: return "MAX_LABELS_KEY_VALUE_LENGTH" - case .maxLabelsEntriesCount: return "MAX_LABELS_ENTRIES_COUNT" - case .maxLifecycleRulesPerBucket: return "MAX_LIFECYCLE_RULES_PER_BUCKET" - case .maxLabelsKeyValueBytes: return "MAX_LABELS_KEY_VALUE_BYTES" - case .maxNotificationCustomAttributeKeyLength: - return "MAX_NOTIFICATION_CUSTOM_ATTRIBUTE_KEY_LENGTH" - case .maxObjectIdsPerDeleteObjectsRequest: return "MAX_OBJECT_IDS_PER_DELETE_OBJECTS_REQUEST" - case .maxCustomMetadataFieldNameBytes: return "MAX_CUSTOM_METADATA_FIELD_NAME_BYTES" - case .maxCustomMetadataFieldValueBytes: return "MAX_CUSTOM_METADATA_FIELD_VALUE_BYTES" - case .maxCustomMetadataTotalSizeBytes: return "MAX_CUSTOM_METADATA_TOTAL_SIZE_BYTES" - case .maxBucketMetadataTotalSizeBytes: return "MAX_BUCKET_METADATA_TOTAL_SIZE_BYTES" - case .maxReadChunkBytes: return "MAX_READ_CHUNK_BYTES" - case .maxObjectSizeMb: return "MAX_OBJECT_SIZE_MB" - case .unknownIntValue: return nil - case .unknownStringValue(let v): return v - } - } - - /// Initialize from a string value. - /// - /// If the value is unknown, this initializes to [`unknownStringValue`](doc:Values/unknownStringValue(_:)). - public init(stringValue: Swift.String) { - switch stringValue { - case "VALUES_UNSPECIFIED": self = .unspecified - case "MAX_READ_CHUNK_BYTES": self = .maxReadChunkBytes - case "MAX_WRITE_CHUNK_BYTES": self = .maxReadChunkBytes - case "MAX_OBJECT_SIZE_MB": self = .maxObjectSizeMb - case "MAX_CUSTOM_METADATA_FIELD_NAME_BYTES": self = .maxCustomMetadataFieldNameBytes - case "MAX_CUSTOM_METADATA_FIELD_VALUE_BYTES": self = .maxCustomMetadataFieldValueBytes - case "MAX_CUSTOM_METADATA_TOTAL_SIZE_BYTES": self = .maxCustomMetadataTotalSizeBytes - case "MAX_BUCKET_METADATA_TOTAL_SIZE_BYTES": self = .maxBucketMetadataTotalSizeBytes - case "MAX_NOTIFICATION_CONFIGS_PER_BUCKET": self = .maxLifecycleRulesPerBucket - case "MAX_LIFECYCLE_RULES_PER_BUCKET": self = .maxLifecycleRulesPerBucket - case "MAX_NOTIFICATION_CUSTOM_ATTRIBUTES": self = .maxNotificationCustomAttributes - case "MAX_NOTIFICATION_CUSTOM_ATTRIBUTE_KEY_LENGTH": - self = .maxNotificationCustomAttributeKeyLength - case "MAX_NOTIFICATION_CUSTOM_ATTRIBUTE_VALUE_LENGTH": self = .maxCustomMetadataFieldNameBytes - case "MAX_LABELS_ENTRIES_COUNT": self = .maxLabelsEntriesCount - case "MAX_LABELS_KEY_VALUE_LENGTH": self = .maxLabelsKeyValueLength - case "MAX_LABELS_KEY_VALUE_BYTES": self = .maxLabelsKeyValueBytes - case "MAX_OBJECT_IDS_PER_DELETE_OBJECTS_REQUEST": self = .maxObjectIdsPerDeleteObjectsRequest - case "SPLIT_TOKEN_MAX_VALID_DAYS": self = .splitTokenMaxValidDays - default: self = .unknownStringValue(stringValue) - } - } - - /// Initialize from an integer value. - /// - /// If the value is unknown, this initializes to [`unknownIntValue`](doc:Values/unknownIntValue(_:)). - public init(intValue: Int) { - switch intValue { - case 0: self = .unspecified - case 5: self = .maxNotificationCustomAttributes - case 14: self = .splitTokenMaxValidDays - case 63: self = .maxLabelsKeyValueLength - case 64: self = .maxLabelsEntriesCount - case 100: self = .maxLifecycleRulesPerBucket - case 128: self = .maxLabelsKeyValueBytes - case 256: self = .maxNotificationCustomAttributeKeyLength - case 1000: self = .maxObjectIdsPerDeleteObjectsRequest - case 1024: self = .maxCustomMetadataFieldNameBytes - case 4096: self = .maxCustomMetadataFieldValueBytes - case 8192: self = .maxCustomMetadataTotalSizeBytes - case 20480: self = .maxBucketMetadataTotalSizeBytes - case 2097152: self = .maxReadChunkBytes - case 5242880: self = .maxObjectSizeMb - default: self = .unknownIntValue(intValue) - } - } - - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let v = try? container.decode(Int.self) { - self.init(intValue: v) - return - } - if let s = try? container.decode(String.self) { - if let v = Int(s) { - self.init(intValue: v) - } else { - self.init(stringValue: s) - } - return - } - throw DecodingError.dataCorruptedError( - in: container, debugDescription: "Expected enum value, must be integer or string.") - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .unspecified: return try container.encode(0) - case .maxNotificationCustomAttributes: return try container.encode(5) - case .splitTokenMaxValidDays: return try container.encode(14) - case .maxLabelsKeyValueLength: return try container.encode(63) - case .maxLabelsEntriesCount: return try container.encode(64) - case .maxLifecycleRulesPerBucket: return try container.encode(100) - case .maxLabelsKeyValueBytes: return try container.encode(128) - case .maxNotificationCustomAttributeKeyLength: return try container.encode(256) - case .maxObjectIdsPerDeleteObjectsRequest: return try container.encode(1000) - case .maxCustomMetadataFieldNameBytes: return try container.encode(1024) - case .maxCustomMetadataFieldValueBytes: return try container.encode(4096) - case .maxCustomMetadataTotalSizeBytes: return try container.encode(8192) - case .maxBucketMetadataTotalSizeBytes: return try container.encode(20480) - case .maxReadChunkBytes: return try container.encode(2097152) - case .maxObjectSizeMb: return try container.encode(5242880) - case .unknownIntValue(let v): return try container.encode(v) - case .unknownStringValue(let v): return try container.encode(v) - } - } - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.ServiceConstants" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/StartResumableWriteRequest.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/StartResumableWriteRequest.swift deleted file mode 100644 index aedcead68..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/StartResumableWriteRequest.swift +++ /dev/null @@ -1,66 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Request message for -/// [StartResumableWrite][google.storage.v2.Storage.StartResumableWrite]. -/// -/// [google.storage.v2.Storage.StartResumableWrite]: -public struct StartResumableWriteRequest: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Required. Contains the information necessary to start a resumable write. - public var writeObjectSpec: WriteObjectSpec? = nil - - /// Optional. A set of parameters common to Storage API requests related to an - /// object. - public var commonObjectRequestParams: CommonObjectRequestParams? = nil - - /// Optional. The checksums of the complete object. This is used to validate - /// the uploaded object. For each upload, `object_checksums` can be provided - /// when initiating a resumable upload with`StartResumableWriteRequest` or when - /// completing a write with `WriteObjectRequest` with - /// `finish_write` set to `true`. - public var objectChecksums: ObjectChecksums? = nil - - /// Initialize a new instance of `StartResumableWriteRequest`. - 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 = StartResumableWriteRequest().with { $0.writeObjectSpec = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.StartResumableWriteRequest" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/StartResumableWriteResponse.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/StartResumableWriteResponse.swift deleted file mode 100644 index c1835774f..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/StartResumableWriteResponse.swift +++ /dev/null @@ -1,59 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Response object for -/// [StartResumableWrite][google.storage.v2.Storage.StartResumableWrite]. -/// -/// [google.storage.v2.Storage.StartResumableWrite]: -public struct StartResumableWriteResponse: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// A unique identifier for the initiated resumable write operation. - /// As the ID grants write access, you should keep it confidential during - /// the upload to prevent unauthorized access and data tampering during your - /// upload. This ID should be included in subsequent `WriteObject` requests to - /// upload the object data. - public var uploadId: Swift.String = Swift.String() - - /// Initialize a new instance of `StartResumableWriteResponse`. - 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 = StartResumableWriteResponse().with { $0.uploadId = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.StartResumableWriteResponse" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Logging.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Logging.swift new file mode 100644 index 000000000..07df7ea6a --- /dev/null +++ b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Logging.swift @@ -0,0 +1,255 @@ +// 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. + +import Foundation +#if canImport(FoundationNetworking) + import FoundationNetworking +#endif +import GoogleCloudWkt +import GoogleCloudGax +import struct Logging.Logger + +extension Clients { + final class StorageLogging: StorageStub { + let inner: any StorageStub + let logger: Logger + + public init(_ inner: any StorageStub, logger: Logger) { + var logger = logger + logger[metadataKey: "gcp.artifact.id"] = "google-storage-v2" + logger[metadataKey: "gcp.client.service"] = "storage" + logger[metadataKey: "gcp.experimental.swift.client"] = "Storage" + self.inner = inner + self.logger = logger + } + + func _intercept( + request: Input, + options: GoogleCloudGax.RequestOptions, + name: Swift.String, + action: (Input, GoogleCloudGax.RequestOptions) async throws -> Output, + ) async throws -> Output { + var logger = logger + logger[metadataKey: "gcp.experimental.swift.request.id"] = "\(UUID())" + logger[metadataKey: "gcp.experimental.swift.method"] = .string(name) + logger.debug("enter : \(request) \(options)") + do { + let output = try await action(request, options) + logger.debug("success: \(request) \(options) \(output)") + return output + } catch let error { + logger.debug("error : \(request) \(options) \(error)") + throw error + } + } + + public func deleteBucket( + request: DeleteBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws { + try await self._intercept( + request: request, + options: options, + name: "deleteBucket", + action: { (r: DeleteBucketRequest, o: GoogleCloudGax.RequestOptions) async throws -> Void in + return try await self.inner.deleteBucket(request: r, options: o) + }) + } + + public func getBucket( + request: GetBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket { + try await self._intercept( + request: request, + options: options, + name: "getBucket", + action: { + (r: GetBucketRequest, o: GoogleCloudGax.RequestOptions) async throws -> Bucket + in + return try await self.inner.getBucket(request: r, options: o) + }) + } + + public func createBucket( + request: CreateBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket { + try await self._intercept( + request: request, + options: options, + name: "createBucket", + action: { + (r: CreateBucketRequest, o: GoogleCloudGax.RequestOptions) async throws -> Bucket + in + return try await self.inner.createBucket(request: r, options: o) + }) + } + + public func listBuckets( + request: ListBucketsRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> ListBucketsResponse { + try await self._intercept( + request: request, + options: options, + name: "listBuckets", + action: { + (r: ListBucketsRequest, o: GoogleCloudGax.RequestOptions) async throws + -> ListBucketsResponse + in + return try await self.inner.listBuckets(request: r, options: o) + }) + } + + public func lockBucketRetentionPolicy( + request: LockBucketRetentionPolicyRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket { + try await self._intercept( + request: request, + options: options, + name: "lockBucketRetentionPolicy", + action: { + (r: LockBucketRetentionPolicyRequest, o: GoogleCloudGax.RequestOptions) async throws + -> Bucket + in + return try await self.inner.lockBucketRetentionPolicy(request: r, options: o) + }) + } + + public func updateBucket( + request: UpdateBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket { + try await self._intercept( + request: request, + options: options, + name: "updateBucket", + action: { + (r: UpdateBucketRequest, o: GoogleCloudGax.RequestOptions) async throws -> Bucket + in + return try await self.inner.updateBucket(request: r, options: o) + }) + } + + public func composeObject( + request: ComposeObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object { + try await self._intercept( + request: request, + options: options, + name: "composeObject", + action: { + (r: ComposeObjectRequest, o: GoogleCloudGax.RequestOptions) async throws -> Object + in + return try await self.inner.composeObject(request: r, options: o) + }) + } + + public func deleteObject( + request: DeleteObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws { + try await self._intercept( + request: request, + options: options, + name: "deleteObject", + action: { (r: DeleteObjectRequest, o: GoogleCloudGax.RequestOptions) async throws -> Void in + return try await self.inner.deleteObject(request: r, options: o) + }) + } + + public func restoreObject( + request: RestoreObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object { + try await self._intercept( + request: request, + options: options, + name: "restoreObject", + action: { + (r: RestoreObjectRequest, o: GoogleCloudGax.RequestOptions) async throws -> Object + in + return try await self.inner.restoreObject(request: r, options: o) + }) + } + + public func getObject( + request: GetObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object { + try await self._intercept( + request: request, + options: options, + name: "getObject", + action: { + (r: GetObjectRequest, o: GoogleCloudGax.RequestOptions) async throws -> Object + in + return try await self.inner.getObject(request: r, options: o) + }) + } + + public func updateObject( + request: UpdateObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object { + try await self._intercept( + request: request, + options: options, + name: "updateObject", + action: { + (r: UpdateObjectRequest, o: GoogleCloudGax.RequestOptions) async throws -> Object + in + return try await self.inner.updateObject(request: r, options: o) + }) + } + + public func listObjects( + request: ListObjectsRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> ListObjectsResponse { + try await self._intercept( + request: request, + options: options, + name: "listObjects", + action: { + (r: ListObjectsRequest, o: GoogleCloudGax.RequestOptions) async throws + -> ListObjectsResponse + in + return try await self.inner.listObjects(request: r, options: o) + }) + } + + public func rewriteObject( + request: RewriteObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> RewriteResponse { + try await self._intercept( + request: request, + options: options, + name: "rewriteObject", + action: { + (r: RewriteObjectRequest, o: GoogleCloudGax.RequestOptions) async throws + -> RewriteResponse + in + return try await self.inner.rewriteObject(request: r, options: o) + }) + } + + public func moveObject( + request: MoveObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object { + try await self._intercept( + request: request, + options: options, + name: "moveObject", + action: { + (r: MoveObjectRequest, o: GoogleCloudGax.RequestOptions) async throws -> Object + in + return try await self.inner.moveObject(request: r, options: o) + }) + } + } +} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Retry.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Retry.swift new file mode 100644 index 000000000..e2bbc03b9 --- /dev/null +++ b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Retry.swift @@ -0,0 +1,247 @@ +// 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. + +import Foundation +#if canImport(FoundationNetworking) + import FoundationNetworking +#endif +import GoogleCloudWkt +import GoogleCloudGax + +extension Clients { + final class StorageRetry: StorageStub { + let inner: any StorageStub + let options: GoogleCloudGax.ClientOptions + + public init(_ inner: any StorageStub, options: GoogleCloudGax.ClientOptions) { + self.inner = inner + self.options = options + } + + func _intercept( + request: Input, + options: GoogleCloudGax.RequestOptions, + idempotent: Swift.Bool, + action: (Input, GoogleCloudGax.RequestOptions) async throws -> Output, + ) async throws -> Output { + let loop = GoogleCloudGax._RetryLoop( + options: options, withDefault: self.options, idempotent: idempotent, + ) + let attempt = { (attemptTimeout: Swift.Duration?) async throws -> Output in + var attemptOptions = options + attemptOptions.attemptTimeout = attemptTimeout + return try await action(request, attemptOptions) + } + return try await loop.run(attempt: attempt) + } + + public func deleteBucket( + request: DeleteBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws { + try await self._intercept( + request: request, + options: options, + idempotent: false, + action: { (r: DeleteBucketRequest, o: GoogleCloudGax.RequestOptions) async throws -> Void in + return try await self.inner.deleteBucket(request: r, options: o) + }) + } + + public func getBucket( + request: GetBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket { + try await self._intercept( + request: request, + options: options, + idempotent: false, + action: { + (r: GetBucketRequest, o: GoogleCloudGax.RequestOptions) async throws -> Bucket + in + return try await self.inner.getBucket(request: r, options: o) + }) + } + + public func createBucket( + request: CreateBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket { + try await self._intercept( + request: request, + options: options, + idempotent: false, + action: { + (r: CreateBucketRequest, o: GoogleCloudGax.RequestOptions) async throws -> Bucket + in + return try await self.inner.createBucket(request: r, options: o) + }) + } + + public func listBuckets( + request: ListBucketsRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> ListBucketsResponse { + try await self._intercept( + request: request, + options: options, + idempotent: false, + action: { + (r: ListBucketsRequest, o: GoogleCloudGax.RequestOptions) async throws + -> ListBucketsResponse + in + return try await self.inner.listBuckets(request: r, options: o) + }) + } + + public func lockBucketRetentionPolicy( + request: LockBucketRetentionPolicyRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket { + try await self._intercept( + request: request, + options: options, + idempotent: false, + action: { + (r: LockBucketRetentionPolicyRequest, o: GoogleCloudGax.RequestOptions) async throws + -> Bucket + in + return try await self.inner.lockBucketRetentionPolicy(request: r, options: o) + }) + } + + public func updateBucket( + request: UpdateBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket { + try await self._intercept( + request: request, + options: options, + idempotent: false, + action: { + (r: UpdateBucketRequest, o: GoogleCloudGax.RequestOptions) async throws -> Bucket + in + return try await self.inner.updateBucket(request: r, options: o) + }) + } + + public func composeObject( + request: ComposeObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object { + try await self._intercept( + request: request, + options: options, + idempotent: false, + action: { + (r: ComposeObjectRequest, o: GoogleCloudGax.RequestOptions) async throws -> Object + in + return try await self.inner.composeObject(request: r, options: o) + }) + } + + public func deleteObject( + request: DeleteObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws { + try await self._intercept( + request: request, + options: options, + idempotent: false, + action: { (r: DeleteObjectRequest, o: GoogleCloudGax.RequestOptions) async throws -> Void in + return try await self.inner.deleteObject(request: r, options: o) + }) + } + + public func restoreObject( + request: RestoreObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object { + try await self._intercept( + request: request, + options: options, + idempotent: false, + action: { + (r: RestoreObjectRequest, o: GoogleCloudGax.RequestOptions) async throws -> Object + in + return try await self.inner.restoreObject(request: r, options: o) + }) + } + + public func getObject( + request: GetObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object { + try await self._intercept( + request: request, + options: options, + idempotent: false, + action: { + (r: GetObjectRequest, o: GoogleCloudGax.RequestOptions) async throws -> Object + in + return try await self.inner.getObject(request: r, options: o) + }) + } + + public func updateObject( + request: UpdateObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object { + try await self._intercept( + request: request, + options: options, + idempotent: false, + action: { + (r: UpdateObjectRequest, o: GoogleCloudGax.RequestOptions) async throws -> Object + in + return try await self.inner.updateObject(request: r, options: o) + }) + } + + public func listObjects( + request: ListObjectsRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> ListObjectsResponse { + try await self._intercept( + request: request, + options: options, + idempotent: false, + action: { + (r: ListObjectsRequest, o: GoogleCloudGax.RequestOptions) async throws + -> ListObjectsResponse + in + return try await self.inner.listObjects(request: r, options: o) + }) + } + + public func rewriteObject( + request: RewriteObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> RewriteResponse { + try await self._intercept( + request: request, + options: options, + idempotent: false, + action: { + (r: RewriteObjectRequest, o: GoogleCloudGax.RequestOptions) async throws + -> RewriteResponse + in + return try await self.inner.rewriteObject(request: r, options: o) + }) + } + + public func moveObject( + request: MoveObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object { + try await self._intercept( + request: request, + options: options, + idempotent: false, + action: { + (r: MoveObjectRequest, o: GoogleCloudGax.RequestOptions) async throws -> Object + in + return try await self.inner.moveObject(request: r, options: o) + }) + } + } +} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Stub.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Stub.swift new file mode 100644 index 000000000..bec4cd421 --- /dev/null +++ b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Stub.swift @@ -0,0 +1,79 @@ +// 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. + +import Foundation +import GoogleCloudWkt +import GoogleCloudGax + +extension Clients { + protocol StorageStub { + func deleteBucket( + request: DeleteBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws + + func getBucket( + request: GetBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket + + func createBucket( + request: CreateBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket + + func listBuckets( + request: ListBucketsRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> ListBucketsResponse + + func lockBucketRetentionPolicy( + request: LockBucketRetentionPolicyRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket + + func updateBucket( + request: UpdateBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket + + func composeObject( + request: ComposeObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object + + func deleteObject( + request: DeleteObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws + + func restoreObject( + request: RestoreObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object + + func getObject( + request: GetObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object + + func updateObject( + request: UpdateObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object + + func listObjects( + request: ListObjectsRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> ListObjectsResponse + + func rewriteObject( + request: RewriteObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> RewriteResponse + + func moveObject( + request: MoveObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object + } +} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Transport.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Transport.swift new file mode 100644 index 000000000..56ec0ca45 --- /dev/null +++ b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/Storage+Transport.swift @@ -0,0 +1,225 @@ +// 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. + +import Foundation +import GoogleCloudAuth +@_spi(GoogleCloudInternal) import GoogleCloudGax +@_spi(GoogleCloudInternal) import GoogleCloudGaxGRPC +import GoogleCloudWkt + +internal import StorageProtos +internal import GoogleCloudWktConvert +internal import SwiftProtobuf + +extension Clients { + class StorageTransport: StorageStub { + let inner: GoogleCloudGaxGRPC._GRPCClient + + public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws { + self.inner = try GoogleCloudGaxGRPC._GRPCClient( + from: options, + withDefaultEndpoint: "https://storage.googleapis.com" + ) + } + + public init(_ inner: GoogleCloudGaxGRPC._GRPCClient) { + self.inner = inner + } + + public func deleteBucket( + request: DeleteBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws { + let protoRequest = try request.toProto() + let _: SwiftProtobuf.Google_Protobuf_Empty = try await self.inner.execute( + path: "/google.storage.v2.Storage/DeleteBucket", + request: protoRequest, + options: options, + clientHeader: Clients.clientHeader + ) + } + + public func getBucket( + request: GetBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket { + let protoRequest = try request.toProto() + let protoResponse: StorageProtos.Google_Storage_V2_Bucket = try await self.inner.execute( + path: "/google.storage.v2.Storage/GetBucket", + request: protoRequest, + options: options, + clientHeader: Clients.clientHeader + ) + return try Bucket(proto: protoResponse) + } + + public func createBucket( + request: CreateBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket { + let protoRequest = try request.toProto() + let protoResponse: StorageProtos.Google_Storage_V2_Bucket = try await self.inner.execute( + path: "/google.storage.v2.Storage/CreateBucket", + request: protoRequest, + options: options, + clientHeader: Clients.clientHeader + ) + return try Bucket(proto: protoResponse) + } + + public func listBuckets( + request: ListBucketsRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> ListBucketsResponse { + let protoRequest = try request.toProto() + let protoResponse: StorageProtos.Google_Storage_V2_ListBucketsResponse = try await self.inner + .execute( + path: "/google.storage.v2.Storage/ListBuckets", + request: protoRequest, + options: options, + clientHeader: Clients.clientHeader + ) + return try ListBucketsResponse(proto: protoResponse) + } + + public func lockBucketRetentionPolicy( + request: LockBucketRetentionPolicyRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket { + let protoRequest = try request.toProto() + let protoResponse: StorageProtos.Google_Storage_V2_Bucket = try await self.inner.execute( + path: "/google.storage.v2.Storage/LockBucketRetentionPolicy", + request: protoRequest, + options: options, + clientHeader: Clients.clientHeader + ) + return try Bucket(proto: protoResponse) + } + + public func updateBucket( + request: UpdateBucketRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Bucket { + let protoRequest = try request.toProto() + let protoResponse: StorageProtos.Google_Storage_V2_Bucket = try await self.inner.execute( + path: "/google.storage.v2.Storage/UpdateBucket", + request: protoRequest, + options: options, + clientHeader: Clients.clientHeader + ) + return try Bucket(proto: protoResponse) + } + + public func composeObject( + request: ComposeObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object { + let protoRequest = try request.toProto() + let protoResponse: StorageProtos.Google_Storage_V2_Object = try await self.inner.execute( + path: "/google.storage.v2.Storage/ComposeObject", + request: protoRequest, + options: options, + clientHeader: Clients.clientHeader + ) + return try Object(proto: protoResponse) + } + + public func deleteObject( + request: DeleteObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws { + let protoRequest = try request.toProto() + let _: SwiftProtobuf.Google_Protobuf_Empty = try await self.inner.execute( + path: "/google.storage.v2.Storage/DeleteObject", + request: protoRequest, + options: options, + clientHeader: Clients.clientHeader + ) + } + + public func restoreObject( + request: RestoreObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object { + let protoRequest = try request.toProto() + let protoResponse: StorageProtos.Google_Storage_V2_Object = try await self.inner.execute( + path: "/google.storage.v2.Storage/RestoreObject", + request: protoRequest, + options: options, + clientHeader: Clients.clientHeader + ) + return try Object(proto: protoResponse) + } + + public func getObject( + request: GetObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object { + let protoRequest = try request.toProto() + let protoResponse: StorageProtos.Google_Storage_V2_Object = try await self.inner.execute( + path: "/google.storage.v2.Storage/GetObject", + request: protoRequest, + options: options, + clientHeader: Clients.clientHeader + ) + return try Object(proto: protoResponse) + } + + public func updateObject( + request: UpdateObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object { + let protoRequest = try request.toProto() + let protoResponse: StorageProtos.Google_Storage_V2_Object = try await self.inner.execute( + path: "/google.storage.v2.Storage/UpdateObject", + request: protoRequest, + options: options, + clientHeader: Clients.clientHeader + ) + return try Object(proto: protoResponse) + } + + public func listObjects( + request: ListObjectsRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> ListObjectsResponse { + let protoRequest = try request.toProto() + let protoResponse: StorageProtos.Google_Storage_V2_ListObjectsResponse = try await self.inner + .execute( + path: "/google.storage.v2.Storage/ListObjects", + request: protoRequest, + options: options, + clientHeader: Clients.clientHeader + ) + return try ListObjectsResponse(proto: protoResponse) + } + + public func rewriteObject( + request: RewriteObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> RewriteResponse { + let protoRequest = try request.toProto() + let protoResponse: StorageProtos.Google_Storage_V2_RewriteResponse = try await self.inner + .execute( + path: "/google.storage.v2.Storage/RewriteObject", + request: protoRequest, + options: options, + clientHeader: Clients.clientHeader + ) + return try RewriteResponse(proto: protoResponse) + } + + public func moveObject( + request: MoveObjectRequest, options: GoogleCloudGax.RequestOptions + ) async throws -> Object { + let protoRequest = try request.toProto() + let protoResponse: StorageProtos.Google_Storage_V2_Object = try await self.inner.execute( + path: "/google.storage.v2.Storage/MoveObject", + request: protoRequest, + options: options, + clientHeader: Clients.clientHeader + ) + return try Object(proto: protoResponse) + } + } +} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/WriteObjectRequest.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/WriteObjectRequest.swift deleted file mode 100644 index 907e0dc57..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/WriteObjectRequest.swift +++ /dev/null @@ -1,188 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Request message for [WriteObject][google.storage.v2.Storage.WriteObject]. -/// -/// [google.storage.v2.Storage.WriteObject]: -public struct WriteObjectRequest: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Required. The offset from the beginning of the object at which the data - /// should be written. - /// - /// In the first `WriteObjectRequest` of a `WriteObject()` action, it - /// indicates the initial offset for the `Write()` call. The value **must** be - /// equal to the `persisted_size` that a call to `QueryWriteStatus()` would - /// return (0 if this is the first write to the object). - /// - /// On subsequent calls, this value **must** be no larger than the sum of the - /// first `write_offset` and the sizes of all `data` chunks sent previously on - /// this stream. - /// - /// An incorrect value causes an error. - public var writeOffset: Swift.Int64 = Swift.Int64() - - /// Optional. Checksums for the complete object. If the checksums computed by - /// the service don't match the specified checksums the call fails. This field - /// might only be provided in the first or last request (either with - /// `first_message`, or `finish_write` set). - public var objectChecksums: ObjectChecksums? = nil - - /// Optional. If `true`, this indicates that the write is complete. Sending any - /// `WriteObjectRequest`s subsequent to one in which `finish_write` is `true` - /// causes an error. - /// For a non-resumable write (where the `upload_id` was not set in the first - /// message), it is an error not to set this field in the final message of the - /// stream. - public var finishWrite: Swift.Bool = Swift.Bool() - - /// Optional. A set of parameters common to Cloud Storage API requests - /// concerning an object. - public var commonObjectRequestParams: CommonObjectRequestParams? = nil - - /// The first message of each stream should set one of the following. - public var firstMessage: OneOf_FirstMessage? = nil - - /// A portion of the data for the object. - public var data: OneOf_Data? = nil - - /// Initialize a new instance of `WriteObjectRequest`. - 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 = WriteObjectRequest().with { $0.uploadId = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - private enum CodingKeys: Swift.String, CodingKey { - case uploadId = "uploadId" - case writeObjectSpec = "writeObjectSpec" - case writeOffset = "writeOffset" - case checksummedData = "checksummedData" - case objectChecksums = "objectChecksums" - case finishWrite = "finishWrite" - case commonObjectRequestParams = "commonObjectRequestParams" - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - self.writeOffset = try container.decode(Swift.Int64.self, forKey: .writeOffset) - self.objectChecksums = try container.decodeIfPresent( - ObjectChecksums.self, forKey: .objectChecksums) - self.finishWrite = try container.decode(Swift.Bool.self, forKey: .finishWrite) - self.commonObjectRequestParams = try container.decodeIfPresent( - CommonObjectRequestParams.self, forKey: .commonObjectRequestParams) - - var firstMessage: OneOf_FirstMessage? = nil - let firstMessageCheckAndSet = { - if firstMessage != nil { - throw DecodingError.dataCorrupted( - DecodingError.Context( - codingPath: decoder.codingPath, - debugDescription: "Multiple values set for oneof 'firstMessage'")) - } - firstMessage = $0 - } - if let uploadId = try container.decodeIfPresent(Swift.String.self, forKey: .uploadId) { - try firstMessageCheckAndSet(.uploadId(uploadId)) - } - if let writeObjectSpec = try container.decodeIfPresent( - WriteObjectSpec?.self, forKey: .writeObjectSpec) - { - try firstMessageCheckAndSet(.writeObjectSpec(writeObjectSpec)) - } - self.firstMessage = firstMessage - - var data: OneOf_Data? = nil - let dataCheckAndSet = { - if data != nil { - throw DecodingError.dataCorrupted( - DecodingError.Context( - codingPath: decoder.codingPath, debugDescription: "Multiple values set for oneof 'data'" - )) - } - data = $0 - } - if let checksummedData = try container.decodeIfPresent( - ChecksummedData?.self, forKey: .checksummedData) - { - try dataCheckAndSet(.checksummedData(checksummedData)) - } - self.data = data - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(self.writeOffset, forKey: .writeOffset) - try container.encode(self.objectChecksums, forKey: .objectChecksums) - try container.encode(self.finishWrite, forKey: .finishWrite) - try container.encode(self.commonObjectRequestParams, forKey: .commonObjectRequestParams) - - if let choice = self.firstMessage { - switch choice { - case .uploadId(let value): - try container.encode(value, forKey: .uploadId) - case .writeObjectSpec(let value): - try container.encode(value, forKey: .writeObjectSpec) - } - } - - if let choice = self.data { - switch choice { - case .checksummedData(let value): - try container.encode(value, forKey: .checksummedData) - } - } - } - - /// The first message of each stream should set one of the following. - public enum OneOf_FirstMessage: Codable, Equatable, Sendable { - /// For resumable uploads. This should be the `upload_id` returned from a - /// call to `StartResumableWriteResponse`. - case uploadId(Swift.String) - /// For non-resumable uploads. Describes the overall upload, including the - /// destination bucket and object name, preconditions, etc. - indirect case writeObjectSpec(WriteObjectSpec?) - } - - /// A portion of the data for the object. - public enum OneOf_Data: Codable, Equatable, Sendable { - /// The data to insert. If a crc32c checksum is provided that doesn't match - /// the checksum computed by the service, the request fails. - indirect case checksummedData(ChecksummedData?) - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.WriteObjectRequest" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/WriteObjectResponse.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/WriteObjectResponse.swift deleted file mode 100644 index 49dfbd5d9..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/WriteObjectResponse.swift +++ /dev/null @@ -1,112 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Response message for -/// [WriteObject][google.storage.v2.Storage.WriteObject]. -/// -/// [google.storage.v2.Storage.WriteObject]: -public struct WriteObjectResponse: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// If persisted_size is set, contains checksums of persisted data. - public var persistedDataChecksums: ObjectChecksums? = nil - - /// The response sets one of the following. - public var writeStatus: OneOf_WriteStatus? = nil - - /// Initialize a new instance of `WriteObjectResponse`. - 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 = WriteObjectResponse().with { $0.persistedSize = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - private enum CodingKeys: Swift.String, CodingKey { - case persistedSize = "persistedSize" - case resource = "resource" - case persistedDataChecksums = "persistedDataChecksums" - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - self.persistedDataChecksums = try container.decodeIfPresent( - ObjectChecksums.self, forKey: .persistedDataChecksums) - - var writeStatus: OneOf_WriteStatus? = nil - let writeStatusCheckAndSet = { - if writeStatus != nil { - throw DecodingError.dataCorrupted( - DecodingError.Context( - codingPath: decoder.codingPath, - debugDescription: "Multiple values set for oneof 'writeStatus'")) - } - writeStatus = $0 - } - if let persistedSize = try container.decodeIfPresent(Swift.Int64.self, forKey: .persistedSize) { - try writeStatusCheckAndSet(.persistedSize(persistedSize)) - } - if let resource = try container.decodeIfPresent(Object?.self, forKey: .resource) { - try writeStatusCheckAndSet(.resource(resource)) - } - self.writeStatus = writeStatus - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(self.persistedDataChecksums, forKey: .persistedDataChecksums) - - if let choice = self.writeStatus { - switch choice { - case .persistedSize(let value): - try container.encode(value, forKey: .persistedSize) - case .resource(let value): - try container.encode(value, forKey: .resource) - } - } - } - - /// The response sets one of the following. - public enum OneOf_WriteStatus: Codable, Equatable, Sendable { - /// The total number of bytes that have been processed for the given object - /// from all `WriteObject` calls. Only set if the upload has not finalized. - case persistedSize(Swift.Int64) - /// A resource containing the metadata for the uploaded object. Only set if - /// the upload has finalized. - indirect case resource(Object?) - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.WriteObjectResponse" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/WriteObjectSpec.swift b/packages/storage/Sources/GoogleCloudStorage/generated/Storage/WriteObjectSpec.swift deleted file mode 100644 index 4e8fdba5e..000000000 --- a/packages/storage/Sources/GoogleCloudStorage/generated/Storage/WriteObjectSpec.swift +++ /dev/null @@ -1,89 +0,0 @@ -// 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. - -import Foundation -import GoogleCloudWkt - -/// Describes an attempt to insert an object, possibly over multiple requests. -public struct WriteObjectSpec: Codable, Equatable, GoogleCloudWkt._AnyPackable, - Sendable -{ - /// Required. Destination object, including its name and its metadata. - public var resource: Object? = nil - - /// Optional. Apply a predefined set of access controls to this object. - /// Valid values are `authenticatedRead`, `bucketOwnerFullControl`, - /// `bucketOwnerRead`, `private`, `projectPrivate`, or `publicRead`. - public var predefinedAcl: Swift.String = Swift.String() - - /// Makes the operation conditional on whether the object's current - /// generation matches the given value. Setting to `0` makes the operation - /// succeed only if there are no live versions of the object. - public var ifGenerationMatch: Swift.Int64? = nil - - /// Makes the operation conditional on whether the object's live - /// generation does not match the given value. If no live object exists, the - /// precondition fails. Setting to `0` makes the operation succeed only if - /// there is a live version of the object. - public var ifGenerationNotMatch: Swift.Int64? = nil - - /// Makes the operation conditional on whether the object's current - /// metageneration matches the given value. - public var ifMetagenerationMatch: Swift.Int64? = nil - - /// Makes the operation conditional on whether the object's current - /// metageneration does not match the given value. - public var ifMetagenerationNotMatch: Swift.Int64? = nil - - /// The expected final object size being uploaded. - /// If this value is set, closing the stream after writing fewer or more than - /// `object_size` bytes results in an `OUT_OF_RANGE` error. - /// - /// This situation is considered a client error, and if such an error occurs - /// you must start the upload over from scratch, this time sending the correct - /// number of bytes. - public var objectSize: Swift.Int64? = nil - - /// If `true`, the object is created in appendable mode. - /// This field might only be set when using `BidiWriteObject`. - public var appendable: Swift.Bool? = nil - - /// Initialize a new instance of `WriteObjectSpec`. - 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 = WriteObjectSpec().with { $0.resource = ... } - /// ``` - public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self { - var copy = self - try config(©) - return copy - } - - public static var _anyTypeUrl: Swift.String { - return "type.googleapis.com/google.storage.v2.WriteObjectSpec" - } - 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) - } -} diff --git a/packages/storage/Sources/GoogleCloudStorage/generated/StorageControl/StorageControl+Transport.swift b/packages/storage/Sources/GoogleCloudStorage/generated/StorageControl/StorageControl+Transport.swift index 8ec5d7dec..81925f353 100644 --- a/packages/storage/Sources/GoogleCloudStorage/generated/StorageControl/StorageControl+Transport.swift +++ b/packages/storage/Sources/GoogleCloudStorage/generated/StorageControl/StorageControl+Transport.swift @@ -38,6 +38,10 @@ extension Clients { ) } + public init(_ inner: GoogleCloudGaxGRPC._GRPCClient) { + self.inner = inner + } + public func createFolder( request: CreateFolderRequest, options: GoogleCloudGax.RequestOptions ) async throws -> Folder {