예제 #1
0
        public QCloudServer()
        {
            QLog.SetLogLevel(Level.V);

            uin                       = "2779643970";
            appid                     = "1251668577";
            bucketVersioning          = "dotnet-ut-versioning-1251668577";
            regionForBucketVersioning = "ap-beijing";
            bucketForObjectTest       = "dotnet-ut-obj-1251668577";
            bucketForLoggingTarget    = "dotnet-ut-logging-target-1251668577";
            region                    = "ap-guangzhou";

            secretId  = Environment.GetEnvironmentVariable("SECRET_ID");
            secretKey = Environment.GetEnvironmentVariable("SECRET_KEY");
            if (secretId == null)
            {
                secretId  = Environment.GetEnvironmentVariable("SECRET_ID", EnvironmentVariableTarget.Machine);
                secretKey = Environment.GetEnvironmentVariable("SECERT_KEY", EnvironmentVariableTarget.Machine);
            }

            CosXmlConfig config = new CosXmlConfig.Builder()
                                  .SetRegion(region)
                                  .SetDebugLog(true)
                                  .IsHttps(true)
                                  .SetConnectionLimit(512)
                                  .SetConnectionTimeoutMs(10 * 1000)
                                  .SetReadWriteTimeoutMs(10 * 1000)
                                  .Build();


            long keyDurationSecond = 600;

            QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, keyDurationSecond);


            cosXml = new CosXmlServer(config, qCloudCredentialProvider);
        }