Beispiel #1
0
 /// <summary>
 /// Updates the metadata for an object in storage asynchronously.
 /// </summary>
 /// <remarks>
 /// <para>
 /// If no preconditions are explicitly set in <paramref name="options"/>, the generation and
 /// metageneration of <paramref name="obj"/> are used as a precondition for the update,
 /// unless <see cref="UpdateObjectOptions.ForceNoPreconditions"/> is
 /// set to <c>true</c>.
 /// </para>
 /// </remarks>
 /// <param name="obj">Object to update. Must not be null, and must have populated <c>Name</c> and
 /// <c>Bucket</c> properties.</param>
 /// <param name="options">Additional options for the update. May be null, in which case appropriate
 /// defaults will be used.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
 /// <returns>A task representing the asynchronous operation, with a result returning the
 /// <see cref="Object"/> representation of the storage object.</returns>
 public virtual Task <Object> UpdateObjectAsync(
     Object obj,
     UpdateObjectOptions options         = null,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }
        private ObjectsResource.UpdateRequest CreateUpdateObjectRequest(Object obj, UpdateObjectOptions options)
        {
            GaxPreconditions.CheckNotNull(obj, nameof(obj));
            GaxPreconditions.CheckArgument(obj.Bucket != null, nameof(obj), "The Bucket property of the object to update is null");
            GaxPreconditions.CheckArgument(obj.Name != null, nameof(obj), "The Name property of the object to update is null");
            var request = Service.Objects.Update(obj, obj.Bucket, obj.Name);

            options?.ModifyRequest(request, obj);
            return(request);
        }
        private ObjectsResource.UpdateRequest CreateUpdateObjectRequest(Object obj, UpdateObjectOptions options)
        {
            GaxPreconditions.CheckNotNull(obj, nameof(obj));
            GaxPreconditions.CheckArgument(obj.Bucket != null, nameof(obj), "The Bucket property of the object to update is null");
            GaxPreconditions.CheckArgument(obj.Name != null, nameof(obj), "The Name property of the object to update is null");
            var request = Service.Objects.Update(obj, obj.Bucket, obj.Name);

            request.ModifyRequest += _versionHeaderAction;
            options?.ModifyRequest(request, obj);
            ApplyEncryptionKey(options?.EncryptionKey, kmsNameFromOptions: null, request);
            return(request);
        }
 /// <inheritdoc />
 public override Task <Object> UpdateObjectAsync(
     Object obj,
     UpdateObjectOptions options         = null,
     CancellationToken cancellationToken = default(CancellationToken))
 => CreateUpdateObjectRequest(obj, options).ExecuteAsync(cancellationToken);
 /// <inheritdoc />
 public override Object UpdateObject(
     Object obj,
     UpdateObjectOptions options = null)
 => CreateUpdateObjectRequest(obj, options).Execute();
Beispiel #6
0
 /// <summary>
 /// Updates the metadata for an object in storage synchronously.
 /// </summary>
 /// <remarks>
 /// <para>
 /// If no preconditions are explicitly set in <paramref name="options"/>, the generation and
 /// metageneration of <paramref name="obj"/> are used as a precondition for the update,
 /// unless <see cref="UpdateObjectOptions.ForceNoPreconditions"/> is
 /// set to <c>true</c>.
 /// </para>
 /// </remarks>
 /// <param name="obj">Object to update. Must not be null, and must have populated <c>Name</c> and
 /// <c>Bucket</c> properties.</param>
 /// <param name="options">Additional options for the update. May be null, in which case appropriate
 /// defaults will be used.</param>
 /// <returns>The <see cref="Object"/> representation of the updated storage object.</returns>
 public virtual Object UpdateObject(
     Object obj,
     UpdateObjectOptions options = null)
 {
     throw new NotImplementedException();
 }