diff --git a/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/OsLoginServiceClient.java b/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/OsLoginServiceClient.java index 98908f22..a1cdf853 100644 --- a/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/OsLoginServiceClient.java +++ b/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/OsLoginServiceClient.java @@ -340,190 +340,6 @@ public final UnaryCallable deleteSshPublicKeyC return stub.deleteSshPublicKeyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Retrieves the profile information used for logging in to a virtual machine on Google Compute - * Engine. - * - *

Sample code: - * - *


-   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
-   *   UserName name = UserName.of("[USER]");
-   *   LoginProfile response = osLoginServiceClient.getLoginProfile(name);
-   * }
-   * 
- * - * @param name Required. The unique ID for the user in format `users/{user}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final LoginProfile getLoginProfile(UserName name) { - GetLoginProfileRequest request = - GetLoginProfileRequest.newBuilder().setName(name == null ? null : name.toString()).build(); - return getLoginProfile(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Retrieves the profile information used for logging in to a virtual machine on Google Compute - * Engine. - * - *

Sample code: - * - *


-   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
-   *   UserName name = UserName.of("[USER]");
-   *   LoginProfile response = osLoginServiceClient.getLoginProfile(name.toString());
-   * }
-   * 
- * - * @param name Required. The unique ID for the user in format `users/{user}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final LoginProfile getLoginProfile(String name) { - GetLoginProfileRequest request = GetLoginProfileRequest.newBuilder().setName(name).build(); - return getLoginProfile(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Retrieves the profile information used for logging in to a virtual machine on Google Compute - * Engine. - * - *

Sample code: - * - *


-   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
-   *   UserName name = UserName.of("[USER]");
-   *   GetLoginProfileRequest request = GetLoginProfileRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   LoginProfile response = osLoginServiceClient.getLoginProfile(request);
-   * }
-   * 
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final LoginProfile getLoginProfile(GetLoginProfileRequest request) { - return getLoginProfileCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Retrieves the profile information used for logging in to a virtual machine on Google Compute - * Engine. - * - *

Sample code: - * - *


-   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
-   *   UserName name = UserName.of("[USER]");
-   *   GetLoginProfileRequest request = GetLoginProfileRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<LoginProfile> future = osLoginServiceClient.getLoginProfileCallable().futureCall(request);
-   *   // Do something
-   *   LoginProfile response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable getLoginProfileCallable() { - return stub.getLoginProfileCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Retrieves an SSH public key. - * - *

Sample code: - * - *


-   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
-   *   FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
-   *   SshPublicKey response = osLoginServiceClient.getSshPublicKey(name);
-   * }
-   * 
- * - * @param name Required. The fingerprint of the public key to retrieve. Public keys are identified - * by their SHA-256 fingerprint. The fingerprint of the public key is in format - * `users/{user}/sshPublicKeys/{fingerprint}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final SshPublicKey getSshPublicKey(FingerprintName name) { - GetSshPublicKeyRequest request = - GetSshPublicKeyRequest.newBuilder().setName(name == null ? null : name.toString()).build(); - return getSshPublicKey(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Retrieves an SSH public key. - * - *

Sample code: - * - *


-   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
-   *   FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
-   *   SshPublicKey response = osLoginServiceClient.getSshPublicKey(name.toString());
-   * }
-   * 
- * - * @param name Required. The fingerprint of the public key to retrieve. Public keys are identified - * by their SHA-256 fingerprint. The fingerprint of the public key is in format - * `users/{user}/sshPublicKeys/{fingerprint}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final SshPublicKey getSshPublicKey(String name) { - GetSshPublicKeyRequest request = GetSshPublicKeyRequest.newBuilder().setName(name).build(); - return getSshPublicKey(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Retrieves an SSH public key. - * - *

Sample code: - * - *


-   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
-   *   FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
-   *   GetSshPublicKeyRequest request = GetSshPublicKeyRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   SshPublicKey response = osLoginServiceClient.getSshPublicKey(request);
-   * }
-   * 
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final SshPublicKey getSshPublicKey(GetSshPublicKeyRequest request) { - return getSshPublicKeyCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Retrieves an SSH public key. - * - *

Sample code: - * - *


-   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
-   *   FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
-   *   GetSshPublicKeyRequest request = GetSshPublicKeyRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<SshPublicKey> future = osLoginServiceClient.getSshPublicKeyCallable().futureCall(request);
-   *   // Do something
-   *   SshPublicKey response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable getSshPublicKeyCallable() { - return stub.getSshPublicKeyCallable(); - } - // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Adds an SSH public key and returns the profile information. Default POSIX account information @@ -870,6 +686,190 @@ public final UnaryCallable updateSshPub return stub.updateSshPublicKeyCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the profile information used for logging in to a virtual machine on Google Compute + * Engine. + * + *

Sample code: + * + *


+   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+   *   UserName name = UserName.of("[USER]");
+   *   LoginProfile response = osLoginServiceClient.getLoginProfile(name);
+   * }
+   * 
+ * + * @param name Required. The unique ID for the user in format `users/{user}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LoginProfile getLoginProfile(UserName name) { + GetLoginProfileRequest request = + GetLoginProfileRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getLoginProfile(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the profile information used for logging in to a virtual machine on Google Compute + * Engine. + * + *

Sample code: + * + *


+   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+   *   UserName name = UserName.of("[USER]");
+   *   LoginProfile response = osLoginServiceClient.getLoginProfile(name.toString());
+   * }
+   * 
+ * + * @param name Required. The unique ID for the user in format `users/{user}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LoginProfile getLoginProfile(String name) { + GetLoginProfileRequest request = GetLoginProfileRequest.newBuilder().setName(name).build(); + return getLoginProfile(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the profile information used for logging in to a virtual machine on Google Compute + * Engine. + * + *

Sample code: + * + *


+   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+   *   UserName name = UserName.of("[USER]");
+   *   GetLoginProfileRequest request = GetLoginProfileRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   LoginProfile response = osLoginServiceClient.getLoginProfile(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LoginProfile getLoginProfile(GetLoginProfileRequest request) { + return getLoginProfileCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the profile information used for logging in to a virtual machine on Google Compute + * Engine. + * + *

Sample code: + * + *


+   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+   *   UserName name = UserName.of("[USER]");
+   *   GetLoginProfileRequest request = GetLoginProfileRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<LoginProfile> future = osLoginServiceClient.getLoginProfileCallable().futureCall(request);
+   *   // Do something
+   *   LoginProfile response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable getLoginProfileCallable() { + return stub.getLoginProfileCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an SSH public key. + * + *

Sample code: + * + *


+   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+   *   FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
+   *   SshPublicKey response = osLoginServiceClient.getSshPublicKey(name);
+   * }
+   * 
+ * + * @param name Required. The fingerprint of the public key to retrieve. Public keys are identified + * by their SHA-256 fingerprint. The fingerprint of the public key is in format + * `users/{user}/sshPublicKeys/{fingerprint}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final SshPublicKey getSshPublicKey(FingerprintName name) { + GetSshPublicKeyRequest request = + GetSshPublicKeyRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getSshPublicKey(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an SSH public key. + * + *

Sample code: + * + *


+   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+   *   FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
+   *   SshPublicKey response = osLoginServiceClient.getSshPublicKey(name.toString());
+   * }
+   * 
+ * + * @param name Required. The fingerprint of the public key to retrieve. Public keys are identified + * by their SHA-256 fingerprint. The fingerprint of the public key is in format + * `users/{user}/sshPublicKeys/{fingerprint}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final SshPublicKey getSshPublicKey(String name) { + GetSshPublicKeyRequest request = GetSshPublicKeyRequest.newBuilder().setName(name).build(); + return getSshPublicKey(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an SSH public key. + * + *

Sample code: + * + *


+   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+   *   FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
+   *   GetSshPublicKeyRequest request = GetSshPublicKeyRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   SshPublicKey response = osLoginServiceClient.getSshPublicKey(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final SshPublicKey getSshPublicKey(GetSshPublicKeyRequest request) { + return getSshPublicKeyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves an SSH public key. + * + *

Sample code: + * + *


+   * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+   *   FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
+   *   GetSshPublicKeyRequest request = GetSshPublicKeyRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<SshPublicKey> future = osLoginServiceClient.getSshPublicKeyCallable().futureCall(request);
+   *   // Do something
+   *   SshPublicKey response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable getSshPublicKeyCallable() { + return stub.getSshPublicKeyCallable(); + } + @Override public final void close() { stub.close(); diff --git a/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/OsLoginServiceSettings.java b/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/OsLoginServiceSettings.java index 8a7e1ec4..4e7b7f28 100644 --- a/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/OsLoginServiceSettings.java +++ b/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/OsLoginServiceSettings.java @@ -76,16 +76,6 @@ public UnaryCallSettings deleteSshPublicKeySet return ((OsLoginServiceStubSettings) getStubSettings()).deleteSshPublicKeySettings(); } - /** Returns the object with the settings used for calls to getLoginProfile. */ - public UnaryCallSettings getLoginProfileSettings() { - return ((OsLoginServiceStubSettings) getStubSettings()).getLoginProfileSettings(); - } - - /** Returns the object with the settings used for calls to getSshPublicKey. */ - public UnaryCallSettings getSshPublicKeySettings() { - return ((OsLoginServiceStubSettings) getStubSettings()).getSshPublicKeySettings(); - } - /** Returns the object with the settings used for calls to importSshPublicKey. */ public UnaryCallSettings importSshPublicKeySettings() { @@ -97,6 +87,16 @@ public UnaryCallSettings updateSshPubli return ((OsLoginServiceStubSettings) getStubSettings()).updateSshPublicKeySettings(); } + /** Returns the object with the settings used for calls to getLoginProfile. */ + public UnaryCallSettings getLoginProfileSettings() { + return ((OsLoginServiceStubSettings) getStubSettings()).getLoginProfileSettings(); + } + + /** Returns the object with the settings used for calls to getSshPublicKey. */ + public UnaryCallSettings getSshPublicKeySettings() { + return ((OsLoginServiceStubSettings) getStubSettings()).getSshPublicKeySettings(); + } + public static final OsLoginServiceSettings create(OsLoginServiceStubSettings stub) throws IOException { return new OsLoginServiceSettings.Builder(stub.toBuilder()).build(); @@ -206,18 +206,6 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().deleteSshPublicKeySettings(); } - /** Returns the builder for the settings used for calls to getLoginProfile. */ - public UnaryCallSettings.Builder - getLoginProfileSettings() { - return getStubSettingsBuilder().getLoginProfileSettings(); - } - - /** Returns the builder for the settings used for calls to getSshPublicKey. */ - public UnaryCallSettings.Builder - getSshPublicKeySettings() { - return getStubSettingsBuilder().getSshPublicKeySettings(); - } - /** Returns the builder for the settings used for calls to importSshPublicKey. */ public UnaryCallSettings.Builder importSshPublicKeySettings() { @@ -230,6 +218,18 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().updateSshPublicKeySettings(); } + /** Returns the builder for the settings used for calls to getLoginProfile. */ + public UnaryCallSettings.Builder + getLoginProfileSettings() { + return getStubSettingsBuilder().getLoginProfileSettings(); + } + + /** Returns the builder for the settings used for calls to getSshPublicKey. */ + public UnaryCallSettings.Builder + getSshPublicKeySettings() { + return getStubSettingsBuilder().getSshPublicKeySettings(); + } + @Override public OsLoginServiceSettings build() throws IOException { return new OsLoginServiceSettings(this); diff --git a/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/GrpcOsLoginServiceStub.java b/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/GrpcOsLoginServiceStub.java index 0ad32fca..2990f57c 100644 --- a/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/GrpcOsLoginServiceStub.java +++ b/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/GrpcOsLoginServiceStub.java @@ -69,24 +69,6 @@ public class GrpcOsLoginServiceStub extends OsLoginServiceStub { ProtoUtils.marshaller(DeleteSshPublicKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private static final MethodDescriptor - getLoginProfileMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.oslogin.v1.OsLoginService/GetLoginProfile") - .setRequestMarshaller( - ProtoUtils.marshaller(GetLoginProfileRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(LoginProfile.getDefaultInstance())) - .build(); - private static final MethodDescriptor - getSshPublicKeyMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.oslogin.v1.OsLoginService/GetSshPublicKey") - .setRequestMarshaller( - ProtoUtils.marshaller(GetSshPublicKeyRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(SshPublicKey.getDefaultInstance())) - .build(); private static final MethodDescriptor importSshPublicKeyMethodDescriptor = MethodDescriptor.newBuilder() @@ -106,16 +88,34 @@ public class GrpcOsLoginServiceStub extends OsLoginServiceStub { ProtoUtils.marshaller(UpdateSshPublicKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(SshPublicKey.getDefaultInstance())) .build(); + private static final MethodDescriptor + getLoginProfileMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.oslogin.v1.OsLoginService/GetLoginProfile") + .setRequestMarshaller( + ProtoUtils.marshaller(GetLoginProfileRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(LoginProfile.getDefaultInstance())) + .build(); + private static final MethodDescriptor + getSshPublicKeyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.oslogin.v1.OsLoginService/GetSshPublicKey") + .setRequestMarshaller( + ProtoUtils.marshaller(GetSshPublicKeyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(SshPublicKey.getDefaultInstance())) + .build(); private final BackgroundResource backgroundResources; private final UnaryCallable deletePosixAccountCallable; private final UnaryCallable deleteSshPublicKeyCallable; - private final UnaryCallable getLoginProfileCallable; - private final UnaryCallable getSshPublicKeyCallable; private final UnaryCallable importSshPublicKeyCallable; private final UnaryCallable updateSshPublicKeyCallable; + private final UnaryCallable getLoginProfileCallable; + private final UnaryCallable getSshPublicKeyCallable; private final GrpcStubCallableFactory callableFactory; @@ -184,32 +184,6 @@ public Map extract(DeleteSshPublicKeyRequest request) { } }) .build(); - GrpcCallSettings getLoginProfileTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(getLoginProfileMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetLoginProfileRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } - }) - .build(); - GrpcCallSettings getSshPublicKeyTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(getSshPublicKeyMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetSshPublicKeyRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } - }) - .build(); GrpcCallSettings importSshPublicKeyTransportSettings = GrpcCallSettings.newBuilder() @@ -237,6 +211,32 @@ public Map extract(UpdateSshPublicKeyRequest request) { } }) .build(); + GrpcCallSettings getLoginProfileTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLoginProfileMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetLoginProfileRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings getSshPublicKeyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getSshPublicKeyMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetSshPublicKeyRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); this.deletePosixAccountCallable = callableFactory.createUnaryCallable( @@ -248,12 +248,6 @@ public Map extract(UpdateSshPublicKeyRequest request) { deleteSshPublicKeyTransportSettings, settings.deleteSshPublicKeySettings(), clientContext); - this.getLoginProfileCallable = - callableFactory.createUnaryCallable( - getLoginProfileTransportSettings, settings.getLoginProfileSettings(), clientContext); - this.getSshPublicKeyCallable = - callableFactory.createUnaryCallable( - getSshPublicKeyTransportSettings, settings.getSshPublicKeySettings(), clientContext); this.importSshPublicKeyCallable = callableFactory.createUnaryCallable( importSshPublicKeyTransportSettings, @@ -264,6 +258,12 @@ public Map extract(UpdateSshPublicKeyRequest request) { updateSshPublicKeyTransportSettings, settings.updateSshPublicKeySettings(), clientContext); + this.getLoginProfileCallable = + callableFactory.createUnaryCallable( + getLoginProfileTransportSettings, settings.getLoginProfileSettings(), clientContext); + this.getSshPublicKeyCallable = + callableFactory.createUnaryCallable( + getSshPublicKeyTransportSettings, settings.getSshPublicKeySettings(), clientContext); backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } @@ -276,14 +276,6 @@ public UnaryCallable deleteSshPublicKeyCallabl return deleteSshPublicKeyCallable; } - public UnaryCallable getLoginProfileCallable() { - return getLoginProfileCallable; - } - - public UnaryCallable getSshPublicKeyCallable() { - return getSshPublicKeyCallable; - } - public UnaryCallable importSshPublicKeyCallable() { return importSshPublicKeyCallable; @@ -293,6 +285,14 @@ public UnaryCallable updateSshPublicKey return updateSshPublicKeyCallable; } + public UnaryCallable getLoginProfileCallable() { + return getLoginProfileCallable; + } + + public UnaryCallable getSshPublicKeyCallable() { + return getSshPublicKeyCallable; + } + @Override public final void close() { shutdown(); diff --git a/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/OsLoginServiceStub.java b/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/OsLoginServiceStub.java index 82356ebf..13381155 100644 --- a/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/OsLoginServiceStub.java +++ b/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/OsLoginServiceStub.java @@ -48,14 +48,6 @@ public UnaryCallable deleteSshPublicKeyCallabl throw new UnsupportedOperationException("Not implemented: deleteSshPublicKeyCallable()"); } - public UnaryCallable getLoginProfileCallable() { - throw new UnsupportedOperationException("Not implemented: getLoginProfileCallable()"); - } - - public UnaryCallable getSshPublicKeyCallable() { - throw new UnsupportedOperationException("Not implemented: getSshPublicKeyCallable()"); - } - public UnaryCallable importSshPublicKeyCallable() { throw new UnsupportedOperationException("Not implemented: importSshPublicKeyCallable()"); @@ -65,6 +57,14 @@ public UnaryCallable updateSshPublicKey throw new UnsupportedOperationException("Not implemented: updateSshPublicKeyCallable()"); } + public UnaryCallable getLoginProfileCallable() { + throw new UnsupportedOperationException("Not implemented: getLoginProfileCallable()"); + } + + public UnaryCallable getSshPublicKeyCallable() { + throw new UnsupportedOperationException("Not implemented: getSshPublicKeyCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/OsLoginServiceStubSettings.java b/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/OsLoginServiceStubSettings.java index 9a8d9e8f..f50a7ed2 100644 --- a/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/OsLoginServiceStubSettings.java +++ b/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/OsLoginServiceStubSettings.java @@ -92,12 +92,12 @@ public class OsLoginServiceStubSettings extends StubSettings deletePosixAccountSettings; private final UnaryCallSettings deleteSshPublicKeySettings; - private final UnaryCallSettings getLoginProfileSettings; - private final UnaryCallSettings getSshPublicKeySettings; private final UnaryCallSettings importSshPublicKeySettings; private final UnaryCallSettings updateSshPublicKeySettings; + private final UnaryCallSettings getLoginProfileSettings; + private final UnaryCallSettings getSshPublicKeySettings; /** Returns the object with the settings used for calls to deletePosixAccount. */ public UnaryCallSettings deletePosixAccountSettings() { @@ -109,16 +109,6 @@ public UnaryCallSettings deleteSshPublicKeySet return deleteSshPublicKeySettings; } - /** Returns the object with the settings used for calls to getLoginProfile. */ - public UnaryCallSettings getLoginProfileSettings() { - return getLoginProfileSettings; - } - - /** Returns the object with the settings used for calls to getSshPublicKey. */ - public UnaryCallSettings getSshPublicKeySettings() { - return getSshPublicKeySettings; - } - /** Returns the object with the settings used for calls to importSshPublicKey. */ public UnaryCallSettings importSshPublicKeySettings() { @@ -130,6 +120,16 @@ public UnaryCallSettings updateSshPubli return updateSshPublicKeySettings; } + /** Returns the object with the settings used for calls to getLoginProfile. */ + public UnaryCallSettings getLoginProfileSettings() { + return getLoginProfileSettings; + } + + /** Returns the object with the settings used for calls to getSshPublicKey. */ + public UnaryCallSettings getSshPublicKeySettings() { + return getSshPublicKeySettings; + } + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public OsLoginServiceStub createStub() throws IOException { if (getTransportChannelProvider() @@ -201,10 +201,10 @@ protected OsLoginServiceStubSettings(Builder settingsBuilder) throws IOException deletePosixAccountSettings = settingsBuilder.deletePosixAccountSettings().build(); deleteSshPublicKeySettings = settingsBuilder.deleteSshPublicKeySettings().build(); - getLoginProfileSettings = settingsBuilder.getLoginProfileSettings().build(); - getSshPublicKeySettings = settingsBuilder.getSshPublicKeySettings().build(); importSshPublicKeySettings = settingsBuilder.importSshPublicKeySettings().build(); updateSshPublicKeySettings = settingsBuilder.updateSshPublicKeySettings().build(); + getLoginProfileSettings = settingsBuilder.getLoginProfileSettings().build(); + getSshPublicKeySettings = settingsBuilder.getSshPublicKeySettings().build(); } /** Builder for OsLoginServiceStubSettings. */ @@ -215,14 +215,14 @@ public static class Builder extends StubSettings.Builder deleteSshPublicKeySettings; - private final UnaryCallSettings.Builder - getLoginProfileSettings; - private final UnaryCallSettings.Builder - getSshPublicKeySettings; private final UnaryCallSettings.Builder importSshPublicKeySettings; private final UnaryCallSettings.Builder updateSshPublicKeySettings; + private final UnaryCallSettings.Builder + getLoginProfileSettings; + private final UnaryCallSettings.Builder + getSshPublicKeySettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -249,9 +249,9 @@ public static class Builder extends StubSettings.Builder>of( deletePosixAccountSettings, deleteSshPublicKeySettings, - getLoginProfileSettings, - getSshPublicKeySettings, importSshPublicKeySettings, - updateSshPublicKeySettings); + updateSshPublicKeySettings, + getLoginProfileSettings, + getSshPublicKeySettings); initDefaults(this); } @@ -302,32 +302,32 @@ private static Builder initDefaults(Builder builder) { builder .deletePosixAccountSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); builder .deleteSshPublicKeySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); builder - .getLoginProfileSettings() + .importSshPublicKeySettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); builder - .getSshPublicKeySettings() + .updateSshPublicKeySettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); builder - .importSshPublicKeySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .getLoginProfileSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); builder - .updateSshPublicKeySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .getSshPublicKeySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); return builder; @@ -338,19 +338,19 @@ protected Builder(OsLoginServiceStubSettings settings) { deletePosixAccountSettings = settings.deletePosixAccountSettings.toBuilder(); deleteSshPublicKeySettings = settings.deleteSshPublicKeySettings.toBuilder(); - getLoginProfileSettings = settings.getLoginProfileSettings.toBuilder(); - getSshPublicKeySettings = settings.getSshPublicKeySettings.toBuilder(); importSshPublicKeySettings = settings.importSshPublicKeySettings.toBuilder(); updateSshPublicKeySettings = settings.updateSshPublicKeySettings.toBuilder(); + getLoginProfileSettings = settings.getLoginProfileSettings.toBuilder(); + getSshPublicKeySettings = settings.getSshPublicKeySettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( deletePosixAccountSettings, deleteSshPublicKeySettings, - getLoginProfileSettings, - getSshPublicKeySettings, importSshPublicKeySettings, - updateSshPublicKeySettings); + updateSshPublicKeySettings, + getLoginProfileSettings, + getSshPublicKeySettings); } // NEXT_MAJOR_VER: remove 'throws Exception' @@ -381,18 +381,6 @@ public Builder applyToAllUnaryMethods( return deleteSshPublicKeySettings; } - /** Returns the builder for the settings used for calls to getLoginProfile. */ - public UnaryCallSettings.Builder - getLoginProfileSettings() { - return getLoginProfileSettings; - } - - /** Returns the builder for the settings used for calls to getSshPublicKey. */ - public UnaryCallSettings.Builder - getSshPublicKeySettings() { - return getSshPublicKeySettings; - } - /** Returns the builder for the settings used for calls to importSshPublicKey. */ public UnaryCallSettings.Builder importSshPublicKeySettings() { @@ -405,6 +393,18 @@ public Builder applyToAllUnaryMethods( return updateSshPublicKeySettings; } + /** Returns the builder for the settings used for calls to getLoginProfile. */ + public UnaryCallSettings.Builder + getLoginProfileSettings() { + return getLoginProfileSettings; + } + + /** Returns the builder for the settings used for calls to getSshPublicKey. */ + public UnaryCallSettings.Builder + getSshPublicKeySettings() { + return getSshPublicKeySettings; + } + @Override public OsLoginServiceStubSettings build() throws IOException { return new OsLoginServiceStubSettings(this); diff --git a/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/OsLoginServiceClientTest.java b/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/OsLoginServiceClientTest.java index 40a58382..fdf225bb 100644 --- a/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/OsLoginServiceClientTest.java +++ b/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/OsLoginServiceClientTest.java @@ -153,21 +153,22 @@ public void deleteSshPublicKeyExceptionTest() throws Exception { @Test @SuppressWarnings("all") - public void getLoginProfileTest() { - String name2 = "name2-1052831874"; - LoginProfile expectedResponse = LoginProfile.newBuilder().setName(name2).build(); + public void importSshPublicKeyTest() { + ImportSshPublicKeyResponse expectedResponse = ImportSshPublicKeyResponse.newBuilder().build(); mockOsLoginService.addResponse(expectedResponse); - UserName name = UserName.of("[USER]"); + UserName parent = UserName.of("[USER]"); + SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build(); - LoginProfile actualResponse = client.getLoginProfile(name); + ImportSshPublicKeyResponse actualResponse = client.importSshPublicKey(parent, sshPublicKey); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockOsLoginService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetLoginProfileRequest actualRequest = (GetLoginProfileRequest) actualRequests.get(0); + ImportSshPublicKeyRequest actualRequest = (ImportSshPublicKeyRequest) actualRequests.get(0); - Assert.assertEquals(name, UserName.parse(actualRequest.getName())); + Assert.assertEquals(parent, UserName.parse(actualRequest.getParent())); + Assert.assertEquals(sshPublicKey, actualRequest.getSshPublicKey()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -176,14 +177,15 @@ public void getLoginProfileTest() { @Test @SuppressWarnings("all") - public void getLoginProfileExceptionTest() throws Exception { + public void importSshPublicKeyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockOsLoginService.addException(exception); try { - UserName name = UserName.of("[USER]"); + UserName parent = UserName.of("[USER]"); + SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build(); - client.getLoginProfile(name); + client.importSshPublicKey(parent, sshPublicKey); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -192,31 +194,25 @@ public void getLoginProfileExceptionTest() throws Exception { @Test @SuppressWarnings("all") - public void getSshPublicKeyTest() { - String key = "key106079"; - long expirationTimeUsec = 2058878882L; - String fingerprint = "fingerprint-1375934236"; - com.google.cloud.oslogin.common.FingerprintName name2 = - com.google.cloud.oslogin.common.FingerprintName.of("[USER]", "[FINGERPRINT]"); - SshPublicKey expectedResponse = - SshPublicKey.newBuilder() - .setKey(key) - .setExpirationTimeUsec(expirationTimeUsec) - .setFingerprint(fingerprint) - .setName(name2.toString()) - .build(); + public void importSshPublicKeyTest2() { + ImportSshPublicKeyResponse expectedResponse = ImportSshPublicKeyResponse.newBuilder().build(); mockOsLoginService.addResponse(expectedResponse); - FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]"); + UserName parent = UserName.of("[USER]"); + SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build(); + String projectId = "projectId-1969970175"; - SshPublicKey actualResponse = client.getSshPublicKey(name); + ImportSshPublicKeyResponse actualResponse = + client.importSshPublicKey(parent, sshPublicKey, projectId); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockOsLoginService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetSshPublicKeyRequest actualRequest = (GetSshPublicKeyRequest) actualRequests.get(0); + ImportSshPublicKeyRequest actualRequest = (ImportSshPublicKeyRequest) actualRequests.get(0); - Assert.assertEquals(name, FingerprintName.parse(actualRequest.getName())); + Assert.assertEquals(parent, UserName.parse(actualRequest.getParent())); + Assert.assertEquals(sshPublicKey, actualRequest.getSshPublicKey()); + Assert.assertEquals(projectId, actualRequest.getProjectId()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -225,14 +221,16 @@ public void getSshPublicKeyTest() { @Test @SuppressWarnings("all") - public void getSshPublicKeyExceptionTest() throws Exception { + public void importSshPublicKeyExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockOsLoginService.addException(exception); try { - FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]"); + UserName parent = UserName.of("[USER]"); + SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build(); + String projectId = "projectId-1969970175"; - client.getSshPublicKey(name); + client.importSshPublicKey(parent, sshPublicKey, projectId); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -241,21 +239,32 @@ public void getSshPublicKeyExceptionTest() throws Exception { @Test @SuppressWarnings("all") - public void importSshPublicKeyTest() { - ImportSshPublicKeyResponse expectedResponse = ImportSshPublicKeyResponse.newBuilder().build(); + public void updateSshPublicKeyTest() { + String key = "key106079"; + long expirationTimeUsec = 2058878882L; + String fingerprint = "fingerprint-1375934236"; + com.google.cloud.oslogin.common.FingerprintName name2 = + com.google.cloud.oslogin.common.FingerprintName.of("[USER]", "[FINGERPRINT]"); + SshPublicKey expectedResponse = + SshPublicKey.newBuilder() + .setKey(key) + .setExpirationTimeUsec(expirationTimeUsec) + .setFingerprint(fingerprint) + .setName(name2.toString()) + .build(); mockOsLoginService.addResponse(expectedResponse); - UserName parent = UserName.of("[USER]"); + FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]"); SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build(); - ImportSshPublicKeyResponse actualResponse = client.importSshPublicKey(parent, sshPublicKey); + SshPublicKey actualResponse = client.updateSshPublicKey(name, sshPublicKey); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockOsLoginService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ImportSshPublicKeyRequest actualRequest = (ImportSshPublicKeyRequest) actualRequests.get(0); + UpdateSshPublicKeyRequest actualRequest = (UpdateSshPublicKeyRequest) actualRequests.get(0); - Assert.assertEquals(parent, UserName.parse(actualRequest.getParent())); + Assert.assertEquals(name, FingerprintName.parse(actualRequest.getName())); Assert.assertEquals(sshPublicKey, actualRequest.getSshPublicKey()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -265,15 +274,15 @@ public void importSshPublicKeyTest() { @Test @SuppressWarnings("all") - public void importSshPublicKeyExceptionTest() throws Exception { + public void updateSshPublicKeyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockOsLoginService.addException(exception); try { - UserName parent = UserName.of("[USER]"); + FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]"); SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build(); - client.importSshPublicKey(parent, sshPublicKey); + client.updateSshPublicKey(name, sshPublicKey); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -282,25 +291,35 @@ public void importSshPublicKeyExceptionTest() throws Exception { @Test @SuppressWarnings("all") - public void importSshPublicKeyTest2() { - ImportSshPublicKeyResponse expectedResponse = ImportSshPublicKeyResponse.newBuilder().build(); + public void updateSshPublicKeyTest2() { + String key = "key106079"; + long expirationTimeUsec = 2058878882L; + String fingerprint = "fingerprint-1375934236"; + com.google.cloud.oslogin.common.FingerprintName name2 = + com.google.cloud.oslogin.common.FingerprintName.of("[USER]", "[FINGERPRINT]"); + SshPublicKey expectedResponse = + SshPublicKey.newBuilder() + .setKey(key) + .setExpirationTimeUsec(expirationTimeUsec) + .setFingerprint(fingerprint) + .setName(name2.toString()) + .build(); mockOsLoginService.addResponse(expectedResponse); - UserName parent = UserName.of("[USER]"); + FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]"); SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build(); - String projectId = "projectId-1969970175"; + FieldMask updateMask = FieldMask.newBuilder().build(); - ImportSshPublicKeyResponse actualResponse = - client.importSshPublicKey(parent, sshPublicKey, projectId); + SshPublicKey actualResponse = client.updateSshPublicKey(name, sshPublicKey, updateMask); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockOsLoginService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ImportSshPublicKeyRequest actualRequest = (ImportSshPublicKeyRequest) actualRequests.get(0); + UpdateSshPublicKeyRequest actualRequest = (UpdateSshPublicKeyRequest) actualRequests.get(0); - Assert.assertEquals(parent, UserName.parse(actualRequest.getParent())); + Assert.assertEquals(name, FingerprintName.parse(actualRequest.getName())); Assert.assertEquals(sshPublicKey, actualRequest.getSshPublicKey()); - Assert.assertEquals(projectId, actualRequest.getProjectId()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -309,16 +328,16 @@ public void importSshPublicKeyTest2() { @Test @SuppressWarnings("all") - public void importSshPublicKeyExceptionTest2() throws Exception { + public void updateSshPublicKeyExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockOsLoginService.addException(exception); try { - UserName parent = UserName.of("[USER]"); + FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]"); SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build(); - String projectId = "projectId-1969970175"; + FieldMask updateMask = FieldMask.newBuilder().build(); - client.importSshPublicKey(parent, sshPublicKey, projectId); + client.updateSshPublicKey(name, sshPublicKey, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -327,33 +346,21 @@ public void importSshPublicKeyExceptionTest2() throws Exception { @Test @SuppressWarnings("all") - public void updateSshPublicKeyTest() { - String key = "key106079"; - long expirationTimeUsec = 2058878882L; - String fingerprint = "fingerprint-1375934236"; - com.google.cloud.oslogin.common.FingerprintName name2 = - com.google.cloud.oslogin.common.FingerprintName.of("[USER]", "[FINGERPRINT]"); - SshPublicKey expectedResponse = - SshPublicKey.newBuilder() - .setKey(key) - .setExpirationTimeUsec(expirationTimeUsec) - .setFingerprint(fingerprint) - .setName(name2.toString()) - .build(); + public void getLoginProfileTest() { + String name2 = "name2-1052831874"; + LoginProfile expectedResponse = LoginProfile.newBuilder().setName(name2).build(); mockOsLoginService.addResponse(expectedResponse); - FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]"); - SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build(); + UserName name = UserName.of("[USER]"); - SshPublicKey actualResponse = client.updateSshPublicKey(name, sshPublicKey); + LoginProfile actualResponse = client.getLoginProfile(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockOsLoginService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateSshPublicKeyRequest actualRequest = (UpdateSshPublicKeyRequest) actualRequests.get(0); + GetLoginProfileRequest actualRequest = (GetLoginProfileRequest) actualRequests.get(0); - Assert.assertEquals(name, FingerprintName.parse(actualRequest.getName())); - Assert.assertEquals(sshPublicKey, actualRequest.getSshPublicKey()); + Assert.assertEquals(name, UserName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -362,15 +369,14 @@ public void updateSshPublicKeyTest() { @Test @SuppressWarnings("all") - public void updateSshPublicKeyExceptionTest() throws Exception { + public void getLoginProfileExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockOsLoginService.addException(exception); try { - FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]"); - SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build(); + UserName name = UserName.of("[USER]"); - client.updateSshPublicKey(name, sshPublicKey); + client.getLoginProfile(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -379,7 +385,7 @@ public void updateSshPublicKeyExceptionTest() throws Exception { @Test @SuppressWarnings("all") - public void updateSshPublicKeyTest2() { + public void getSshPublicKeyTest() { String key = "key106079"; long expirationTimeUsec = 2058878882L; String fingerprint = "fingerprint-1375934236"; @@ -395,19 +401,15 @@ public void updateSshPublicKeyTest2() { mockOsLoginService.addResponse(expectedResponse); FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]"); - SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - SshPublicKey actualResponse = client.updateSshPublicKey(name, sshPublicKey, updateMask); + SshPublicKey actualResponse = client.getSshPublicKey(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockOsLoginService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateSshPublicKeyRequest actualRequest = (UpdateSshPublicKeyRequest) actualRequests.get(0); + GetSshPublicKeyRequest actualRequest = (GetSshPublicKeyRequest) actualRequests.get(0); Assert.assertEquals(name, FingerprintName.parse(actualRequest.getName())); - Assert.assertEquals(sshPublicKey, actualRequest.getSshPublicKey()); - Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -416,16 +418,14 @@ public void updateSshPublicKeyTest2() { @Test @SuppressWarnings("all") - public void updateSshPublicKeyExceptionTest2() throws Exception { + public void getSshPublicKeyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockOsLoginService.addException(exception); try { FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]"); - SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateSshPublicKey(name, sshPublicKey, updateMask); + client.getSshPublicKey(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception diff --git a/synth.metadata b/synth.metadata index d2a42869..6d63c79d 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "aed11c01e52921613b9ee469c2d85f5f33175fb7", - "internalRef": "310660461" + "sha": "5a90d467aa65e7f038f87585e8fbb45d74475e7c", + "internalRef": "312088359" } }, {