public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonSimpleSystemsManagementConfig config = new AmazonSimpleSystemsManagementConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonSimpleSystemsManagementClient client = new AmazonSimpleSystemsManagementClient(creds, config); GetInventoryResponse resp = new GetInventoryResponse(); do { GetInventoryRequest req = new GetInventoryRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.GetInventory(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Entities) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
public void GetInventoryResourceNames() { moq::Mock <OsConfigZonalService.OsConfigZonalServiceClient> mockGrpcClient = new moq::Mock <OsConfigZonalService.OsConfigZonalServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetInventoryRequest request = new GetInventoryRequest { InventoryName = InventoryName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]"), }; Inventory expectedResponse = new Inventory { OsInfo = new Inventory.Types.OsInfo(), Items = { { "key8a0b6e3c", new Inventory.Types.Item() }, }, InventoryName = InventoryName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]"), UpdateTime = new wkt::Timestamp(), }; mockGrpcClient.Setup(x => x.GetInventory(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); OsConfigZonalServiceClient client = new OsConfigZonalServiceClientImpl(mockGrpcClient.Object, null); Inventory response = client.GetInventory(request.InventoryName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetInventoryResourceNamesAsync() { moq::Mock <OsConfigZonalService.OsConfigZonalServiceClient> mockGrpcClient = new moq::Mock <OsConfigZonalService.OsConfigZonalServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetInventoryRequest request = new GetInventoryRequest { InventoryName = InventoryName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]"), }; Inventory expectedResponse = new Inventory { OsInfo = new Inventory.Types.OsInfo(), Items = { { "key8a0b6e3c", new Inventory.Types.Item() }, }, InventoryName = InventoryName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]"), UpdateTime = new wkt::Timestamp(), }; mockGrpcClient.Setup(x => x.GetInventoryAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Inventory>(stt::Task.FromResult(expectedResponse), null, null, null, null)); OsConfigZonalServiceClient client = new OsConfigZonalServiceClientImpl(mockGrpcClient.Object, null); Inventory responseCallSettings = await client.GetInventoryAsync(request.InventoryName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Inventory responseCancellationToken = await client.GetInventoryAsync(request.InventoryName, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void CheckGetInventoryResponseCode() { var expectedStatusCode = HttpStatusCode.OK; GetInventoryRequest getInventoryRequest = new GetInventoryRequest(); var actualStatusCode = getInventoryRequest.GetInventoryResponseCode(); Assert.AreEqual(expectedStatusCode, actualStatusCode, "Status code 200 olarak dönmemiştir.Dönen code: {0}", actualStatusCode); }
public async Task <L2Response> GetInventory(string player) { var inventoryRequest = new GetInventoryRequest() { Username = player }; var responseObject = await inventoryRequest.SendPostRequest <GetInventoryResponse>(); return(responseObject); }
public override async Task <GetInventoryResponse> GetInventory(GetInventoryRequest request, ServerCallContext context) { var repo = _queryRepositoryFactory.QueryEfRepository <Domain.Inventory>(); var inv = await repo.FindOneAsync(x => x.Id == request.Id.ConvertTo <Guid>()); var response = new GetInventoryResponse { Result = inv.ToDto() }; return(response); }
public override async Task <GetInventoryResponse> GetInventory(GetInventoryRequest request, ServerCallContext context) { try { var repo = _queryRepositoryFactory.QueryEfRepository <Domain.Inventory>(); var inv = await repo.FindOneAsync(x => x.Id == request.Id.ConvertTo <Guid>()); var response = new GetInventoryResponse { Result = inv.ToDto() }; return(response); } catch (Exception ex) { _logger.LogError(ex.Message); throw new RpcException(new Status(StatusCode.Internal, ex.Message)); } }
public InventoryItem[] getInventory(GetInventoryRequest arg0) { //不用,不需要 return(null); }
public int getInventoryCount(GetInventoryRequest request) { //不用,不需要 return(0); }
public async Task <GetInventoryResponse> GetInventoryAsync(GetInventoryRequest request) { AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions(); return(await GetInventoryWithOptionsAsync(request, runtime)); }
public GetInventoryResponse GetInventory(GetInventoryRequest request) { AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions(); return(GetInventoryWithOptions(request, runtime)); }
public async Task <GetInventoryResponse> GetInventoryWithOptionsAsync(GetInventoryRequest request, AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime) { AlibabaCloud.TeaUtil.Common.ValidateModel(request); return(TeaModel.ToObject <GetInventoryResponse>(await DoRequestAsync("GetInventory", "HTTPS", "POST", "2020-05-15", "AK", null, request.ToMap(), runtime))); }