public List <string> GetDomains()
        {
            ListDomainsRequest  ListDomainsAction = new ListDomainsRequest();
            ListDomainsResponse response          = Service.ListDomains(ListDomainsAction);

            return(response.ListDomainsResult.DomainName);
        }
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonSimpleWorkflowConfig config = new AmazonSimpleWorkflowConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonSimpleWorkflowClient client = new AmazonSimpleWorkflowClient(creds, config);

            DomainInfos resp = new DomainInfos();

            do
            {
                ListDomainsRequest req = new ListDomainsRequest
                {
                    NextPageToken = resp.NextPageToken
                    ,
                    MaximumPageSize = maxItems
                };

                resp = client.ListDomains(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.DomainInfos)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextPageToken));
        }
Exemple #3
0
        private async Task CreateDomain()
        {
            //Get the list of domains
            ListDomainsRequest listDomainRequest = new ListDomainsRequest()
            {
                RegistrationStatus = RegistrationStatus.REGISTERED
            };
            ListDomainsResponse listDomainsResponse = await this.SwfClient.ListDomainsAsync(listDomainRequest);

            //Check if our domain exists
            if (listDomainsResponse.DomainInfos.Infos.Any(x => x.Name == this.SwfConfiguration.DomainName))
            {
                return;
            }

            //If doesn't exist -> create
            RegisterDomainRequest registerDomainRequest = new RegisterDomainRequest()
            {
                Name        = this.SwfConfiguration.DomainName,
                Description = this.SwfConfiguration.DomainDescription,
                WorkflowExecutionRetentionPeriodInDays = this.SwfConfiguration.WorkflowExecutionRetentionPeriodInDays
            };

            await this.SwfClient.RegisterDomainAsync(registerDomainRequest);
        }
