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);
        }
        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 <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 <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);
        }
 private Amazon.ServiceDiscovery.Model.GetInstanceResponse CallAWSServiceOperation(IAmazonServiceDiscovery client, Amazon.ServiceDiscovery.Model.GetInstanceRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Cloud Map", "GetInstance");
     try
     {
         #if DESKTOP
         return(client.GetInstance(request));
         #elif CORECLR
         return(client.GetInstanceAsync(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;
     }
 }