public override Task <ListDevicesResponse> ListDevices(ListDevicesRequest request, ServerCallContext context) { IOptionsSnapshot <DeviceOptions> deviceOptions = this.serviceProvider.GetRequiredService <IOptionsSnapshot <DeviceOptions> >(); var response = new ListDevicesResponse(); response.Devices.Add( from d in deviceOptions.Value.Devices let id = ByteString.CopyFrom(d.ComputeIdBinary()) join e in this.plcManager.PlcDictionary.AsEnumerable() on id equals e.Key into g from e in g.DefaultIfEmpty() select new Device { Id = id, Name = d.Name, Ipv4Address = e.Value == null ? ByteString.Empty : ByteString.CopyFrom(((IPEndPoint)e.Value.RemoteEndPoint).Address.GetAddressBytes()), Status = e.Value == null ? DeviceStatus.Disconnected : DeviceStatus.Healthy, }); return(Task.FromResult(response)); }
internal virtual ListDevicesResponse ListDevices(ListDevicesRequest request) { var marshaller = ListDevicesRequestMarshaller.Instance; var unmarshaller = ListDevicesResponseUnmarshaller.Instance; return(Invoke <ListDevicesRequest, ListDevicesResponse>(request, marshaller, unmarshaller)); }
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); ListDevicesResponse resp = new ListDevicesResponse(); do { ListDevicesRequest req = new ListDevicesRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListDevices(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.DeviceSummaries) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
private static void queryDevices(IoTDAClient client) { ListDevicesRequest req = new ListDevicesRequest { InstanceId = "1a7ffc5c-d89c-44dd-8265-b1653d951ce0" }; try { var resp = client.ListDevices(req); Console.WriteLine(resp.HttpStatusCode); Console.WriteLine(resp.Page); foreach (var SimplifyDevice in resp.Devices) { Console.WriteLine(JsonConvert.SerializeObject(SimplifyDevice)); } } catch (RequestTimeoutException requestTimeoutException) { Console.WriteLine(requestTimeoutException.ErrorMessage); } catch (ServiceResponseException clientRequestException) { Console.WriteLine(clientRequestException.HttpStatusCode); Console.WriteLine(clientRequestException.ErrorCode); Console.WriteLine(clientRequestException.ErrorMsg); } catch (ConnectionException connectionException) { Console.WriteLine(connectionException.ErrorMessage); } }
/// <summary> /// Initiates the asynchronous execution of the ListDevices operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListDevices 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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devices-2018-05-14/ListDevices">REST API Reference for ListDevices Operation</seealso> public virtual Task <ListDevicesResponse> ListDevicesAsync(ListDevicesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = ListDevicesRequestMarshaller.Instance; var unmarshaller = ListDevicesResponseUnmarshaller.Instance; return(InvokeAsync <ListDevicesRequest, ListDevicesResponse>(request, marshaller, unmarshaller, cancellationToken)); }
/// <summary> /// Initiates the asynchronous execution of the ListDevices operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListDevices operation on AmazonIoT1ClickDevicesServiceClient.</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 EndListDevices /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devices-2018-05-14/ListDevices">REST API Reference for ListDevices Operation</seealso> public virtual IAsyncResult BeginListDevices(ListDevicesRequest request, AsyncCallback callback, object state) { var marshaller = ListDevicesRequestMarshaller.Instance; var unmarshaller = ListDevicesResponseUnmarshaller.Instance; return(BeginInvoke <ListDevicesRequest>(request, marshaller, unmarshaller, callback, state)); }
/// <summary> /// Initiates the asynchronous execution of the ListDevices operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListDevices operation on AmazonIoT1ClickDevicesServiceClient.</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 EndListDevices /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devices-2018-05-14/ListDevices">REST API Reference for ListDevices Operation</seealso> public virtual IAsyncResult BeginListDevices(ListDevicesRequest request, AsyncCallback callback, object state) { var options = new InvokeOptions(); options.RequestMarshaller = ListDevicesRequestMarshaller.Instance; options.ResponseUnmarshaller = ListDevicesResponseUnmarshaller.Instance; return(BeginInvoke(request, options, callback, state)); }
/// <summary> /// 查询设备列表 /// </summary> public async Task <ListDevicesResponse> ListDevicesAsync(ListDevicesRequest listDevicesRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); string urlPath = HttpUtils.AddUrlPath("/v5/iot/{project_id}/devices", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, listDevicesRequest); HttpResponseMessage response = await DoHttpRequestAsync("GET", request); return(JsonUtils.DeSerialize <ListDevicesResponse>(response)); }
internal virtual ListDevicesResponse ListDevices(ListDevicesRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = ListDevicesRequestMarshaller.Instance; options.ResponseUnmarshaller = ListDevicesResponseUnmarshaller.Instance; return(Invoke <ListDevicesResponse>(request, options)); }
/// <summary> /// Initiates the asynchronous execution of the ListDevices operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListDevices 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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devices-2018-05-14/ListDevices">REST API Reference for ListDevices Operation</seealso> public virtual Task <ListDevicesResponse> ListDevicesAsync(ListDevicesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = ListDevicesRequestMarshaller.Instance; options.ResponseUnmarshaller = ListDevicesResponseUnmarshaller.Instance; return(InvokeAsync <ListDevicesResponse>(request, options, cancellationToken)); }
public override AsyncUnaryCall <ListDevicesResponse> ListDevicesAsync(ListDevicesRequest request, Metadata headers = null, DateTime?deadline = null, CancellationToken cancellationToken = default) { var response = new ListDevicesResponse(); response.Devices.Add(Devices.Values); return(TestCalls.AsyncUnaryCall( Task.FromResult(response), Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { })); }
private ListDevicesRequest CreateListDevicesRequest(int limit, string paginationToken) { EnsureUserAuthenticated(); ListDevicesRequest listDevicesRequest = new ListDevicesRequest() { AccessToken = SessionTokens.AccessToken, Limit = limit, PaginationToken = paginationToken }; return(listDevicesRequest); }
/// <summary> /// Lists the CognitoDevices associated with this user using an asynchronous call /// </summary> /// <param name="limit">Maxmimum number of devices to be returned in this call</param> /// <param name="paginationToken">Token to continue earlier search</param> /// <returns>Returns a list of CognitoDevices associated with this user</returns> public virtual async Task <List <CognitoDevice> > ListDevicesAsync(int limit, string paginationToken) { ListDevicesRequest listDevicesRequest = CreateListDevicesRequest(limit, paginationToken); ListDevicesResponse listDevicesReponse = await Provider.ListDevicesAsync(listDevicesRequest).ConfigureAwait(false); List <CognitoDevice> devicesList = new List <CognitoDevice>(); foreach (DeviceType device in listDevicesReponse.Devices) { devicesList.Add(new CognitoDevice(device, this)); } return(devicesList); }
/// <summary> /// Lists the CognitoDevices associated with this user using an asynchronous call /// </summary> /// <param name="limit">Maxmimum number of devices to be returned in this call</param> /// <param name="paginationToken">Token to continue earlier search</param> /// <returns>Returns a list of CognitoDevices associated with this user</returns> public void ListDevicesAsync(int limit, string paginationToken, AsyncCallback <List <CognitoDevice> > callback = null) { ListDevicesRequest listDevicesRequest = CreateListDevicesRequest(limit, paginationToken); Provider.ListDevicesAsync(listDevicesRequest, r => { List <CognitoDevice> devicesList = null; if (r.Exception == null) { devicesList = new List <CognitoDevice>(); foreach (DeviceType device in r.Response.Devices) { devicesList.Add(new CognitoDevice(device, this)); } } callback?.Invoke(new AsyncResult <List <CognitoDevice> >(devicesList, r.Exception)); }); }
public async Task <ListDevicesResponse> ListDevicesWithOptionsAsync(ListDevicesRequest request, AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime) { AlibabaCloud.TeaUtil.Common.ValidateModel(request); return(TeaModel.ToObject <ListDevicesResponse>(await DoRequestAsync("ListDevices", "HTTPS", "POST", "2020-05-15", "AK", null, request.ToMap(), runtime))); }
public ListDevicesResponse ListDevices(ListDevicesRequest request) { AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions(); return(ListDevicesWithOptions(request, runtime)); }
public async Task <ListDevicesResponse> ListDevicesAsync(ListDevicesRequest request) { AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions(); return(await ListDevicesWithOptionsAsync(request, runtime)); }
public void ListDevicesAsync(ListDevicesRequest request, AmazonServiceCallback <ListDevicesRequest, ListDevicesResponse> callback, AsyncOptions options = null) { throw new System.NotImplementedException(); }