Exemple #4
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonSageMakerConfig config = new AmazonSageMakerConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonSageMakerClient client = new AmazonSageMakerClient(creds, config);

            ListDomainsResponse resp = new ListDomainsResponse();

            do
            {
                ListDomainsRequest req = new ListDomainsRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResults = maxItems
                };

                resp = client.ListDomains(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.Domains)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the ListDomains operation.
        /// <seealso cref="Amazon.SimpleDB.IAmazonSimpleDB.ListDomains"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListDomains operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <ListDomainsResponse> ListDomainsAsync(ListDomainsRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new ListDomainsRequestMarshaller();
            var unmarshaller = ListDomainsResponseUnmarshaller.GetInstance();

            return(Invoke <IRequest, ListDomainsRequest, ListDomainsResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
Exemple #6
0
        static void RegisterDomain()
        {
            // Register if the domain is not already registered.
            var listDomainRequest = new ListDomainsRequest()
            {
                RegistrationStatus = RegistrationStatus.REGISTERED
            };

            if (SwfClient.ListDomains(listDomainRequest).DomainInfos.Infos.FirstOrDefault(
                    x => x.Name == domainName) == null)
            {
                var request = new RegisterDomainRequest()
                {
                    Name        = domainName,
                    Description = "Swf Demo",
                    WorkflowExecutionRetentionPeriodInDays = "1"
                };

                Console.WriteLine("INITIATOR: Created Domain - " + domainName);
                try
                {
                    SwfClient.RegisterDomain(request);
                }
                catch (DomainAlreadyExistsException dex)
                {
                }
            }
        }
        /// <summary>
        /// The <code>ListDomains</code> operation lists all domains associated with the Access
        /// Key ID. It returns domain names up to the limit set by <a href="#MaxNumberOfDomains">MaxNumberOfDomains</a>.
        /// A <a href="#NextToken">NextToken</a> is returned if there are more than <code>MaxNumberOfDomains</code>
        /// domains. Calling <code>ListDomains</code> successive times with the <code>NextToken</code>
        /// provided by the operation returns up to <code>MaxNumberOfDomains</code> more domain
        /// names with each successive operation call.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the ListDomains service method.</param>
        ///
        /// <returns>The response from the ListDomains service method, as returned by SimpleDB.</returns>
        /// <exception cref="Amazon.SimpleDB.Model.InvalidNextTokenException">
        /// The specified NextToken is not valid.
        /// </exception>
        /// <exception cref="Amazon.SimpleDB.Model.InvalidParameterValueException">
        /// The value for a parameter is invalid.
        /// </exception>
        public virtual ListDomainsResponse ListDomains(ListDomainsRequest request)
        {
            var marshaller   = ListDomainsRequestMarshaller.Instance;
            var unmarshaller = ListDomainsResponseUnmarshaller.Instance;

            return(Invoke <ListDomainsRequest, ListDomainsResponse>(request, marshaller, unmarshaller));
        }
Exemple #8
0
        /// <summary>
        /// Fetches the domain names and populates them to the domain list box.
        /// </summary>
        private void PopulateDomainNames()
        {
            SimpleDBResponseEventHandler <object, ResponseEventArgs> handler = null;

            handler = delegate(object sender, ResponseEventArgs args)
            {
                SimpleDB.Client.OnSimpleDBResponse -= handler;
                ListDomainsResponse response = args.Response as ListDomainsResponse;

                if (null != response)
                {
                    ListDomainsResult listResult = response.ListDomainsResult;
                    if (null != listResult)
                    {
                        this.Dispatcher.BeginInvoke(() =>
                        {
                            this.DomainNameList.Clear();
                            listResult.DomainName.ForEach(domain => this.DomainNameList.Add(domain));
                        });
                    }
                }
            };

            //Show a wait message.
            this.Dispatcher.BeginInvoke(() =>
            {
                this.DomainNameList.Clear();
                this.DomainNameList.Add("Please wait...");
            });
            SimpleDB.Client.OnSimpleDBResponse += handler;
            ListDomainsRequest request = new ListDomainsRequest();

            SimpleDB.Client.BeginListDomains(request);
        }
        internal ListDomainsResponse ListDomains(ListDomainsRequest request)
        {
            var marshaller   = new ListDomainsRequestMarshaller();
            var unmarshaller = ListDomainsResponseUnmarshaller.Instance;

            return(Invoke <ListDomainsRequest, ListDomainsResponse>(request, marshaller, unmarshaller));
        }
Exemple #10
0
        /// <summary>
        /// Initiates the asynchronous execution of the ListDomains operation.
        /// <seealso cref="M:Amazon.SimpleDB.AmazonSimpleDB.ListDomains"/>
        /// </summary>
        /// <param name="request">The ListDomainsRequest that defines the parameters of
        /// the operation.</param>
        public void BeginListDomains(ListDomainsRequest request)
        {
            IDictionary <string, string> parameters = ConvertListDomains(request);
            SDBAsyncResult result = new SDBAsyncResult(parameters, null);

            invoke <ListDomainsResponse>(result);
        }
        /// <summary>
        /// Return a (paginated) list of domains.
        ///
        /// </summary>
        /// <param name="request">The request object containing the details to send. Required.</param>
        /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
        /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
        /// <returns>A response object containing details about the completed operation</returns>
        /// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/tenantmanagercontrolplane/ListDomains.cs.html">here</a> to see an example of how to use ListDomains API.</example>
        public async Task <ListDomainsResponse> ListDomains(ListDomainsRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
        {
            logger.Trace("Called listDomains");
            Uri                uri            = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/domains".Trim('/')));
            HttpMethod         method         = new HttpMethod("GET");
            HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);

            requestMessage.Headers.Add("Accept", "application/json");
            GenericRetrier      retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
            HttpResponseMessage responseMessage;

            try
            {
                if (retryingClient != null)
                {
                    responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
                }
                else
                {
                    responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
                }
                this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);

                return(Converter.FromHttpResponseMessage <ListDomainsResponse>(responseMessage));
            }
            catch (Exception e)
            {
                logger.Error($"ListDomains failed with error: {e.Message}");
                throw;
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the ListDomains operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListDomains operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <ListDomainsResponse> ListDomainsAsync(ListDomainsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new ListDomainsRequestMarshaller();
            var unmarshaller = ListDomainsResponseUnmarshaller.Instance;

            return(InvokeAsync <ListDomainsRequest, ListDomainsResponse>(request, marshaller,
                                                                         unmarshaller, cancellationToken));
        }
Exemple #13
0
        /// <summary>
        /// The <code>ListDomains</code> operation lists all domains associated with the Access
        /// Key ID. It returns domain names up to the limit set by <a href="#MaxNumberOfDomains">MaxNumberOfDomains</a>.
        /// A <a href="#NextToken">NextToken</a> is returned if there are more than <code>MaxNumberOfDomains</code>
        /// domains. Calling <code>ListDomains</code> successive times with the <code>NextToken</code>
        /// provided by the operation returns up to <code>MaxNumberOfDomains</code> more domain
        /// names with each successive operation call.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the ListDomains service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the ListDomains service method, as returned by SimpleDB.</returns>
        /// <exception cref="Amazon.SimpleDB.Model.InvalidNextTokenException">
        /// The specified NextToken is not valid.
        /// </exception>
        /// <exception cref="Amazon.SimpleDB.Model.InvalidParameterValueException">
        /// The value for a parameter is invalid.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/sdb-2009-04-15/ListDomains">REST API Reference for ListDomains Operation</seealso>
        public virtual Task <ListDomainsResponse> ListDomainsAsync(ListDomainsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListDomainsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListDomainsResponseUnmarshaller.Instance;

            return(InvokeAsync <ListDomainsResponse>(request, options, cancellationToken));
        }
Exemple #14
0
        private void ListDomainButton_Click(object sender, RoutedEventArgs e)
        {
            SimpleDB.Client.OnSimpleDBResponse += ListDomainWebResponse;
            ListDomainsRequest request = new ListDomainsRequest();

            this.ListDomainMessage = "Please wait...";
            this.DomainNameList.Clear();
            SimpleDB.Client.BeginListDomains(request);
        }
Exemple #15
0
 internal void ListDomains()
 {
     RunTest(() =>
     {
         ListDomainsRequest request = new ListDomainsRequest();
         var response = _client.ListDomains(request);
         return(response.ToString());
     });
 }
Exemple #16
0
        internal virtual ListDomainsResponse ListDomains(ListDomainsRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListDomainsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListDomainsResponseUnmarshaller.Instance;

            return(Invoke <ListDomainsResponse>(request, options));
        }
Exemple #17
0
        public void SmokeTest()
        {
            var listDomainsRequest = new ListDomainsRequest
            {
                RegistrationStatus = RegistrationStatus.REGISTERED
            };
            var listDomainsResponse = Client.ListDomains(listDomainsRequest);

            Assert.AreEqual(listDomainsResponse.HttpStatusCode, System.Net.HttpStatusCode.OK);
        }
Exemple #18
0
        private async Task <DomainInfo> ListDomainFromAmazonBy(string domainName, RegistrationStatus registrationStatus)
        {
            var request = new ListDomainsRequest()
            {
                RegistrationStatus = registrationStatus
            };
            var response = await _simpleWorkflowClient.ListDomainsAsync(request);

            return(response.DomainInfos.Infos.FirstOrDefault(d => d.Name.Equals(domainName)));
        }
Exemple #19
0
        public static bool DoesDomainExist(string domainName, IAmazonSimpleDB sdbClient)
        {
            ListDomainsRequest  listDomainsRequest = new ListDomainsRequest();
            ListDomainsResponse response           = sdbClient.ListDomains(listDomainsRequest);

            if (response != null)
            {
                return(response.DomainNames.Contains(domainName));
            }

            return(false);
        }
Exemple #20
0
        private void WriteSimpleDBInfo()
        {
            StringBuilder       output      = new StringBuilder();
            ListDomainsRequest  sdbRequest  = new ListDomainsRequest();
            ListDomainsResponse sdbResponse = sdb.ListDomains(sdbRequest);

            foreach (string domain in sdbResponse.DomainNames)
            {
                output.AppendFormat("<li>{0}</li>", domain);
            }
            this.sdbPlaceholder.Text = output.ToString();
        }
		internal ListDomainsResponse ListDomains(ListDomainsRequest request)
        {
            var task = ListDomainsAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
Exemple #22
0
        private async Task <bool> checkDomainExists(string domainName)
        {
            _logger.LogDebug($"Checking for domain   {domainName}");

            var client = GetClient();

            ListDomainsRequest request = new ListDomainsRequest();

            ListDomainsResponse response = await client.ListDomainsAsync(request);

            _logger.LogDebug(response.ToString());

            return(response.DomainNames.Any(n => n == domainName));
        }
 /// <summary>
 /// Creates a new enumerable which will iterate over the responses received from the ListDomains operation. This enumerable
 /// will fetch more data from the server as needed.
 /// </summary>
 /// <param name="request">The request object containing the details to send</param>
 /// <param name="retryConfiguration">The configuration for retrying, may be null</param>
 /// <param name="cancellationToken">The cancellation token object</param>
 /// <returns>The enumerator, which supports a simple iteration over a collection of a specified type</returns>
 public IEnumerable <ListDomainsResponse> ListDomainsResponseEnumerator(ListDomainsRequest request, Common.Retry.RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
 {
     return(new Common.Utils.ResponseEnumerable <ListDomainsRequest, ListDomainsResponse>(
                response => response.OpcNextPage,
                input =>
     {
         if (!string.IsNullOrEmpty(input))
         {
             request.Page = input;
         }
         return request;
     },
                request => client.ListDomains(request, retryConfiguration, cancellationToken)
                ));
 }
Exemple #24
0
        private static IDictionary <string, string> ConvertListDomains(ListDomainsRequest request)
        {
            IDictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary["Action"] = "ListDomains";
            if (request.IsSetMaxNumberOfDomains())
            {
                dictionary["MaxNumberOfDomains"] = request.MaxNumberOfDomains.ToString();
            }
            if (request.IsSetNextToken())
            {
                dictionary["NextToken"] = request.NextToken;
            }
            return(dictionary);
        }
Exemple #25
0
        /**
         * Convert ListDomainsRequest to name value pairs
         */
        private static IDictionary <string, string> ConvertListDomains(ListDomainsRequest request)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters["Action"] = "ListDomains";
            if (request.IsSetMaxNumberOfDomains())
            {
                parameters["MaxNumberOfDomains"] = request.MaxNumberOfDomains.ToString(CultureInfo.InvariantCulture);
            }
            if (request.IsSetNextToken())
            {
                parameters["NextToken"] = request.NextToken;
            }

            return(parameters);
        }
Exemple #26
0
        /**
         * Convert ListDomainsRequest to name value pairs
         */
        private IDictionary <String, String> ConvertListDomains(ListDomainsRequest request)
        {
            IDictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("Action", "ListDomains");
            if (request.IsSetMaxNumberOfDomains())
            {
                parameters.Add("MaxNumberOfDomains", request.MaxNumberOfDomains + "");
            }
            if (request.IsSetNextToken())
            {
                parameters.Add("NextToken", request.NextToken);
            }

            return(parameters);
        }
        private void EnsureDomain(string domain)
        {
            var listDomainsRequest  = new ListDomainsRequest();
            var listDomainsResponse = _client.ListDomains(listDomainsRequest);

            if (listDomainsResponse.ListDomainsResult.DomainName.Contains(domain))
            {
                return;
            }

            var createDomainRequest = new CreateDomainRequest {
                DomainName = domain
            };

            _client.CreateDomain(createDomainRequest);
        }
Exemple #28
0
        public static void CheckForDomain(string domainName, IAmazonSimpleDB sdbClient)
        {
            VerifyKeys();

            ListDomainsRequest  listDomainsRequest  = new ListDomainsRequest();
            ListDomainsResponse listDomainsResponse = sdbClient.ListDomains(listDomainsRequest);

            if (!listDomainsResponse.DomainNames.Contains(domainName))
            {
                CreateDomainRequest createDomainRequest = new CreateDomainRequest()
                {
                    DomainName = domainName
                };
                sdbClient.CreateDomain(createDomainRequest);
            }
        }
Exemple #29
0
 /// <summary>
 /// Lists the domains.
 /// </summary>
 /// <returns>ListDomainsResponse1.</returns>
 public ListDomainsInfo ListDomains()
 {
     using (var clt = new AmazonSDBPortTypeClient())
     {
         try
         {
             var req = new ListDomainsRequest();
             clt.Open();
             var rsp = clt.ListDomains(req);
             return(ListDomainsMapper.MapToInfo(rsp.ListDomainsResponse));
         }
         finally
         {
             clt.Close();
         }
     }
 }
Exemple #30
0
        public virtual bool DoesDomainExist(string domainName)
        {
            var exists  = false;
            var client  = this.GetClient();
            var request = new ListDomainsRequest();

            var response = client.ListDomains(request);

            response.ListDomainsResult.DomainName.ForEach(x =>
            {
                if (x == domainName)
                {
                    exists = true;
                }
            });

            return(exists);
        }
Exemple #31
0
 internal void ListDomains()
 {
     RunTest(() =>
     {
         ListDomainsRequest request = new ListDomainsRequest();
         var response = _client.ListDomains(request);
         return response.ToString();
     });
 }