internal virtual GetPolicyResponse GetPolicy(GetPolicyRequest request) { var marshaller = GetPolicyRequestMarshaller.Instance; var unmarshaller = GetPolicyResponseUnmarshaller.Instance; return(Invoke <GetPolicyRequest, GetPolicyResponse>(request, marshaller, unmarshaller)); }
/// <summary> /// Initiates the asynchronous execution of the GetPolicy operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetPolicy 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/fms-2018-01-01/GetPolicy">REST API Reference for GetPolicy Operation</seealso> public virtual Task <GetPolicyResponse> GetPolicyAsync(GetPolicyRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = GetPolicyRequestMarshaller.Instance; var unmarshaller = GetPolicyResponseUnmarshaller.Instance; return(InvokeAsync <GetPolicyRequest, GetPolicyResponse>(request, marshaller, unmarshaller, cancellationToken)); }
/// <summary> /// Returns information about the specified AWS Firewall Manager policy. /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetPolicy 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 GetPolicy service method, as returned by FMS.</returns> /// <exception cref="Amazon.FMS.Model.InternalErrorException"> /// The operation failed because of a system problem, even though the request was valid. /// Retry your request. /// </exception> /// <exception cref="Amazon.FMS.Model.InvalidOperationException"> /// The operation failed because there was nothing to do. For example, you might have /// submitted an <code>AssociateAdminAccount</code> request, but the account ID that you /// submitted was already set as the AWS Firewall Manager administrator. /// </exception> /// <exception cref="Amazon.FMS.Model.InvalidTypeException"> /// The value of the <code>Type</code> parameter is invalid. /// </exception> /// <exception cref="Amazon.FMS.Model.ResourceNotFoundException"> /// The specified resource was not found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/fms-2018-01-01/GetPolicy">REST API Reference for GetPolicy Operation</seealso> public virtual Task <GetPolicyResponse> GetPolicyAsync(GetPolicyRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = GetPolicyRequestMarshaller.Instance; options.ResponseUnmarshaller = GetPolicyResponseUnmarshaller.Instance; return(InvokeAsync <GetPolicyResponse>(request, options, cancellationToken)); }
internal virtual GetPolicyResponse GetPolicy(GetPolicyRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = GetPolicyRequestMarshaller.Instance; options.ResponseUnmarshaller = GetPolicyResponseUnmarshaller.Instance; return(Invoke <GetPolicyResponse>(request, options)); }
public GetPolicyResponse GetPolicy(GetPolicyRequest parameter) { var product = this.virtuClient.GetProducts().Single(A => A.Name, "Верное решение"); var risks = this.virtuClient.GetRisks(product.ID); var currencies = this.virtuClient.GetCurrencies(product.ID); var getBuyoutTariffs = this.virtuClient.GetBuyouts(product.ID); var strategyDetails = this.virtuClient.StrategiesSearch(new StrategiesSearchInput() { IsActive = true, ReadRedefined = true, }); var policy = this.virtuClient.Read(parameter.policyId); var currency = currencies.Single(A => A.ID, policy.Currency); var strategyDetail = strategyDetails.Single(A => A.ID, policy.InvestmentStrategyData.ID); var investingCurrency = currencies.Single(A => A.ID, strategyDetail.OptionCurrency); GetPolicyResponse result = new GetPolicyResponse() { amount = policy.Premium.Value, coefficient = policy.ParticipationCoefficient.Value, status = getStatus(policy.StatusName), strategy = policy.InvestmentStrategyRaw, fullDescription = product.Description, currency = getCurrency(currency).Value, coverCapital = 100, effectiveDate = getDate(policy.EffectiveDate).Value, expirationDate = getDate(policy.ExpirationDate).Value, insuranceRisks = risks.Select(A => new risk() { id = A.ID, sum = policy.Premium.Value.ToString(), text = A.Name, }).ToArray(), paymentsPlan = null, policyNumber = policy.SERIAL + " " + policy.NUMBER, productId = policy.ProductID, productName = product.Name, redemptionAmounts = getBuyoutTariffs.Select(A => new redemptionAmountInfo() { sum = decimal.Parse(A.InsSum.value), date = DateTime.Today.AddYears(int.Parse(A.Year.value)) }).ToArray(), }; result.profitability = calcDividends( premium: result.amount, participationCoefficient: result.coefficient, currency: result.currency, investingCurrency: getCurrency(investingCurrency).Value, startDate: getDate(strategyDetail.InvestmentStartDate).Value, endDate: DateTime.Today, strategyId: strategyDetail.ID, quoteOnStartDate: strategyDetail.BaseIndexOnStartDate.Value); return(result); }
/// <summary> /// Creates a waiter using the provided configuration. /// </summary> /// <param name="request">Request to send.</param> /// <param name="config">Wait Configuration</param> /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param> /// <returns>a new Oci.common.Waiter instance</returns> public Waiter <GetPolicyRequest, GetPolicyResponse> ForPolicy(GetPolicyRequest request, WaiterConfiguration config, params Policy.LifecycleStateEnum[] targetStates) { var agent = new WaiterAgent <GetPolicyRequest, GetPolicyResponse>( request, request => client.GetPolicy(request), response => targetStates.Contains(response.Policy.LifecycleState.Value), targetStates.Contains(Policy.LifecycleStateEnum.Deleted) ); return(new Waiter <GetPolicyRequest, GetPolicyResponse>(config, agent)); }
/// <summary>Snippet for GetPolicy</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetPolicyRequestObject() { // Create client BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = BinauthzManagementServiceV1Beta1Client.Create(); // Initialize request argument(s) GetPolicyRequest request = new GetPolicyRequest { PolicyName = PolicyName.FromProject("[PROJECT]"), }; // Make the request Policy response = binauthzManagementServiceV1Beta1Client.GetPolicy(request); }
/// <summary>Snippet for GetPolicyAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetPolicyRequestObjectAsync() { // Create client BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = await BinauthzManagementServiceV1Beta1Client.CreateAsync(); // Initialize request argument(s) GetPolicyRequest request = new GetPolicyRequest { PolicyName = PolicyName.FromProject("[PROJECT]"), }; // Make the request Policy response = await binauthzManagementServiceV1Beta1Client.GetPolicyAsync(request); }
/// <summary> /// 本接口(GetPolicy)可用于查询查看策略详情。 /// </summary> /// <param name="req">参考<see cref="GetPolicyRequest"/></param> /// <returns>参考<see cref="GetPolicyResponse"/>实例</returns> public async Task <GetPolicyResponse> GetPolicy(GetPolicyRequest req) { JsonResponseModel <GetPolicyResponse> rsp = null; try { var strResp = await this.InternalRequest(req, "GetPolicy"); rsp = JsonConvert.DeserializeObject <JsonResponseModel <GetPolicyResponse> >(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return(rsp.Response); }
/// <summary>Snippet for GetPolicyAsync</summary> public async Task GetPolicyRequestObjectAsync() { // Snippet: GetPolicyAsync(GetPolicyRequest, CallSettings) // Additional: GetPolicyAsync(GetPolicyRequest, CancellationToken) // Create client BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = await BinauthzManagementServiceV1Beta1Client.CreateAsync(); // Initialize request argument(s) GetPolicyRequest request = new GetPolicyRequest { PolicyName = PolicyName.FromProject("[PROJECT]"), }; // Make the request Policy response = await binauthzManagementServiceV1Beta1Client.GetPolicyAsync(request); // End snippet }
/// <summary> /// Initiates the asynchronous execution of the GetPolicy operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetPolicy operation on AmazonLambdaClient.</param> /// <param name="callback">An Action delegate that is invoked when the operation completes.</param> /// <param name="options">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> public void GetPolicyAsync(GetPolicyRequest request, AmazonServiceCallback <GetPolicyRequest, GetPolicyResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new GetPolicyRequestMarshaller(); var unmarshaller = GetPolicyResponseUnmarshaller.Instance; Action <AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if (callback != null) { callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult <GetPolicyRequest, GetPolicyResponse> responseObject = new AmazonServiceResult <GetPolicyRequest, GetPolicyResponse>((GetPolicyRequest)req, (GetPolicyResponse)res, ex, ao.State); callback(responseObject); } } ; BeginInvoke <GetPolicyRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
public static void GetPolicy() { var client = new AmazonIdentityManagementServiceClient(); var request = new GetPolicyRequest { PolicyArn = "arn:aws:iam::123456789:policy/DemoEC2Permissions" }; try { var response = client.GetPolicy(request); Console.WriteLine("Policy " + response.Policy.PolicyName + "successfully retrieved"); } catch (NoSuchEntityException) { Console.WriteLine ("Policy 'DemoEC2Permissions' does not exist."); } }
protected override void ProcessRecord() { base.ProcessRecord(); GetPolicyRequest request; try { request = new GetPolicyRequest { PolicyId = PolicyId }; HandleOutput(request); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
private void HandleOutput(GetPolicyRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case LifecycleStateParamSet: response = client.Waiters.ForPolicy(request, waiterConfig, WaitForLifecycleState).Execute(); break; case Default: response = client.GetPolicy(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.Policy); }
public void GetPolicy() { moq::Mock <OrgPolicy.OrgPolicyClient> mockGrpcClient = new moq::Mock <OrgPolicy.OrgPolicyClient>(moq::MockBehavior.Strict); GetPolicyRequest request = new GetPolicyRequest { PolicyName = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]"), }; Policy expectedResponse = new Policy { PolicyName = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]"), Spec = new PolicySpec(), Alternate = new AlternatePolicySpec(), }; mockGrpcClient.Setup(x => x.GetPolicy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); OrgPolicyClient client = new OrgPolicyClientImpl(mockGrpcClient.Object, null); Policy response = client.GetPolicy(request.Name); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void getAndApplyPolicy(String session) { GetPolicyRequest request = new GetPolicyRequest(); request.session = MainWindow.Session; try { GetPolicyResponse response = client.GetPolicy(request); closeApps(); getServices(); applicationService.BannedApplications = response.policy.bannedApps; applicationService.BannedSites = response.policy.bannedSites; applicationService.BannedServices = response.policy.bannedServices; applicationService.banApplications(); applicationService.banSites(); applicationService.banServices(); } catch (Exception ex) { return; } }
public async stt::Task GetPolicyRequestObjectAsync() { moq::Mock <OrgPolicy.OrgPolicyClient> mockGrpcClient = new moq::Mock <OrgPolicy.OrgPolicyClient>(moq::MockBehavior.Strict); GetPolicyRequest request = new GetPolicyRequest { PolicyName = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]"), }; Policy expectedResponse = new Policy { PolicyName = PolicyName.FromProjectPolicy("[PROJECT]", "[POLICY]"), Spec = new PolicySpec(), Alternate = new AlternatePolicySpec(), }; mockGrpcClient.Setup(x => x.GetPolicyAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Policy>(stt::Task.FromResult(expectedResponse), null, null, null, null)); OrgPolicyClient client = new OrgPolicyClientImpl(mockGrpcClient.Object, null); Policy responseCallSettings = await client.GetPolicyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Policy responseCancellationToken = await client.GetPolicyAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetPolicyAsync(GetPolicyRequest request, AmazonServiceCallback <GetPolicyRequest, GetPolicyResponse> callback, AsyncOptions options = null) { throw new System.NotImplementedException(); }
public Task <GetPolicyResponse> GetPolicyAsync(GetPolicyRequest request, CancellationToken cancellationToken = new CancellationToken()) { throw new System.NotImplementedException(); }
/// <summary> /// Creates a waiter using default wait configuration. /// </summary> /// <param name="request">Request to send.</param> /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param> /// <returns>a new Oci.common.Waiter instance</returns> public Waiter <GetPolicyRequest, GetPolicyResponse> ForPolicy(GetPolicyRequest request, params Policy.LifecycleStateEnum[] targetStates) { return(this.ForPolicy(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates)); }