/// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ImportSshPublicKeyResponse response = new ImportSshPublicKeyResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("ServerId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.ServerId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("SshPublicKeyId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.SshPublicKeyId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("UserName", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.UserName = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Exemplo n.º 2
0
 /// <summary>Snippet for ImportSshPublicKey</summary>
 public void ImportSshPublicKey1()
 {
     // Snippet: ImportSshPublicKey(UserName,SshPublicKey,CallSettings)
     // Create client
     OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.Create();
     // Initialize request argument(s)
     UserName     parent       = new UserName("[USER]");
     SshPublicKey sshPublicKey = new SshPublicKey();
     // Make the request
     ImportSshPublicKeyResponse response = osLoginServiceClient.ImportSshPublicKey(parent, sshPublicKey);
     // End snippet
 }
 /// <summary>Snippet for ImportSshPublicKey</summary>
 public void ImportSshPublicKey2ResourceNames()
 {
     // Snippet: ImportSshPublicKey(UserName, SshPublicKey, string, CallSettings)
     // Create client
     OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.Create();
     // Initialize request argument(s)
     UserName     parent       = UserName.FromUser("[USER]");
     SshPublicKey sshPublicKey = new SshPublicKey();
     string       projectId    = "";
     // Make the request
     ImportSshPublicKeyResponse response = osLoginServiceClient.ImportSshPublicKey(parent, sshPublicKey, projectId);
     // End snippet
 }
 /// <summary>Snippet for ImportSshPublicKey</summary>
 public void ImportSshPublicKey2()
 {
     // Snippet: ImportSshPublicKey(string, SshPublicKey, string, CallSettings)
     // Create client
     OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.Create();
     // Initialize request argument(s)
     string       parent       = "users/[USER]";
     SshPublicKey sshPublicKey = new SshPublicKey();
     string       projectId    = "";
     // Make the request
     ImportSshPublicKeyResponse response = osLoginServiceClient.ImportSshPublicKey(parent, sshPublicKey, projectId);
     // End snippet
 }
Exemplo n.º 5
0
 /// <summary>Snippet for ImportSshPublicKey</summary>
 public void ImportSshPublicKey_RequestObject()
 {
     // Snippet: ImportSshPublicKey(ImportSshPublicKeyRequest,CallSettings)
     // Create client
     OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.Create();
     // Initialize request argument(s)
     ImportSshPublicKeyRequest request = new ImportSshPublicKeyRequest
     {
         ParentAsUserName = new UserName("[USER]"),
         SshPublicKey     = new SshPublicKey(),
     };
     // Make the request
     ImportSshPublicKeyResponse response = osLoginServiceClient.ImportSshPublicKey(request);
     // End snippet
 }
