当前位置: 首页>>代码示例>>C#>>正文


C# Amazon类代码示例

本文整理汇总了C#中Amazon的典型用法代码示例。如果您正苦于以下问题:C# Amazon类的具体用法?C# Amazon怎么用?C# Amazon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Amazon类属于命名空间,在下文中一共展示了Amazon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Get_Msg_From_Req_Q

        public static bool Get_Msg_From_Req_Q(out Amazon.SQS.Model.Message msg, out bool msgFound)
        {
            msgFound = false;
            msg = null;
            try
            {
                ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest();
                receiveMessageRequest.MaxNumberOfMessages = 1;
                receiveMessageRequest.QueueUrl = requests_Q_url;
                ReceiveMessageResponse receiveMessageResponse = sqs.ReceiveMessage(receiveMessageRequest);
                if (receiveMessageResponse.IsSetReceiveMessageResult())
                {
                    ReceiveMessageResult receiveMessageResult = receiveMessageResponse.ReceiveMessageResult;
                    List<Amazon.SQS.Model.Message> receivedMsges = receiveMessageResponse.ReceiveMessageResult.Message;
                    if (receivedMsges.Count == 0)
                    {
                        return true;
                    }
                    msgFound = true;
                    msg = receivedMsges[0];
                }

            }
            catch (AmazonSQSException ex)
            {
                Console.WriteLine("Caught Exception: " + ex.Message);
                Console.WriteLine("Response Status Code: " + ex.StatusCode);
                Console.WriteLine("Error Code: " + ex.ErrorCode);
                Console.WriteLine("Error Type: " + ex.ErrorType);
                Console.WriteLine("Request ID: " + ex.RequestId);
                Console.WriteLine("XML: " + ex.XML);
                return false;
            }
            return true;
        }
开发者ID:tamirez3dco,项目名称:Rendering_Code,代码行数:35,代码来源:SQS.cs

示例2: ZAwsElasticIp

        public ZAwsElasticIp(ZAwsEc2Controller controller, Amazon.EC2.Model.Address res)
            : base(controller)
        {
            Update(res);

            //myController.HandleNewElasticIp(this);
        }
开发者ID:zmilojko,项目名称:ZAws,代码行数:7,代码来源:ZAwsElasticIp.cs

示例3: DecodeAttribute

        /// <summary>
        /// Decodes the base64 encoded properties of the Attribute.
        /// The Name and/or Value properties of an Attribute can be base64 encoded.
        /// </summary>
        /// <param name="inputAttribute">The properties of this Attribute will be decoded</param>
        /// <seealso cref="P:Amazon.SimpleDB.Model.Attribute.NameEncoding" />
        /// <seealso cref="P:Amazon.SimpleDB.Model.Attribute.ValueEncoding" />
        public static void DecodeAttribute(Amazon.SimpleDB.Model.Attribute inputAttribute)
        {
            if (null == inputAttribute)
            {
                throw new ArgumentNullException("inputAttribute", "The Attribute passed in was null");
            }

            string encoding = inputAttribute.NameEncoding;
            if (null != encoding)
            {
                if (String.Compare(encoding, base64Str, true) == 0)
                {
                    // The Name is base64 encoded
                    inputAttribute.Name = AmazonSimpleDBUtil.DecodeBase64String(inputAttribute.Name);
                    inputAttribute.NameEncoding = "";
                }
            }

            encoding = inputAttribute.ValueEncoding;
            if (null != encoding)
            {
                if (String.Compare(encoding, base64Str, true) == 0)
                {
                    // The Value is base64 encoded
                    inputAttribute.Value = AmazonSimpleDBUtil.DecodeBase64String(inputAttribute.Value);
                    inputAttribute.ValueEncoding = "";
                }
            }
        }
开发者ID:ChadBurggraf,项目名称:awssdk,代码行数:36,代码来源:AmazonSimpleDBUtil.cs

