Beispiel #1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            CreateInternetGatewayResponse response = new CreateInternetGatewayResponse();

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth = 2;
            }

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("internetGateway", targetDepth))
                    {
                        var unmarshaller = InternetGatewayUnmarshaller.Instance;
                        response.InternetGateway = unmarshaller.Unmarshall(context);
                        continue;
                    }
                }
            }

            return(response);
        }
Beispiel #2
0
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            CreateInternetGatewayResponse response = new CreateInternetGatewayResponse();

            int targetDepth = 2;

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("internetGateway", targetDepth))
                    {
                        response.InternetGateway = InternetGatewayUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                }
            }


            return(response);
        }
Beispiel #3
0
        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);
        }