public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonAlexaForBusinessConfig config = new AmazonAlexaForBusinessConfig();

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

            SearchDevicesResponse resp = new SearchDevicesResponse();

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

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

                foreach (var obj in resp.Devices)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Пример #2
0
        /// <summary>
        /// Searches for devices using the specified filters.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the SearchDevices 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 SearchDevices service method, as returned by Braket.</returns>
        /// <exception cref="Amazon.Braket.Model.AccessDeniedException">
        /// You do not have sufficient access to perform this action.
        /// </exception>
        /// <exception cref="Amazon.Braket.Model.InternalServiceException">
        /// The request processing has failed because of an unknown error, exception, or failure.
        /// </exception>
        /// <exception cref="Amazon.Braket.Model.ThrottlingException">
        /// The throttling rate limit is met.
        /// </exception>
        /// <exception cref="Amazon.Braket.Model.ValidationException">
        /// The input fails to satisfy the constraints specified by an AWS service.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/SearchDevices">REST API Reference for SearchDevices Operation</seealso>
        public virtual Task <SearchDevicesResponse> SearchDevicesAsync(SearchDevicesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = SearchDevicesRequestMarshaller.Instance;
            options.ResponseUnmarshaller = SearchDevicesResponseUnmarshaller.Instance;

            return(InvokeAsync <SearchDevicesResponse>(request, options, cancellationToken));
        }
Пример #3
0
        internal virtual SearchDevicesResponse SearchDevices(SearchDevicesRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = SearchDevicesRequestMarshaller.Instance;
            options.ResponseUnmarshaller = SearchDevicesResponseUnmarshaller.Instance;

            return(Invoke <SearchDevicesResponse>(request, options));
        }
Пример #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the SearchDevices operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the SearchDevices operation on AmazonBraketClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndSearchDevices
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/braket-2019-09-01/SearchDevices">REST API Reference for SearchDevices Operation</seealso>
        public virtual IAsyncResult BeginSearchDevices(SearchDevicesRequest request, AsyncCallback callback, object state)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = SearchDevicesRequestMarshaller.Instance;
            options.ResponseUnmarshaller = SearchDevicesResponseUnmarshaller.Instance;

            return(BeginInvoke(request, options, callback, state));
        }
Пример #5
0
        public async Task <IEnumerable <JObject> > SearchDevicesAsync([FromBody] SearchDevicesRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            if (string.IsNullOrEmpty(request.Query))
            {
                throw new ArgumentNullException("request.Query");
            }

            return(await _provisioningService.GetDevicesAsync(request.Query, request.MaxCount));
        }
Пример #6
0
        public async Task <JArray> SearchDevicesAsync([FromBody] SearchDevicesRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            if (string.IsNullOrEmpty(request.Query))
            {
                throw new ArgumentNullException("request.Query");
            }

            if (request.MaxCount <= 0)
            {
                throw new ArgumentException("MaxCount has to be greater than 0.", "request.MaxCount");
            }

            return(await _provisioningService.GetDevicesAsync(request.Query, request.MaxCount));
        }
Пример #7
0
        public void Test()
        {
            var request = new SearchDevicesRequest();

            request.AddCriteria(SearchCriteriaDto.Active);
        }