示例#1
0
        public async Task SetEACL(SetExtendedACLRequest request, DateTime?deadline = null, CancellationToken context = default)
        {
            var resp = await ContainerClient.SetExtendedACLAsync(request, deadline : deadline, cancellationToken : context);

            if (!resp.Verify())
            {
                throw new InvalidOperationException("invalid set eacl response");
            }
        }
        public void SetEACL(CancellationToken context, EACLTable eacl, CallOptions options = null)
        {
            var container_client = new ContainerService.ContainerServiceClient(channel);
            var opts             = DefaultCallOptions.ApplyCustomOptions(options);
            var req = new SetExtendedACLRequest
            {
                Body = new SetExtendedACLRequest.Types.Body
                {
                    Eacl      = eacl,
                    Signature = eacl.SignMessagePart(key),
                }
            };

            req.MetaHeader = opts.GetRequestMetaHeader();
            req.SignRequest(key);

            var resp = container_client.SetExtendedACL(req, cancellationToken: context);

            if (!resp.VerifyResponse())
            {
                throw new InvalidOperationException("invalid container put response");
            }
        }
示例#3
0
        public async Task SetEACL(EACLTable eacl, CallOptions options = null, CancellationToken context = default)
        {
            if (eacl is null)
            {
                throw new ArgumentNullException(nameof(eacl));
            }
            var opts = DefaultCallOptions.ApplyCustomOptions(options);

            CheckOptions(opts);
            eacl.Version = Refs.Version.SDKVersion();
            var req = new SetExtendedACLRequest
            {
                Body = new SetExtendedACLRequest.Types.Body
                {
                    Eacl      = eacl,
                    Signature = opts.Key.SignRFC6979(eacl),
                }
            };

            req.MetaHeader = opts.GetRequestMetaHeader();
            opts.Key.Sign(req);

            await SetEACL(req, opts.Deadline, context);
        }