diff --git a/packages/google-storagetransfer/README.md b/packages/google-storagetransfer/README.md index 4548db36064..5b3744c3b50 100644 --- a/packages/google-storagetransfer/README.md +++ b/packages/google-storagetransfer/README.md @@ -44,7 +44,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained]. 1. [Select or create a Cloud Platform project][projects]. 1. [Enable billing for your project][billing]. 1. [Enable the Storage Transfer Service API][enable_api]. -1. [Set up authentication with a service account][auth] so you can access the +1. [Set up authentication][auth] so you can access the API from your local workstation. ### Installing the client library @@ -205,4 +205,4 @@ See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [projects]: https://console.cloud.google.com/project [billing]: https://support.google.com/cloud/answer/6293499#enable-billing [enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=storagetransfer.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/getting-started +[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local diff --git a/packages/google-storagetransfer/protos/google/storagetransfer/v1/transfer.proto b/packages/google-storagetransfer/protos/google/storagetransfer/v1/transfer.proto index ab249c9d2cf..ef8d2844b9e 100644 --- a/packages/google-storagetransfer/protos/google/storagetransfer/v1/transfer.proto +++ b/packages/google-storagetransfer/protos/google/storagetransfer/v1/transfer.proto @@ -24,7 +24,6 @@ import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/storagetransfer/v1/transfer_types.proto"; -option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.StorageTransfer.V1"; option go_package = "cloud.google.com/go/storagetransfer/apiv1/storagetransferpb;storagetransferpb"; option java_outer_classname = "TransferProto"; @@ -254,17 +253,32 @@ message DeleteTransferJobRequest { // be specified when listing transfer jobs. message ListTransferJobsRequest { // Required. A list of query parameters specified as JSON text in the form of: - // `{"projectId":"my_project_id", - // "jobNames":["jobid1","jobid2",...], - // "jobStatuses":["status1","status2",...]}` // - // Since `jobNames` and `jobStatuses` support multiple values, their values - // must be specified with array notation. `projectId` is required. - // `jobNames` and `jobStatuses` are optional. The valid values for - // `jobStatuses` are case-insensitive: - // [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED], - // [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED], and - // [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED]. + // ``` + // { + // "projectId":"my_project_id", + // "jobNames":["jobid1","jobid2",...], + // "jobStatuses":["status1","status2",...], + // "dataBackend":"QUERY_REPLICATION_CONFIGS", + // "sourceBucket":"source-bucket-name", + // "sinkBucket":"sink-bucket-name", + // } + // ``` + // + // The JSON formatting in the example is for display only; provide the + // query parameters without spaces or line breaks. + // + // * `projectId` is required. + // * Since `jobNames` and `jobStatuses` support multiple values, their values + // must be specified with array notation. `jobNames` and `jobStatuses` are + // optional. Valid values are case-insensitive: + // * [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED] + // * [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED] + // * [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED] + // * Specify `"dataBackend":"QUERY_REPLICATION_CONFIGS"` to return a list of + // cross-bucket replication jobs. + // * Limit the results to jobs from a particular bucket with `sourceBucket` + // and/or to a particular bucket with `sinkBucket`. string filter = 1 [(google.api.field_behavior) = REQUIRED]; // The list page size. The max allowed value is 256. diff --git a/packages/google-storagetransfer/protos/google/storagetransfer/v1/transfer_types.proto b/packages/google-storagetransfer/protos/google/storagetransfer/v1/transfer_types.proto index 757eae4c03d..6e7a4d10d48 100644 --- a/packages/google-storagetransfer/protos/google/storagetransfer/v1/transfer_types.proto +++ b/packages/google-storagetransfer/protos/google/storagetransfer/v1/transfer_types.proto @@ -24,7 +24,6 @@ import "google/rpc/code.proto"; import "google/type/date.proto"; import "google/type/timeofday.proto"; -option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.StorageTransfer.V1"; option go_package = "cloud.google.com/go/storagetransfer/apiv1/storagetransferpb;storagetransferpb"; option java_outer_classname = "TransferTypes"; @@ -352,43 +351,43 @@ message AzureBlobStorageData { string credentials_secret = 7 [(google.api.field_behavior) = OPTIONAL]; } -// An HttpData resource specifies a list of objects on the web to be transferred -// over HTTP. The information of the objects to be transferred is contained in -// a file referenced by a URL. The first line in the file must be -// `"TsvHttpData-1.0"`, which specifies the format of the file. Subsequent -// lines specify the information of the list of objects, one object per list -// entry. Each entry has the following tab-delimited fields: +// An HttpData resource specifies a list of objects on the web to be +// transferred over HTTP. The information of the objects to be transferred is +// contained in a file referenced by a URL. The first line in the file must be +// `"TsvHttpData-1.0"`, which specifies the format of the file. Subsequent +// lines specify the information of the list of objects, one object per list +// entry. Each entry has the following tab-delimited fields: // -// * **HTTP URL** — The location of the object. +// * **HTTP URL** — The location of the object. // -// * **Length** — The size of the object in bytes. +// * **Length** — The size of the object in bytes. // -// * **MD5** — The base64-encoded MD5 hash of the object. +// * **MD5** — The base64-encoded MD5 hash of the object. // -// For an example of a valid TSV file, see -// [Transferring data from -// URLs](https://cloud.google.com/storage-transfer/docs/create-url-list). +// For an example of a valid TSV file, see +// [Transferring data from +// URLs](https://cloud.google.com/storage-transfer/docs/create-url-list). // -// When transferring data based on a URL list, keep the following in mind: +// When transferring data based on a URL list, keep the following in mind: // // * When an object located at `http(s)://hostname:port/` is -// transferred to a data sink, the name of the object at the data sink is +// transferred to a data sink, the name of the object at the data sink is // `/`. // // * If the specified size of an object does not match the actual size of the -// object fetched, the object is not transferred. +// object fetched, the object is not transferred. // // * If the specified MD5 does not match the MD5 computed from the transferred -// bytes, the object transfer fails. +// bytes, the object transfer fails. // // * Ensure that each URL you specify is publicly accessible. For -// example, in Cloud Storage you can -// [share an object publicly] -// (/storage/docs/cloud-console#_sharingdata) and get a link to it. +// example, in Cloud Storage you can +// [share an object publicly] +// (/storage/docs/cloud-console#_sharingdata) and get a link to it. // // * Storage Transfer Service obeys `robots.txt` rules and requires the source -// HTTP server to support `Range` requests and to return a `Content-Length` -// header in each response. +// HTTP server to support `Range` requests and to return a `Content-Length` +// header in each response. // // * [ObjectConditions][google.storagetransfer.v1.ObjectConditions] have no // effect when filtering objects to transfer. @@ -686,6 +685,35 @@ message TransferSpec { string sink_agent_pool_name = 18; } +// Specifies the configuration for a cross-bucket replication job. Cross-bucket +// replication copies new or updated objects from a source Cloud Storage bucket +// to a destination Cloud Storage bucket. Existing objects in the source bucket +// are not copied by a new cross-bucket replication job. +message ReplicationSpec { + // The data source to be replicated. + oneof data_source { + // The Cloud Storage bucket from which to replicate objects. + GcsData gcs_data_source = 1; + } + + // The destination for replicated objects. + oneof data_sink { + // The Cloud Storage bucket to which to replicate objects. + GcsData gcs_data_sink = 2; + } + + // Object conditions that determine which objects are transferred. For + // replication jobs, only `include_prefixes` and `exclude_prefixes` are + // supported. + ObjectConditions object_conditions = 3; + + // Specifies the metadata options to be applied during replication. + // Delete options are not supported. If a delete option is specified, the + // request fails with an [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] + // error. + TransferOptions transfer_options = 4; +} + // Specifies the metadata options for running a transfer. message MetadataOptions { // Whether symlinks should be skipped or preserved during a transfer job. @@ -1033,6 +1061,9 @@ message TransferJob { // Transfer specification. TransferSpec transfer_spec = 4; + // Replication specification. + ReplicationSpec replication_spec = 17; + // Notification configuration. NotificationConfig notification_config = 11; diff --git a/packages/google-storagetransfer/protos/protos.d.ts b/packages/google-storagetransfer/protos/protos.d.ts index e8b9ce502a0..48263b36db9 100644 --- a/packages/google-storagetransfer/protos/protos.d.ts +++ b/packages/google-storagetransfer/protos/protos.d.ts @@ -3891,6 +3891,127 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a ReplicationSpec. */ + interface IReplicationSpec { + + /** ReplicationSpec gcsDataSource */ + gcsDataSource?: (google.storagetransfer.v1.IGcsData|null); + + /** ReplicationSpec gcsDataSink */ + gcsDataSink?: (google.storagetransfer.v1.IGcsData|null); + + /** ReplicationSpec objectConditions */ + objectConditions?: (google.storagetransfer.v1.IObjectConditions|null); + + /** ReplicationSpec transferOptions */ + transferOptions?: (google.storagetransfer.v1.ITransferOptions|null); + } + + /** Represents a ReplicationSpec. */ + class ReplicationSpec implements IReplicationSpec { + + /** + * Constructs a new ReplicationSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.storagetransfer.v1.IReplicationSpec); + + /** ReplicationSpec gcsDataSource. */ + public gcsDataSource?: (google.storagetransfer.v1.IGcsData|null); + + /** ReplicationSpec gcsDataSink. */ + public gcsDataSink?: (google.storagetransfer.v1.IGcsData|null); + + /** ReplicationSpec objectConditions. */ + public objectConditions?: (google.storagetransfer.v1.IObjectConditions|null); + + /** ReplicationSpec transferOptions. */ + public transferOptions?: (google.storagetransfer.v1.ITransferOptions|null); + + /** ReplicationSpec dataSource. */ + public dataSource?: "gcsDataSource"; + + /** ReplicationSpec dataSink. */ + public dataSink?: "gcsDataSink"; + + /** + * Creates a new ReplicationSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns ReplicationSpec instance + */ + public static create(properties?: google.storagetransfer.v1.IReplicationSpec): google.storagetransfer.v1.ReplicationSpec; + + /** + * Encodes the specified ReplicationSpec message. Does not implicitly {@link google.storagetransfer.v1.ReplicationSpec.verify|verify} messages. + * @param message ReplicationSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.storagetransfer.v1.IReplicationSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReplicationSpec message, length delimited. Does not implicitly {@link google.storagetransfer.v1.ReplicationSpec.verify|verify} messages. + * @param message ReplicationSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.storagetransfer.v1.IReplicationSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReplicationSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReplicationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.storagetransfer.v1.ReplicationSpec; + + /** + * Decodes a ReplicationSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReplicationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.storagetransfer.v1.ReplicationSpec; + + /** + * Verifies a ReplicationSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReplicationSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReplicationSpec + */ + public static fromObject(object: { [k: string]: any }): google.storagetransfer.v1.ReplicationSpec; + + /** + * Creates a plain object from a ReplicationSpec message. Also converts values to other types if specified. + * @param message ReplicationSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.storagetransfer.v1.ReplicationSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReplicationSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReplicationSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a MetadataOptions. */ interface IMetadataOptions { @@ -4448,6 +4569,9 @@ export namespace google { /** TransferJob transferSpec */ transferSpec?: (google.storagetransfer.v1.ITransferSpec|null); + /** TransferJob replicationSpec */ + replicationSpec?: (google.storagetransfer.v1.IReplicationSpec|null); + /** TransferJob notificationConfig */ notificationConfig?: (google.storagetransfer.v1.INotificationConfig|null); @@ -4497,6 +4621,9 @@ export namespace google { /** TransferJob transferSpec. */ public transferSpec?: (google.storagetransfer.v1.ITransferSpec|null); + /** TransferJob replicationSpec. */ + public replicationSpec?: (google.storagetransfer.v1.IReplicationSpec|null); + /** TransferJob notificationConfig. */ public notificationConfig?: (google.storagetransfer.v1.INotificationConfig|null); diff --git a/packages/google-storagetransfer/protos/protos.js b/packages/google-storagetransfer/protos/protos.js index d6e61c12e05..4a5b7b40793 100644 --- a/packages/google-storagetransfer/protos/protos.js +++ b/packages/google-storagetransfer/protos/protos.js @@ -9144,6 +9144,335 @@ return TransferSpec; })(); + v1.ReplicationSpec = (function() { + + /** + * Properties of a ReplicationSpec. + * @memberof google.storagetransfer.v1 + * @interface IReplicationSpec + * @property {google.storagetransfer.v1.IGcsData|null} [gcsDataSource] ReplicationSpec gcsDataSource + * @property {google.storagetransfer.v1.IGcsData|null} [gcsDataSink] ReplicationSpec gcsDataSink + * @property {google.storagetransfer.v1.IObjectConditions|null} [objectConditions] ReplicationSpec objectConditions + * @property {google.storagetransfer.v1.ITransferOptions|null} [transferOptions] ReplicationSpec transferOptions + */ + + /** + * Constructs a new ReplicationSpec. + * @memberof google.storagetransfer.v1 + * @classdesc Represents a ReplicationSpec. + * @implements IReplicationSpec + * @constructor + * @param {google.storagetransfer.v1.IReplicationSpec=} [properties] Properties to set + */ + function ReplicationSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReplicationSpec gcsDataSource. + * @member {google.storagetransfer.v1.IGcsData|null|undefined} gcsDataSource + * @memberof google.storagetransfer.v1.ReplicationSpec + * @instance + */ + ReplicationSpec.prototype.gcsDataSource = null; + + /** + * ReplicationSpec gcsDataSink. + * @member {google.storagetransfer.v1.IGcsData|null|undefined} gcsDataSink + * @memberof google.storagetransfer.v1.ReplicationSpec + * @instance + */ + ReplicationSpec.prototype.gcsDataSink = null; + + /** + * ReplicationSpec objectConditions. + * @member {google.storagetransfer.v1.IObjectConditions|null|undefined} objectConditions + * @memberof google.storagetransfer.v1.ReplicationSpec + * @instance + */ + ReplicationSpec.prototype.objectConditions = null; + + /** + * ReplicationSpec transferOptions. + * @member {google.storagetransfer.v1.ITransferOptions|null|undefined} transferOptions + * @memberof google.storagetransfer.v1.ReplicationSpec + * @instance + */ + ReplicationSpec.prototype.transferOptions = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ReplicationSpec dataSource. + * @member {"gcsDataSource"|undefined} dataSource + * @memberof google.storagetransfer.v1.ReplicationSpec + * @instance + */ + Object.defineProperty(ReplicationSpec.prototype, "dataSource", { + get: $util.oneOfGetter($oneOfFields = ["gcsDataSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * ReplicationSpec dataSink. + * @member {"gcsDataSink"|undefined} dataSink + * @memberof google.storagetransfer.v1.ReplicationSpec + * @instance + */ + Object.defineProperty(ReplicationSpec.prototype, "dataSink", { + get: $util.oneOfGetter($oneOfFields = ["gcsDataSink"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ReplicationSpec instance using the specified properties. + * @function create + * @memberof google.storagetransfer.v1.ReplicationSpec + * @static + * @param {google.storagetransfer.v1.IReplicationSpec=} [properties] Properties to set + * @returns {google.storagetransfer.v1.ReplicationSpec} ReplicationSpec instance + */ + ReplicationSpec.create = function create(properties) { + return new ReplicationSpec(properties); + }; + + /** + * Encodes the specified ReplicationSpec message. Does not implicitly {@link google.storagetransfer.v1.ReplicationSpec.verify|verify} messages. + * @function encode + * @memberof google.storagetransfer.v1.ReplicationSpec + * @static + * @param {google.storagetransfer.v1.IReplicationSpec} message ReplicationSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplicationSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsDataSource != null && Object.hasOwnProperty.call(message, "gcsDataSource")) + $root.google.storagetransfer.v1.GcsData.encode(message.gcsDataSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsDataSink != null && Object.hasOwnProperty.call(message, "gcsDataSink")) + $root.google.storagetransfer.v1.GcsData.encode(message.gcsDataSink, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.objectConditions != null && Object.hasOwnProperty.call(message, "objectConditions")) + $root.google.storagetransfer.v1.ObjectConditions.encode(message.objectConditions, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.transferOptions != null && Object.hasOwnProperty.call(message, "transferOptions")) + $root.google.storagetransfer.v1.TransferOptions.encode(message.transferOptions, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReplicationSpec message, length delimited. Does not implicitly {@link google.storagetransfer.v1.ReplicationSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.storagetransfer.v1.ReplicationSpec + * @static + * @param {google.storagetransfer.v1.IReplicationSpec} message ReplicationSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplicationSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReplicationSpec message from the specified reader or buffer. + * @function decode + * @memberof google.storagetransfer.v1.ReplicationSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.storagetransfer.v1.ReplicationSpec} ReplicationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplicationSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.storagetransfer.v1.ReplicationSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.gcsDataSource = $root.google.storagetransfer.v1.GcsData.decode(reader, reader.uint32()); + break; + } + case 2: { + message.gcsDataSink = $root.google.storagetransfer.v1.GcsData.decode(reader, reader.uint32()); + break; + } + case 3: { + message.objectConditions = $root.google.storagetransfer.v1.ObjectConditions.decode(reader, reader.uint32()); + break; + } + case 4: { + message.transferOptions = $root.google.storagetransfer.v1.TransferOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReplicationSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.storagetransfer.v1.ReplicationSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.storagetransfer.v1.ReplicationSpec} ReplicationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplicationSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReplicationSpec message. + * @function verify + * @memberof google.storagetransfer.v1.ReplicationSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReplicationSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsDataSource != null && message.hasOwnProperty("gcsDataSource")) { + properties.dataSource = 1; + { + var error = $root.google.storagetransfer.v1.GcsData.verify(message.gcsDataSource); + if (error) + return "gcsDataSource." + error; + } + } + if (message.gcsDataSink != null && message.hasOwnProperty("gcsDataSink")) { + properties.dataSink = 1; + { + var error = $root.google.storagetransfer.v1.GcsData.verify(message.gcsDataSink); + if (error) + return "gcsDataSink." + error; + } + } + if (message.objectConditions != null && message.hasOwnProperty("objectConditions")) { + var error = $root.google.storagetransfer.v1.ObjectConditions.verify(message.objectConditions); + if (error) + return "objectConditions." + error; + } + if (message.transferOptions != null && message.hasOwnProperty("transferOptions")) { + var error = $root.google.storagetransfer.v1.TransferOptions.verify(message.transferOptions); + if (error) + return "transferOptions." + error; + } + return null; + }; + + /** + * Creates a ReplicationSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.storagetransfer.v1.ReplicationSpec + * @static + * @param {Object.} object Plain object + * @returns {google.storagetransfer.v1.ReplicationSpec} ReplicationSpec + */ + ReplicationSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.storagetransfer.v1.ReplicationSpec) + return object; + var message = new $root.google.storagetransfer.v1.ReplicationSpec(); + if (object.gcsDataSource != null) { + if (typeof object.gcsDataSource !== "object") + throw TypeError(".google.storagetransfer.v1.ReplicationSpec.gcsDataSource: object expected"); + message.gcsDataSource = $root.google.storagetransfer.v1.GcsData.fromObject(object.gcsDataSource); + } + if (object.gcsDataSink != null) { + if (typeof object.gcsDataSink !== "object") + throw TypeError(".google.storagetransfer.v1.ReplicationSpec.gcsDataSink: object expected"); + message.gcsDataSink = $root.google.storagetransfer.v1.GcsData.fromObject(object.gcsDataSink); + } + if (object.objectConditions != null) { + if (typeof object.objectConditions !== "object") + throw TypeError(".google.storagetransfer.v1.ReplicationSpec.objectConditions: object expected"); + message.objectConditions = $root.google.storagetransfer.v1.ObjectConditions.fromObject(object.objectConditions); + } + if (object.transferOptions != null) { + if (typeof object.transferOptions !== "object") + throw TypeError(".google.storagetransfer.v1.ReplicationSpec.transferOptions: object expected"); + message.transferOptions = $root.google.storagetransfer.v1.TransferOptions.fromObject(object.transferOptions); + } + return message; + }; + + /** + * Creates a plain object from a ReplicationSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.storagetransfer.v1.ReplicationSpec + * @static + * @param {google.storagetransfer.v1.ReplicationSpec} message ReplicationSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReplicationSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.objectConditions = null; + object.transferOptions = null; + } + if (message.gcsDataSource != null && message.hasOwnProperty("gcsDataSource")) { + object.gcsDataSource = $root.google.storagetransfer.v1.GcsData.toObject(message.gcsDataSource, options); + if (options.oneofs) + object.dataSource = "gcsDataSource"; + } + if (message.gcsDataSink != null && message.hasOwnProperty("gcsDataSink")) { + object.gcsDataSink = $root.google.storagetransfer.v1.GcsData.toObject(message.gcsDataSink, options); + if (options.oneofs) + object.dataSink = "gcsDataSink"; + } + if (message.objectConditions != null && message.hasOwnProperty("objectConditions")) + object.objectConditions = $root.google.storagetransfer.v1.ObjectConditions.toObject(message.objectConditions, options); + if (message.transferOptions != null && message.hasOwnProperty("transferOptions")) + object.transferOptions = $root.google.storagetransfer.v1.TransferOptions.toObject(message.transferOptions, options); + return object; + }; + + /** + * Converts this ReplicationSpec to JSON. + * @function toJSON + * @memberof google.storagetransfer.v1.ReplicationSpec + * @instance + * @returns {Object.} JSON object + */ + ReplicationSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReplicationSpec + * @function getTypeUrl + * @memberof google.storagetransfer.v1.ReplicationSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReplicationSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.storagetransfer.v1.ReplicationSpec"; + }; + + return ReplicationSpec; + })(); + v1.MetadataOptions = (function() { /** @@ -10714,6 +11043,7 @@ * @property {string|null} [description] TransferJob description * @property {string|null} [projectId] TransferJob projectId * @property {google.storagetransfer.v1.ITransferSpec|null} [transferSpec] TransferJob transferSpec + * @property {google.storagetransfer.v1.IReplicationSpec|null} [replicationSpec] TransferJob replicationSpec * @property {google.storagetransfer.v1.INotificationConfig|null} [notificationConfig] TransferJob notificationConfig * @property {google.storagetransfer.v1.ILoggingConfig|null} [loggingConfig] TransferJob loggingConfig * @property {google.storagetransfer.v1.ISchedule|null} [schedule] TransferJob schedule @@ -10772,6 +11102,14 @@ */ TransferJob.prototype.transferSpec = null; + /** + * TransferJob replicationSpec. + * @member {google.storagetransfer.v1.IReplicationSpec|null|undefined} replicationSpec + * @memberof google.storagetransfer.v1.TransferJob + * @instance + */ + TransferJob.prototype.replicationSpec = null; + /** * TransferJob notificationConfig. * @member {google.storagetransfer.v1.INotificationConfig|null|undefined} notificationConfig @@ -10894,6 +11232,8 @@ $root.google.storagetransfer.v1.LoggingConfig.encode(message.loggingConfig, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); if (message.eventStream != null && Object.hasOwnProperty.call(message, "eventStream")) $root.google.storagetransfer.v1.EventStream.encode(message.eventStream, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.replicationSpec != null && Object.hasOwnProperty.call(message, "replicationSpec")) + $root.google.storagetransfer.v1.ReplicationSpec.encode(message.replicationSpec, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); return writer; }; @@ -10944,6 +11284,10 @@ message.transferSpec = $root.google.storagetransfer.v1.TransferSpec.decode(reader, reader.uint32()); break; } + case 17: { + message.replicationSpec = $root.google.storagetransfer.v1.ReplicationSpec.decode(reader, reader.uint32()); + break; + } case 11: { message.notificationConfig = $root.google.storagetransfer.v1.NotificationConfig.decode(reader, reader.uint32()); break; @@ -11029,6 +11373,11 @@ if (error) return "transferSpec." + error; } + if (message.replicationSpec != null && message.hasOwnProperty("replicationSpec")) { + var error = $root.google.storagetransfer.v1.ReplicationSpec.verify(message.replicationSpec); + if (error) + return "replicationSpec." + error; + } if (message.notificationConfig != null && message.hasOwnProperty("notificationConfig")) { var error = $root.google.storagetransfer.v1.NotificationConfig.verify(message.notificationConfig); if (error) @@ -11103,6 +11452,11 @@ throw TypeError(".google.storagetransfer.v1.TransferJob.transferSpec: object expected"); message.transferSpec = $root.google.storagetransfer.v1.TransferSpec.fromObject(object.transferSpec); } + if (object.replicationSpec != null) { + if (typeof object.replicationSpec !== "object") + throw TypeError(".google.storagetransfer.v1.TransferJob.replicationSpec: object expected"); + message.replicationSpec = $root.google.storagetransfer.v1.ReplicationSpec.fromObject(object.replicationSpec); + } if (object.notificationConfig != null) { if (typeof object.notificationConfig !== "object") throw TypeError(".google.storagetransfer.v1.TransferJob.notificationConfig: object expected"); @@ -11194,6 +11548,7 @@ object.latestOperationName = ""; object.loggingConfig = null; object.eventStream = null; + object.replicationSpec = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -11221,6 +11576,8 @@ object.loggingConfig = $root.google.storagetransfer.v1.LoggingConfig.toObject(message.loggingConfig, options); if (message.eventStream != null && message.hasOwnProperty("eventStream")) object.eventStream = $root.google.storagetransfer.v1.EventStream.toObject(message.eventStream, options); + if (message.replicationSpec != null && message.hasOwnProperty("replicationSpec")) + object.replicationSpec = $root.google.storagetransfer.v1.ReplicationSpec.toObject(message.replicationSpec, options); return object; }; diff --git a/packages/google-storagetransfer/protos/protos.json b/packages/google-storagetransfer/protos/protos.json index 0edb09c16a6..93928a93564 100644 --- a/packages/google-storagetransfer/protos/protos.json +++ b/packages/google-storagetransfer/protos/protos.json @@ -1,4 +1,7 @@ { + "options": { + "syntax": "proto3" + }, "nested": { "google": { "nested": { @@ -6,7 +9,6 @@ "nested": { "v1": { "options": { - "cc_enable_arenas": true, "csharp_namespace": "Google.Cloud.StorageTransfer.V1", "go_package": "cloud.google.com/go/storagetransfer/apiv1/storagetransferpb;storagetransferpb", "java_outer_classname": "TransferTypes", @@ -979,6 +981,38 @@ } } }, + "ReplicationSpec": { + "oneofs": { + "dataSource": { + "oneof": [ + "gcsDataSource" + ] + }, + "dataSink": { + "oneof": [ + "gcsDataSink" + ] + } + }, + "fields": { + "gcsDataSource": { + "type": "GcsData", + "id": 1 + }, + "gcsDataSink": { + "type": "GcsData", + "id": 2 + }, + "objectConditions": { + "type": "ObjectConditions", + "id": 3 + }, + "transferOptions": { + "type": "TransferOptions", + "id": 4 + } + } + }, "MetadataOptions": { "fields": { "symlink": { @@ -1160,6 +1194,10 @@ "type": "TransferSpec", "id": 4 }, + "replicationSpec": { + "type": "ReplicationSpec", + "id": 17 + }, "notificationConfig": { "type": "NotificationConfig", "id": 11 diff --git a/packages/google-storagetransfer/samples/generated/v1/snippet_metadata_google.storagetransfer.v1.json b/packages/google-storagetransfer/samples/generated/v1/snippet_metadata_google.storagetransfer.v1.json index 0021ccb6552..8c951fff0f1 100644 --- a/packages/google-storagetransfer/samples/generated/v1/snippet_metadata_google.storagetransfer.v1.json +++ b/packages/google-storagetransfer/samples/generated/v1/snippet_metadata_google.storagetransfer.v1.json @@ -198,7 +198,7 @@ "segments": [ { "start": 25, - "end": 73, + "end": 86, "type": "FULL" } ], diff --git a/packages/google-storagetransfer/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js b/packages/google-storagetransfer/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js index 9db8fd6b62f..243bd0cf7f3 100644 --- a/packages/google-storagetransfer/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js +++ b/packages/google-storagetransfer/samples/generated/v1/storage_transfer_service.list_transfer_jobs.js @@ -30,16 +30,29 @@ function main(filter) { */ /** * Required. A list of query parameters specified as JSON text in the form of: - * `{"projectId":"my_project_id", - * "jobNames":"jobid1","jobid2",..., - * "jobStatuses":"status1","status2",... }` - * Since `jobNames` and `jobStatuses` support multiple values, their values - * must be specified with array notation. `projectId` is required. - * `jobNames` and `jobStatuses` are optional. The valid values for - * `jobStatuses` are case-insensitive: - * ENABLED google.storagetransfer.v1.TransferJob.Status.ENABLED, - * DISABLED google.storagetransfer.v1.TransferJob.Status.DISABLED, and - * DELETED google.storagetransfer.v1.TransferJob.Status.DELETED. + * ``` + * { + * "projectId":"my_project_id", + * "jobNames":"jobid1","jobid2",..., + * "jobStatuses":"status1","status2",..., + * "dataBackend":"QUERY_REPLICATION_CONFIGS", + * "sourceBucket":"source-bucket-name", + * "sinkBucket":"sink-bucket-name", + * } + * ``` + * The JSON formatting in the example is for display only; provide the + * query parameters without spaces or line breaks. + * * `projectId` is required. + * * Since `jobNames` and `jobStatuses` support multiple values, their values + * must be specified with array notation. `jobNames` and `jobStatuses` are + * optional. Valid values are case-insensitive: + * * ENABLED google.storagetransfer.v1.TransferJob.Status.ENABLED + * * DISABLED google.storagetransfer.v1.TransferJob.Status.DISABLED + * * DELETED google.storagetransfer.v1.TransferJob.Status.DELETED + * * Specify `"dataBackend":"QUERY_REPLICATION_CONFIGS"` to return a list of + * cross-bucket replication jobs. + * * Limit the results to jobs from a particular bucket with `sourceBucket` + * and/or to a particular bucket with `sinkBucket`. */ // const filter = 'abc123' /** diff --git a/packages/google-storagetransfer/src/v1/storage_transfer_service_client.ts b/packages/google-storagetransfer/src/v1/storage_transfer_service_client.ts index 748d9651f68..10abbe9c49f 100644 --- a/packages/google-storagetransfer/src/v1/storage_transfer_service_client.ts +++ b/packages/google-storagetransfer/src/v1/storage_transfer_service_client.ts @@ -1697,17 +1697,32 @@ export class StorageTransferServiceClient { * The request object that will be sent. * @param {string} request.filter * Required. A list of query parameters specified as JSON text in the form of: - * `{"projectId":"my_project_id", - * "jobNames":["jobid1","jobid2",...], - * "jobStatuses":["status1","status2",...]}` * - * Since `jobNames` and `jobStatuses` support multiple values, their values - * must be specified with array notation. `projectId` is required. - * `jobNames` and `jobStatuses` are optional. The valid values for - * `jobStatuses` are case-insensitive: - * {@link protos.google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}, - * {@link protos.google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, and - * {@link protos.google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. + * ``` + * { + * "projectId":"my_project_id", + * "jobNames":["jobid1","jobid2",...], + * "jobStatuses":["status1","status2",...], + * "dataBackend":"QUERY_REPLICATION_CONFIGS", + * "sourceBucket":"source-bucket-name", + * "sinkBucket":"sink-bucket-name", + * } + * ``` + * + * The JSON formatting in the example is for display only; provide the + * query parameters without spaces or line breaks. + * + * * `projectId` is required. + * * Since `jobNames` and `jobStatuses` support multiple values, their values + * must be specified with array notation. `jobNames` and `jobStatuses` are + * optional. Valid values are case-insensitive: + * * {@link protos.google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED} + * * {@link protos.google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED} + * * {@link protos.google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED} + * * Specify `"dataBackend":"QUERY_REPLICATION_CONFIGS"` to return a list of + * cross-bucket replication jobs. + * * Limit the results to jobs from a particular bucket with `sourceBucket` + * and/or to a particular bucket with `sinkBucket`. * @param {number} request.pageSize * The list page size. The max allowed value is 256. * @param {string} request.pageToken @@ -1801,17 +1816,32 @@ export class StorageTransferServiceClient { * The request object that will be sent. * @param {string} request.filter * Required. A list of query parameters specified as JSON text in the form of: - * `{"projectId":"my_project_id", - * "jobNames":["jobid1","jobid2",...], - * "jobStatuses":["status1","status2",...]}` * - * Since `jobNames` and `jobStatuses` support multiple values, their values - * must be specified with array notation. `projectId` is required. - * `jobNames` and `jobStatuses` are optional. The valid values for - * `jobStatuses` are case-insensitive: - * {@link protos.google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}, - * {@link protos.google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, and - * {@link protos.google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. + * ``` + * { + * "projectId":"my_project_id", + * "jobNames":["jobid1","jobid2",...], + * "jobStatuses":["status1","status2",...], + * "dataBackend":"QUERY_REPLICATION_CONFIGS", + * "sourceBucket":"source-bucket-name", + * "sinkBucket":"sink-bucket-name", + * } + * ``` + * + * The JSON formatting in the example is for display only; provide the + * query parameters without spaces or line breaks. + * + * * `projectId` is required. + * * Since `jobNames` and `jobStatuses` support multiple values, their values + * must be specified with array notation. `jobNames` and `jobStatuses` are + * optional. Valid values are case-insensitive: + * * {@link protos.google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED} + * * {@link protos.google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED} + * * {@link protos.google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED} + * * Specify `"dataBackend":"QUERY_REPLICATION_CONFIGS"` to return a list of + * cross-bucket replication jobs. + * * Limit the results to jobs from a particular bucket with `sourceBucket` + * and/or to a particular bucket with `sinkBucket`. * @param {number} request.pageSize * The list page size. The max allowed value is 256. * @param {string} request.pageToken @@ -1853,17 +1883,32 @@ export class StorageTransferServiceClient { * The request object that will be sent. * @param {string} request.filter * Required. A list of query parameters specified as JSON text in the form of: - * `{"projectId":"my_project_id", - * "jobNames":["jobid1","jobid2",...], - * "jobStatuses":["status1","status2",...]}` * - * Since `jobNames` and `jobStatuses` support multiple values, their values - * must be specified with array notation. `projectId` is required. - * `jobNames` and `jobStatuses` are optional. The valid values for - * `jobStatuses` are case-insensitive: - * {@link protos.google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED}, - * {@link protos.google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED}, and - * {@link protos.google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED}. + * ``` + * { + * "projectId":"my_project_id", + * "jobNames":["jobid1","jobid2",...], + * "jobStatuses":["status1","status2",...], + * "dataBackend":"QUERY_REPLICATION_CONFIGS", + * "sourceBucket":"source-bucket-name", + * "sinkBucket":"sink-bucket-name", + * } + * ``` + * + * The JSON formatting in the example is for display only; provide the + * query parameters without spaces or line breaks. + * + * * `projectId` is required. + * * Since `jobNames` and `jobStatuses` support multiple values, their values + * must be specified with array notation. `jobNames` and `jobStatuses` are + * optional. Valid values are case-insensitive: + * * {@link protos.google.storagetransfer.v1.TransferJob.Status.ENABLED|ENABLED} + * * {@link protos.google.storagetransfer.v1.TransferJob.Status.DISABLED|DISABLED} + * * {@link protos.google.storagetransfer.v1.TransferJob.Status.DELETED|DELETED} + * * Specify `"dataBackend":"QUERY_REPLICATION_CONFIGS"` to return a list of + * cross-bucket replication jobs. + * * Limit the results to jobs from a particular bucket with `sourceBucket` + * and/or to a particular bucket with `sinkBucket`. * @param {number} request.pageSize * The list page size. The max allowed value is 256. * @param {string} request.pageToken