Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [aiplatform] add service_account to UploadModelRequest in aiplatform v1beta1 model_service.proto #8895

Merged
merged 8 commits into from
Dec 9, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ public final OperationFuture<UploadModelResponse, UploadModelOperationMetadata>
* .setParentModel("parentModel998431903")
* .setModelId("modelId1226956324")
* .setModel(Model.newBuilder().build())
* .setServiceAccount("serviceAccount1079137720")
* .build();
* UploadModelResponse response = modelServiceClient.uploadModelAsync(request).get();
* }
Expand Down Expand Up @@ -298,6 +299,7 @@ public final OperationFuture<UploadModelResponse, UploadModelOperationMetadata>
* .setParentModel("parentModel998431903")
* .setModelId("modelId1226956324")
* .setModel(Model.newBuilder().build())
* .setServiceAccount("serviceAccount1079137720")
* .build();
* OperationFuture<UploadModelResponse, UploadModelOperationMetadata> future =
* modelServiceClient.uploadModelOperationCallable().futureCall(request);
Expand Down Expand Up @@ -331,6 +333,7 @@ public final OperationFuture<UploadModelResponse, UploadModelOperationMetadata>
* .setParentModel("parentModel998431903")
* .setModelId("modelId1226956324")
* .setModel(Model.newBuilder().build())
* .setServiceAccount("serviceAccount1079137720")
* .build();
* ApiFuture<Operation> future = modelServiceClient.uploadModelCallable().futureCall(request);
* // Do something.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ public final OperationFuture<UploadModelResponse, UploadModelOperationMetadata>
* .setParentModel("parentModel998431903")
* .setModelId("modelId1226956324")
* .setModel(Model.newBuilder().build())
* .setServiceAccount("serviceAccount1079137720")
* .build();
* UploadModelResponse response = modelServiceClient.uploadModelAsync(request).get();
* }
Expand Down Expand Up @@ -300,6 +301,7 @@ public final OperationFuture<UploadModelResponse, UploadModelOperationMetadata>
* .setParentModel("parentModel998431903")
* .setModelId("modelId1226956324")
* .setModel(Model.newBuilder().build())
* .setServiceAccount("serviceAccount1079137720")
* .build();
* OperationFuture<UploadModelResponse, UploadModelOperationMetadata> future =
* modelServiceClient.uploadModelOperationCallable().futureCall(request);
Expand Down Expand Up @@ -333,6 +335,7 @@ public final OperationFuture<UploadModelResponse, UploadModelOperationMetadata>
* .setParentModel("parentModel998431903")
* .setModelId("modelId1226956324")
* .setModel(Model.newBuilder().build())
* .setServiceAccount("serviceAccount1079137720")
* .build();
* ApiFuture<Operation> future = modelServiceClient.uploadModelCallable().futureCall(request);
* // Do something.
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ private UploadModelRequest() {
parent_ = "";
parentModel_ = "";
modelId_ = "";
serviceAccount_ = "";
}

@java.lang.Override
Expand Down Expand Up @@ -279,6 +280,67 @@ public com.google.cloud.aiplatform.v1.ModelOrBuilder getModelOrBuilder() {
return getModel();
}

public static final int SERVICE_ACCOUNT_FIELD_NUMBER = 6;
private volatile java.lang.Object serviceAccount_;
/**
*
*
* <pre>
* Optional. The user-provided custom service account to use to do the model
* upload. If empty, [Vertex AI Service
* Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
* will be used. Users uploading the Model must have the
* `iam.serviceAccounts.actAs` permission on this service account. Also, this
* account must belong to the project specified in the `parent` field and have
* all necessary read permissions.
* </pre>
*
* <code>string service_account = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The serviceAccount.
*/
@java.lang.Override
public java.lang.String getServiceAccount() {
java.lang.Object ref = serviceAccount_;
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();
serviceAccount_ = s;
return s;
}
}
/**
*
*
* <pre>
* Optional. The user-provided custom service account to use to do the model
* upload. If empty, [Vertex AI Service
* Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
* will be used. Users uploading the Model must have the
* `iam.serviceAccounts.actAs` permission on this service account. Also, this
* account must belong to the project specified in the `parent` field and have
* all necessary read permissions.
* </pre>
*
* <code>string service_account = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The bytes for serviceAccount.
*/
@java.lang.Override
public com.google.protobuf.ByteString getServiceAccountBytes() {
java.lang.Object ref = serviceAccount_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
serviceAccount_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}

private byte memoizedIsInitialized = -1;

@java.lang.Override
Expand All @@ -305,6 +367,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(modelId_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 5, modelId_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceAccount_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 6, serviceAccount_);
}
getUnknownFields().writeTo(output);
}

