This is an automated email from the ASF dual-hosted git repository.
dyankiv pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
The following commit(s) were added to refs/heads/develop by this push:
new 7fbb2b9 add gcp specific image naming
new d001c77 Merge pull request #1412 from denysyankiv/DATALAB-1716
7fbb2b9 is described below
commit 7fbb2b9586841f38a7b544597965b5878323ddb5
Author: Denys Yankiv <[email protected]>
AuthorDate: Wed Feb 9 16:30:36 2022 +0200
add gcp specific image naming
---
.../epam/datalab/backendapi/util/BillingUtils.java | 28 +++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git
a/services/self-service/src/main/java/com/epam/datalab/backendapi/util/BillingUtils.java
b/services/self-service/src/main/java/com/epam/datalab/backendapi/util/BillingUtils.java
index fe9575f..bf425ea 100644
---
a/services/self-service/src/main/java/com/epam/datalab/backendapi/util/BillingUtils.java
+++
b/services/self-service/src/main/java/com/epam/datalab/backendapi/util/BillingUtils.java
@@ -60,6 +60,11 @@ public class BillingUtils {
private static final String IMAGE_STANDARD_FORMAT1 =
"%s-%s-%s-%s-notebook-image";
private static final String IMAGE_STANDARD_FORMAT2 =
"%s-%s-%s-notebook-image";
private static final String IMAGE_CUSTOM_FORMAT = "%s-%s-%s-%s-%s";
+ // GCP specific
+ private static final String IMAGE_VOLUME_PRIMARY_GCP =
"%s-%s-%s-%s-primary-image";
+ private static final String IMAGE_VOLUME_SECONDARY_GCP =
"%s-%s-%s-%s-secondary-image";
+ private static final String IMAGE_CUSTOM_VOLUME_PRIMARY_GCP =
"%s-%s-%s-%s-primary-image-%s";
+ private static final String IMAGE_CUSTOM_VOLUME_SECONDARY_GCP =
"%s-%s-%s-%s-secondary-image-%s";
private static final String SHARED_RESOURCE = "Shared resource";
private static final String IMAGE_NAME = "Image";
@@ -206,8 +211,13 @@ public class BillingUtils {
public static Stream<BillingReportLine>
customImageBillingDataStream(ImageInfoRecord image, String sbn) {
String imageId = String.format(IMAGE_CUSTOM_FORMAT, sbn,
image.getProject(), image.getEndpoint(), image.getApplication(),
image.getName()).toLowerCase();
+ String imageIdGCP1 = String.format(IMAGE_CUSTOM_VOLUME_PRIMARY_GCP,
sbn, image.getProject(), image.getEndpoint(), image.getApplication(),
image.getName()).toLowerCase();
+ String imageIdGCP2 = String.format(IMAGE_CUSTOM_VOLUME_SECONDARY_GCP,
sbn, image.getProject(), image.getEndpoint(), image.getApplication(),
image.getName()).toLowerCase();
return Stream.of(
-
BillingReportLine.builder().resourceName(image.getName()).project(image.getProject()).datalabId(imageId).user(image.getUser()).resourceType(IMAGE).build()
+
BillingReportLine.builder().resourceName(image.getName()).project(image.getProject()).datalabId(imageId).user(image.getUser()).resourceType(IMAGE).build(),
+
BillingReportLine.builder().resourceName(image.getName()).project(image.getProject()).datalabId(imageIdGCP1).user(image.getUser()).resourceType(IMAGE).build(),
+
BillingReportLine.builder().resourceName(image.getName()).project(image.getProject()).datalabId(imageIdGCP2).user(image.getUser()).resourceType(IMAGE).build()
+
);
}
@@ -260,6 +270,22 @@ public class BillingUtils {
.user(SHARED_RESOURCE)
.resourceType(IMAGE)
.build());
+ list.add(BillingReportLine
+ .builder()
+ .resourceName(IMAGE_NAME)
+ .datalabId(String.format(IMAGE_VOLUME_PRIMARY_GCP, sbn,
project, endpoint, notebook).toLowerCase())
+ .project(project)
+ .user(SHARED_RESOURCE)
+ .resourceType(IMAGE)
+ .build());
+ list.add(BillingReportLine
+ .builder()
+ .resourceName(IMAGE_NAME)
+ .datalabId(String.format(IMAGE_VOLUME_SECONDARY_GCP, sbn,
project, endpoint, notebook).toLowerCase())
+ .project(project)
+ .user(SHARED_RESOURCE)
+ .resourceType(IMAGE)
+ .build());
}
return list.stream();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]