예제 #1
0
        /// <summary>
        /// Creates an access point and associates it with the specified bucket.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the CreateAccessPoint service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the CreateAccessPoint service method, as returned by S3Control.</returns>
        public virtual Task <CreateAccessPointResponse> CreateAccessPointAsync(CreateAccessPointRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = CreateAccessPointRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CreateAccessPointResponseUnmarshaller.Instance;

            return(InvokeAsync <CreateAccessPointResponse>(request, options, cancellationToken));
        }
예제 #2
0
        internal virtual CreateAccessPointResponse CreateAccessPoint(CreateAccessPointRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = CreateAccessPointRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CreateAccessPointResponseUnmarshaller.Instance;

            return(Invoke <CreateAccessPointResponse>(request, options));
        }
        public void CreateAccessPointTest()
        {
            var bucketArn       = "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:bucket:mybucket";
            var s3ControlConfig = new AmazonS3ControlConfig
            {
                RegionEndpoint = RegionEndpoint.USWest2
            };
            var createAccessPointRequest = new CreateAccessPointRequest
            {
                Bucket = bucketArn,
                Name   = "accessPoint",
            };
            var marshalledRequest = S3ControlArnTestUtils.RunMockRequest(createAccessPointRequest, CreateAccessPointRequestMarshaller.Instance, s3ControlConfig);

            Assert.AreEqual(new Uri("https://s3-outposts.us-west-2.amazonaws.com"), marshalledRequest.Endpoint);
            Assert.AreEqual("op-01234567890123456", marshalledRequest.Headers["x-amz-outpost-id"]);
            Assert.AreEqual("123456789012", marshalledRequest.Headers["x-amz-account-id"]);
        }
예제 #4
0
        public void TestS3OutpostsSignerCreateAccessPointWithArn()
        {
            var signer = new S3Signer();
            var createAccessPointRequest = new CreateAccessPointRequest
            {
                Bucket = "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:bucket:mybucket",
                Name   = "myaccesspoint",
            };
            var config = new AmazonS3ControlConfig
            {
                UseArnRegion   = true,
                RegionEndpoint = RegionEndpoint.USWest2
            };
            var originalAuthService = config.AuthenticationServiceName;
            var iRequest            = S3ControlArnTestUtils.RunMockRequest(createAccessPointRequest, CreateAccessPointRequestMarshaller.Instance, config);

            signer.Sign(iRequest, config, new RequestMetrics(), new ImmutableCredentials("ACCESS", "SECRET", ""));

            Assert.IsTrue(iRequest.Headers.ContainsKey(HeaderKeys.AuthorizationHeader));
            Assert.IsTrue((iRequest.Headers["Authorization"]).Contains("s3-outposts"));
            Assert.IsTrue(config.AuthenticationServiceName == originalAuthService);
        }