From f0f44640f924c8440b48112c8272da489d1fbe25 Mon Sep 17 00:00:00 2001 From: Manuel Rafeli Date: Mon, 30 Oct 2023 12:50:16 +0100 Subject: [PATCH] README onboarding-sdk (#29) --- README.md | 8 +- .../onboarding-sdk-azure-storage/README.md | 42 +++++ .../onboarding-sdk-common/README.md | 23 +++ .../onboarding-sdk-product/README.md | 154 ++++++++++++++++++ .../src/main/schema/Product_v1.avsc | 107 ++++++++++++ 5 files changed, 333 insertions(+), 1 deletion(-) create mode 100644 onboarding-sdk/onboarding-sdk-azure-storage/README.md create mode 100644 onboarding-sdk/onboarding-sdk-common/README.md create mode 100644 onboarding-sdk/onboarding-sdk-product/README.md create mode 100644 onboarding-sdk/onboarding-sdk-product/src/main/schema/Product_v1.avsc diff --git a/README.md b/README.md index b8611da43..6ece86fa3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ # Selfcare Onboarding -Repository that contains backend services for selfcare onboarding. +Repository that contains backend services for selfcare onboarding. It is a monorepo for onboarding domain that contains: + +- `onboarding-functions`: functions that handle all asynchronous activities related to preparing and completing the onboarding process. Indeed, they are activated by the onboarding microservice upon receiving an onboarding request +- `onboarding-ms`: microservice that implements CRUD operations for the 'onboarding' object and the business logic for the onboarding phase. During the onboarding process +- `onboarding-sdk`: Java utility classes that simplify the work of developers about onboarding activity + +Look at single README module for more information. diff --git a/onboarding-sdk/onboarding-sdk-azure-storage/README.md b/onboarding-sdk/onboarding-sdk-azure-storage/README.md new file mode 100644 index 000000000..7c2292fe4 --- /dev/null +++ b/onboarding-sdk/onboarding-sdk-azure-storage/README.md @@ -0,0 +1,42 @@ +# Onboarding SDK Azure Storage + +This library has been developed to provide a set of Java utility classes to simplify the work of interact with azure storage. It includes features that helping for upload or download file from an azure storage container. + +## Installation + +To use this library in your projects, you can add the dependency to your pom.xml if you're using Maven: + +```shell script + + it.pagopa.selfcare + onboarding-sdk-azure-storage + 0.0.1 + +``` + +If you are using Gradle, you can add the dependency to your build.gradle file: + +```shell script +dependencies { + implementation 'it.pagopa.selfcare:onboarding-sdk-azure-storage:0.0.1' +} +``` + +## Usage + +Here's an example of how to use AzureBlobClient: + +```java script + +public class Main { + public static void main(String[] args) { + final String azureStorageConnectionString = ... ; // set the azure storage connectionString, for ex. AccountName=asd;AccountKey=asd;DefaultEndpointsProtocol=http;BlobEndpoint=http://127.0.0.1:10000/account; + final String azureStorageContainerName = ... ; // set the azure storage container name + final AzureBlobClient azureBlobClient = new AzureBlobClientDefault(azureStorageConnectionString, azureStorageContainerName); + + //Getting file as text + final String filepath = ... ; + final String jsonString = azureBlobClient.getFileAsText(filepath); + } +} +``` \ No newline at end of file diff --git a/onboarding-sdk/onboarding-sdk-common/README.md b/onboarding-sdk/onboarding-sdk-common/README.md new file mode 100644 index 000000000..31068846b --- /dev/null +++ b/onboarding-sdk/onboarding-sdk-common/README.md @@ -0,0 +1,23 @@ +# Onboarding SDK Common + +This library has been developed to provide a set of Java utility classes to simplify the work of onboarding service. It includes constants that helping for some aspects of onboarding activity. + +## Installation + +To use this library in your projects, you can add the dependency to your pom.xml if you're using Maven: + +```shell script + + it.pagopa.selfcare + onboarding-sdk-common + 0.0.1 + +``` + +If you are using Gradle, you can add the dependency to your build.gradle file: + +```shell script +dependencies { + implementation 'it.pagopa.selfcare:onboarding-sdk-common:0.0.1' +} +``` diff --git a/onboarding-sdk/onboarding-sdk-product/README.md b/onboarding-sdk/onboarding-sdk-product/README.md new file mode 100644 index 000000000..049f28831 --- /dev/null +++ b/onboarding-sdk/onboarding-sdk-product/README.md @@ -0,0 +1,154 @@ +# Onboarding SDK Product + +This library has been developed to provide a set of Java utility classes to simplify the work of handle **Selfcare Product** as string. + +## Installation + +To use this library in your projects, you can add the dependency to your pom.xml if you're using Maven: + +```shell script + + it.pagopa.selfcare + onboarding-sdk-product + 0.0.1 + +``` + +If you are using Gradle, you can add the dependency to your build.gradle file: + +```shell script +dependencies { + implementation 'it.pagopa.selfcare:onboarding-sdk-product:0.0.1' +} +``` +## Product JSON Schema + +Product string which are used by ProductService must follow a specific schema: + +``` +{ + "type" : "record", + "name" : "Product", + "namespace" : "it.pagopa.selfcare.product.entity", + "fields" : [ { + "name" : "id", + "type" : [ "string" ] + }, { + "name" : "logo", + "type" : [ "string" ] + }, { + "name" : "depictImageUrl", + "type" : [ "string" ] + }, { + "name" : "title", + "type" : [ "string" ] + }, { + "name" : "logoBgColor", + "type" : [ "string" ] + }, { + "name" : "description", + "type" : [ "string" ] + }, { + "name" : "urlPublic", + "type" : [ "string" ] + }, { + "name" : "urlBO", + "type" : [ "string" ] + }, { + "name" : "createdAt", + "type" : [ "string" ] + }, { + "name" : "createdBy", + "type" : [ "string" ] + }, { + "name" : "modifiedAt", + "type" : [ "string" ] + }, { + "name" : "modifiedBy", + "type" : [ "string" ] + }, { + "name" : "roleManagementURL", + "type" : [ "null", "string" ] + }, { + "name" : "contractTemplateUpdatedAt", + "type" : [ "string" ] + }, { + "name" : "contractTemplatePath", + "type" : [ "string" ] + }, { + "name" : "contractTemplateVersion", + "type" : [ "string" ] + }, { + "name" : "institutionContractMappings", + "type" : [ "null", { + "type" : "map", + "values" : { + "type" : "record", + "name" : "ContractStorage", + "fields" : [ { + "name" : "contractTemplateUpdatedAt", + "type" : [ "null", "string" ] + }, { + "name" : "contractTemplatePath", + "type" : [ "null", "string" ] + }, { + "name" : "contractTemplateVersion", + "type" : [ "null", "string" ] + } ] + } + } ] + }, { + "name" : "enabled", + "type" : "boolean" + }, { + "name" : "delegable", + "type" : ["null","boolean"] + }, { + "name" : "status", + "type" : [ "string" ] + }, { + "name" : "parentId", + "type" : [ "null", "string" ] + }, { + "name" : "identityTokenAudience", + "type" : [ "string" ] + }, { + "name" : "backOfficeEnvironmentConfigurations", + "type" : [ "null", { + "type" : "map", + "values" : { + "type" : "record", + "name" : "BackOfficeConfigurations", + "fields" : [ { + "name" : "url", + "type" : [ "null", "string" ] + }, { + "name" : "identityTokenAudience", + "type" : [ "null", "string" ] + } ] + } + } ] + }, { + "name" : "parent", + "type" : [ "null", "Product" ] + } ] +} +``` + +## Usage + +Here's an example of how to use ProductService for retrieving product: + +```java script + +public class Main { + public static void main(String[] args) { + final String productJsonString = ... ; // set a json string compliant to a List of Product Pojo + final ProductService productService = new ProductServiceDefault(productJsonString); + + //Get product if it is valid + final String productId = "prod-pagopa"; + final Product product = productService.getProductIsValid(productId); + } +} +``` \ No newline at end of file diff --git a/onboarding-sdk/onboarding-sdk-product/src/main/schema/Product_v1.avsc b/onboarding-sdk/onboarding-sdk-product/src/main/schema/Product_v1.avsc new file mode 100644 index 000000000..8975cbc5b --- /dev/null +++ b/onboarding-sdk/onboarding-sdk-product/src/main/schema/Product_v1.avsc @@ -0,0 +1,107 @@ +{ + "type" : "record", + "name" : "Product", + "namespace" : "it.pagopa.selfcare.product.entity", + "fields" : [ { + "name" : "id", + "type" : [ "string" ] + }, { + "name" : "logo", + "type" : [ "string" ] + }, { + "name" : "depictImageUrl", + "type" : [ "string" ] + }, { + "name" : "title", + "type" : [ "string" ] + }, { + "name" : "logoBgColor", + "type" : [ "string" ] + }, { + "name" : "description", + "type" : [ "string" ] + }, { + "name" : "urlPublic", + "type" : [ "string" ] + }, { + "name" : "urlBO", + "type" : [ "string" ] + }, { + "name" : "createdAt", + "type" : [ "string" ] + }, { + "name" : "createdBy", + "type" : [ "string" ] + }, { + "name" : "modifiedAt", + "type" : [ "string" ] + }, { + "name" : "modifiedBy", + "type" : [ "string" ] + }, { + "name" : "roleManagementURL", + "type" : [ "null", "string" ] + }, { + "name" : "contractTemplateUpdatedAt", + "type" : [ "string" ] + }, { + "name" : "contractTemplatePath", + "type" : [ "string" ] + }, { + "name" : "contractTemplateVersion", + "type" : [ "string" ] + }, { + "name" : "institutionContractMappings", + "type" : [ "null", { + "type" : "map", + "values" : { + "type" : "record", + "name" : "ContractStorage", + "fields" : [ { + "name" : "contractTemplateUpdatedAt", + "type" : [ "null", "string" ] + }, { + "name" : "contractTemplatePath", + "type" : [ "null", "string" ] + }, { + "name" : "contractTemplateVersion", + "type" : [ "null", "string" ] + } ] + } + } ] + }, { + "name" : "enabled", + "type" : "boolean" + }, { + "name" : "delegable", + "type" : ["null","boolean"] + }, { + "name" : "status", + "type" : [ "string" ] + }, { + "name" : "parentId", + "type" : [ "null", "string" ] + }, { + "name" : "identityTokenAudience", + "type" : [ "string" ] + }, { + "name" : "backOfficeEnvironmentConfigurations", + "type" : [ "null", { + "type" : "map", + "values" : { + "type" : "record", + "name" : "BackOfficeConfigurations", + "fields" : [ { + "name" : "url", + "type" : [ "null", "string" ] + }, { + "name" : "identityTokenAudience", + "type" : [ "null", "string" ] + } ] + } + } ] + }, { + "name" : "parent", + "type" : [ "null", "Product" ] + } ] +} \ No newline at end of file