/// <inheritdoc />
        public override async Task <IList <string> > TestBucketIamPermissionsAsync(string bucket, IEnumerable <string> permissions,
                                                                                   TestBucketIamPermissionsOptions options = null, CancellationToken cancellationToken = default)
        {
            var response = await CreateTestIamPermissionsRequest(bucket, permissions, options).ExecuteAsync(cancellationToken).ConfigureAwait(false);

            return(response.Permissions);
        }
        private TestIamPermissionsRequest CreateTestIamPermissionsRequest(string bucket, IEnumerable <string> permissions, TestBucketIamPermissionsOptions options)
        {
            ValidateBucketName(bucket);
            GaxPreconditions.CheckNotNull(permissions, nameof(permissions));
            List <string> permissionsList = permissions.ToList();

            GaxPreconditions.CheckArgument(permissionsList.Count != 0, nameof(permissions), "List of permissions to test must not be empty");
            var request = Service.Buckets.TestIamPermissions(bucket, new Repeatable <string>(permissionsList));

            options?.ModifyRequest(request);
            return(request);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Tests the IAM policy information about a bucket asynchronously.
 /// </summary>
 /// <param name="bucket">The name of the bucket. Must not be null.</param>
 /// <param name="permissions">The permissions to test. Must not be null or empty.</param>
 /// <param name="options">Additional options for the operation. 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
 /// permissions held by the caller.</returns>
 public virtual Task <IList <string> > TestBucketIamPermissionsAsync(string bucket, IEnumerable <string> permissions, TestBucketIamPermissionsOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }
 /// <inheritdoc />
 public override IList <string> TestBucketIamPermissions(string bucket, IEnumerable <string> permissions, TestBucketIamPermissionsOptions options = null) =>
 CreateTestIamPermissionsRequest(bucket, permissions, options).Execute().Permissions;
Exemplo n.º 5
0
 /// <summary>
 /// Tests the IAM permissions for a bucket synchronously.
 /// </summary>
 /// <param name="bucket">The name of the bucket. Must not be null.</param>
 /// <param name="permissions">The permissions to test. Must not be null or empty.</param>
 /// <param name="options">Additional options for the operation. May be null, in which case appropriate
 /// defaults will be used.</param>
 /// <returns>The permissions held by the caller.</returns>
 public virtual IList <string> TestBucketIamPermissions(string bucket, IEnumerable <string> permissions, TestBucketIamPermissionsOptions options = null)
 {
     throw new NotImplementedException();
 }