public async stt::Task GetRequestObjectAsync()
        {
            moq::Mock <InterconnectAttachments.InterconnectAttachmentsClient> mockGrpcClient = new moq::Mock <InterconnectAttachments.InterconnectAttachmentsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForRegionOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetInterconnectAttachmentRequest request = new GetInterconnectAttachmentRequest
            {
                Region  = "regionedb20d96",
                Project = "projectaa6ff846",
                InterconnectAttachment = "interconnect_attachmentc83a7a7c",
            };
            InterconnectAttachment expectedResponse = new InterconnectAttachment
            {
                Id   = 11672635353343658936UL,
                Mtu  = 1280318054,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                Type = "typee2cc9d59",
                CreationTimestamp      = "creation_timestamp235e59a1",
                DataplaneVersion       = -763719012,
                PartnerMetadata        = new InterconnectAttachmentPartnerMetadata(),
                EdgeAvailabilityDomain = "edge_availability_domainf7acc827",
                Encryption             = "encryption9174df5b",
                State                   = "state2e9ed39e",
                VlanTag8021Q            = 1290733749,
                Region                  = "regionedb20d96",
                Router                  = "routerd55c39f3",
                Bandwidth               = "bandwidth2b6c6736",
                OperationalStatus       = "operational_status14a476d9",
                Interconnect            = "interconnect253e8bf5",
                PrivateInterconnectInfo = new InterconnectAttachmentPrivateInfo(),
                CandidateSubnets        =
                {
                    "candidate_subnets3377adaa",
                },
                CloudRouterIpAddress    = "cloud_router_ip_address62b476a9",
                CustomerRouterIpAddress = "customer_router_ip_address819aa186",
                IpsecInternalAddresses  =
                {
                    "ipsec_internal_addresses8b47c5bb",
                },
                Description       = "description2cf9da67",
                PartnerAsn        = 6862354938501622805L,
                PairingKey        = "pairing_keyfe878c44",
                AdminEnabled      = true,
                SelfLink          = "self_link7e87f12d",
                SatisfiesPzs      = false,
                GoogleReferenceId = "google_reference_id815b6ab4",
            };

            mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <InterconnectAttachment>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            InterconnectAttachmentsClient client = new InterconnectAttachmentsClientImpl(mockGrpcClient.Object, null);
            InterconnectAttachment        responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            InterconnectAttachment responseCancellationToken = await client.GetAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for PatchAsync</summary>
        public async Task PatchAsync()
        {
            // Snippet: PatchAsync(string, string, string, InterconnectAttachment, CallSettings)
            // Additional: PatchAsync(string, string, string, InterconnectAttachment, CancellationToken)
            // Create client
            InterconnectAttachmentsClient interconnectAttachmentsClient = await InterconnectAttachmentsClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            string region  = "";
            string interconnectAttachment = "";
            InterconnectAttachment interconnectAttachmentResource = new InterconnectAttachment();
            // Make the request
            lro::Operation <Operation, Operation> response = await interconnectAttachmentsClient.PatchAsync(project, region, interconnectAttachment, interconnectAttachmentResource);

            // Poll until the returned long-running operation is complete
            lro::Operation <Operation, Operation> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            Operation 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
            lro::Operation <Operation, Operation> retrievedResponse = await interconnectAttachmentsClient.PollOncePatchAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Operation retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Пример #3
0
        public void GetRequestObject()
        {
            moq::Mock <InterconnectAttachments.InterconnectAttachmentsClient> mockGrpcClient = new moq::Mock <InterconnectAttachments.InterconnectAttachmentsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForRegionOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetInterconnectAttachmentRequest request = new GetInterconnectAttachmentRequest
            {
                Region  = "regionedb20d96",
                Project = "projectaa6ff846",
                InterconnectAttachment = "interconnect_attachmentc83a7a7c",
            };
            InterconnectAttachment expectedResponse = new InterconnectAttachment
            {
                Id   = 11672635353343658936UL,
                Mtu  = 1280318054,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                Type = InterconnectAttachment.Types.Type.PartnerProvider,
                CreationTimestamp      = "creation_timestamp235e59a1",
                DataplaneVersion       = -763719012,
                PartnerMetadata        = new InterconnectAttachmentPartnerMetadata(),
                EdgeAvailabilityDomain = InterconnectAttachment.Types.EdgeAvailabilityDomain.AvailabilityDomain1,
                Encryption             = InterconnectAttachment.Types.Encryption.None,
                State                   = InterconnectAttachment.Types.State.Unspecified,
                VlanTag8021Q            = 1290733749,
                Region                  = "regionedb20d96",
                Router                  = "routerd55c39f3",
                Bandwidth               = InterconnectAttachment.Types.Bandwidth.Bps500M,
                OperationalStatus       = InterconnectAttachment.Types.OperationalStatus.UndefinedOperationalStatus,
                Interconnect            = "interconnect253e8bf5",
                PrivateInterconnectInfo = new InterconnectAttachmentPrivateInfo(),
                CandidateSubnets        =
                {
                    "candidate_subnets3377adaa",
                },
                CloudRouterIpAddress    = "cloud_router_ip_address62b476a9",
                CustomerRouterIpAddress = "customer_router_ip_address819aa186",
                IpsecInternalAddresses  =
                {
                    "ipsec_internal_addresses8b47c5bb",
                },
                Description       = "description2cf9da67",
                PartnerAsn        = 6862354938501622805L,
                PairingKey        = "pairing_keyfe878c44",
                AdminEnabled      = true,
                SelfLink          = "self_link7e87f12d",
                SatisfiesPzs      = false,
                GoogleReferenceId = "google_reference_id815b6ab4",
            };

            mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            InterconnectAttachmentsClient client   = new InterconnectAttachmentsClientImpl(mockGrpcClient.Object, null);
            InterconnectAttachment        response = client.Get(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #4
0
 /// <summary>Snippet for Insert</summary>
 public void Insert()
 {
     // Snippet: Insert(string, string, InterconnectAttachment, CallSettings)
     // Create client
     InterconnectAttachmentsClient interconnectAttachmentsClient = InterconnectAttachmentsClient.Create();
     // Initialize request argument(s)
     string project = "";
     string region  = "";
     InterconnectAttachment interconnectAttachmentResource = new InterconnectAttachment();
     // Make the request
     Operation response = interconnectAttachmentsClient.Insert(project, region, interconnectAttachmentResource);
     // End snippet
 }
Пример #5
0
 /// <summary>Snippet for Get</summary>
 public void Get()
 {
     // Snippet: Get(string, string, string, CallSettings)
     // Create client
     InterconnectAttachmentsClient interconnectAttachmentsClient = InterconnectAttachmentsClient.Create();
     // Initialize request argument(s)
     string project = "";
     string region  = "";
     string interconnectAttachment = "";
     // Make the request
     InterconnectAttachment response = interconnectAttachmentsClient.Get(project, region, interconnectAttachment);
     // End snippet
 }
Пример #6
0
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, string, InterconnectAttachment, CallSettings)
            // Additional: InsertAsync(string, string, InterconnectAttachment, CancellationToken)
            // Create client
            InterconnectAttachmentsClient interconnectAttachmentsClient = await InterconnectAttachmentsClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            string region  = "";
            InterconnectAttachment interconnectAttachmentResource = new InterconnectAttachment();
            // Make the request
            Operation response = await interconnectAttachmentsClient.InsertAsync(project, region, interconnectAttachmentResource);

            // End snippet
        }
Пример #7
0
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetAsync()
        {
            // Snippet: GetAsync(string, string, string, CallSettings)
            // Additional: GetAsync(string, string, string, CancellationToken)
            // Create client
            InterconnectAttachmentsClient interconnectAttachmentsClient = await InterconnectAttachmentsClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            string region  = "";
            string interconnectAttachment = "";
            // Make the request
            InterconnectAttachment response = await interconnectAttachmentsClient.GetAsync(project, region, interconnectAttachment);

            // End snippet
        }
Пример #8
0
 /// <summary>Snippet for Get</summary>
 public void GetRequestObject()
 {
     // Snippet: Get(GetInterconnectAttachmentRequest, CallSettings)
     // Create client
     InterconnectAttachmentsClient interconnectAttachmentsClient = InterconnectAttachmentsClient.Create();
     // Initialize request argument(s)
     GetInterconnectAttachmentRequest request = new GetInterconnectAttachmentRequest
     {
         Region  = "",
         Project = "",
         InterconnectAttachment = "",
     };
     // Make the request
     InterconnectAttachment response = interconnectAttachmentsClient.Get(request);
     // End snippet
 }
Пример #9
0
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetRequestObjectAsync()
        {
            // Snippet: GetAsync(GetInterconnectAttachmentRequest, CallSettings)
            // Additional: GetAsync(GetInterconnectAttachmentRequest, CancellationToken)
            // Create client
            InterconnectAttachmentsClient interconnectAttachmentsClient = await InterconnectAttachmentsClient.CreateAsync();

            // Initialize request argument(s)
            GetInterconnectAttachmentRequest request = new GetInterconnectAttachmentRequest
            {
                Region  = "",
                Project = "",
                InterconnectAttachment = "",
            };
            // Make the request
            InterconnectAttachment response = await interconnectAttachmentsClient.GetAsync(request);

            // End snippet
        }
        /// <summary>
        /// Creates an InterconnectAttachment in the specified project using the data included in the request.
        /// Documentation https://developers.google.com/compute/beta/reference/interconnectAttachments/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Compute service.</param>
        /// <param name="project">Project ID for this request.</param>
        /// <param name="region">Name of the region for this request.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Insert(ComputeService service, string project, string region, InterconnectAttachment body, InterconnectAttachmentsInsertOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (region == null)
                {
                    throw new ArgumentNullException(region);
                }

                // Building the initial request.
                var request = service.InterconnectAttachments.Insert(body, project, region);

                // Applying optional parameters to the request.
                request = (InterconnectAttachmentsResource.InsertRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request InterconnectAttachments.Insert failed.", ex);
            }
        }