Tüm Ürünler
Search
Belge Merkezi

Object Storage Service:Get the ACL of an object (Android SDK)

Son Güncelleme:Oct 01, 2026

Nesne erişim denetim listeleri (ACL'ler); özel, genel okuma ve genel okuma-yazma türlerini içerir. Bu konuda bir nesnenin ACL'sinin nasıl alınacağı açıklanmaktadır.

Kullanım notları

  • Bu konudaki örnek kodu çalıştırmadan önce özel etki alanı adı veya Security Token Service (STS) kullanma gibi yöntemlerle bir OSSClient örneği oluşturmalısınız. Daha fazla bilgi için bkz. Başlatma (Android SDK).

Nesne ACL'leri

Üç tür dosya erişim izni bulunur:


Dosya erişim izinleri


Açıklama


Özel


Nesne üzerinde okuma ve yazma izinlerine yalnızca nesne sahibi ve yetkili kullanıcılar sahiptir.


Genel okuma


Nesne üzerinde okuma ve yazma izinlerine yalnızca nesne sahibi ve yetkili kullanıcılar sahiptir. Diğer kullanıcıların nesne üzerinde yalnızca okuma izni vardır. Nesne ACL'sini bu değere ayarlarken dikkatli olun.


Genel okuma-yazma


Tüm kullanıcıların nesne üzerinde okuma ve yazma izni vardır. Nesne ACL'sini bu değere ayarlarken dikkatli olun.

Örnekler

Aşağıdaki örnek kod, examplebucket adlı bir paket içindeki exampleobject.txt adlı bir nesnenin ACL'sinin nasıl alınacağını gösterir:

// Specify the bucket name and the full path of the object. Example: examplebucket and exampledir/exampleobject.txt. The full path of the object cannot contain the bucket name.
GetObjectACLRequest request = new GetObjectACLRequest("examplebucket", "exampledir/exampleobject.txt");
// OSS SDK for Android does not support setting object ACLs. You can only get object ACLs.
// The following code shows how to get the ACL of an object.
oss.asyncGetObjectACL(request, new OSSCompletedCallback<GetObjectACLRequest, GetObjectACLResult>() {
    @Override
    public void onSuccess(GetObjectACLRequest request, GetObjectACLResult result) {
        Log.d("GetObjectACL", "Success!");
        Log.d("ObjectAcl", result.getObjectACL());
        Log.d("Owner", result.getObjectOwner());
        Log.d("ID", result.getObjectOwnerID());
    }

    @Override
    public void onFailure(GetObjectACLRequest request, ClientException clientException, ServiceException serviceException) {
        // Request exceptions.
        if (clientException != null) {
            // Client exceptions, such as network exceptions.
            clientException.printStackTrace();
        }
        if (serviceException != null) {
            // Server exceptions.
            Log.e("ErrorCode", serviceException.getErrorCode());
            Log.e("RequestId", serviceException.getRequestId());
            Log.e("HostId", serviceException.getHostId());
            Log.e("RawMessage", serviceException.getRawMessage());
        }
    }
});

İlgili Konular

  • Bir nesnenin ACL'sini sorgulamak için çağırabileceğiniz API işlemi hakkında daha fazla bilgi için bkz. GetObjectACL.

  • Bir OSSClient örneğinin nasıl başlatılacağı hakkında daha fazla bilgi için bkz. Başlatma.