protected override void ProcessRecord() { base.ProcessRecord(); GetInternetGatewayRequest request; try { request = new GetInternetGatewayRequest { IgId = IgId }; HandleOutput(request); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
private void HandleOutput(GetInternetGatewayRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case LifecycleStateParamSet: response = client.Waiters.ForInternetGateway(request, waiterConfig, WaitForLifecycleState).Execute(); break; case Default: response = client.GetInternetGateway(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.InternetGateway); }
private static async Task <InternetGateway> CreateInternalGateway(VirtualNetworkClient vcnClient, string compartmentId, Vcn vcn) { CreateInternetGatewayDetails createInternetGatewayDetails = new CreateInternetGatewayDetails { CompartmentId = compartmentId, DisplayName = IgName, IsEnabled = true, VcnId = vcn.Id }; CreateInternetGatewayRequest createInternetGatewayRequest = new CreateInternetGatewayRequest { CreateInternetGatewayDetails = createInternetGatewayDetails }; CreateInternetGatewayResponse createInternetGatewayResponse = await vcnClient.CreateInternetGateway(createInternetGatewayRequest); GetInternetGatewayRequest getInternetGatewayRequest = new GetInternetGatewayRequest { IgId = createInternetGatewayResponse.InternetGateway.Id }; GetInternetGatewayResponse getInternetGatewayResponse = vcnClient.Waiters.ForInternetGateway(getInternetGatewayRequest, InternetGateway.LifecycleStateEnum.Available).Execute(); InternetGateway internetGateway = getInternetGatewayResponse.InternetGateway; logger.Info($"Created internet gateway: {internetGateway.Id} and state is {internetGateway.LifecycleState}"); return(internetGateway); }