• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Amazon类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ZAwsEc2

        public ZAwsEc2(ZAwsEc2Controller controller, Amazon.EC2.Model.Reservation res)
            : base(controller)
        {
            StatisticsValid = false;

            LatestBootConsoleTimestamp = "";
            ConsoleOutput = "";

            Update(res);

            /*
            Trace.WriteLine("Now will see to configure new applications.");
            ConfigureAppsWhenBootingComplete = myController.HandleNewEc2Instance(this) ? 3 : 0;
            Trace.WriteLine("ConfigureAppsWhenBootingComplete = " + ConfigureAppsWhenBootingComplete.ToString());
             * */
        }
开发者ID:zmilojko,项目名称:ZAws,代码行数:16,代码来源:ZAwsEc2.cs


示例17: 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);
            }
            var client = ((AmazonDynamoDBClient)context.Client);
            S3ClientCache cache = new S3ClientCache(client.GetCredentials(), client.CloneConfig<AmazonS3Config>());

            lock (S3Link.cacheLock)
            {
                S3Link.Caches.Add(context, cache);                
            }

            return new S3Link(cache, bucket, key, region.SystemName);
        }
开发者ID:rossmas,项目名称:aws-sdk-net,代码行数:43,代码来源:S3Link.cs


示例18: BuildMediaModel

        private static Media BuildMediaModel(Amazon.AmazonService.Item amazonItem)
        {
            Media returnMedia = new Media();

            returnMedia.Title = amazonItem.ItemAttributes.Title;
            returnMedia.EAN = amazonItem.ItemAttributes.EAN;

            int mediaId = UpdateMediaTypes(amazonItem.ItemAttributes.ProductGroup);

            returnMedia.fkMediaTypeId = mediaId;

            if(amazonItem.LargeImage != null)
            {
                returnMedia.Image = amazonItem.LargeImage.URL;
            }

            return returnMedia;
        }
开发者ID:jphoiting,项目名称:MediaCollector,代码行数:18,代码来源:MediaController.cs


示例19: DecodeAttribute

 public static void DecodeAttribute(Amazon.SimpleDB.Model.Attribute inputAttribute)
 {
     if (inputAttribute == null)
     {
         throw new ArgumentNullException("inputAttribute", "The Attribute passed in was null");
     }
     string nameEncoding = inputAttribute.NameEncoding;
     if ((nameEncoding != null) && (string.Compare(nameEncoding, base64Str, true) == 0))
     {
         inputAttribute.Name = DecodeBase64String(inputAttribute.Name);
         inputAttribute.NameEncoding = "";
     }
     nameEncoding = inputAttribute.ValueEncoding;
     if ((nameEncoding != null) && (string.Compare(nameEncoding, base64Str, true) == 0))
     {
         inputAttribute.Value = DecodeBase64String(inputAttribute.Value);
         inputAttribute.ValueEncoding = "";
     }
 }
开发者ID:pusp,项目名称:o2platform,代码行数:19,代码来源:AmazonSimpleDBUtil.cs


示例20: 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)
        {
#if BCL35            
            ThreadPool.QueueUserWorkItem(new WaitCallback(delegate
            {
#elif PCL || BCL45
            Task.Run(() =>
            {
#endif
                string eventString = null;
                try
                {
                    eventString = JsonMapper.ToJson(eventObject);
                }
                catch (Exception e)
                {
                    _logger.Error(e, "An exception occurred when converting low level client event to json string.");
                    List<Amazon.MobileAnalytics.Model.Event> eventList = new List<Amazon.MobileAnalytics.Model.Event>();
                    eventList.Add(eventObject);
                    MobileAnalyticsErrorEventArgs eventArgs = new MobileAnalyticsErrorEventArgs(this.GetType().Name, "An exception occurred when converting low level client event to json string.", e, eventList);
                    _maManager.OnRaiseErrorEvent(eventArgs);
                }

                if (null != eventString)
                {
                    try
                    {
                        _eventStore.PutEvent(eventString, _appID);
                    }
                    catch (Exception e)
                    {
                        _logger.Error(e, "Event {0} was not stored.", eventObject.EventType);
                        MobileAnalyticsErrorEventArgs eventArgs = new MobileAnalyticsErrorEventArgs(this.GetType().Name, "An exception occurred when storing event into event store.", e, new List<Amazon.MobileAnalytics.Model.Event>());
                        _maManager.OnRaiseErrorEvent(eventArgs);
                    }
                    _logger.DebugFormat("Event {0} is queued for delivery", eventObject.EventType);
                }
#if BCL35
            }));
#elif PCL || BCL45
            });
#endif
        }
开发者ID:rajdotnet,项目名称:aws-sdk-net,代码行数:47,代码来源:DeliveryClient.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AmazonDynamoDBCallback类代码示例发布时间:2022-05-24
下一篇:
C# Xml.TypeBase类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap