/// <summary>Snippet for DeleteConnectorAsync</summary> public async Task DeleteConnectorResourceNamesAsync() { // Snippet: DeleteConnectorAsync(ConnectorName, CallSettings) // Additional: DeleteConnectorAsync(ConnectorName, CancellationToken) // Create client VpcAccessServiceClient vpcAccessServiceClient = await VpcAccessServiceClient.CreateAsync(); // Initialize request argument(s) ConnectorName name = ConnectorName.FromProjectLocationConnector("[PROJECT]", "[LOCATION]", "[CONNECTOR]"); // Make the request Operation <Empty, OperationMetadata> response = await vpcAccessServiceClient.DeleteConnectorAsync(name); // Poll until the returned long-running operation is complete Operation <Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Empty result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <Empty, OperationMetadata> retrievedResponse = await vpcAccessServiceClient.PollOnceDeleteConnectorAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Empty retrievedResult = retrievedResponse.Result; } // End snippet }
public void GetConnector() { moq::Mock <VpcAccessService.VpcAccessServiceClient> mockGrpcClient = new moq::Mock <VpcAccessService.VpcAccessServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetConnectorRequest request = new GetConnectorRequest { ConnectorName = ConnectorName.FromProjectLocationConnector("[PROJECT]", "[LOCATION]", "[CONNECTOR]"), }; Connector expectedResponse = new Connector { ConnectorName = ConnectorName.FromProjectLocationConnector("[PROJECT]", "[LOCATION]", "[CONNECTOR]"), Network = "networkd22ce091", IpCidrRange = "ip_cidr_range745a04d3", State = Connector.Types.State.Unspecified, MinThroughput = -1306078102, MaxThroughput = 1609945563, ConnectedProjects = { "connected_projects7e2fb014", }, Subnet = new Connector.Types.Subnet(), }; mockGrpcClient.Setup(x => x.GetConnector(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); VpcAccessServiceClient client = new VpcAccessServiceClientImpl(mockGrpcClient.Object, null); Connector response = client.GetConnector(request.Name); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for DeleteConnector</summary> public void DeleteConnectorRequestObject() { // Snippet: DeleteConnector(DeleteConnectorRequest, CallSettings) // Create client VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.Create(); // Initialize request argument(s) DeleteConnectorRequest request = new DeleteConnectorRequest { ConnectorName = ConnectorName.FromProjectLocationConnector("[PROJECT]", "[LOCATION]", "[CONNECTOR]"), }; // Make the request Operation <Empty, OperationMetadata> response = vpcAccessServiceClient.DeleteConnector(request); // Poll until the returned long-running operation is complete Operation <Empty, OperationMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result Empty result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <Empty, OperationMetadata> retrievedResponse = vpcAccessServiceClient.PollOnceDeleteConnector(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Empty retrievedResult = retrievedResponse.Result; } // End snippet }
public async stt::Task GetConnectorRequestObjectAsync() { moq::Mock <VpcAccessService.VpcAccessServiceClient> mockGrpcClient = new moq::Mock <VpcAccessService.VpcAccessServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetConnectorRequest request = new GetConnectorRequest { ConnectorName = ConnectorName.FromProjectLocationConnector("[PROJECT]", "[LOCATION]", "[CONNECTOR]"), }; Connector expectedResponse = new Connector { ConnectorName = ConnectorName.FromProjectLocationConnector("[PROJECT]", "[LOCATION]", "[CONNECTOR]"), Network = "networkd22ce091", IpCidrRange = "ip_cidr_range745a04d3", State = Connector.Types.State.Unspecified, MinThroughput = -1306078102, MaxThroughput = 1609945563, ConnectedProjects = { "connected_projects7e2fb014", }, Subnet = new Connector.Types.Subnet(), }; mockGrpcClient.Setup(x => x.GetConnectorAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Connector>(stt::Task.FromResult(expectedResponse), null, null, null, null)); VpcAccessServiceClient client = new VpcAccessServiceClientImpl(mockGrpcClient.Object, null); Connector responseCallSettings = await client.GetConnectorAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Connector responseCancellationToken = await client.GetConnectorAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object"/>. /// </returns> /// <filterpriority>2</filterpriority> public override int GetHashCode() { int cName = ConnectorName == null ? 0 : ConnectorName.GetHashCode(); int rUri = RepositoryUri == null ? 0 : RepositoryUri.GetHashCode(); int rId = RepositoryId == null ? 0 : RepositoryId.GetHashCode(); return(cName ^ rUri ^ rId); }
/// <summary>Snippet for GetConnector</summary> public void GetConnectorResourceNames() { // Snippet: GetConnector(ConnectorName, CallSettings) // Create client VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.Create(); // Initialize request argument(s) ConnectorName name = ConnectorName.FromProjectLocationConnector("[PROJECT]", "[LOCATION]", "[CONNECTOR]"); // Make the request Connector response = vpcAccessServiceClient.GetConnector(name); // End snippet }
public override void Initialization() { try { //Выбираем коннектор _conName = ConnectorNames[0]; //Выбираем инструменты var securities = Securities[_conName]; foreach (var security in securities) { if (security.InitialMargin > 0) { _futures = security; } else { _stock = security; } } //Создаем индикаторы для торговой стратегии if (HistoricalDataType == HistoricalDataType.Candles) { _averageSpreadOnCandles = new AverageSpreadOnCandles((int)Parameter(1)); _topOnCandles = new BollingerTopOnCandles((int)Parameter(2), (int)Parameter(3)); _averageOnCandles = new BollingerAverageOnCandles((int)Parameter(2)); _bottomOnCandles = new BollingerBottomOnCandles((int)Parameter(2), (int)Parameter(3)); } else { _averageSpreadOnTicks = new AverageSpreadOnTicks((int)Parameter(1)); _topOnTicks = new BollingerTopOnTicks((int)Parameter(2), (int)Parameter(3)); _averageOnTicks = new BollingerAverageOnTicks((int)Parameter(2)); _bottomOnTicks = new BollingerBottomOnTicks((int)Parameter(2), (int)Parameter(3)); } //Величина смещения цены для исполнения лимитных заявок как рыночных _offsetFutures = _futures.Tick * (int)Parameter(4); _offsetStock = _stock.Tick * (int)Parameter(4); //Объем заявки _volumeStocks = (int)Parameter(5); _volumeFutures = (int)Parameter(6); //Подписываемся на события при инициализации стратегии Subscribe(); } catch (Exception ex) { ExceptionMessage(ex, "Strategy"); } }
/// <summary>Snippet for GetConnectorAsync</summary> public async Task GetConnectorResourceNamesAsync() { // Snippet: GetConnectorAsync(ConnectorName, CallSettings) // Additional: GetConnectorAsync(ConnectorName, CancellationToken) // Create client VpcAccessServiceClient vpcAccessServiceClient = await VpcAccessServiceClient.CreateAsync(); // Initialize request argument(s) ConnectorName name = ConnectorName.FromProjectLocationConnector("[PROJECT]", "[LOCATION]", "[CONNECTOR]"); // Make the request Connector response = await vpcAccessServiceClient.GetConnectorAsync(name); // End snippet }
/// <summary>Snippet for GetConnector</summary> public void GetConnectorRequestObject() { // Snippet: GetConnector(GetConnectorRequest, CallSettings) // Create client VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.Create(); // Initialize request argument(s) GetConnectorRequest request = new GetConnectorRequest { ConnectorName = ConnectorName.FromProjectLocationConnector("[PROJECT]", "[LOCATION]", "[CONNECTOR]"), }; // Make the request Connector response = vpcAccessServiceClient.GetConnector(request); // End snippet }