Exemplo n.º 6
0
        /// <summary>Snippet for ImportSshPublicKeyAsync</summary>
        public async Task ImportSshPublicKeyAsync1()
        {
            // Snippet: ImportSshPublicKeyAsync(UserName,SshPublicKey,CallSettings)
            // Additional: ImportSshPublicKeyAsync(UserName,SshPublicKey,CancellationToken)
            // Create client
            OsLoginServiceClient osLoginServiceClient = await OsLoginServiceClient.CreateAsync();

            // Initialize request argument(s)
            UserName     parent       = new UserName("[USER]");
            SshPublicKey sshPublicKey = new SshPublicKey();
            // Make the request
            ImportSshPublicKeyResponse response = await osLoginServiceClient.ImportSshPublicKeyAsync(parent, sshPublicKey);

            // End snippet
        }
        /// <summary>Snippet for ImportSshPublicKeyAsync</summary>
        public async Task ImportSshPublicKey2ResourceNamesAsync()
        {
            // Snippet: ImportSshPublicKeyAsync(UserName, SshPublicKey, string, CallSettings)
            // Additional: ImportSshPublicKeyAsync(UserName, SshPublicKey, string, CancellationToken)
            // Create client
            OsLoginServiceClient osLoginServiceClient = await OsLoginServiceClient.CreateAsync();

            // Initialize request argument(s)
            UserName     parent       = UserName.FromUser("[USER]");
            SshPublicKey sshPublicKey = new SshPublicKey();
            string       projectId    = "";
            // Make the request
            ImportSshPublicKeyResponse response = await osLoginServiceClient.ImportSshPublicKeyAsync(parent, sshPublicKey, projectId);

            // End snippet
        }
 public async Task ImportSshPublicKeyAsync3()
 {
     Mock<OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock<OsLoginService.OsLoginServiceClient>(MockBehavior.Strict);
     ImportSshPublicKeyRequest request = new ImportSshPublicKeyRequest
     {
         ParentAsUserName = new UserName("[USER]"),
         SshPublicKey = new SshPublicKey(),
     };
     ImportSshPublicKeyResponse expectedResponse = new ImportSshPublicKeyResponse();
     mockGrpcClient.Setup(x => x.ImportSshPublicKeyAsync(request, It.IsAny<CallOptions>()))
         .Returns(new Grpc.Core.AsyncUnaryCall<ImportSshPublicKeyResponse>(Task.FromResult(expectedResponse), null, null, null, null));
     OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null);
     ImportSshPublicKeyResponse response = await client.ImportSshPublicKeyAsync(request);
     Assert.Same(expectedResponse, response);
     mockGrpcClient.VerifyAll();
 }
 public void ImportSshPublicKey3()
 {
     Mock<OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock<OsLoginService.OsLoginServiceClient>(MockBehavior.Strict);
     ImportSshPublicKeyRequest request = new ImportSshPublicKeyRequest
     {
         ParentAsUserName = new UserName("[USER]"),
         SshPublicKey = new SshPublicKey(),
     };
     ImportSshPublicKeyResponse expectedResponse = new ImportSshPublicKeyResponse();
     mockGrpcClient.Setup(x => x.ImportSshPublicKey(request, It.IsAny<CallOptions>()))
         .Returns(expectedResponse);
     OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null);
     ImportSshPublicKeyResponse response = client.ImportSshPublicKey(request);
     Assert.Same(expectedResponse, response);
     mockGrpcClient.VerifyAll();
 }
Exemplo n.º 10
0
        /// <summary>Snippet for ImportSshPublicKeyAsync</summary>
        public async Task ImportSshPublicKeyAsync_RequestObject()
        {
            // Snippet: ImportSshPublicKeyAsync(ImportSshPublicKeyRequest,CallSettings)
            // Additional: ImportSshPublicKeyAsync(ImportSshPublicKeyRequest,CancellationToken)
            // Create client
            OsLoginServiceClient osLoginServiceClient = await OsLoginServiceClient.CreateAsync();

            // Initialize request argument(s)
            ImportSshPublicKeyRequest request = new ImportSshPublicKeyRequest
            {
                ParentAsUserName = new UserName("[USER]"),
                SshPublicKey     = new SshPublicKey(),
            };
            // Make the request
            ImportSshPublicKeyResponse response = await osLoginServiceClient.ImportSshPublicKeyAsync(request);

            // End snippet
        }
 public void ImportSshPublicKey2()
 {
     Mock<OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock<OsLoginService.OsLoginServiceClient>(MockBehavior.Strict);
     ImportSshPublicKeyRequest expectedRequest = new ImportSshPublicKeyRequest
     {
         ParentAsUserName = new UserName("[USER]"),
         SshPublicKey = new SshPublicKey(),
         ProjectId = "projectId-1969970175",
     };
     ImportSshPublicKeyResponse expectedResponse = new ImportSshPublicKeyResponse();
     mockGrpcClient.Setup(x => x.ImportSshPublicKey(expectedRequest, It.IsAny<CallOptions>()))
         .Returns(expectedResponse);
     OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null);
     UserName parent = new UserName("[USER]");
     SshPublicKey sshPublicKey = new SshPublicKey();
     string projectId = "projectId-1969970175";
     ImportSshPublicKeyResponse response = client.ImportSshPublicKey(parent, sshPublicKey, projectId);
     Assert.Same(expectedResponse, response);
     mockGrpcClient.VerifyAll();
 }