Expand All @@ -326,6 +391,9 @@ public int getSerializedSize() {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(modelId_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, modelId_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceAccount_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, serviceAccount_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
Expand All @@ -349,6 +417,7 @@ public boolean equals(final java.lang.Object obj) {
if (hasModel()) {
if (!getModel().equals(other.getModel())) return false;
}
if (!getServiceAccount().equals(other.getServiceAccount())) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
Expand All @@ -370,6 +439,8 @@ public int hashCode() {
hash = (37 * hash) + MODEL_FIELD_NUMBER;
hash = (53 * hash) + getModel().hashCode();
}
hash = (37 * hash) + SERVICE_ACCOUNT_FIELD_NUMBER;
hash = (53 * hash) + getServiceAccount().hashCode();
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
Expand Down Expand Up @@ -520,6 +591,8 @@ public Builder clear() {
model_ = null;
modelBuilder_ = null;
}
serviceAccount_ = "";

return this;
}

Expand Down Expand Up @@ -555,6 +628,7 @@ public com.google.cloud.aiplatform.v1.UploadModelRequest buildPartial() {
} else {
result.model_ = modelBuilder_.build();
}
result.serviceAccount_ = serviceAccount_;
onBuilt();
return result;
}
Expand Down Expand Up @@ -620,6 +694,10 @@ public Builder mergeFrom(com.google.cloud.aiplatform.v1.UploadModelRequest other
if (other.hasModel()) {
mergeModel(other.getModel());
}
if (!other.getServiceAccount().isEmpty()) {
serviceAccount_ = other.serviceAccount_;
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
Expand Down Expand Up @@ -670,6 +748,12 @@ public Builder mergeFrom(

break;
} // case 42
case 50:
{
serviceAccount_ = input.readStringRequireUtf8();

break;
} // case 50
default:
{
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
Expand Down Expand Up @@ -1230,6 +1314,142 @@ public com.google.cloud.aiplatform.v1.ModelOrBuilder getModelOrBuilder() {
return modelBuilder_;
}

private java.lang.Object serviceAccount_ = "";
/**
*
*
* <pre>
* Optional. The user-provided custom service account to use to do the model
* upload. If empty, [Vertex AI Service
* Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
* will be used. Users uploading the Model must have the
* `iam.serviceAccounts.actAs` permission on this service account. Also, this
* account must belong to the project specified in the `parent` field and have
* all necessary read permissions.
* </pre>
*
* <code>string service_account = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The serviceAccount.
*/
public java.lang.String getServiceAccount() {
java.lang.Object ref = serviceAccount_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
serviceAccount_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
* <pre>
* Optional. The user-provided custom service account to use to do the model
* upload. If empty, [Vertex AI Service
* Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
* will be used. Users uploading the Model must have the
* `iam.serviceAccounts.actAs` permission on this service account. Also, this
* account must belong to the project specified in the `parent` field and have
* all necessary read permissions.
* </pre>
*
* <code>string service_account = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The bytes for serviceAccount.
*/
public com.google.protobuf.ByteString getServiceAccountBytes() {
java.lang.Object ref = serviceAccount_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
serviceAccount_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
* <pre>
* Optional. The user-provided custom service account to use to do the model
* upload. If empty, [Vertex AI Service
* Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
* will be used. Users uploading the Model must have the
* `iam.serviceAccounts.actAs` permission on this service account. Also, this
* account must belong to the project specified in the `parent` field and have
* all necessary read permissions.
* </pre>
*
* <code>string service_account = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @param value The serviceAccount to set.
* @return This builder for chaining.
*/
public Builder setServiceAccount(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}

serviceAccount_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* Optional. The user-provided custom service account to use to do the model
* upload. If empty, [Vertex AI Service
* Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
* will be used. Users uploading the Model must have the
* `iam.serviceAccounts.actAs` permission on this service account. Also, this
* account must belong to the project specified in the `parent` field and have
* all necessary read permissions.
* </pre>
*
* <code>string service_account = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return This builder for chaining.
*/
public Builder clearServiceAccount() {

serviceAccount_ = getDefaultInstance().getServiceAccount();
onChanged();
return this;
}
/**
*
*
* <pre>
* Optional. The user-provided custom service account to use to do the model
* upload. If empty, [Vertex AI Service
* Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
* will be used. Users uploading the Model must have the
* `iam.serviceAccounts.actAs` permission on this service account. Also, this
* account must belong to the project specified in the `parent` field and have
* all necessary read permissions.
* </pre>
*
* <code>string service_account = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @param value The bytes for serviceAccount to set.
* @return This builder for chaining.
*/
public Builder setServiceAccountBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);

serviceAccount_ = value;
onChanged();
return this;
}

@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,41 @@ public interface UploadModelRequestOrBuilder
* </code>
*/
com.google.cloud.aiplatform.v1.ModelOrBuilder getModelOrBuilder();

/**
*
*
* <pre>
* Optional. The user-provided custom service account to use to do the model
* upload. If empty, [Vertex AI Service
* Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
* will be used. Users uploading the Model must have the
* `iam.serviceAccounts.actAs` permission on this service account. Also, this
* account must belong to the project specified in the `parent` field and have
* all necessary read permissions.
* </pre>
*
* <code>string service_account = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The serviceAccount.
*/
java.lang.String getServiceAccount();
/**
*
*
* <pre>
* Optional. The user-provided custom service account to use to do the model
* upload. If empty, [Vertex AI Service
* Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
* will be used. Users uploading the Model must have the
* `iam.serviceAccounts.actAs` permission on this service account. Also, this
* account must belong to the project specified in the `parent` field and have
* all necessary read permissions.
* </pre>
*
* <code>string service_account = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The bytes for serviceAccount.
*/
com.google.protobuf.ByteString getServiceAccountBytes();
}