diff --git a/java-os-login/README.md b/java-os-login/README.md
index 129b6bafa2e0..f22fdb13a7ee 100644
--- a/java-os-login/README.md
+++ b/java-os-login/README.md
@@ -19,20 +19,20 @@ If you are using Maven, add this to your pom.xml file:
Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * UserName parent = UserName.of("[USER]");
+ * OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ * OsLoginProto.SshPublicKey response =
+ * osLoginServiceClient.createSshPublicKey(parent, sshPublicKey);
+ * }
+ * }
+ *
+ * @param parent Required. The unique ID for the user in format `users/{user}`.
+ * @param sshPublicKey Required. The SSH public key and expiration time.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OsLoginProto.SshPublicKey createSshPublicKey(
+ UserName parent, OsLoginProto.SshPublicKey sshPublicKey) {
+ CreateSshPublicKeyRequest request =
+ CreateSshPublicKeyRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setSshPublicKey(sshPublicKey)
+ .build();
+ return createSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Create an SSH public key
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * String parent = UserName.of("[USER]").toString();
+ * OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ * OsLoginProto.SshPublicKey response =
+ * osLoginServiceClient.createSshPublicKey(parent, sshPublicKey);
+ * }
+ * }
+ *
+ * @param parent Required. The unique ID for the user in format `users/{user}`.
+ * @param sshPublicKey Required. The SSH public key and expiration time.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OsLoginProto.SshPublicKey createSshPublicKey(
+ String parent, OsLoginProto.SshPublicKey sshPublicKey) {
+ CreateSshPublicKeyRequest request =
+ CreateSshPublicKeyRequest.newBuilder()
+ .setParent(parent)
+ .setSshPublicKey(sshPublicKey)
+ .build();
+ return createSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Create an SSH public key
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * CreateSshPublicKeyRequest request =
+ * CreateSshPublicKeyRequest.newBuilder()
+ * .setParent(UserName.of("[USER]").toString())
+ * .setSshPublicKey(OsLoginProto.SshPublicKey.newBuilder().build())
+ * .build();
+ * OsLoginProto.SshPublicKey response = osLoginServiceClient.createSshPublicKey(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 OsLoginProto.SshPublicKey createSshPublicKey(CreateSshPublicKeyRequest request) {
+ return createSshPublicKeyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Create an SSH public key
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * CreateSshPublicKeyRequest request =
+ * CreateSshPublicKeyRequest.newBuilder()
+ * .setParent(UserName.of("[USER]").toString())
+ * .setSshPublicKey(OsLoginProto.SshPublicKey.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * osLoginServiceClient.createSshPublicKeyCallable().futureCall(request);
+ * // Do something.
+ * OsLoginProto.SshPublicKey response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableThe builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. * - *
For example, to set the total timeout of deletePosixAccount to 30 seconds: + *
For example, to set the total timeout of createSshPublicKey to 30 seconds: * *
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
@@ -60,10 +60,10 @@
* OsLoginServiceSettings.Builder osLoginServiceSettingsBuilder =
* OsLoginServiceSettings.newBuilder();
* osLoginServiceSettingsBuilder
- * .deletePosixAccountSettings()
+ * .createSshPublicKeySettings()
* .setRetrySettings(
* osLoginServiceSettingsBuilder
- * .deletePosixAccountSettings()
+ * .createSshPublicKeySettings()
* .getRetrySettings()
* .toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
@@ -74,6 +74,12 @@
@Generated("by gapic-generator-java")
public class OsLoginServiceSettings extends ClientSettings {
+ /** Returns the object with the settings used for calls to createSshPublicKey. */
+ public UnaryCallSettings
+ createSshPublicKeySettings() {
+ return ((OsLoginServiceStubSettings) getStubSettings()).createSshPublicKeySettings();
+ }
+
/** Returns the object with the settings used for calls to deletePosixAccount. */
public UnaryCallSettings deletePosixAccountSettings() {
return ((OsLoginServiceStubSettings) getStubSettings()).deletePosixAccountSettings();
@@ -222,6 +228,12 @@ public Builder applyToAllUnaryMethods(
return this;
}
+ /** Returns the builder for the settings used for calls to createSshPublicKey. */
+ public UnaryCallSettings.Builder
+ createSshPublicKeySettings() {
+ return getStubSettingsBuilder().createSshPublicKeySettings();
+ }
+
/** Returns the builder for the settings used for calls to deletePosixAccount. */
public UnaryCallSettings.Builder
deletePosixAccountSettings() {
diff --git a/java-os-login/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/gapic_metadata.json b/java-os-login/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/gapic_metadata.json
index e26d9749e145..48a08d23b11a 100644
--- a/java-os-login/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/gapic_metadata.json
+++ b/java-os-login/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/gapic_metadata.json
@@ -10,6 +10,9 @@
"grpc": {
"libraryClient": "OsLoginServiceClient",
"rpcs": {
+ "CreateSshPublicKey": {
+ "methods": ["createSshPublicKey", "createSshPublicKey", "createSshPublicKey", "createSshPublicKeyCallable"]
+ },
"DeletePosixAccount": {
"methods": ["deletePosixAccount", "deletePosixAccount", "deletePosixAccount", "deletePosixAccountCallable"]
},
diff --git a/java-os-login/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/package-info.java b/java-os-login/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/package-info.java
index 14bcc2d400e7..56f0cc127145 100644
--- a/java-os-login/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/package-info.java
+++ b/java-os-login/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/package-info.java
@@ -33,8 +33,10 @@
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
- * PosixAccountName name = PosixAccountName.of("[USER]", "[PROJECT]");
- * osLoginServiceClient.deletePosixAccount(name);
+ * UserName parent = UserName.of("[USER]");
+ * OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ * OsLoginProto.SshPublicKey response =
+ * osLoginServiceClient.createSshPublicKey(parent, sshPublicKey);
* }
* }
*/
diff --git a/java-os-login/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/GrpcOsLoginServiceStub.java b/java-os-login/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/GrpcOsLoginServiceStub.java
index f6afc623a404..c9ae20602c97 100644
--- a/java-os-login/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/GrpcOsLoginServiceStub.java
+++ b/java-os-login/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/stub/GrpcOsLoginServiceStub.java
@@ -23,6 +23,7 @@
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.oslogin.common.OsLoginProto;
+import com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest;
import com.google.cloud.oslogin.v1.DeletePosixAccountRequest;
import com.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest;
import com.google.cloud.oslogin.v1.GetLoginProfileRequest;
@@ -48,6 +49,17 @@
*/
@Generated("by gapic-generator-java")
public class GrpcOsLoginServiceStub extends OsLoginServiceStub {
+ private static final MethodDescriptorThe builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. * - *
For example, to set the total timeout of deletePosixAccount to 30 seconds: + *
For example, to set the total timeout of createSshPublicKey to 30 seconds: * *
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
@@ -79,10 +80,10 @@
* OsLoginServiceStubSettings.Builder osLoginServiceSettingsBuilder =
* OsLoginServiceStubSettings.newBuilder();
* osLoginServiceSettingsBuilder
- * .deletePosixAccountSettings()
+ * .createSshPublicKeySettings()
* .setRetrySettings(
* osLoginServiceSettingsBuilder
- * .deletePosixAccountSettings()
+ * .createSshPublicKeySettings()
* .getRetrySettings()
* .toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
@@ -96,9 +97,13 @@ public class OsLoginServiceStubSettings extends StubSettings DEFAULT_SERVICE_SCOPES =
ImmutableList.builder()
.add("https://www.googleapis.com/auth/cloud-platform")
+ .add("https://www.googleapis.com/auth/cloud-platform.read-only")
.add("https://www.googleapis.com/auth/compute")
+ .add("https://www.googleapis.com/auth/compute.readonly")
.build();
+ private final UnaryCallSettings
+ createSshPublicKeySettings;
private final UnaryCallSettings deletePosixAccountSettings;
private final UnaryCallSettings deleteSshPublicKeySettings;
private final UnaryCallSettings getLoginProfileSettings;
@@ -109,6 +114,12 @@ public class OsLoginServiceStubSettings extends StubSettings
updateSshPublicKeySettings;
+ /** Returns the object with the settings used for calls to createSshPublicKey. */
+ public UnaryCallSettings
+ createSshPublicKeySettings() {
+ return createSshPublicKeySettings;
+ }
+
/** Returns the object with the settings used for calls to deletePosixAccount. */
public UnaryCallSettings deletePosixAccountSettings() {
return deletePosixAccountSettings;
@@ -248,6 +259,7 @@ public Builder toBuilder() {
protected OsLoginServiceStubSettings(Builder settingsBuilder) throws IOException {
super(settingsBuilder);
+ createSshPublicKeySettings = settingsBuilder.createSshPublicKeySettings().build();
deletePosixAccountSettings = settingsBuilder.deletePosixAccountSettings().build();
deleteSshPublicKeySettings = settingsBuilder.deleteSshPublicKeySettings().build();
getLoginProfileSettings = settingsBuilder.getLoginProfileSettings().build();
@@ -259,6 +271,8 @@ protected OsLoginServiceStubSettings(Builder settingsBuilder) throws IOException
/** Builder for OsLoginServiceStubSettings. */
public static class Builder extends StubSettings.Builder {
private final ImmutableList> unaryMethodSettingsBuilders;
+ private final UnaryCallSettings.Builder
+ createSshPublicKeySettings;
private final UnaryCallSettings.Builder
deletePosixAccountSettings;
private final UnaryCallSettings.Builder
@@ -277,6 +291,7 @@ public static class Builder extends StubSettings.Builder> definitions =
ImmutableMap.builder();
+ definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList()));
definitions.put(
"retry_policy_0_codes",
ImmutableSet.copyOf(
@@ -290,6 +305,8 @@ public static class Builder extends StubSettings.Builder definitions = ImmutableMap.builder();
RetrySettings settings = null;
+ settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
+ definitions.put("no_retry_params", settings);
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(100L))
@@ -311,6 +328,7 @@ protected Builder() {
protected Builder(ClientContext clientContext) {
super(clientContext);
+ createSshPublicKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
deletePosixAccountSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
deleteSshPublicKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
getLoginProfileSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
@@ -320,6 +338,7 @@ protected Builder(ClientContext clientContext) {
unaryMethodSettingsBuilders =
ImmutableList.>of(
+ createSshPublicKeySettings,
deletePosixAccountSettings,
deleteSshPublicKeySettings,
getLoginProfileSettings,
@@ -332,6 +351,7 @@ protected Builder(ClientContext clientContext) {
protected Builder(OsLoginServiceStubSettings settings) {
super(settings);
+ createSshPublicKeySettings = settings.createSshPublicKeySettings.toBuilder();
deletePosixAccountSettings = settings.deletePosixAccountSettings.toBuilder();
deleteSshPublicKeySettings = settings.deleteSshPublicKeySettings.toBuilder();
getLoginProfileSettings = settings.getLoginProfileSettings.toBuilder();
@@ -341,6 +361,7 @@ protected Builder(OsLoginServiceStubSettings settings) {
unaryMethodSettingsBuilders =
ImmutableList.>of(
+ createSshPublicKeySettings,
deletePosixAccountSettings,
deleteSshPublicKeySettings,
getLoginProfileSettings,
@@ -376,6 +397,11 @@ private static Builder createHttpJsonDefault() {
}
private static Builder initDefaults(Builder builder) {
+ builder
+ .createSshPublicKeySettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
+
builder
.deletePosixAccountSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
@@ -424,6 +450,12 @@ public Builder applyToAllUnaryMethods(
return unaryMethodSettingsBuilders;
}
+ /** Returns the builder for the settings used for calls to createSshPublicKey. */
+ public UnaryCallSettings.Builder
+ createSshPublicKeySettings() {
+ return createSshPublicKeySettings;
+ }
+
/** Returns the builder for the settings used for calls to deletePosixAccount. */
public UnaryCallSettings.Builder
deletePosixAccountSettings() {
diff --git a/java-os-login/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/MockOsLoginServiceImpl.java b/java-os-login/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/MockOsLoginServiceImpl.java
index 8cafbc124427..6a37b9a53970 100644
--- a/java-os-login/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/MockOsLoginServiceImpl.java
+++ b/java-os-login/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/MockOsLoginServiceImpl.java
@@ -60,6 +60,28 @@ public void reset() {
responses = new LinkedList<>();
}
+ @Override
+ public void createSshPublicKey(
+ CreateSshPublicKeyRequest request,
+ StreamObserver responseObserver) {
+ Object response = responses.poll();
+ if (response instanceof OsLoginProto.SshPublicKey) {
+ requests.add(request);
+ responseObserver.onNext(((OsLoginProto.SshPublicKey) response));
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError(((Exception) response));
+ } else {
+ responseObserver.onError(
+ new IllegalArgumentException(
+ String.format(
+ "Unrecognized response type %s for method CreateSshPublicKey, expected %s or %s",
+ response == null ? "null" : response.getClass().getName(),
+ OsLoginProto.SshPublicKey.class.getName(),
+ Exception.class.getName())));
+ }
+ }
+
@Override
public void deletePosixAccount(
DeletePosixAccountRequest request, StreamObserver responseObserver) {
diff --git a/java-os-login/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/OsLoginServiceClientHttpJsonTest.java b/java-os-login/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/OsLoginServiceClientHttpJsonTest.java
index b3bf589dba44..fccb1db8cb83 100644
--- a/java-os-login/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/OsLoginServiceClientHttpJsonTest.java
+++ b/java-os-login/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/OsLoginServiceClientHttpJsonTest.java
@@ -76,6 +76,104 @@ public void tearDown() throws Exception {
mockService.reset();
}
+ @Test
+ public void createSshPublicKeyTest() throws Exception {
+ OsLoginProto.SshPublicKey expectedResponse =
+ OsLoginProto.SshPublicKey.newBuilder()
+ .setKey("key106079")
+ .setExpirationTimeUsec(-2058878882)
+ .setFingerprint("fingerprint-1375934236")
+ .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ UserName parent = UserName.of("[USER]");
+ OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+
+ OsLoginProto.SshPublicKey actualResponse = client.createSshPublicKey(parent, sshPublicKey);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void createSshPublicKeyExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ UserName parent = UserName.of("[USER]");
+ OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ client.createSshPublicKey(parent, sshPublicKey);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void createSshPublicKeyTest2() throws Exception {
+ OsLoginProto.SshPublicKey expectedResponse =
+ OsLoginProto.SshPublicKey.newBuilder()
+ .setKey("key106079")
+ .setExpirationTimeUsec(-2058878882)
+ .setFingerprint("fingerprint-1375934236")
+ .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String parent = "users/user-1015";
+ OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+
+ OsLoginProto.SshPublicKey actualResponse = client.createSshPublicKey(parent, sshPublicKey);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void createSshPublicKeyExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String parent = "users/user-1015";
+ OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ client.createSshPublicKey(parent, sshPublicKey);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
@Test
public void deletePosixAccountTest() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
@@ -427,6 +525,7 @@ public void importSshPublicKeyTest() throws Exception {
ImportSshPublicKeyResponse expectedResponse =
ImportSshPublicKeyResponse.newBuilder()
.setLoginProfile(LoginProfile.newBuilder().build())
+ .setDetails("details1557721666")
.build();
mockService.addResponse(expectedResponse);
@@ -473,6 +572,7 @@ public void importSshPublicKeyTest2() throws Exception {
ImportSshPublicKeyResponse expectedResponse =
ImportSshPublicKeyResponse.newBuilder()
.setLoginProfile(LoginProfile.newBuilder().build())
+ .setDetails("details1557721666")
.build();
mockService.addResponse(expectedResponse);
@@ -519,6 +619,7 @@ public void importSshPublicKeyTest3() throws Exception {
ImportSshPublicKeyResponse expectedResponse =
ImportSshPublicKeyResponse.newBuilder()
.setLoginProfile(LoginProfile.newBuilder().build())
+ .setDetails("details1557721666")
.build();
mockService.addResponse(expectedResponse);
@@ -568,6 +669,7 @@ public void importSshPublicKeyTest4() throws Exception {
ImportSshPublicKeyResponse expectedResponse =
ImportSshPublicKeyResponse.newBuilder()
.setLoginProfile(LoginProfile.newBuilder().build())
+ .setDetails("details1557721666")
.build();
mockService.addResponse(expectedResponse);
diff --git a/java-os-login/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/OsLoginServiceClientTest.java b/java-os-login/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/OsLoginServiceClientTest.java
index 92eec17f16a1..c062c508663c 100644
--- a/java-os-login/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/OsLoginServiceClientTest.java
+++ b/java-os-login/google-cloud-os-login/src/test/java/com/google/cloud/oslogin/v1/OsLoginServiceClientTest.java
@@ -80,6 +80,94 @@ public void tearDown() throws Exception {
client.close();
}
+ @Test
+ public void createSshPublicKeyTest() throws Exception {
+ OsLoginProto.SshPublicKey expectedResponse =
+ OsLoginProto.SshPublicKey.newBuilder()
+ .setKey("key106079")
+ .setExpirationTimeUsec(-2058878882)
+ .setFingerprint("fingerprint-1375934236")
+ .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
+ .build();
+ mockOsLoginService.addResponse(expectedResponse);
+
+ UserName parent = UserName.of("[USER]");
+ OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+
+ OsLoginProto.SshPublicKey actualResponse = client.createSshPublicKey(parent, sshPublicKey);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockOsLoginService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ CreateSshPublicKeyRequest actualRequest = ((CreateSshPublicKeyRequest) actualRequests.get(0));
+
+ Assert.assertEquals(parent.toString(), actualRequest.getParent());
+ Assert.assertEquals(sshPublicKey, actualRequest.getSshPublicKey());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void createSshPublicKeyExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockOsLoginService.addException(exception);
+
+ try {
+ UserName parent = UserName.of("[USER]");
+ OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ client.createSshPublicKey(parent, sshPublicKey);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void createSshPublicKeyTest2() throws Exception {
+ OsLoginProto.SshPublicKey expectedResponse =
+ OsLoginProto.SshPublicKey.newBuilder()
+ .setKey("key106079")
+ .setExpirationTimeUsec(-2058878882)
+ .setFingerprint("fingerprint-1375934236")
+ .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
+ .build();
+ mockOsLoginService.addResponse(expectedResponse);
+
+ String parent = "parent-995424086";
+ OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+
+ OsLoginProto.SshPublicKey actualResponse = client.createSshPublicKey(parent, sshPublicKey);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockOsLoginService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ CreateSshPublicKeyRequest actualRequest = ((CreateSshPublicKeyRequest) actualRequests.get(0));
+
+ Assert.assertEquals(parent, actualRequest.getParent());
+ Assert.assertEquals(sshPublicKey, actualRequest.getSshPublicKey());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void createSshPublicKeyExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockOsLoginService.addException(exception);
+
+ try {
+ String parent = "parent-995424086";
+ OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ client.createSshPublicKey(parent, sshPublicKey);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
@Test
public void deletePosixAccountTest() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
@@ -383,6 +471,7 @@ public void importSshPublicKeyTest() throws Exception {
ImportSshPublicKeyResponse expectedResponse =
ImportSshPublicKeyResponse.newBuilder()
.setLoginProfile(LoginProfile.newBuilder().build())
+ .setDetails("details1557721666")
.build();
mockOsLoginService.addResponse(expectedResponse);
@@ -424,6 +513,7 @@ public void importSshPublicKeyTest2() throws Exception {
ImportSshPublicKeyResponse expectedResponse =
ImportSshPublicKeyResponse.newBuilder()
.setLoginProfile(LoginProfile.newBuilder().build())
+ .setDetails("details1557721666")
.build();
mockOsLoginService.addResponse(expectedResponse);
@@ -465,6 +555,7 @@ public void importSshPublicKeyTest3() throws Exception {
ImportSshPublicKeyResponse expectedResponse =
ImportSshPublicKeyResponse.newBuilder()
.setLoginProfile(LoginProfile.newBuilder().build())
+ .setDetails("details1557721666")
.build();
mockOsLoginService.addResponse(expectedResponse);
@@ -510,6 +601,7 @@ public void importSshPublicKeyTest4() throws Exception {
ImportSshPublicKeyResponse expectedResponse =
ImportSshPublicKeyResponse.newBuilder()
.setLoginProfile(LoginProfile.newBuilder().build())
+ .setDetails("details1557721666")
.build();
mockOsLoginService.addResponse(expectedResponse);
diff --git a/java-os-login/grpc-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/OsLoginServiceGrpc.java b/java-os-login/grpc-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/OsLoginServiceGrpc.java
index 4bb1b10ad44a..75622e1a2134 100644
--- a/java-os-login/grpc-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/OsLoginServiceGrpc.java
+++ b/java-os-login/grpc-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/OsLoginServiceGrpc.java
@@ -37,6 +37,54 @@ private OsLoginServiceGrpc() {}
public static final String SERVICE_NAME = "google.cloud.oslogin.v1.OsLoginService";
// Static method descriptors that strictly reflect the proto.
+ private static volatile io.grpc.MethodDescriptor<
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest,
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey>
+ getCreateSshPublicKeyMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "CreateSshPublicKey",
+ requestType = com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest.class,
+ responseType = com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor<
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest,
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey>
+ getCreateSshPublicKeyMethod() {
+ io.grpc.MethodDescriptor<
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest,
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey>
+ getCreateSshPublicKeyMethod;
+ if ((getCreateSshPublicKeyMethod = OsLoginServiceGrpc.getCreateSshPublicKeyMethod) == null) {
+ synchronized (OsLoginServiceGrpc.class) {
+ if ((getCreateSshPublicKeyMethod = OsLoginServiceGrpc.getCreateSshPublicKeyMethod)
+ == null) {
+ OsLoginServiceGrpc.getCreateSshPublicKeyMethod =
+ getCreateSshPublicKeyMethod =
+ io.grpc.MethodDescriptor
+ .
+ newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateSshPublicKey"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest
+ .getDefaultInstance()))
+ .setResponseMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey
+ .getDefaultInstance()))
+ .setSchemaDescriptor(
+ new OsLoginServiceMethodDescriptorSupplier("CreateSshPublicKey"))
+ .build();
+ }
+ }
+ }
+ return getCreateSshPublicKeyMethod;
+ }
+
private static volatile io.grpc.MethodDescriptor<
com.google.cloud.oslogin.v1.DeletePosixAccountRequest, com.google.protobuf.Empty>
getDeletePosixAccountMethod;
@@ -366,6 +414,21 @@ public OsLoginServiceFutureStub newStub(
*/
public abstract static class OsLoginServiceImplBase implements io.grpc.BindableService {
+ /**
+ *
+ *
+ *
+ * Create an SSH public key
+ *
+ */
+ public void createSshPublicKey(
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest request,
+ io.grpc.stub.StreamObserver
+ responseObserver) {
+ io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
+ getCreateSshPublicKeyMethod(), responseObserver);
+ }
+
/**
*
*
@@ -460,6 +523,13 @@ public void updateSshPublicKey(
@java.lang.Override
public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
+ .addMethod(
+ getCreateSshPublicKeyMethod(),
+ io.grpc.stub.ServerCalls.asyncUnaryCall(
+ new MethodHandlers<
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest,
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey>(
+ this, METHODID_CREATE_SSH_PUBLIC_KEY)))
.addMethod(
getDeletePosixAccountMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
@@ -523,6 +593,23 @@ protected OsLoginServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions
return new OsLoginServiceStub(channel, callOptions);
}
+ /**
+ *
+ *
+ *
+ * Create an SSH public key
+ *
+ */
+ public void createSshPublicKey(
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest request,
+ io.grpc.stub.StreamObserver
+ responseObserver) {
+ io.grpc.stub.ClientCalls.asyncUnaryCall(
+ getChannel().newCall(getCreateSshPublicKeyMethod(), getCallOptions()),
+ request,
+ responseObserver);
+ }
+
/**
*
*
@@ -648,6 +735,19 @@ protected OsLoginServiceBlockingStub build(
return new OsLoginServiceBlockingStub(channel, callOptions);
}
+ /**
+ *
+ *
+ *
+ * Create an SSH public key
+ *
+ */
+ public com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey createSshPublicKey(
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getCreateSshPublicKeyMethod(), getCallOptions(), request);
+ }
+
/**
*
*
@@ -752,6 +852,20 @@ protected OsLoginServiceFutureStub build(
return new OsLoginServiceFutureStub(channel, callOptions);
}
+ /**
+ *
+ *
+ *
+ * Create an SSH public key
+ *
+ */
+ public com.google.common.util.concurrent.ListenableFuture<
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey>
+ createSshPublicKey(com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest request) {
+ return io.grpc.stub.ClientCalls.futureUnaryCall(
+ getChannel().newCall(getCreateSshPublicKeyMethod(), getCallOptions()), request);
+ }
+
/**
*
*
@@ -839,12 +953,13 @@ protected OsLoginServiceFutureStub build(
}
}
- private static final int METHODID_DELETE_POSIX_ACCOUNT = 0;
- private static final int METHODID_DELETE_SSH_PUBLIC_KEY = 1;
- private static final int METHODID_GET_LOGIN_PROFILE = 2;
- private static final int METHODID_GET_SSH_PUBLIC_KEY = 3;
- private static final int METHODID_IMPORT_SSH_PUBLIC_KEY = 4;
- private static final int METHODID_UPDATE_SSH_PUBLIC_KEY = 5;
+ private static final int METHODID_CREATE_SSH_PUBLIC_KEY = 0;
+ private static final int METHODID_DELETE_POSIX_ACCOUNT = 1;
+ private static final int METHODID_DELETE_SSH_PUBLIC_KEY = 2;
+ private static final int METHODID_GET_LOGIN_PROFILE = 3;
+ private static final int METHODID_GET_SSH_PUBLIC_KEY = 4;
+ private static final int METHODID_IMPORT_SSH_PUBLIC_KEY = 5;
+ private static final int METHODID_UPDATE_SSH_PUBLIC_KEY = 6;
private static final class MethodHandlers
implements io.grpc.stub.ServerCalls.UnaryMethod,
@@ -863,6 +978,13 @@ private static final class MethodHandlers
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) {
switch (methodId) {
+ case METHODID_CREATE_SSH_PUBLIC_KEY:
+ serviceImpl.createSshPublicKey(
+ (com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest) request,
+ (io.grpc.stub.StreamObserver<
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey>)
+ responseObserver);
+ break;
case METHODID_DELETE_POSIX_ACCOUNT:
serviceImpl.deletePosixAccount(
(com.google.cloud.oslogin.v1.DeletePosixAccountRequest) request,
@@ -963,6 +1085,7 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() {
result =
io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new OsLoginServiceFileDescriptorSupplier())
+ .addMethod(getCreateSshPublicKeyMethod())
.addMethod(getDeletePosixAccountMethod())
.addMethod(getDeleteSshPublicKeyMethod())
.addMethod(getGetLoginProfileMethod())
diff --git a/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/CreateSshPublicKeyRequest.java b/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/CreateSshPublicKeyRequest.java
new file mode 100644
index 000000000000..dd3a5ae50a23
--- /dev/null
+++ b/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/CreateSshPublicKeyRequest.java
@@ -0,0 +1,927 @@
+/*
+ * Copyright 2020 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/cloud/oslogin/v1/oslogin.proto
+
+package com.google.cloud.oslogin.v1;
+
+/**
+ *
+ *
+ *
+ * A request message for creating an SSH public key.
+ *
+ *
+ * Protobuf type {@code google.cloud.oslogin.v1.CreateSshPublicKeyRequest}
+ */
+public final class CreateSshPublicKeyRequest extends com.google.protobuf.GeneratedMessageV3
+ implements
+ // @@protoc_insertion_point(message_implements:google.cloud.oslogin.v1.CreateSshPublicKeyRequest)
+ CreateSshPublicKeyRequestOrBuilder {
+ private static final long serialVersionUID = 0L;
+ // Use CreateSshPublicKeyRequest.newBuilder() to construct.
+ private CreateSshPublicKeyRequest(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
+ super(builder);
+ }
+
+ private CreateSshPublicKeyRequest() {
+ parent_ = "";
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
+ return new CreateSshPublicKeyRequest();
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
+ return this.unknownFields;
+ }
+
+ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
+ return com.google.cloud.oslogin.v1.OsLoginProto
+ .internal_static_google_cloud_oslogin_v1_CreateSshPublicKeyRequest_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return com.google.cloud.oslogin.v1.OsLoginProto
+ .internal_static_google_cloud_oslogin_v1_CreateSshPublicKeyRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest.class,
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest.Builder.class);
+ }
+
+ public static final int PARENT_FIELD_NUMBER = 1;
+ private volatile java.lang.Object parent_;
+ /**
+ *
+ *
+ *
+ * Required. The unique ID for the user in format `users/{user}`.
+ *
+ *
+ *
+ * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
+ *
+ *
+ * @return The parent.
+ */
+ @java.lang.Override
+ public java.lang.String getParent() {
+ java.lang.Object ref = parent_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ parent_ = s;
+ return s;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Required. The unique ID for the user in format `users/{user}`.
+ *
+ *
+ *
+ * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
+ *
+ *
+ * @return The bytes for parent.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString getParentBytes() {
+ java.lang.Object ref = parent_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
+ parent_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int SSH_PUBLIC_KEY_FIELD_NUMBER = 2;
+ private com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey_;
+ /**
+ *
+ *
+ *
+ * Required. The SSH public key and expiration time.
+ *
+ *
+ *
+ * .google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return Whether the sshPublicKey field is set.
+ */
+ @java.lang.Override
+ public boolean hasSshPublicKey() {
+ return sshPublicKey_ != null;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The SSH public key and expiration time.
+ *
+ *
+ *
+ * .google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The sshPublicKey.
+ */
+ @java.lang.Override
+ public com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey getSshPublicKey() {
+ return sshPublicKey_ == null
+ ? com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey.getDefaultInstance()
+ : sshPublicKey_;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The SSH public key and expiration time.
+ *
+ *
+ *
+ * .google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ @java.lang.Override
+ public com.google.cloud.oslogin.common.OsLoginProto.SshPublicKeyOrBuilder
+ getSshPublicKeyOrBuilder() {
+ return getSshPublicKey();
+ }
+
+ private byte memoizedIsInitialized = -1;
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_);
+ }
+ if (sshPublicKey_ != null) {
+ output.writeMessage(2, getSshPublicKey());
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_);
+ }
+ if (sshPublicKey_ != null) {
+ size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getSshPublicKey());
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest)) {
+ return super.equals(obj);
+ }
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest other =
+ (com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest) obj;
+
+ if (!getParent().equals(other.getParent())) return false;
+ if (hasSshPublicKey() != other.hasSshPublicKey()) return false;
+ if (hasSshPublicKey()) {
+ if (!getSshPublicKey().equals(other.getSshPublicKey())) return false;
+ }
+ if (!getUnknownFields().equals(other.getUnknownFields())) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + PARENT_FIELD_NUMBER;
+ hash = (53 * hash) + getParent().hashCode();
+ if (hasSshPublicKey()) {
+ hash = (37 * hash) + SSH_PUBLIC_KEY_FIELD_NUMBER;
+ hash = (53 * hash) + getSshPublicKey().hashCode();
+ }
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest parseFrom(
+ java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest parseFrom(
+ java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest parseFrom(
+ byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest parseFrom(
+ java.io.InputStream input) throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
+ }
+
+ public static com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest parseFrom(
+ java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
+ PARSER, input, extensionRegistry);
+ }
+
+ public static com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest parseDelimitedFrom(
+ java.io.InputStream input) throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
+ }
+
+ public static com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest parseDelimitedFrom(
+ java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
+ PARSER, input, extensionRegistry);
+ }
+
+ public static com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest parseFrom(
+ com.google.protobuf.CodedInputStream input) throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
+ }
+
+ public static com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
+ PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() {
+ return newBuilder();
+ }
+
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+
+ public static Builder newBuilder(
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ *
+ *
+ *
+ * A request message for creating an SSH public key.
+ *
+ *
+ * Protobuf type {@code google.cloud.oslogin.v1.CreateSshPublicKeyRequest}
+ */
+ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder
+ implements
+ // @@protoc_insertion_point(builder_implements:google.cloud.oslogin.v1.CreateSshPublicKeyRequest)
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequestOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
+ return com.google.cloud.oslogin.v1.OsLoginProto
+ .internal_static_google_cloud_oslogin_v1_CreateSshPublicKeyRequest_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return com.google.cloud.oslogin.v1.OsLoginProto
+ .internal_static_google_cloud_oslogin_v1_CreateSshPublicKeyRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest.class,
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest.Builder.class);
+ }
+
+ // Construct using com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest.newBuilder()
+ private Builder() {}
+
+ private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+ }
+
+ @java.lang.Override
+ public Builder clear() {
+ super.clear();
+ parent_ = "";
+
+ if (sshPublicKeyBuilder_ == null) {
+ sshPublicKey_ = null;
+ } else {
+ sshPublicKey_ = null;
+ sshPublicKeyBuilder_ = null;
+ }
+ return this;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
+ return com.google.cloud.oslogin.v1.OsLoginProto
+ .internal_static_google_cloud_oslogin_v1_CreateSshPublicKeyRequest_descriptor;
+ }
+
+ @java.lang.Override
+ public com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest getDefaultInstanceForType() {
+ return com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest.getDefaultInstance();
+ }
+
+ @java.lang.Override
+ public com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest build() {
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @java.lang.Override
+ public com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest buildPartial() {
+ com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest result =
+ new com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest(this);
+ result.parent_ = parent_;
+ if (sshPublicKeyBuilder_ == null) {
+ result.sshPublicKey_ = sshPublicKey_;
+ } else {
+ result.sshPublicKey_ = sshPublicKeyBuilder_.build();
+ }
+ onBuilt();
+ return result;
+ }
+
+ @java.lang.Override
+ public Builder clone() {
+ return super.clone();
+ }
+
+ @java.lang.Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
+ return super.setField(field, value);
+ }
+
+ @java.lang.Override
+ public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+
+ @java.lang.Override
+ public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+
+ @java.lang.Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+
+ @java.lang.Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
+ return super.addRepeatedField(field, value);
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest) {
+ return mergeFrom((com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest) other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest other) {
+ if (other == com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest.getDefaultInstance())
+ return this;
+ if (!other.getParent().isEmpty()) {
+ parent_ = other.parent_;
+ onChanged();
+ }
+ if (other.hasSshPublicKey()) {
+ mergeSshPublicKey(other.getSshPublicKey());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10:
+ {
+ parent_ = input.readStringRequireUtf8();
+
+ break;
+ } // case 10
+ case 18:
+ {
+ input.readMessage(getSshPublicKeyFieldBuilder().getBuilder(), extensionRegistry);
+
+ break;
+ } // case 18
+ default:
+ {
+ if (!super.parseUnknownField(input, extensionRegistry, tag)) {
+ done = true; // was an endgroup tag
+ }
+ break;
+ } // default:
+ } // switch (tag)
+ } // while (!done)
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.unwrapIOException();
+ } finally {
+ onChanged();
+ } // finally
+ return this;
+ }
+
+ private java.lang.Object parent_ = "";
+ /**
+ *
+ *
+ *
+ * Required. The unique ID for the user in format `users/{user}`.
+ *
+ *
+ *
+ * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
+ *
+ *
+ * @return The parent.
+ */
+ public java.lang.String getParent() {
+ java.lang.Object ref = parent_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ parent_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Required. The unique ID for the user in format `users/{user}`.
+ *
+ *
+ *
+ * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
+ *
+ *
+ * @return The bytes for parent.
+ */
+ public com.google.protobuf.ByteString getParentBytes() {
+ java.lang.Object ref = parent_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
+ parent_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Required. The unique ID for the user in format `users/{user}`.
+ *
+ *
+ *
+ * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
+ *
+ *
+ * @param value The parent to set.
+ * @return This builder for chaining.
+ */
+ public Builder setParent(java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ parent_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The unique ID for the user in format `users/{user}`.
+ *
+ *
+ *
+ * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
+ *
+ *
+ * @return This builder for chaining.
+ */
+ public Builder clearParent() {
+
+ parent_ = getDefaultInstance().getParent();
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The unique ID for the user in format `users/{user}`.
+ *
+ *
+ *
+ * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
+ *
+ *
+ * @param value The bytes for parent to set.
+ * @return This builder for chaining.
+ */
+ public Builder setParentBytes(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ parent_ = value;
+ onChanged();
+ return this;
+ }
+
+ private com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey_;
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey,
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey.Builder,
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKeyOrBuilder>
+ sshPublicKeyBuilder_;
+ /**
+ *
+ *
+ *
+ * Required. The SSH public key and expiration time.
+ *
+ *
+ *
+ * .google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return Whether the sshPublicKey field is set.
+ */
+ public boolean hasSshPublicKey() {
+ return sshPublicKeyBuilder_ != null || sshPublicKey_ != null;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The SSH public key and expiration time.
+ *
+ *
+ *
+ * .google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The sshPublicKey.
+ */
+ public com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey getSshPublicKey() {
+ if (sshPublicKeyBuilder_ == null) {
+ return sshPublicKey_ == null
+ ? com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey.getDefaultInstance()
+ : sshPublicKey_;
+ } else {
+ return sshPublicKeyBuilder_.getMessage();
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Required. The SSH public key and expiration time.
+ *
+ *
+ *
+ * .google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public Builder setSshPublicKey(
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey value) {
+ if (sshPublicKeyBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ sshPublicKey_ = value;
+ onChanged();
+ } else {
+ sshPublicKeyBuilder_.setMessage(value);
+ }
+
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The SSH public key and expiration time.
+ *
+ *
+ *
+ * .google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public Builder setSshPublicKey(
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey.Builder builderForValue) {
+ if (sshPublicKeyBuilder_ == null) {
+ sshPublicKey_ = builderForValue.build();
+ onChanged();
+ } else {
+ sshPublicKeyBuilder_.setMessage(builderForValue.build());
+ }
+
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The SSH public key and expiration time.
+ *
+ *
+ *
+ * .google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public Builder mergeSshPublicKey(
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey value) {
+ if (sshPublicKeyBuilder_ == null) {
+ if (sshPublicKey_ != null) {
+ sshPublicKey_ =
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey.newBuilder(sshPublicKey_)
+ .mergeFrom(value)
+ .buildPartial();
+ } else {
+ sshPublicKey_ = value;
+ }
+ onChanged();
+ } else {
+ sshPublicKeyBuilder_.mergeFrom(value);
+ }
+
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The SSH public key and expiration time.
+ *
+ *
+ *
+ * .google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public Builder clearSshPublicKey() {
+ if (sshPublicKeyBuilder_ == null) {
+ sshPublicKey_ = null;
+ onChanged();
+ } else {
+ sshPublicKey_ = null;
+ sshPublicKeyBuilder_ = null;
+ }
+
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Required. The SSH public key and expiration time.
+ *
+ *
+ *
+ * .google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey.Builder
+ getSshPublicKeyBuilder() {
+
+ onChanged();
+ return getSshPublicKeyFieldBuilder().getBuilder();
+ }
+ /**
+ *
+ *
+ *
+ * Required. The SSH public key and expiration time.
+ *
+ *
+ *
+ * .google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ public com.google.cloud.oslogin.common.OsLoginProto.SshPublicKeyOrBuilder
+ getSshPublicKeyOrBuilder() {
+ if (sshPublicKeyBuilder_ != null) {
+ return sshPublicKeyBuilder_.getMessageOrBuilder();
+ } else {
+ return sshPublicKey_ == null
+ ? com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey.getDefaultInstance()
+ : sshPublicKey_;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Required. The SSH public key and expiration time.
+ *
+ *
+ *
+ * .google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey,
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey.Builder,
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKeyOrBuilder>
+ getSshPublicKeyFieldBuilder() {
+ if (sshPublicKeyBuilder_ == null) {
+ sshPublicKeyBuilder_ =
+ new com.google.protobuf.SingleFieldBuilderV3<
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey,
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey.Builder,
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKeyOrBuilder>(
+ getSshPublicKey(), getParentForChildren(), isClean());
+ sshPublicKey_ = null;
+ }
+ return sshPublicKeyBuilder_;
+ }
+
+ @java.lang.Override
+ public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+ // @@protoc_insertion_point(builder_scope:google.cloud.oslogin.v1.CreateSshPublicKeyRequest)
+ }
+
+ // @@protoc_insertion_point(class_scope:google.cloud.oslogin.v1.CreateSshPublicKeyRequest)
+ private static final com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest DEFAULT_INSTANCE;
+
+ static {
+ DEFAULT_INSTANCE = new com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest();
+ }
+
+ public static com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser PARSER =
+ new com.google.protobuf.AbstractParser() {
+ @java.lang.Override
+ public CreateSshPublicKeyRequest parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ Builder builder = newBuilder();
+ try {
+ builder.mergeFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(builder.buildPartial());
+ } catch (com.google.protobuf.UninitializedMessageException e) {
+ throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(e)
+ .setUnfinishedMessage(builder.buildPartial());
+ }
+ return builder.buildPartial();
+ }
+ };
+
+ public static com.google.protobuf.Parser parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Parser getParserForType() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.cloud.oslogin.v1.CreateSshPublicKeyRequest getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+}
diff --git a/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/CreateSshPublicKeyRequestOrBuilder.java b/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/CreateSshPublicKeyRequestOrBuilder.java
new file mode 100644
index 000000000000..83a2eb7edd2b
--- /dev/null
+++ b/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/CreateSshPublicKeyRequestOrBuilder.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2020 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/cloud/oslogin/v1/oslogin.proto
+
+package com.google.cloud.oslogin.v1;
+
+public interface CreateSshPublicKeyRequestOrBuilder
+ extends
+ // @@protoc_insertion_point(interface_extends:google.cloud.oslogin.v1.CreateSshPublicKeyRequest)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ *
+ *
+ *
+ * Required. The unique ID for the user in format `users/{user}`.
+ *
+ *
+ *
+ * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
+ *
+ *
+ * @return The parent.
+ */
+ java.lang.String getParent();
+ /**
+ *
+ *
+ *
+ * Required. The unique ID for the user in format `users/{user}`.
+ *
+ *
+ *
+ * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
+ *
+ *
+ * @return The bytes for parent.
+ */
+ com.google.protobuf.ByteString getParentBytes();
+
+ /**
+ *
+ *
+ *
+ * Required. The SSH public key and expiration time.
+ *
+ *
+ *
+ * .google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return Whether the sshPublicKey field is set.
+ */
+ boolean hasSshPublicKey();
+ /**
+ *
+ *
+ *
+ * Required. The SSH public key and expiration time.
+ *
+ *
+ *
+ * .google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ *
+ * @return The sshPublicKey.
+ */
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey getSshPublicKey();
+ /**
+ *
+ *
+ *
+ * Required. The SSH public key and expiration time.
+ *
+ *
+ *
+ * .google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(.google.api.field_behavior) = REQUIRED];
+ *
+ */
+ com.google.cloud.oslogin.common.OsLoginProto.SshPublicKeyOrBuilder getSshPublicKeyOrBuilder();
+}
diff --git a/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/ImportSshPublicKeyResponse.java b/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/ImportSshPublicKeyResponse.java
index 89c12cb77f78..9f7cbff7fa1f 100644
--- a/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/ImportSshPublicKeyResponse.java
+++ b/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/ImportSshPublicKeyResponse.java
@@ -37,7 +37,9 @@ private ImportSshPublicKeyResponse(com.google.protobuf.GeneratedMessageV3.Builde
super(builder);
}
- private ImportSshPublicKeyResponse() {}
+ private ImportSshPublicKeyResponse() {
+ details_ = "";
+ }
@java.lang.Override
@SuppressWarnings({"unused"})
@@ -113,6 +115,55 @@ public com.google.cloud.oslogin.v1.LoginProfileOrBuilder getLoginProfileOrBuilde
return getLoginProfile();
}
+ public static final int DETAILS_FIELD_NUMBER = 2;
+ private volatile java.lang.Object details_;
+ /**
+ *
+ *
+ *
+ * Detailed information about import results.
+ *
+ *
+ * string details = 2;
+ *
+ * @return The details.
+ */
+ @java.lang.Override
+ public java.lang.String getDetails() {
+ java.lang.Object ref = details_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ details_ = s;
+ return s;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Detailed information about import results.
+ *
+ *
+ * string details = 2;
+ *
+ * @return The bytes for details.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString getDetailsBytes() {
+ java.lang.Object ref = details_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
+ details_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
private byte memoizedIsInitialized = -1;
@java.lang.Override
@@ -130,6 +181,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
if (loginProfile_ != null) {
output.writeMessage(1, getLoginProfile());
}
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(details_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 2, details_);
+ }
getUnknownFields().writeTo(output);
}
@@ -142,6 +196,9 @@ public int getSerializedSize() {
if (loginProfile_ != null) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getLoginProfile());
}
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(details_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, details_);
+ }
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
@@ -162,6 +219,7 @@ public boolean equals(final java.lang.Object obj) {
if (hasLoginProfile()) {
if (!getLoginProfile().equals(other.getLoginProfile())) return false;
}
+ if (!getDetails().equals(other.getDetails())) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@@ -177,6 +235,8 @@ public int hashCode() {
hash = (37 * hash) + LOGIN_PROFILE_FIELD_NUMBER;
hash = (53 * hash) + getLoginProfile().hashCode();
}
+ hash = (37 * hash) + DETAILS_FIELD_NUMBER;
+ hash = (53 * hash) + getDetails().hashCode();
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
@@ -322,6 +382,8 @@ public Builder clear() {
loginProfile_ = null;
loginProfileBuilder_ = null;
}
+ details_ = "";
+
return this;
}
@@ -354,6 +416,7 @@ public com.google.cloud.oslogin.v1.ImportSshPublicKeyResponse buildPartial() {
} else {
result.loginProfile_ = loginProfileBuilder_.build();
}
+ result.details_ = details_;
onBuilt();
return result;
}
@@ -407,6 +470,10 @@ public Builder mergeFrom(com.google.cloud.oslogin.v1.ImportSshPublicKeyResponse
if (other.hasLoginProfile()) {
mergeLoginProfile(other.getLoginProfile());
}
+ if (!other.getDetails().isEmpty()) {
+ details_ = other.details_;
+ onChanged();
+ }
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
@@ -439,6 +506,12 @@ public Builder mergeFrom(
break;
} // case 10
+ case 18:
+ {
+ details_ = input.readStringRequireUtf8();
+
+ break;
+ } // case 18
default:
{
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
@@ -642,6 +715,112 @@ public com.google.cloud.oslogin.v1.LoginProfileOrBuilder getLoginProfileOrBuilde
return loginProfileBuilder_;
}
+ private java.lang.Object details_ = "";
+ /**
+ *
+ *
+ *
+ * Detailed information about import results.
+ *
+ *
+ * string details = 2;
+ *
+ * @return The details.
+ */
+ public java.lang.String getDetails() {
+ java.lang.Object ref = details_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ details_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Detailed information about import results.
+ *
+ *
+ * string details = 2;
+ *
+ * @return The bytes for details.
+ */
+ public com.google.protobuf.ByteString getDetailsBytes() {
+ java.lang.Object ref = details_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
+ details_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ *
+ *
+ *
+ * Detailed information about import results.
+ *
+ *
+ * string details = 2;
+ *
+ * @param value The details to set.
+ * @return This builder for chaining.
+ */
+ public Builder setDetails(java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ details_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Detailed information about import results.
+ *
+ *
+ * string details = 2;
+ *
+ * @return This builder for chaining.
+ */
+ public Builder clearDetails() {
+
+ details_ = getDefaultInstance().getDetails();
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ *
+ *
+ * Detailed information about import results.
+ *
+ *
+ * string details = 2;
+ *
+ * @param value The bytes for details to set.
+ * @return This builder for chaining.
+ */
+ public Builder setDetailsBytes(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ details_ = value;
+ onChanged();
+ return this;
+ }
+
@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
diff --git a/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/ImportSshPublicKeyResponseOrBuilder.java b/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/ImportSshPublicKeyResponseOrBuilder.java
index d61d57550170..a74f5ecf87b1 100644
--- a/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/ImportSshPublicKeyResponseOrBuilder.java
+++ b/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/ImportSshPublicKeyResponseOrBuilder.java
@@ -57,4 +57,29 @@ public interface ImportSshPublicKeyResponseOrBuilder
* .google.cloud.oslogin.v1.LoginProfile login_profile = 1;
*/
com.google.cloud.oslogin.v1.LoginProfileOrBuilder getLoginProfileOrBuilder();
+
+ /**
+ *
+ *
+ *
+ * Detailed information about import results.
+ *
+ *
+ * string details = 2;
+ *
+ * @return The details.
+ */
+ java.lang.String getDetails();
+ /**
+ *
+ *
+ *
+ * Detailed information about import results.
+ *
+ *
+ * string details = 2;
+ *
+ * @return The bytes for details.
+ */
+ com.google.protobuf.ByteString getDetailsBytes();
}
diff --git a/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/OsLoginProto.java b/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/OsLoginProto.java
index d12ed9396f3a..bdd184bf5033 100644
--- a/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/OsLoginProto.java
+++ b/java-os-login/proto-google-cloud-os-login-v1/src/main/java/com/google/cloud/oslogin/v1/OsLoginProto.java
@@ -35,6 +35,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r
internal_static_google_cloud_oslogin_v1_LoginProfile_SshPublicKeysEntry_descriptor;
static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_google_cloud_oslogin_v1_LoginProfile_SshPublicKeysEntry_fieldAccessorTable;
+ static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_google_cloud_oslogin_v1_CreateSshPublicKeyRequest_descriptor;
+ static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_google_cloud_oslogin_v1_CreateSshPublicKeyRequest_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_google_cloud_oslogin_v1_DeletePosixAccountRequest_descriptor;
static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
@@ -86,64 +90,77 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ "oginProfile.SshPublicKeysEntry\032_\n\022SshPub"
+ "licKeysEntry\022\013\n\003key\030\001 \001(\t\0228\n\005value\030\002 \001(\013"
+ "2).google.cloud.oslogin.common.SshPublic"
- + "Key:\0028\001\"V\n\031DeletePosixAccountRequest\0229\n\004"
- + "name\030\001 \001(\tB+\340A\002\372A%\n#oslogin.googleapis.c"
- + "om/PosixAccount\"V\n\031DeleteSshPublicKeyReq"
- + "uest\0229\n\004name\030\001 \001(\tB+\340A\002\372A%\n#oslogin.goog"
- + "leapis.com/SshPublicKey\"z\n\026GetLoginProfi"
- + "leRequest\0229\n\004name\030\001 \001(\tB+\340A\002\372A%\022#oslogin"
- + ".googleapis.com/PosixAccount\022\022\n\nproject_"
- + "id\030\002 \001(\t\022\021\n\tsystem_id\030\003 \001(\t\"S\n\026GetSshPub"
- + "licKeyRequest\0229\n\004name\030\001 \001(\tB+\340A\002\372A%\n#osl"
- + "ogin.googleapis.com/SshPublicKey\"\264\001\n\031Imp"
- + "ortSshPublicKeyRequest\022;\n\006parent\030\001 \001(\tB+"
- + "\340A\002\372A%\022#oslogin.googleapis.com/SshPublic"
- + "Key\022F\n\016ssh_public_key\030\002 \001(\0132).google.clo"
- + "ud.oslogin.common.SshPublicKeyB\003\340A\001\022\022\n\np"
- + "roject_id\030\003 \001(\t\"Z\n\032ImportSshPublicKeyRes"
- + "ponse\022<\n\rlogin_profile\030\001 \001(\0132%.google.cl"
- + "oud.oslogin.v1.LoginProfile\"\317\001\n\031UpdateSs"
- + "hPublicKeyRequest\0229\n\004name\030\001 \001(\tB+\340A\002\372A%\n"
- + "#oslogin.googleapis.com/SshPublicKey\022F\n\016"
- + "ssh_public_key\030\002 \001(\0132).google.cloud.oslo"
- + "gin.common.SshPublicKeyB\003\340A\002\022/\n\013update_m"
- + "ask\030\003 \001(\0132\032.google.protobuf.FieldMask2\320\t"
- + "\n\016OsLoginService\022\216\001\n\022DeletePosixAccount\022"
- + "2.google.cloud.oslogin.v1.DeletePosixAcc"
- + "ountRequest\032\026.google.protobuf.Empty\",\202\323\344"
- + "\223\002\037*\035/v1/{name=users/*/projects/*}\332A\004nam"
- + "e\022\223\001\n\022DeleteSshPublicKey\0222.google.cloud."
- + "oslogin.v1.DeleteSshPublicKeyRequest\032\026.g"
- + "oogle.protobuf.Empty\"1\202\323\344\223\002$*\"/v1/{name="
- + "users/*/sshPublicKeys/*}\332A\004name\022\231\001\n\017GetL"
- + "oginProfile\022/.google.cloud.oslogin.v1.Ge"
- + "tLoginProfileRequest\032%.google.cloud.oslo"
- + "gin.v1.LoginProfile\".\202\323\344\223\002!\022\037/v1/{name=u"
- + "sers/*}/loginProfile\332A\004name\022\240\001\n\017GetSshPu"
- + "blicKey\022/.google.cloud.oslogin.v1.GetSsh"
- + "PublicKeyRequest\032).google.cloud.oslogin."
- + "common.SshPublicKey\"1\202\323\344\223\002$\022\"/v1/{name=u"
- + "sers/*/sshPublicKeys/*}\332A\004name\022\371\001\n\022Impor"
- + "tSshPublicKey\0222.google.cloud.oslogin.v1."
- + "ImportSshPublicKeyRequest\0323.google.cloud"
- + ".oslogin.v1.ImportSshPublicKeyResponse\"z"
- + "\202\323\344\223\0029\"\'/v1/{parent=users/*}:importSshPu"
- + "blicKey:\016ssh_public_key\332A\025parent,ssh_pub"
- + "lic_key\332A parent,ssh_public_key,project_"
- + "id\022\347\001\n\022UpdateSshPublicKey\0222.google.cloud"
- + ".oslogin.v1.UpdateSshPublicKeyRequest\032)."
- + "google.cloud.oslogin.common.SshPublicKey"
- + "\"r\202\323\344\223\00242\"/v1/{name=users/*/sshPublicKey"
- + "s/*}:\016ssh_public_key\332A\023name,ssh_public_k"
- + "ey\332A\037name,ssh_public_key,update_mask\032r\312A"
- + "\026oslogin.googleapis.com\322AVhttps://www.go"
- + "ogleapis.com/auth/cloud-platform,https:/"
- + "/www.googleapis.com/auth/computeB\276\001\n\033com"
- + ".google.cloud.oslogin.v1B\014OsLoginProtoP\001"
- + "Z>google.golang.org/genproto/googleapis/"
- + "cloud/oslogin/v1;oslogin\252\002\027Google.Cloud."
- + "OsLogin.V1\312\002\027Google\\Cloud\\OsLogin\\V1\352\002\032G"
- + "oogle::Cloud::OsLogin::V1b\006proto3"
+ + "Key:\0028\001\"\240\001\n\031CreateSshPublicKeyRequest\022;\n"
+ + "\006parent\030\001 \001(\tB+\340A\002\372A%\022#oslogin.googleapi"
+ + "s.com/SshPublicKey\022F\n\016ssh_public_key\030\002 \001"
+ + "(\0132).google.cloud.oslogin.common.SshPubl"
+ + "icKeyB\003\340A\002\"V\n\031DeletePosixAccountRequest\022"
+ + "9\n\004name\030\001 \001(\tB+\340A\002\372A%\n#oslogin.googleapi"
+ + "s.com/PosixAccount\"V\n\031DeleteSshPublicKey"
+ + "Request\0229\n\004name\030\001 \001(\tB+\340A\002\372A%\n#oslogin.g"
+ + "oogleapis.com/SshPublicKey\"z\n\026GetLoginPr"
+ + "ofileRequest\0229\n\004name\030\001 \001(\tB+\340A\002\372A%\022#oslo"
+ + "gin.googleapis.com/PosixAccount\022\022\n\nproje"
+ + "ct_id\030\002 \001(\t\022\021\n\tsystem_id\030\003 \001(\t\"S\n\026GetSsh"
+ + "PublicKeyRequest\0229\n\004name\030\001 \001(\tB+\340A\002\372A%\n#"
+ + "oslogin.googleapis.com/SshPublicKey\"\264\001\n\031"
+ + "ImportSshPublicKeyRequest\022;\n\006parent\030\001 \001("
+ + "\tB+\340A\002\372A%\022#oslogin.googleapis.com/SshPub"
+ + "licKey\022F\n\016ssh_public_key\030\002 \001(\0132).google."
+ + "cloud.oslogin.common.SshPublicKeyB\003\340A\001\022\022"
+ + "\n\nproject_id\030\003 \001(\t\"k\n\032ImportSshPublicKey"
+ + "Response\022<\n\rlogin_profile\030\001 \001(\0132%.google"
+ + ".cloud.oslogin.v1.LoginProfile\022\017\n\007detail"
+ + "s\030\002 \001(\t\"\317\001\n\031UpdateSshPublicKeyRequest\0229\n"
+ + "\004name\030\001 \001(\tB+\340A\002\372A%\n#oslogin.googleapis."
+ + "com/SshPublicKey\022F\n\016ssh_public_key\030\002 \001(\013"
+ + "2).google.cloud.oslogin.common.SshPublic"
+ + "KeyB\003\340A\002\022/\n\013update_mask\030\003 \001(\0132\032.google.p"
+ + "rotobuf.FieldMask2\206\014\n\016OsLoginService\022\307\001\n"
+ + "\022CreateSshPublicKey\0222.google.cloud.oslog"
+ + "in.v1.CreateSshPublicKeyRequest\032).google"
+ + ".cloud.oslogin.common.SshPublicKey\"R\202\323\344\223"
+ + "\0024\"\"/v1/{parent=users/*}/sshPublicKeys:\016"
+ + "ssh_public_key\332A\025parent,ssh_public_key\022\216"
+ + "\001\n\022DeletePosixAccount\0222.google.cloud.osl"
+ + "ogin.v1.DeletePosixAccountRequest\032\026.goog"
+ + "le.protobuf.Empty\",\202\323\344\223\002\037*\035/v1/{name=use"
+ + "rs/*/projects/*}\332A\004name\022\223\001\n\022DeleteSshPub"
+ + "licKey\0222.google.cloud.oslogin.v1.DeleteS"
+ + "shPublicKeyRequest\032\026.google.protobuf.Emp"
+ + "ty\"1\202\323\344\223\002$*\"/v1/{name=users/*/sshPublicK"
+ + "eys/*}\332A\004name\022\231\001\n\017GetLoginProfile\022/.goog"
+ + "le.cloud.oslogin.v1.GetLoginProfileReque"
+ + "st\032%.google.cloud.oslogin.v1.LoginProfil"
+ + "e\".\202\323\344\223\002!\022\037/v1/{name=users/*}/loginProfi"
+ + "le\332A\004name\022\240\001\n\017GetSshPublicKey\022/.google.c"
+ + "loud.oslogin.v1.GetSshPublicKeyRequest\032)"
+ + ".google.cloud.oslogin.common.SshPublicKe"
+ + "y\"1\202\323\344\223\002$\022\"/v1/{name=users/*/sshPublicKe"
+ + "ys/*}\332A\004name\022\371\001\n\022ImportSshPublicKey\0222.go"
+ + "ogle.cloud.oslogin.v1.ImportSshPublicKey"
+ + "Request\0323.google.cloud.oslogin.v1.Import"
+ + "SshPublicKeyResponse\"z\202\323\344\223\0029\"\'/v1/{paren"
+ + "t=users/*}:importSshPublicKey:\016ssh_publi"
+ + "c_key\332A\025parent,ssh_public_key\332A parent,s"
+ + "sh_public_key,project_id\022\347\001\n\022UpdateSshPu"
+ + "blicKey\0222.google.cloud.oslogin.v1.Update"
+ + "SshPublicKeyRequest\032).google.cloud.oslog"
+ + "in.common.SshPublicKey\"r\202\323\344\223\00242\"/v1/{nam"
+ + "e=users/*/sshPublicKeys/*}:\016ssh_public_k"
+ + "ey\332A\023name,ssh_public_key\332A\037name,ssh_publ"
+ + "ic_key,update_mask\032\335\001\312A\026oslogin.googleap"
+ + "is.com\322A\300\001https://www.googleapis.com/aut"
+ + "h/cloud-platform,https://www.googleapis."
+ + "com/auth/cloud-platform.read-only,https:"
+ + "//www.googleapis.com/auth/compute,https:"
+ + "//www.googleapis.com/auth/compute.readon"
+ + "lyB\276\001\n\033com.google.cloud.oslogin.v1B\014OsLo"
+ + "ginProtoP\001Z>google.golang.org/genproto/g"
+ + "oogleapis/cloud/oslogin/v1;oslogin\252\002\027Goo"
+ + "gle.Cloud.OsLogin.V1\312\002\027Google\\Cloud\\OsLo"
+ + "gin\\V1\352\002\032Google::Cloud::OsLogin::V1b\006pro"
+ + "to3"
};
descriptor =
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
@@ -173,8 +190,16 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
new java.lang.String[] {
"Key", "Value",
});
- internal_static_google_cloud_oslogin_v1_DeletePosixAccountRequest_descriptor =
+ internal_static_google_cloud_oslogin_v1_CreateSshPublicKeyRequest_descriptor =
getDescriptor().getMessageTypes().get(1);
+ internal_static_google_cloud_oslogin_v1_CreateSshPublicKeyRequest_fieldAccessorTable =
+ new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_google_cloud_oslogin_v1_CreateSshPublicKeyRequest_descriptor,
+ new java.lang.String[] {
+ "Parent", "SshPublicKey",
+ });
+ internal_static_google_cloud_oslogin_v1_DeletePosixAccountRequest_descriptor =
+ getDescriptor().getMessageTypes().get(2);
internal_static_google_cloud_oslogin_v1_DeletePosixAccountRequest_fieldAccessorTable =
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_cloud_oslogin_v1_DeletePosixAccountRequest_descriptor,
@@ -182,7 +207,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
"Name",
});
internal_static_google_cloud_oslogin_v1_DeleteSshPublicKeyRequest_descriptor =
- getDescriptor().getMessageTypes().get(2);
+ getDescriptor().getMessageTypes().get(3);
internal_static_google_cloud_oslogin_v1_DeleteSshPublicKeyRequest_fieldAccessorTable =
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_cloud_oslogin_v1_DeleteSshPublicKeyRequest_descriptor,
@@ -190,7 +215,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
"Name",
});
internal_static_google_cloud_oslogin_v1_GetLoginProfileRequest_descriptor =
- getDescriptor().getMessageTypes().get(3);
+ getDescriptor().getMessageTypes().get(4);
internal_static_google_cloud_oslogin_v1_GetLoginProfileRequest_fieldAccessorTable =
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_cloud_oslogin_v1_GetLoginProfileRequest_descriptor,
@@ -198,7 +223,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
"Name", "ProjectId", "SystemId",
});
internal_static_google_cloud_oslogin_v1_GetSshPublicKeyRequest_descriptor =
- getDescriptor().getMessageTypes().get(4);
+ getDescriptor().getMessageTypes().get(5);
internal_static_google_cloud_oslogin_v1_GetSshPublicKeyRequest_fieldAccessorTable =
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_cloud_oslogin_v1_GetSshPublicKeyRequest_descriptor,
@@ -206,7 +231,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
"Name",
});
internal_static_google_cloud_oslogin_v1_ImportSshPublicKeyRequest_descriptor =
- getDescriptor().getMessageTypes().get(5);
+ getDescriptor().getMessageTypes().get(6);
internal_static_google_cloud_oslogin_v1_ImportSshPublicKeyRequest_fieldAccessorTable =
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_cloud_oslogin_v1_ImportSshPublicKeyRequest_descriptor,
@@ -214,15 +239,15 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
"Parent", "SshPublicKey", "ProjectId",
});
internal_static_google_cloud_oslogin_v1_ImportSshPublicKeyResponse_descriptor =
- getDescriptor().getMessageTypes().get(6);
+ getDescriptor().getMessageTypes().get(7);
internal_static_google_cloud_oslogin_v1_ImportSshPublicKeyResponse_fieldAccessorTable =
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_cloud_oslogin_v1_ImportSshPublicKeyResponse_descriptor,
new java.lang.String[] {
- "LoginProfile",
+ "LoginProfile", "Details",
});
internal_static_google_cloud_oslogin_v1_UpdateSshPublicKeyRequest_descriptor =
- getDescriptor().getMessageTypes().get(7);
+ getDescriptor().getMessageTypes().get(8);
internal_static_google_cloud_oslogin_v1_UpdateSshPublicKeyRequest_fieldAccessorTable =
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_cloud_oslogin_v1_UpdateSshPublicKeyRequest_descriptor,
diff --git a/java-os-login/proto-google-cloud-os-login-v1/src/main/proto/google/cloud/oslogin/common/common.proto b/java-os-login/proto-google-cloud-os-login-v1/src/main/proto/google/cloud/oslogin/common/common.proto
index 4d9755f0d205..6eeaf8908d86 100644
--- a/java-os-login/proto-google-cloud-os-login-v1/src/main/proto/google/cloud/oslogin/common/common.proto
+++ b/java-os-login/proto-google-cloud-os-login-v1/src/main/proto/google/cloud/oslogin/common/common.proto
@@ -1,4 +1,4 @@
-// Copyright 2019 Google LLC.
+// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
syntax = "proto3";
@@ -26,8 +25,6 @@ option java_outer_classname = "OsLoginProto";
option java_package = "com.google.cloud.oslogin.common";
option php_namespace = "Google\\Cloud\\OsLogin\\Common";
option ruby_package = "Google::Cloud::OsLogin::Common";
-
-// Define a "User" resource owned by OS Login.
option (google.api.resource_definition) = {
type: "oslogin.googleapis.com/User"
pattern: "users/{user}"
diff --git a/java-os-login/proto-google-cloud-os-login-v1/src/main/proto/google/cloud/oslogin/v1/oslogin.proto b/java-os-login/proto-google-cloud-os-login-v1/src/main/proto/google/cloud/oslogin/v1/oslogin.proto
index 25e9be0a07e7..fb3575600c47 100644
--- a/java-os-login/proto-google-cloud-os-login-v1/src/main/proto/google/cloud/oslogin/v1/oslogin.proto
+++ b/java-os-login/proto-google-cloud-os-login-v1/src/main/proto/google/cloud/oslogin/v1/oslogin.proto
@@ -1,4 +1,4 @@
-// Copyright 2019 Google LLC.
+// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
syntax = "proto3";
@@ -41,7 +40,18 @@ service OsLoginService {
option (google.api.default_host) = "oslogin.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
- "https://www.googleapis.com/auth/compute";
+ "https://www.googleapis.com/auth/cloud-platform.read-only,"
+ "https://www.googleapis.com/auth/compute,"
+ "https://www.googleapis.com/auth/compute.readonly";
+
+ // Create an SSH public key
+ rpc CreateSshPublicKey(CreateSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) {
+ option (google.api.http) = {
+ post: "/v1/{parent=users/*}/sshPublicKeys"
+ body: "ssh_public_key"
+ };
+ option (google.api.method_signature) = "parent,ssh_public_key";
+ }
// Deletes a POSIX account.
rpc DeletePosixAccount(DeletePosixAccountRequest) returns (google.protobuf.Empty) {
@@ -113,6 +123,20 @@ message LoginProfile {
map ssh_public_keys = 3;
}
+// A request message for creating an SSH public key.
+message CreateSshPublicKeyRequest {
+ // Required. The unique ID for the user in format `users/{user}`.
+ string parent = 1 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.resource_reference) = {
+ child_type: "oslogin.googleapis.com/SshPublicKey"
+ }
+ ];
+
+ // Required. The SSH public key and expiration time.
+ google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED];
+}
+
// A request message for deleting a POSIX account entry.
message DeletePosixAccountRequest {
// Required. A reference to the POSIX account to update. POSIX accounts are identified
@@ -190,6 +214,9 @@ message ImportSshPublicKeyRequest {
message ImportSshPublicKeyResponse {
// The login profile information for the user.
LoginProfile login_profile = 1;
+
+ // Detailed information about import results.
+ string details = 2;
}
// A request message for updating an SSH public key.