Exemplo n.º 1
0
        public static CORSConfiguration GetCORSConfiguration()
        {
            GetCORSConfigurationRequest request = new GetCORSConfigurationRequest
            {
                BucketName = bucketName
            };
            var response      = client.GetCORSConfiguration(request);
            var configuration = response.Configuration;

            PrintCORSRules(configuration);
            return(configuration);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Este método é específico para AWS e recupera a configuração do CORS existente.
        /// </summary>
        /// <returns>Recupera a configuração existente do CORS</returns>
        public async Task <CORSConfiguration> RetrieveCORSConfigurationAsync(string bucketName)
        {
            var request = new GetCORSConfigurationRequest
            {
                BucketName = bucketName
            };
            var response = await _client.GetCORSConfigurationAsync(request);

            var configuration = response.Configuration;

            return(configuration);
        }
Exemplo n.º 3
0
        static async Task <CORSConfiguration> RetrieveCORSConfigurationAsync()
        {
            GetCORSConfigurationRequest request = new GetCORSConfigurationRequest
            {
                BucketName = bucketName
            };
            var response = await s3Client.GetCORSConfigurationAsync(request);

            var configuration = response.Configuration;

            PrintCORSRules(configuration);
            return(configuration);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 指定した接続情報でCORS設定を取得する。
        /// </summary>
        public async Task <string> GetCorsConfigurationAsync(StorageConfigModel storageConfig)
        {
            GetCORSConfigurationRequest request = new GetCORSConfigurationRequest()
            {
                BucketName = storageConfig.Bucket
            };

            var s3Client = GenerateConfig(storageConfig);
            GetCORSConfigurationResponse response;

            try
            {
                response = await s3Client.GetCORSConfigurationAsync(request);
            }
            catch (HttpRequestException e)
            {
                LogError(e.Message, e);
                return("Unable to connect storage server. Please contact system administrators. NOTE: If you edit the tenant information, you may loose settings for the storage service." + Environment.NewLine + e.Message);
            }
            string result;

            if (response.Configuration == null)
            {
                result = "";
            }
            else
            {
                //結果を文字列に変換
                var serializer = new XmlSerializer(typeof(CORSConfiguration));
                using (var writer = new StringWriter())
                {
                    serializer.Serialize(writer, response.Configuration);
                    result = writer.ToString();
                }
            }

            return(result);
        }
Exemplo n.º 5
0
 public Task <GetCORSConfigurationResponse> GetCORSConfigurationAsync(GetCORSConfigurationRequest request, CancellationToken cancellationToken = default)
 {
     throw new NotImplementedException();
 }
 public GetCORSConfigurationResponse GetCORSConfiguration(GetCORSConfigurationRequest request)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 public void GetCORSConfigurationAsync(GetCORSConfigurationRequest request, AmazonServiceCallback <GetCORSConfigurationRequest, GetCORSConfigurationResponse> callback, AsyncOptions options = null)
 {
     throw new System.NotImplementedException();
 }