示例4: EnqueueEventsForDelivery

 /// <summary>
 /// Enqueues the events for delivery. The event is stored in an instance of <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.IEventStore"/>.
 /// </summary>
 /// <param name="eventObject">Event object.<see cref="Amazon.MobileAnalytics.Model.Event"/></param>
 public void EnqueueEventsForDelivery(Amazon.MobileAnalytics.Model.Event eventObject)
 {
     ThreadPool.QueueUserWorkItem(new WaitCallback(delegate
     {
         EnqueueEventsHelper(eventObject);
     }));
 }
开发者ID:aws,项目名称:aws-sdk-net,代码行数:11,代码来源:DeliveryClient.cs

示例5: RenderAWSMetricDatum

        private void RenderAWSMetricDatum(Amazon.CloudWatch.Model.MetricDatum metricDatum, TextWriter writer)
        {
            if (!String.IsNullOrEmpty(metricDatum.MetricName))
                writer.Write("MetricName: {0}, ", metricDatum.MetricName);
            if (!String.IsNullOrEmpty(metricDatum.Unit))
                writer.Write("Unit: {0}, ", metricDatum.Unit);

            if (metricDatum.StatisticValues == null)
                writer.Write("Value: {0}, ", metricDatum.Value.ToString(CultureInfo.InvariantCulture));

            if (metricDatum.Dimensions.Any())
            {
                writer.Write("Dimensions: {0}, ", String.Join(", ",
                                                              metricDatum.Dimensions.Select(
                                                                  x =>
                                                                  String.Format("{0}: {1}", x.Name, x.Value))));
            }

            if (metricDatum.Timestamp != default(DateTime))
                writer.Write("Timestamp: {0}, ", metricDatum.Timestamp.ToString(CultureInfo.CurrentCulture));

            if (metricDatum.StatisticValues != null)
            {
                if (metricDatum.StatisticValues.Maximum > 0)
                    writer.Write("Maximum: {0}, ", metricDatum.StatisticValues.Maximum.ToString(CultureInfo.InvariantCulture));

                writer.Write("Minimum: {0}, ", metricDatum.StatisticValues.Minimum.ToString(CultureInfo.InvariantCulture));

                if (metricDatum.StatisticValues.SampleCount > 1)
                    writer.Write("SampleCount: {0}, ", metricDatum.StatisticValues.SampleCount.ToString(CultureInfo.InvariantCulture));

                if (metricDatum.StatisticValues.Sum > 0)
                    writer.Write("Sum: {0}, ", metricDatum.StatisticValues.Sum.ToString(CultureInfo.InvariantCulture));
            }
        }
开发者ID:RossWilliams,项目名称:CloudWatchAppender,代码行数:35,代码来源:MetricDatumRenderer.cs

示例6: Delete_Msg_From_Req_Q

        public static bool Delete_Msg_From_Req_Q(Amazon.SQS.Model.Message msg)
        {
            try
            {
                String messageRecieptHandle = msg.ReceiptHandle;

                //Deleting a message
                Console.WriteLine("Deleting the message.\n");
                DeleteMessageRequest deleteRequest = new DeleteMessageRequest();
                deleteRequest.QueueUrl = requests_Q_url;
                deleteRequest.ReceiptHandle = messageRecieptHandle;
                Console.WriteLine("Before deleting incoming msg(" + messageRecieptHandle + ").");
                sqs.DeleteMessage(deleteRequest);
                Console.WriteLine("After deleting incoming msgs().");

            }
            catch (AmazonSQSException ex)
            {
                Console.WriteLine("Caught Exception: " + ex.Message);
                Console.WriteLine("Response Status Code: " + ex.StatusCode);
                Console.WriteLine("Error Code: " + ex.ErrorCode);
                Console.WriteLine("Error Type: " + ex.ErrorType);
                Console.WriteLine("Request ID: " + ex.RequestId);
                Console.WriteLine("XML: " + ex.XML);
                return false;
            }
            return true;
        }
开发者ID:tamirez3dco,项目名称:Rendering_Code,代码行数:28,代码来源:SQS.cs

