/// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            PutObjectLegalHoldResponse response = new PutObjectLegalHoldResponse();

            if (context.ResponseData.IsHeaderPresent("x-amz-request-charged"))
            {
                response.RequestCharged = context.ResponseData.GetHeaderValue("x-amz-request-charged");
            }

            return(response);
        }
Пример #2
0
    public async Task PutGetObjectLegalHold(S3Provider _, string bucket, ISimpleClient client)
    {
        string objectKey = nameof(PutGetObjectLegalHold);

        //Create an object
        await client.PutObjectAsync(bucket, objectKey, null).ConfigureAwait(false);

        //Check that there is no lock
        GetObjectLegalHoldResponse getLegalResp = await client.GetObjectLegalHoldAsync(bucket, objectKey).ConfigureAwait(false);

        Assert.Equal(404, getLegalResp.StatusCode);
        Assert.False(getLegalResp.LegalHold);

        //Set a lock
        PutObjectLegalHoldResponse putLegalResp = await client.PutObjectLegalHoldAsync(bucket, objectKey, true).ConfigureAwait(false);

        Assert.Equal(200, putLegalResp.StatusCode);

        //There should be a lock now
        GetObjectLegalHoldResponse getLegalResp2 = await client.GetObjectLegalHoldAsync(bucket, objectKey).ConfigureAwait(false);

        Assert.Equal(200, getLegalResp2.StatusCode);
        Assert.True(getLegalResp2.LegalHold);
    }
Пример #3
0
        public async Task PutGetObjectLegalHold()
        {
            string objectKey = nameof(PutGetObjectLegalHold);

            //Create an object
            await UploadAsync(objectKey).ConfigureAwait(false);

            //Check that there is no lock
            GetObjectLegalHoldResponse getLegalResp = await ObjectClient.GetObjectLegalHoldAsync(BucketName, objectKey).ConfigureAwait(false);

            Assert.Equal(404, getLegalResp.StatusCode);
            Assert.False(getLegalResp.LegalHold);

            //Set a lock
            PutObjectLegalHoldResponse putLegalResp = await ObjectClient.PutObjectLegalHoldAsync(BucketName, objectKey, true).ConfigureAwait(false);

            Assert.Equal(200, putLegalResp.StatusCode);

            //There should be a lock now
            GetObjectLegalHoldResponse getLegalResp2 = await ObjectClient.GetObjectLegalHoldAsync(BucketName, objectKey).ConfigureAwait(false);

            Assert.Equal(200, getLegalResp2.StatusCode);
            Assert.True(getLegalResp2.LegalHold);
        }