private static async Task <StorageResources> DiscoverStorageResourcesAsync(IAmazonServiceDiscovery discovery, string serviceId)
        {
            GetInstanceResponse resourcesResponse;

            try
            {
                resourcesResponse = await discovery.GetInstanceAsync(new GetInstanceRequest()
                {
                    ServiceId  = serviceId,
                    InstanceId = "storageTables",
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            var attributes = resourcesResponse.Instance.Attributes;

            var storage = new StorageResources()
            {
                CountersTable          = attributes["counters"],
                KudosTable             = attributes["kudos"],
                LinkRequestsTable      = attributes["linkrequests"],
                UserIdsTable           = attributes["userids"],
                ChatMessagesTable      = attributes["chatmessages"],
                SentimentSnapshotTable = attributes["sentimentsnapshots"],
                PaginationTokensTable  = attributes["paginationtokens"],
                SocketSessionsTable    = attributes["socketsessions"]
            };

            return(storage);
        }
        private static async Task <AuthResources> DiscoverAuthResourcesAsync(IAmazonServiceDiscovery discovery, string serviceId)
        {
            GetInstanceResponse resourcesResponse;

            try
            {
                resourcesResponse = await discovery.GetInstanceAsync(new GetInstanceRequest()
                {
                    ServiceId  = serviceId,
                    InstanceId = "auth",
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            var attributes = resourcesResponse.Instance.Attributes;

            return(new AuthResources()
            {
                UserPoolId = attributes["userpoolid"]
            });
        }
        private static async Task <ApiResources> DiscoverApiResourcesAsync(IAmazonServiceDiscovery discovery,
                                                                           string serviceId)
        {
            GetInstanceResponse resourcesResponse;

            try
            {
                resourcesResponse = await discovery.GetInstanceAsync(new GetInstanceRequest()
                {
                    ServiceId  = serviceId,
                    InstanceId = "api",
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            var attributes = resourcesResponse.Instance.Attributes;

            var storage = new ApiResources()
            {
                WebsocketApiId = attributes["websocketApiId"],
            };

            return(storage);
        }
 public CloudMapResourceDiscoverer(IAmazonServiceDiscovery serviceDiscovery, string serviceId)
 {
     this.authLazy = new Lazy <AuthResources>(() =>
                                              DiscoverAuthResourcesAsync(serviceDiscovery, serviceId).GetAwaiter().GetResult());
     this.storageLazy = new Lazy <StorageResources>(() =>
                                                    DiscoverStorageResourcesAsync(serviceDiscovery, serviceId).GetAwaiter().GetResult());
     this.analyticsLazy = new Lazy <AnalyticsResources>(() =>
                                                        DiscoverAnalyticsResourcesAsync(serviceDiscovery, serviceId).GetAwaiter().GetResult());
     this.apiLazy = new Lazy <ApiResources>(() =>
                                            DiscoverApiResourcesAsync(serviceDiscovery, serviceId).GetAwaiter().GetResult());
 }
 private Amazon.ServiceDiscovery.Model.ListServicesResponse CallAWSServiceOperation(IAmazonServiceDiscovery client, Amazon.ServiceDiscovery.Model.ListServicesRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Cloud Map", "ListServices");
     try
     {
         #if DESKTOP
         return(client.ListServices(request));
         #elif CORECLR
         return(client.ListServicesAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
예제 #6
0
 internal ListOperationsPaginator(IAmazonServiceDiscovery client, ListOperationsRequest request)
 {
     this._client  = client;
     this._request = request;
 }
 internal ListNamespacesPaginator(IAmazonServiceDiscovery client, ListNamespacesRequest request)
 {
     this._client  = client;
     this._request = request;
 }
 internal GetInstancesHealthStatusPaginator(IAmazonServiceDiscovery client, GetInstancesHealthStatusRequest request)
 {
     this._client  = client;
     this._request = request;
 }
        private static async Task <AnalyticsResources> DiscoverAnalyticsResourcesAsync(IAmazonServiceDiscovery discovery,
                                                                                       string serviceId)
        {
            GetInstanceResponse resourcesResponse;

            try
            {
                resourcesResponse = await discovery.GetInstanceAsync(new GetInstanceRequest()
                {
                    ServiceId  = serviceId,
                    InstanceId = "analytics",
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            var attributes = resourcesResponse.Instance.Attributes;

            var storage = new AnalyticsResources()
            {
                ChatStreamName             = attributes["chatstream"],
                SentimentReportWorkgroup   = attributes["sentimentreportworkgroup"],
                SentimentReportJobQueueUrl = attributes["sentimentreportqueue"]
            };

            return(storage);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            Client = CreateClient(_CurrentCredentials, _RegionEndpoint);
        }
 internal ServiceDiscoveryPaginatorFactory(IAmazonServiceDiscovery client)
 {
     this.client = client;
 }