示例7: GlacierArchiveInfo

 public GlacierArchiveInfo(Amazon.Glacier.Model.DescribeJobResult result)
 {
     Id = result.ArchiveId;
     SizeInBytes = result.ArchiveSizeInBytes;
     CreationDate = result.CreationDate;
     Checksum = result.SHA256TreeHash;
 }
开发者ID:bfanti,项目名称:Glacierizer,代码行数:7,代码来源:GlacierArchiveInfo.cs

示例8: ProcessCore

        private void ProcessCore(long betScreenshotId, Amazon.S3.AmazonS3 amazonS3Client, SynchronizationContext synchronizationContext)
        {
            using (var unitOfWorkScope = _unitOfWorkScopeFactory.Create())
            {
                BetScreenshot betScreenshot = null;
                try
                {
                    betScreenshot = _repositoryOfBetScreenshot.Get(EntitySpecifications.IdIsEqualTo<BetScreenshot>(betScreenshotId)).Single();
                    var battleBet = _repositoryOfBet.Get(BetSpecifications.BetScreenshotOwner(betScreenshot.Id)).Single();

                    betScreenshot.StartedProcessingDateTime = DateTime.UtcNow;

                    ImageFormat imageFormat;
                    var screenshotEncodedStream = GetScreenshot(battleBet.Url, betScreenshot, synchronizationContext, out imageFormat);

                    PutScreenshot(amazonS3Client, screenshotEncodedStream, betScreenshot, imageFormat);

                    betScreenshot.FinishedProcessingDateTime = DateTime.UtcNow;

                    betScreenshot.StatusEnum = BetScreenshotStatus.Succeeded;
                }
                catch (Exception ex)
                {
                    Logger.TraceException(String.Format("Failed to process betScreenshotId = {0}. Trying to save as failed", betScreenshotId), ex);
                    betScreenshot.StatusEnum = BetScreenshotStatus.Failed;
                }
                finally
                {
                    unitOfWorkScope.SaveChanges();
                }
            }
        }
开发者ID:meze,项目名称:betteamsbattle,代码行数:32,代码来源:BetScreenshotProcessor.cs

示例9: Identify

        public string Identify(Amazon.IdentityManagement.Model.User user)
        {
            if (null == user)
            {
                throw new ArgumentNullException(AnchoringByIdentifierBehavior.ArgumentNameUser);
            }

            return user.UserId;
        }
开发者ID:belaie,项目名称:AzureAD-BYOA-Provisioning-Samples,代码行数:9,代码来源:AnchoringByIdentifierBehavior.cs

示例10: Do

 public override ActivityState Do(Amazon.SimpleWorkflow.Model.ActivityTask task)
 {            
     
     return new ActivityState() 
     {                
         Key = "output",
         Value = new string(task.Input.ToCharArray().Reverse().ToArray())
     };            
 }
开发者ID:perryloh,项目名称:awsswf.net,代码行数:9,代码来源:Providers.cs

示例11: PutScreenshot

        public void PutScreenshot(Amazon.S3.AmazonS3 amazonS3Client, string bucketName, string path, Stream stream)
        {
            var putObjectRequest = new PutObjectRequest();

            putObjectRequest.WithInputStream(stream);
            putObjectRequest.WithBucketName(bucketName);
            putObjectRequest.WithKey(path);

            amazonS3Client.PutObject(putObjectRequest);
        }
开发者ID:meze,项目名称:betteamsbattle,代码行数:10,代码来源:ScreenshotAmazonS3Putter.cs

示例12: Create

        ///// <summary>
        ///// Allows the use of a specific config in the creation of the client for a context
        ///// </summary>
        ///// <param name="context">The context the client should be used in</param>
        ///// <param name="config">The config object for the client</param>
        //public static void UseConfigForClient(DynamoDBContext context, AmazonS3Config config)
        //{
        //    var castedClient = ((AmazonDynamoDBClient)context.Client);
        //    var client = new AmazonS3Client(castedClient.GetCredentials(), config);
        //    S3ClientCache cache;
        //    if (!S3Link.Caches.TryGetValue(context, out cache))
        //    {                
        //        cache = new S3ClientCache(castedClient.GetCredentials(),castedClient.CloneConfig<AmazonS3Config>());
        //        S3Link.Caches.Add(context, cache);
        //    }            
        //    cache.UseClient(client, config.RegionEndpoint);
        //}

        /// <summary>
        /// Creates an S3Link that can be used to managed an S3 connection
        /// </summary>
        /// <param name="context">The context that is handling the S3Link</param>
        /// <param name="bucket">The bucket the S3Link should manage</param>
        /// <param name="key">The key that S3Link should store and download from</param>
        /// <param name="region">The region of the S3 resource</param>
        /// <returns>A new S3Link object that can upload and download to the target bucket</returns>
        public static S3Link Create(DynamoDBContext context, string bucket, string key, Amazon.RegionEndpoint region)
        {
            S3ClientCache cacheFromKey;
            if (S3Link.Caches.TryGetValue(context, out cacheFromKey))
            {
                return new S3Link(cacheFromKey, bucket, key, region.SystemName);
            }

            S3ClientCache cache = CreatClientCacheFromContext(context);
            return new S3Link(cache, bucket, key, region.SystemName);
        }
开发者ID:sadiqj,项目名称:aws-sdk-xamarin,代码行数:37,代码来源:S3Link.cs

示例13: DeliveryClient

 /// <summary>
 /// Constructor of <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.DeliveryClient"/> class.
 /// </summary>
 /// <param name="isDataAllowed">An instance of IDeliveryPolicyFactory <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.IDeliveryPolicyFactory"/></param>
 /// <param name="clientContext">An instance of ClientContext <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.ClientContext"/></param>
 /// <param name="credentials">An instance of Credentials <see cref="Amazon.Runtime.AWSCredentials"/></param>
 /// <param name="regionEndPoint">Region end point <see cref="Amazon.RegionEndpoint"/></param>
 public DeliveryClient(IDeliveryPolicyFactory policyFactory, Amazon.Runtime.Internal.ClientContext clientContext, AWSCredentials credentials, RegionEndpoint regionEndPoint)
 {
     _policyFactory = policyFactory;
     _mobileAnalyticsLowLevelClient = new AmazonMobileAnalyticsClient(credentials, regionEndPoint);
     _clientContext = clientContext;
     _appId = clientContext.AppID;
     _eventStore = new SQLiteEventStore(AWSConfigsMobileAnalytics.MaxDBSize, AWSConfigsMobileAnalytics.DBWarningThreshold);
     _deliveryPolicies = new List<IDeliveryPolicy>();
     _deliveryPolicies.Add(_policyFactory.NewConnectivityPolicy());
     _deliveryPolicies.Add(_policyFactory.NewBackgroundSubmissionPolicy());
 }
开发者ID:NathanSDunn,项目名称:aws-sdk-unity,代码行数:18,代码来源:DeliveryClient.cs

示例14: AWSSubnet

        public AWSSubnet(Amazon.EC2.Model.Subnet subnet)
        {
            Name = "Unnamed";
            if (subnet != null)
            {
                foreach (var tag in subnet.Tags.Where(tag => tag.Key == "Name"))
                {
                    Name = tag.Value;
                }

                SubnetId = subnet.SubnetId;
                CidrBlock = subnet.CidrBlock;
            }
        }
开发者ID:Trov,项目名称:Document.AWS,代码行数:14,代码来源:AWSSubnet.cs

示例15: Process

        public void Process(long betScreenshotId, Amazon.S3.AmazonS3 amazonS3Client, SynchronizationContext synchronizationContext)
        {
            using (var transactionScope = _transactionScopeFactory.Create())
            {
                try
                {
                    ProcessCore(betScreenshotId, amazonS3Client, synchronizationContext);

                    transactionScope.Complete();
                }
                catch (Exception ex)
                {
                    Logger.ErrorException(String.Format("Failed to process betScreenshotId = {0}. Was not saved", betScreenshotId), ex);
                }
            }
        }
开发者ID:meze,项目名称:betteamsbattle,代码行数:16,代码来源:BetScreenshotProcessor.cs


注:本文中的Amazon类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。