Amazon.S3.AmazonS3Client.GetACL C# (CSharp) Метод

GetACL() публичный Метод

Gets the access control policy for the bucket.
public GetACL ( Amazon.S3.Model.GetACLRequest request ) : Amazon.S3.Model.GetACLResponse
request Amazon.S3.Model.GetACLRequest Container for the necessary parameters to execute the GetACL service method.
Результат Amazon.S3.Model.GetACLResponse
        public GetACLResponse GetACL(GetACLRequest request)
        {
            var marshaller = new GetACLRequestMarshaller();
            var unmarshaller = GetACLResponseUnmarshaller.Instance;

            return Invoke<GetACLRequest,GetACLResponse>(request, marshaller, unmarshaller);
        }

Same methods

AmazonS3Client::GetACL ( string bucketName ) : Amazon.S3.Model.GetACLResponse

Usage Example

Пример #1
0
        public void AclSamples()
        {
            {
                #region PutACL Sample 1

                // Create a client
                AmazonS3Client client = new AmazonS3Client();

                // Set Canned ACL (PublicRead) for an existing item
                client.PutACL(new PutACLRequest
                {
                    BucketName = "SampleBucket",
                    Key = "Item1",
                    CannedACL = S3CannedACL.PublicRead
                });

                // Set Canned ACL (PublicRead) for an existing item
                // (This reverts ACL back to default for object)
                client.PutACL(new PutACLRequest
                {
                    BucketName = "SampleBucket",
                    Key = "Item1",
                    CannedACL = S3CannedACL.Private
                });

                #endregion
            }

            {
                #region GetACL\PutACL Samples

                // Create a client
                AmazonS3Client client = new AmazonS3Client();

                // Retrieve ACL for object
                S3AccessControlList acl = client.GetACL(new GetACLRequest
                {
                    BucketName = "SampleBucket",
                    Key = "Item1",
                }).AccessControlList;

                // Retrieve owner
                Owner owner = acl.Owner;


                // Describe grant
                S3Grant grant = new S3Grant
                {
                    Grantee = new S3Grantee { EmailAddress = "*****@*****.**" },
                    Permission = S3Permission.WRITE_ACP
                };

                // Create new ACL
                S3AccessControlList newAcl = new S3AccessControlList
                {
                    Grants = new List<S3Grant> { grant },
                    Owner = owner
                };

                // Set new ACL
                PutACLResponse response = client.PutACL(new PutACLRequest
                {
                    BucketName = "SampleBucket",
                    Key = "Item1",
                    AccessControlList = acl
                });

                #endregion
            }
        }
All Usage Examples Of Amazon.S3.AmazonS3Client::GetACL
AmazonS3Client