public async Task UpdateSshPublicKeyAsync2()
        {
            Mock <OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock <OsLoginService.OsLoginServiceClient>(MockBehavior.Strict);
            UpdateSshPublicKeyRequest expectedRequest = new UpdateSshPublicKeyRequest
            {
                FingerprintName = new FingerprintName("[USER]", "[FINGERPRINT]"),
                SshPublicKey    = new SshPublicKey(),
                UpdateMask      = new FieldMask(),
            };
            SshPublicKey expectedResponse = new SshPublicKey
            {
                Key = "key106079",
                ExpirationTimeUsec = 2058878882L,
                Fingerprint        = "fingerprint-1375934236",
            };

            mockGrpcClient.Setup(x => x.UpdateSshPublicKeyAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <SshPublicKey>(Task.FromResult(expectedResponse), null, null, null, null));
            OsLoginServiceClient client       = new OsLoginServiceClientImpl(mockGrpcClient.Object, null);
            FingerprintName      name         = new FingerprintName("[USER]", "[FINGERPRINT]");
            SshPublicKey         sshPublicKey = new SshPublicKey();
            FieldMask            updateMask   = new FieldMask();
            SshPublicKey         response     = await client.UpdateSshPublicKeyAsync(name, sshPublicKey, updateMask);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void UpdateSshPublicKey()
        {
            Mock <OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock <OsLoginService.OsLoginServiceClient>(MockBehavior.Strict);
            UpdateSshPublicKeyRequest expectedRequest = new UpdateSshPublicKeyRequest
            {
                FingerprintName = new FingerprintName("[USER]", "[FINGERPRINT]"),
                SshPublicKey    = new SshPublicKey(),
            };
            SshPublicKey expectedResponse = new SshPublicKey
            {
                Key = "key106079",
                ExpirationTimeUsec = 2058878882L,
                Fingerprint        = "fingerprint-1375934236",
            };

            mockGrpcClient.Setup(x => x.UpdateSshPublicKey(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            OsLoginServiceClient client       = new OsLoginServiceClientImpl(mockGrpcClient.Object, null);
            FingerprintName      name         = new FingerprintName("[USER]", "[FINGERPRINT]");
            SshPublicKey         sshPublicKey = new SshPublicKey();
            SshPublicKey         response     = client.UpdateSshPublicKey(name, sshPublicKey);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #3
0
 /// <summary>Snippet for GetSshPublicKey</summary>
 public void GetSshPublicKey()
 {
     // Snippet: GetSshPublicKey(FingerprintName,CallSettings)
     // Create client
     OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.Create();
     // Initialize request argument(s)
     FingerprintName name = new FingerprintName("[USER]", "[FINGERPRINT]");
     // Make the request
     SshPublicKey response = osLoginServiceClient.GetSshPublicKey(name);
     // End snippet
 }
Exemple #4
0
 /// <summary>Snippet for UpdateSshPublicKey</summary>
 public void UpdateSshPublicKey2()
 {
     // Snippet: UpdateSshPublicKey(FingerprintName,SshPublicKey,FieldMask,CallSettings)
     // Create client
     OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.Create();
     // Initialize request argument(s)
     FingerprintName name         = new FingerprintName("[USER]", "[FINGERPRINT]");
     SshPublicKey    sshPublicKey = new SshPublicKey();
     FieldMask       updateMask   = new FieldMask();
     // Make the request
     SshPublicKey response = osLoginServiceClient.UpdateSshPublicKey(name, sshPublicKey, updateMask);
     // End snippet
 }
Exemple #5
0
        /// <summary>Snippet for GetSshPublicKeyAsync</summary>
        public async Task GetSshPublicKeyAsync()
        {
            // Snippet: GetSshPublicKeyAsync(FingerprintName,CallSettings)
            // Additional: GetSshPublicKeyAsync(FingerprintName,CancellationToken)
            // Create client
            OsLoginServiceClient osLoginServiceClient = await OsLoginServiceClient.CreateAsync();

            // Initialize request argument(s)
            FingerprintName name = new FingerprintName("[USER]", "[FINGERPRINT]");
            // Make the request
            SshPublicKey response = await osLoginServiceClient.GetSshPublicKeyAsync(name);

            // End snippet
        }
 public async Task DeleteSshPublicKeyAsync()
 {
     Mock<OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock<OsLoginService.OsLoginServiceClient>(MockBehavior.Strict);
     DeleteSshPublicKeyRequest expectedRequest = new DeleteSshPublicKeyRequest
     {
         FingerprintName = new FingerprintName("[USER]", "[FINGERPRINT]"),
     };
     Empty expectedResponse = new Empty();
     mockGrpcClient.Setup(x => x.DeleteSshPublicKeyAsync(expectedRequest, It.IsAny<CallOptions>()))
         .Returns(new Grpc.Core.AsyncUnaryCall<Empty>(Task.FromResult(expectedResponse), null, null, null, null));
     OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null);
     FingerprintName name = new FingerprintName("[USER]", "[FINGERPRINT]");
     await client.DeleteSshPublicKeyAsync(name);
     mockGrpcClient.VerifyAll();
 }
 public void DeleteSshPublicKey()
 {
     Mock<OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock<OsLoginService.OsLoginServiceClient>(MockBehavior.Strict);
     DeleteSshPublicKeyRequest expectedRequest = new DeleteSshPublicKeyRequest
     {
         FingerprintName = new FingerprintName("[USER]", "[FINGERPRINT]"),
     };
     Empty expectedResponse = new Empty();
     mockGrpcClient.Setup(x => x.DeleteSshPublicKey(expectedRequest, It.IsAny<CallOptions>()))
         .Returns(expectedResponse);
     OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null);
     FingerprintName name = new FingerprintName("[USER]", "[FINGERPRINT]");
     client.DeleteSshPublicKey(name);
     mockGrpcClient.VerifyAll();
 }
Exemple #8
0
        /// <summary>Snippet for UpdateSshPublicKeyAsync</summary>
        public async Task UpdateSshPublicKeyAsync2()
        {
            // Snippet: UpdateSshPublicKeyAsync(FingerprintName,SshPublicKey,FieldMask,CallSettings)
            // Additional: UpdateSshPublicKeyAsync(FingerprintName,SshPublicKey,FieldMask,CancellationToken)
            // Create client
            OsLoginServiceClient osLoginServiceClient = await OsLoginServiceClient.CreateAsync();

            // Initialize request argument(s)
            FingerprintName name         = new FingerprintName("[USER]", "[FINGERPRINT]");
            SshPublicKey    sshPublicKey = new SshPublicKey();
            FieldMask       updateMask   = new FieldMask();
            // Make the request
            SshPublicKey response = await osLoginServiceClient.UpdateSshPublicKeyAsync(name, sshPublicKey, updateMask);

            // End snippet
        }