コード例 #1
0
        public async Task <IActionResult> SetObjectAclPrivate()
        {
            try
            {
                var result = await _ossService.SetObjectAclAsync(_bucketName, _objectFilePath, AccessMode.Private);

                if (result)
                {
                    var acl = await _ossService.GetObjectAclAsync(_bucketName, _objectFilePath);

                    return(Json(new ResultObject()
                    {
                        Status = result,
                        Data = acl.ToString(),
                    }));
                }
                else
                {
                    return(Json(new ResultObject()
                    {
                        Status = false,
                    }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new ResultObject()
                {
                    Status = false,
                    Message = ex.Message
                }));
            }
        }
コード例 #2
0
        public async Task <IActionResult> SetObjectAclPrivate()
        {
            try
            {
                var result = await _OSSService.SetObjectAclAsync(_bucketName, "default-dev/PHOTO-1.jpg", AccessMode.Private);

                return(Json(result.ToString()));
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }