From 17c828fe9dd7171ed0a788bb5035b553879d96f2 Mon Sep 17 00:00:00 2001 From: Chirantha Kurukulasuriya Date: Wed, 30 Oct 2024 12:00:51 +0530 Subject: [PATCH 1/4] Add instructions required for each config file type in tab format --- .../use-a-connection-in-your-service.md | 168 ++++++++++++++---- 1 file changed, 134 insertions(+), 34 deletions(-) diff --git a/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md b/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md index f0d19e197..234f77444 100644 --- a/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md +++ b/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md @@ -12,52 +12,152 @@ You can consume a Choreo-deployed service within another service. Consuming conn ### Step 1: Add connection configurations -To integrate another service into your application, follow the steps below: +To integrate another service into your application, click the appropriate tab below based on your preferred configuration file version and follow the step-by-step instructions provided: -1. Copy and paste the snippet from the in-line developer guide into the `component-config` file under the `spec` section. +=== "Component.yaml file (v1.1)" - The following is a sample snippet: + 1. Copy and paste the snippet from the in-line developer guide into the `component.yaml` file. - ``` yaml + The following is a sample snippet: - outbound: - serviceReferences: - - name: - connectionConfig: - env: - - from: ServiceURL - to: - - from: ConsumerKey - to: - - from: ConsumerSecret - to: - - from: TokenURL - to: + ``` yaml - ``` + dependencies: + connectionReferences: + - name: + resourceRef: + + ``` + + | Field | Description | + |------------------|---------------------------------------------------------------------| + | name | The name given to the connection. | + | resourceRef | A unique, readable identifier of the service being connected to. | + + + 2. If you've previously added a `connectionReferences` section under `dependencies`, append this as another item under `connectionReferences`. Upon deploying the component, Choreo automatically creates a subscription if applicable and the necessary configurations to establish the connection will be injected into the Choreo-defined environment variables. + + The following table details the Choreo-defined environment variables: + + | Configuration Key | Choreo-Defined Environment Variable Name | + |-------------------------|---------------------------------------------------------------| + | ServiceURL | CHOREO__SERVICEURL | + | ConsumerKey | CHOREO__CONSUMERKEY | + | ConsumerSecret | CHOREO__CONSUMERSECRET | + | TokenURL | CHOREO__TOKENURL | + + + If you'd like to use custom environment variable names instead of the Choreo-defined ones, add the dependency as a service reference under `dependencies` in the same file. For more details, refer to the instructions under the `component.yaml file (v1.0)` tab. + + + The following table provides details on the configuration keys associated with the connection: + + | Name | Type | Description |Optional | Sensitive | + |----------------|------------|---------------------------------------|---------------|--------------| + | ServiceURL | string | Service URL of the Choreo service | false | false | + | ConsumerKey | string | Consumer key of the Choreo service | false | false | + | ConsumerSecret | string | Consumer secret of the Choreo service | false | true | + | TokenURL | string | Token URL of the STS | false | false | + +=== "Component.yaml file (v1.0)" + + !!! note + This `component.yaml v1.0` is a legacy configuration format. For new projects, we recommend using the latest version (v1.1) of `component.yaml` for improved usability and features. + + 1. Copy and paste the snippet from the in-line developer guide into the `component.yaml` file. + + The following is a sample snippet: + + ``` yaml + + dependencies: + serviceReferences: + - name: + connectionConfig: + env: + - from: ServiceURL + to: + - from: ConsumerKey + to: + - from: ConsumerSecret + to: + - from: TokenURL + to: + + ``` + + | Field | Description | + |------------------|-------------------------------------------------------------| + | name | The name of the service you are connecting to. | + | connectionConfig | The unique connection identifier for the connection. | + | env | The environment variable mapping. | + | from | The key of the configuration entry. | + | to | The environment variable name to which Choreo will inject the value of the key.| + + + 2. Replace `` with an appropriate environment variable name of your choice. If you have previously added a service reference section under `dependencies`, append this as another item under `serviceReferences`. + + Upon deploying the component, Choreo automatically creates a subscription if applicable and populates the specified environment variables with actual values. + + + The following table provides details on the configuration keys associated with the connection: + + | Name | Type | Description |Optional | Sensitive | + |----------------|------------|---------------------------------------|---------------|--------------| + | ServiceURL | string | Service URL of the Choreo service | false | false | + | ConsumerKey | string | Consumer key of the Choreo service | false | false | + | ConsumerSecret | string | Consumer secret of the Choreo service | false | true | + | TokenURL | string | Token URL of the STS | false | false | + +=== "Component-config.yaml file" + + !!! note + This `component-config.yaml` is a legacy configuration format. For new projects, we recommend using the latest version (v1.1) of `component.yaml` for improved usability and features. + + 1. Copy and paste the snippet from the in-line developer guide into the `component-config` file under the `spec` section. + + The following is a sample snippet: + + ``` yaml + + outbound: + serviceReferences: + - name: + connectionConfig: + env: + - from: ServiceURL + to: + - from: ConsumerKey + to: + - from: ConsumerSecret + to: + - from: TokenURL + to: + + ``` - | Field | Description | - |------------------|-------------------------------------------------------------| - | Name | The name of the service you are connecting to. | - | ConnectionConfig | The unique connection identifier for the connection. | - | env | The environment variable mapping. | - | from | The key of the configuration entry. | - | to | The environment variable name to which Choreo will inject the value of the key.| + | Field | Description | + |------------------|-------------------------------------------------------------| + | name | The name of the service you are connecting to. | + | connectionConfig | The unique connection identifier for the connection. | + | env | The environment variable mapping. | + | from | The key of the configuration entry. | + | to | The environment variable name to which Choreo will inject the value of the key.| -2. Replace `` with an appropriate environment variable name of your choice. If you have previously added an outbound service reference, append this as another item under `serviceReferences`. + 2. Replace `` with an appropriate environment variable name of your choice. If you have previously added an outbound service reference, append this as another item under `serviceReferences`. - Upon deploying the component, Choreo automatically creates a subscription if applicable and populates the specified environment variables with actual values. + Upon deploying the component, Choreo automatically creates a subscription if applicable and populates the specified environment variables with actual values. - The following table provides details on the configuration keys associated with the connection: + The following table provides details on the configuration keys associated with the connection: - | Name | Type | Description |Optional | Sensitive | - |----------------|------------|---------------------------------------|---------------|--------------| - | ServiceURL | string | Service URL of the Choreo service | false | false | - | ConsumerKey | string | Consumer key of the Choreo service | false | false | - | ConsumerSecret | string | Consumer secret of the Choreo service | false | true | - | TokenURL | string | Token URL of the STS | false | false | + | Name | Type | Description |Optional | Sensitive | + |----------------|------------|---------------------------------------|---------------|--------------| + | ServiceURL | string | Service URL of the Choreo service | false | false | + | ConsumerKey | string | Consumer key of the Choreo service | false | false | + | ConsumerSecret | string | Consumer secret of the Choreo service | false | true | + | TokenURL | string | Token URL of the STS | false | false | ### Step 2: Read configurations within the application From e37bb9ef8f916285cf5550ca695ff23b52d3b4b0 Mon Sep 17 00:00:00 2001 From: Chirantha Kurukulasuriya Date: Wed, 30 Oct 2024 14:43:28 +0530 Subject: [PATCH 2/4] change codeblock of read configuration to reflect the new env name --- .../use-a-connection-in-your-service.md | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md b/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md index 234f77444..a9f0a73e4 100644 --- a/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md +++ b/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md @@ -59,6 +59,16 @@ To integrate another service into your application, click the appropriate tab be | ConsumerSecret | string | Consumer secret of the Choreo service | false | true | | TokenURL | string | Token URL of the STS | false | false | + ### Step 2: Read configurations within the application + + Once you add the connection configuration snippet, you can proceed to read those configurations within your application. The steps to follow depend on the programming language you are using. + + The following is a sample code snippet in NodeJS: + + ``` java + const serviceURL = process.env.CHOREO__SERVICEURL; + ``` + === "Component.yaml file (v1.0)" !!! note @@ -109,6 +119,17 @@ To integrate another service into your application, click the appropriate tab be | ConsumerSecret | string | Consumer secret of the Choreo service | false | true | | TokenURL | string | Token URL of the STS | false | false | + ### Step 2: Read configurations within the application + + Once you add the connection configuration snippet, you can proceed to read those configurations within your application. The steps to follow depend on the programming language you are using. + + The following is a sample code snippet in NodeJS: + + ``` java + const serviceURL = process.env.SVC_URL; + ``` + + === "Component-config.yaml file" !!! note @@ -159,16 +180,17 @@ To integrate another service into your application, click the appropriate tab be | ConsumerSecret | string | Consumer secret of the Choreo service | false | true | | TokenURL | string | Token URL of the STS | false | false | + ### Step 2: Read configurations within the application -### Step 2: Read configurations within the application + Once you add the connection configuration snippet, you can proceed to read those configurations within your application. The steps to follow depend on the programming language you are using. -Once you add the connection configuration snippet, you can proceed to read those configurations within your application. The steps to follow depend on the programming language you are using. + The following is a sample code snippet in NodeJS: + + ``` java + const serviceURL = process.env.SVC_URL; + ``` -The following is a sample code snippet in NodeJS: -``` java -const serviceURL = process.env.SVC_URL; -``` ### Step 3: Acquire an OAuth 2.0 access token From c82e8fdada74824b933e895734ae9ef775d481a1 Mon Sep 17 00:00:00 2001 From: Chirantha Kurukulasuriya Date: Thu, 31 Oct 2024 14:35:15 +0530 Subject: [PATCH 3/4] Remove content for component v1.1 until release --- en/.spelling | 1 + .../use-a-connection-in-your-service.md | 66 ++----------------- 2 files changed, 5 insertions(+), 62 deletions(-) diff --git a/en/.spelling b/en/.spelling index 1e845c197..051abe026 100644 --- a/en/.spelling +++ b/en/.spelling @@ -15,6 +15,7 @@ buildpacks Temurin RabbitMQ SalesOrderQueue +v1.1 1.x 12.x.x 14.x.x diff --git a/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md b/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md index a9f0a73e4..96f048f35 100644 --- a/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md +++ b/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md @@ -12,67 +12,9 @@ You can consume a Choreo-deployed service within another service. Consuming conn ### Step 1: Add connection configurations -To integrate another service into your application, click the appropriate tab below based on your preferred configuration file version and follow the step-by-step instructions provided: +To integrate another service into your application, click the appropriate tab below based on your current configuration file version and follow the step-by-step instructions: -=== "Component.yaml file (v1.1)" - - 1. Copy and paste the snippet from the in-line developer guide into the `component.yaml` file. - - The following is a sample snippet: - - ``` yaml - - dependencies: - connectionReferences: - - name: - resourceRef: - - ``` - - | Field | Description | - |------------------|---------------------------------------------------------------------| - | name | The name given to the connection. | - | resourceRef | A unique, readable identifier of the service being connected to. | - - - 2. If you've previously added a `connectionReferences` section under `dependencies`, append this as another item under `connectionReferences`. Upon deploying the component, Choreo automatically creates a subscription if applicable and the necessary configurations to establish the connection will be injected into the Choreo-defined environment variables. - - The following table details the Choreo-defined environment variables: - - | Configuration Key | Choreo-Defined Environment Variable Name | - |-------------------------|---------------------------------------------------------------| - | ServiceURL | CHOREO__SERVICEURL | - | ConsumerKey | CHOREO__CONSUMERKEY | - | ConsumerSecret | CHOREO__CONSUMERSECRET | - | TokenURL | CHOREO__TOKENURL | - - - If you'd like to use custom environment variable names instead of the Choreo-defined ones, add the dependency as a service reference under `dependencies` in the same file. For more details, refer to the instructions under the `component.yaml file (v1.0)` tab. - - - The following table provides details on the configuration keys associated with the connection: - - | Name | Type | Description |Optional | Sensitive | - |----------------|------------|---------------------------------------|---------------|--------------| - | ServiceURL | string | Service URL of the Choreo service | false | false | - | ConsumerKey | string | Consumer key of the Choreo service | false | false | - | ConsumerSecret | string | Consumer secret of the Choreo service | false | true | - | TokenURL | string | Token URL of the STS | false | false | - - ### Step 2: Read configurations within the application - - Once you add the connection configuration snippet, you can proceed to read those configurations within your application. The steps to follow depend on the programming language you are using. - - The following is a sample code snippet in NodeJS: - - ``` java - const serviceURL = process.env.CHOREO__SERVICEURL; - ``` - -=== "Component.yaml file (v1.0)" - - !!! note - This `component.yaml v1.0` is a legacy configuration format. For new projects, we recommend using the latest version (v1.1) of `component.yaml` for improved usability and features. +=== "Component.yaml file" 1. Copy and paste the snippet from the in-line developer guide into the `component.yaml` file. @@ -119,7 +61,7 @@ To integrate another service into your application, click the appropriate tab be | ConsumerSecret | string | Consumer secret of the Choreo service | false | true | | TokenURL | string | Token URL of the STS | false | false | - ### Step 2: Read configurations within the application +

Step 2: Read configurations within the application

Once you add the connection configuration snippet, you can proceed to read those configurations within your application. The steps to follow depend on the programming language you are using. @@ -133,7 +75,7 @@ To integrate another service into your application, click the appropriate tab be === "Component-config.yaml file" !!! note - This `component-config.yaml` is a legacy configuration format. For new projects, we recommend using the latest version (v1.1) of `component.yaml` for improved usability and features. + This `component-config.yaml` is a legacy configuration format. For new projects, we recommend using `component.yaml` for improved usability and features. 1. Copy and paste the snippet from the in-line developer guide into the `component-config` file under the `spec` section. From 25e56015f7af703651c9690b976c540fbff1fb71 Mon Sep 17 00:00:00 2001 From: Nisrin Date: Thu, 31 Oct 2024 14:57:09 +0530 Subject: [PATCH 4/4] Update use-a-connection-in-your-service.md --- .../sharing-and-reusing/use-a-connection-in-your-service.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md b/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md index 96f048f35..66fab7412 100644 --- a/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md +++ b/en/docs/develop-components/sharing-and-reusing/use-a-connection-in-your-service.md @@ -12,7 +12,7 @@ You can consume a Choreo-deployed service within another service. Consuming conn ### Step 1: Add connection configurations -To integrate another service into your application, click the appropriate tab below based on your current configuration file version and follow the step-by-step instructions: +To integrate another service into your application, click the appropriate tab below based on your current configuration file and follow the step-by-step instructions: === "Component.yaml file" @@ -61,7 +61,7 @@ To integrate another service into your application, click the appropriate tab be | ConsumerSecret | string | Consumer secret of the Choreo service | false | true | | TokenURL | string | Token URL of the STS | false | false | -

Step 2: Read configurations within the application

+ ### Step 2: Read configurations within the application Once you add the connection configuration snippet, you can proceed to read those configurations within your application. The steps to follow depend on the programming language you are using. @@ -122,7 +122,7 @@ To integrate another service into your application, click the appropriate tab be | ConsumerSecret | string | Consumer secret of the Choreo service | false | true | | TokenURL | string | Token URL of the STS | false | false | - ### Step 2: Read configurations within the application +

Step 2: Read configurations within the application

Once you add the connection configuration snippet, you can proceed to read those configurations within your application. The steps to follow depend on the programming language you are using.