diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/README.md b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/README.md new file mode 100644 index 000000000..c6d5f2361 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/README.md @@ -0,0 +1,25 @@ +# OIC CICD Visual Builder Studio / Build Jobs - Shell Steps + +Assets that contain oic related elementary commands and API interactions to achieve Continual Integration and Continual Deployment of the integration flows and related artifacts + + +## OIC CICD - Files +Collection of the atomic steps implementing the OIC Management API requests calls from the unix shell. Outh2 Authorization is the auth schema and Integratged Application for the Authorization Code or Client Credentials with OIC management API scope is needed(clientId, clientSecret). OCI user key and OCIDs needed to build the OCI V1 signature for the OCI commands for the start/stop OIC service instance. + +Review Date: 28.04.2025 + +# When to use these assets? + +These assets should be used whenever needed to design automatic Integrations deployment or OIC instance management using shell steps with cURL commands - OIC API calls + +# How to use these asset? + +The information is generic in nature and not specified for a particular customer. + +# License + +Copyright (c) 2025 Oracle and/or its affiliates. + +Licensed under the Universal Permissive License (UPL), Version 1.0. + +See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details. diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/README.pdf b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/README.pdf new file mode 100644 index 000000000..5458d3497 Binary files /dev/null and b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/README.pdf differ diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/README.md b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/README.md new file mode 100644 index 000000000..55e96c447 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/README.md @@ -0,0 +1,20 @@ +# OCI CICD + +This folder purpose is to share atomic artifacts on the CICD implementation for OIC. +Attached scripts is possible to use and process on a linux machine however the best option is to use it directly within your prefered CICD Tool. +CLI interaction is implemented using [cURL - command-line tool](https://curl.se/) primarily used for transferring data using various protocols like HTTP, HTTPS, FTP, and more. +![image](./images/VBStudio_Archi_Medium.jpg) + +## OCI CICD Tooling + +OCI provides [PaaS service Oracle Visual Builder Studio(VBS)](https://www.oracle.com/uk/application-development/visual-builder-studio/#rc30p3) that helps rapidly create and extend SaaS applications using a visual development environment with integrated agile and collaborative development, version control, and continuous delivery automation. +Scripts located in the folder is possible to use directly as the Step in the VBS. +![image](./images/VBS-build-job-step.png) + +## OCI VBS and CICD +[BS provides Free* OCI PaaS Service](https://vbcookbook.oracle.com/) to +- Plan and manage development processes with issue tracking, agile and sprint planning, wikis, and development dashboards +- Manage code lifecycle with Git repositories, peer code review, and continuous integration and delivery pipelines +- Gain flexibility with support for popular build and testing frameworks and infrastructure-as-code standards + +*Note: One(Fisrst) instance of the Oracle Visual Builder Studio service is for Free (20 gigabyte storage included)* diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/README.pdf b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/README.pdf new file mode 100644 index 000000000..a92b67957 Binary files /dev/null and b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/README.pdf differ diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/images/VBS-build-job-step.png b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/images/VBS-build-job-step.png new file mode 100644 index 000000000..a79fa7001 Binary files /dev/null and b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/images/VBS-build-job-step.png differ diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/images/VBStudio_Archi_Medium.jpg b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/images/VBStudio_Archi_Medium.jpg new file mode 100644 index 000000000..0fbdd8f7f Binary files /dev/null and b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/images/VBStudio_Archi_Medium.jpg differ diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_activate_integration.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_activate_integration.sh new file mode 100644 index 000000000..0388c10dd --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_activate_integration.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_activate_integration.sh +# +# This script is implementing comand to activate integration in the OIC environment as part of CICD Implementation for OCI/OIC +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 25/04/2025 +# Last updated comments:The script is activating global integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +# get the token to access OIC REST API# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + + + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + +activate_integration_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "X-HTTP-Method-Override: PATCH" -H "Content-Type: application/json" -d "{\"status\": \"ACTIVATED\"}" https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/integrations/<>%7C<>?integrationInstance=<>) + + + +# Error handling +http_status=$(echo "$activate_integration_api" | jq -r '.status') +echo "Activation integration status: $activate_integration_api" + + +# Check if the HTTP status code is ACTIVATION_INPROGRESS (OK) +if [ "$http_status" != "ACTIVATION_INPROGRESS" ]; then + echo "Error: Activation integration failed with HTTP status code: $http_status" >&2 + exit 1 +fi diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_create-iCalSchedule_project_integration.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_create-iCalSchedule_project_integration.sh new file mode 100644 index 000000000..4cfa4832d --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_create-iCalSchedule_project_integration.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_create_iCalSchedule_project_integration.sh +# +# This script is implementing comand to create a schedule using iCal expression for the project integration - OIC environment as part of CICD Implementation for OCI/OIC or example of trigger integration on system event +# +# Oracle +# Created by: Peter Obert +# Created date: 04/2025 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 28/04/2025 +# Last updated comments:The script is creating a schedule using iCal expression for the project integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + +echo '{"icalExpression":"FREQ=MONTHLY;BYDAY=MO,TUE;BYHOUR=12,14;BYMINUTE=20;","name":"my_schedule_name_01_00_0000","startDate":null,"endDate":null,"scheduleTZ":"GMT"}' > ./schedule.json +cat ./schedule.json + +CreateSchedule_Integration_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "Content-Type: application/json" -d @schedule.json https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<>/integrations/<>%7C<<01.00.0000>>/schedule?integrationInstance=<>) + + + +# Error handling +echo "Create iCal Schedule for Integration response: $CreateSchedule_Integration_api" +# Error handling +http_freq=$(echo "$CreateSchedule_Integration_api" | jq -r '.frequency') +http_status=$(echo "$CreateSchedule_Integration_api" | jq -r '.status') + +# Check if the CreateSchedule_Integration_api response is with no content +if [[ -n "$http_status" || -n "$http_freq" ]] +then + echo "Integration schedule using iCal creation succeeded with with reply: $CreateSchedule_Integration_api" >&2 +else + echo "Error: Integration schedule using iCal creation failed with Response: $CreateSchedule_Integration_api" >&2 + exit 1 +fi +exit 0 \ No newline at end of file diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_createSchedule_project_integration.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_createSchedule_project_integration.sh new file mode 100644 index 000000000..1ce79e5c0 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_createSchedule_project_integration.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_createSchedule_project_integration.sh +# +# This script is implementing comand to create a schedule for the project integration - OIC environment as part of CICD Implementation for OCI/OIC or example of trigger integration on system event +# +# Oracle +# Created by: Peter Obert +# Created date: 04/2025 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 28/04/2025 +# Last updated comments:The script is creating a schedule for the project integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + +echo '{"frequency":{"frequencyType":"DAILY","interval":1},"name":"my_schedule_name_01_00_0000","startDate":"2/14/2025|0:0:0","endDate":null,"scheduleTZ":"UTC"}' > ./schedule.json +cat ./schedule.json + +CreateSchedule_Integration_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "Content-Type: application/json" -d @schedule.json https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<>/integrations/<>%7C01.00.0000/schedule?integrationInstance=<>) + + + +# Error handling +echo "Create Schedule for Integration response: $CreateSchedule_Integration_api" +# Error handling +http_freq=$(echo "$CreateSchedule_Integration_api" | jq -r '.frequency') +http_status=$(echo "$CreateSchedule_Integration_api" | jq -r '.status') + +# Check if the RunNowSchedulable_Integration_api response is with no content +if [[ -n "$http_status" || -n "$http_freq" ]] +then + echo "Integration schedule creation succeeded with with reply: $CreateSchedule_Integration_api" >&2 +else + echo "Error: Integration schedule creation failed with Response: $CreateSchedule_Integration_api" >&2 + exit 1 +fi +exit 0 \ No newline at end of file diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_deactivate_integration.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_deactivate_integration.sh new file mode 100644 index 000000000..4d70a4e23 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_deactivate_integration.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_deactivate_integration.sh +# +# This script is implementing comand to deactivate integration in the OIC environment as part of CICD Implementation for OCI/OIC +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 25/04/2025 +# Last updated comments:The script is deactivating global integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + +deactivate_integration_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "X-HTTP-Method-Override: PATCH" -H "Content-Type: application/json" -d "{\"status\": \"CONFIGURED\"}" https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/integrations/<>%7C01.00.0000?integrationInstance=<>) + + + +# Error handling +http_status=$(echo "$deactivate_integration_api" | jq -r '.status') +echo "Export integration status: $deactivate_integration_api" + + +# Check if the HTTP status code is DEACTIVATION_INPROGRESS (OK) +if [ "$http_status" != "DEACTIVATION_INPROGRESS" ]; then + echo "Error: Deactivation of the integration failed with the status code: $http_status" >&2 + exit 1 +fi diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_deleteSchedule_project_integration.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_deleteSchedule_project_integration.sh new file mode 100644 index 000000000..acde1bc02 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_deleteSchedule_project_integration.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_deleteSchedule_project_integration.sh +# +# This script is implementing comand to delete a schedule for the project integration - OIC environment as part of CICD Implementation for OCI/OIC or example of trigger integration on system event +# +# Oracle +# Created by: Peter Obert +# Created date: 04/2025 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 28/04/2025 +# Last updated comments:The script is deleting a schedule for the project integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + + +DeleteSchedule_Integration_api=$(curl -X DELETE -H "Authorization: Bearer $access_token" -H "X-HTTP-Method-Override: PATCH" https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<>/integrations/<>%7C01.00.0000/schedule?integrationInstance=<>) + + + +# Error handling +echo "Stop Schedule for Integration response: $DeleteSchedule_Integration_api" +# Error handling +http_links=$(echo "$DeleteSchedule_Integration_api" | jq -r '.links') +http_status=$(echo "$DeleteSchedule_Integration_api" | jq -r '.status') + +# Check if the DeleteSchedule_Integration_api response is with no content +if [[ -n "$http_status" || (! -n "$http_links") ]] +then + echo "Integration schedule delete succeeded/or schedule is not present with with reply: $DeleteSchedule_Integration_api" >&2 +else + echo "Error: Integration schedule delete failed with Response: $DeleteSchedule_Integration_api" >&2 + exit 1 +fi +exit 0 \ No newline at end of file diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_delete_project.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_delete_project.sh new file mode 100644 index 000000000..25bc7bcea --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_delete_project.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_delete_project.sh +# +# This script is implementing comand to delete project from OIC environment - to be able later e.g. import .car file which can be used in the OIC environments as part of CICD Implementation for OCI/OIC +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 25/04/2025 +# Last updated comments:The script is deleting project from OIC - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + + + + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + + +#delete_project_api=$(curl -X DELETE -H "Authorization: Bearer $access_token" -H "Content-Type: application/json" https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/ORCL-R-ERP_MSEMAIL_ORDERFULFILL/archive?integrationInstance=<> ) + +delete_project_api=$(curl -s -w "%{http_code}" -X DELETE -H "Authorization: Bearer $access_token" -H "Content-Type: application/json" https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<>?integrationInstance=<> ) + + +http_code=$(tail -n1 <<< "$delete_project_api") # get the last line + +# Check if the delete_project_api response is with no content +if [[ $http_code == 200 ]] +then + echo "Integration project delete succeeded" >&2 +else + echo "Error: Integration schedule delete failed with Response: $delete_project_api" >&2 + exit 1 +fi +exit 0 \ No newline at end of file diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_export_integration.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_export_integration.sh new file mode 100644 index 000000000..112f9a0dc --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_export_integration.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_export_integration.sh +# +# This script is implementing comand to export integration (.iar) from the OIC environment as part of CICD Implementation for OCI/OIC - it is expected that after the build the .iar file is archived for the follow-up builds +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 24/04/2025 +# VBS adaptation: 24/04/2025 +# Last updated by: Peter Obert +# Last updated date: 24/04/2025 +# Last updated comments:The script is exporting global integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + +export_integration_api=$(curl -X GET -H "Authorization: Bearer $access_token" -o '<>.iar' https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/integrations/<>%7C01.00.0000/archive?integrationInstance=<>) + + +# Send the GET request and capture the response headers in a separate file +response_headers=$(mktemp) +curl -X GET -H "Authorization: Bearer $access_token" -D "$response_headers" -o '<>.iar' https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/integrations/<>%7C<>/archive?integrationInstance=<> + +# Extract the HTTP status code from the response headers +http_status=$(awk 'NR==1{print $2}' "$response_headers") + +# Check if the HTTP status code is 200 (OK) +if [ "$http_status" != "200" ]; then + echo "Error: Export integration failed with HTTP status code: $http_status" >&2 + exit 1 +fi + +# Clean up the temporary response headers file +rm "$response_headers" \ No newline at end of file diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_export_lookup.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_export_lookup.sh new file mode 100644 index 000000000..62a07e348 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_export_lookup.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_export_lookup.sh +# +# This script is implementing comand to export the lookup from the OIC environment as part of CICD Implementation for OCI/OIC +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 25/04/2025 +# Last updated comments:The script is exporting global lookup - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + +export_lookup_api=$(curl -X GET -H "Authorization: Bearer $access_token" -o 'lookup_file.csv' https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/lookups/<>/archive?integrationInstance=<>) + + +# Send the GET request and capture the response headers in a separate file +response_headers=$(mktemp) +curl -X GET -H "Authorization: Bearer $access_token" -D "$response_headers" -o 'lookup_file.csv' https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/lookups/<>/archive?integrationInstance=<> + +# Extract the HTTP status code from the response headers +http_status=$(awk 'NR==1{print $2}' "$response_headers") + +# Check if the HTTP status code is 200 (OK) +if [ "$http_status" != "200" ]; then + echo "Error: Export lookup failed with HTTP status code: $http_status" >&2 + exit 1 +fi + +# Clean up the temporary response headers file +rm "$response_headers" \ No newline at end of file diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_export_project.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_export_project.sh new file mode 100644 index 000000000..3d24e06a1 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_export_project.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_export_project.sh +# +# This script is implementing comand to export project to .car file which can be used in the other OIC environment as part of CICD Implementation for OCI/OIC +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 25/04/2025 +# Last updated comments:The script is exporting project to file - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + + + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + +echo '{"name":"my_project_name","code":"my_project_code","type":"DEVELOPED","builtBy":"","label":"01.00.0002"}' > Request_payload.json + +export_project_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "Content-Type: application/json" -d @Request_payload.json -o 'my_project_export_filename-01.00.0002.car' https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<>/archive?integrationInstance=<> ) + + +# Send the GET request and capture the response headers in a separate file +response_headers=$(mktemp) +curl -X POST -H "Authorization: Bearer $access_token" -H "Content-Type: application/json" -d @Request_payload.json -o 'my_project_export_filename-01.00.0002.car' https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<>/archive?integrationInstance=<> + +# Extract the HTTP status code from the response headers +http_status=$(awk 'NR==1{print $2}' "$response_headers") + +# Check if the HTTP status code is 200 (OK) +if [ "$http_status" != "200" ]; then + echo "Error: Export project failed with HTTP status code: $http_status" >&2 + exit 1 +fi + +echo .* * + +# Clean up the temporary response headers file +rm "$response_headers" \ No newline at end of file diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_getConnectionToFile_integration.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_getConnectionToFile_integration.sh new file mode 100644 index 000000000..a688ee850 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_getConnectionToFile_integration.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_getConnectionToFile_integration.sh +# +# This script is implementing comand to get connection details and store it to the file where the payload properties can be modified and adjusted according environment. The same payload can be used to import/update the connection the OIC environment as part of CICD Implementation for OCI/OIC +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 25/04/2025 +# Last updated comments:The script is exporting connection payload to file - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + +export_connectionSetUp_api=$(curl -X GET -H "Authorization: Bearer $access_token" -o '<>.json' https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/connections/<>?integrationInstance=<>) + + +# Send the GET request and capture the response headers in a separate file +response_headers=$(mktemp) +curl -X GET -o '<>.json' -H "Authorization: Bearer $access_token" -D "$response_headers" https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/connections/<>?integrationInstance=<> + +# Extract the HTTP status code from the response headers +http_status=$(awk 'NR==1{print $2}' "$response_headers") + +# Check if the HTTP status code is 200 (OK) +if [ "$http_status" != "200" ]; then + echo "Error: Export connection failed with HTTP status code: $http_status" >&2 + exit 1 +fi + +# Clean up the temporary response headers file +rm "$response_headers" \ No newline at end of file diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_getConnectionToFile_project.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_getConnectionToFile_project.sh new file mode 100644 index 000000000..79e7883ce --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_getConnectionToFile_project.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_getConnectionToFile_project.sh +# +# This script is implementing comand to get project connection details and store it to the file where the payload properties can be modified and adjusted according environment. The same payload can be used to import/update the connection the OIC environment as part of CICD Implementation for OCI/OIC +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 25/04/2025 +# Last updated comments:The script is exporting project connection payload to file - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + + +export_connectionSetUp_api=$(curl -X GET -H "Authorization: Bearer $access_token" -o '<>.json' https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<>/connections/<>?integrationInstance=<>) + + +# Send the GET request and capture the response headers in a separate file +response_headers=$(mktemp) +curl -X GET -o 'TESTNESUITE_CONN.json' -H "Authorization: Bearer $access_token" -D "$response_headers" https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<>/connections/<>?integrationInstance=<> + +# Extract the HTTP status code from the response headers +http_status=$(awk 'NR==1{print $2}' "$response_headers") + +# Check if the HTTP status code is 200 (OK) +if [ "$http_status" != "200" ]; then + echo "Error: Export connection failed with HTTP status code: $http_status" >&2 + exit 1 +fi + +# Clean up the temporary response headers file +rm "$response_headers" \ No newline at end of file diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_importReplace_lookup.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_importReplace_lookup.sh new file mode 100644 index 000000000..bfeda16d0 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_importReplace_lookup.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_importReplace_lookup.sh +# +# This script is implementing comand to import/replace the lookup in the OIC environment as part of CICD Implementation for OCI/OIC +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 25/04/2025 +# Last updated comments:The script is importing/overriding global lookup - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + + +import_lookup_api=$(curl -X POST -H "Authorization: Bearer $access_token" -F file=@<>.csv -F type=application/octet-stream https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/lookups/archive?integrationInstance=<>) + +echo "Import lookup info: $import_lookup_api" + +# Error handling +status=$(echo "$import_lookup_api" | jq -r '.status') +echo "Import lookup status: $status" + +if [[ $status == *"409"* ]]; then + update_existing_lookup=$(curl -X PUT -H "Authorization: Bearer $access_token" -F file=@<>.csv -F type=application/octet-stream https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/lookups/archive?integrationInstance=<>) + + status=$(echo "$update_existing_lookup" | jq -r '.status') + echo "Replace lookup status: $status" +fi diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_import_integration.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_import_integration.sh new file mode 100644 index 000000000..6b55bac03 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_import_integration.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_import_integration.sh +# +# This script is implementing comand to import integration (.iar) from the OIC environment as part of CICD Implementation for OCI/OIC - it is expected that before the build the .iar file is archived during the previous build or step +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 24/04/2025 +# VBS adaptation: 24/04/2025 +# Last updated by: Peter Obert +# Last updated date: 24/04/2025 +# Last updated comments:The script is importing global integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + + +import_integration_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "Accept:application/json" -F file=@<>.iar -F type=application/octet-stream https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/integrations/archive?integrationInstance=<>) + + +# Error handling +status=$(echo "$import_integration_api" | jq -r '.status') +echo "Import integration status: $status" + +if [[ $status == *"409"* ]]; then + update_existing_integration=$(curl -X PUT -H "Authorization: Bearer $access_token" -H "Accept:application/json" -F file=@<>.iar -F type=application/octet-stream https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/integrations/archive?integrationInstance=<>) + + status=$(echo "$update_existing_integration" | jq -r '.status') + echo "Replace integration status: $status" +fi diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_import_project.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_import_project.sh new file mode 100644 index 000000000..4e95df02b --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_import_project.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_import_project.sh +# +# This script is implementing comand to import project from .car file which can be used in the OIC environments as part of CICD Implementation for OCI/OIC +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 25/04/2025 +# Last updated comments:The script is importing project from file - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + + + + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + + +import_project_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "Accept:application/json" -F file=@<>.car -F type=application/octet-stream https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/archive?integrationInstance=<>) + + +# Error handling +status=$(echo "$import_project_api" | jq -r '.status') +echo "Import project status: $status" + +if [[ $status == *"409"* ]]; then + update_existing_project=$(curl -X PUT -H "Authorization: Bearer $access_token" -H "Accept:application/json" -F file=@<>.car -F type=application/octet-stream https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/archive?integrationInstance=<>) + + status=$(echo "$update_existing_project" | jq -r '.status') + echo "Replace project status: $status" +fi diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_runNow_integration.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_runNow_integration.sh new file mode 100644 index 000000000..3bb30ec3b --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_runNow_integration.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_runNow_integration.sh +# +# This script is implementing comand to run scheduled integration on demand now() - OIC environment as part of CICD Implementation for OCI/OIC or example of trigger integration on system event +# +# Oracle +# Created by: Peter Obert +# Created date: 04/2025 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 28/04/2025 +# Last updated comments:The script is triggering run of the scheduled integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +# get the token to access OIC REST API# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + +RunNowSchedulable_Integration_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "Content-Type: application/json" -d "{\"status\": \"ACTIVATED\"}" https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/integrations/<>%7C<>/schedule/jobs?integrationInstance=<>) + + + +# Error handling +#http_response=$(echo "$RunNowSchedulable_Integration_api" | jq -r '.status') +echo "Integration run Now response: $RunNowSchedulable_Integration_api" + + +# Check if the RunNowSchedulable_Integration_api response is with no content +if [ -z "$RunNowSchedulable_Integration_api" ]; then + echo "Integration run Now succeeded with with no content reply" >&2 +else + echo "Error: Integration run Now failed with Response: $RunNowSchedulable_Integration_api" >&2 + exit 1 +fi diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_runNow_project_integration.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_runNow_project_integration.sh new file mode 100644 index 000000000..078709b93 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_runNow_project_integration.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_runNow_project_integration.sh +# +# This script is implementing comand to run scheduledproject integration on demand now() - OIC environment as part of CICD Implementation for OCI/OIC or example of trigger integration on system event +# +# Oracle +# Created by: Peter Obert +# Created date: 04/2025 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 28/04/2025 +# Last updated comments:The script is triggering run of the scheduled project integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +# get the token to access OIC REST API# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + +RunNowSchedulable_Integration_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "Content-Type: application/json" -d "{\"status\": \"ACTIVATED\"}" https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<>/integrations/<>%7C<>/schedule/jobs?integrationInstance=<>) + + + +# Error handling +#http_response=$(echo "$RunNowSchedulable_Integration_api" | jq -r '.status') +echo "Integration run Now response: $RunNowSchedulable_Integration_api" + + +# Check if the RunNowSchedulable_Integration_api response is with no content +if [ -z "$RunNowSchedulable_Integration_api" ]; then + echo "Integration run Now succeeded with with no content reply" >&2 +else + echo "Error: Integration run Now failed with Response: $RunNowSchedulable_Integration_api" >&2 + exit 1 +fi diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_startSchedule_project_integration.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_startSchedule_project_integration.sh new file mode 100644 index 000000000..c13a1a8d5 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_startSchedule_project_integration.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_createSchedule_project_integration.sh +# +# This script is implementing comand to start a schedule for the project integration - OIC environment as part of CICD Implementation for OCI/OIC or example of trigger integration on system event +# +# Oracle +# Created by: Peter Obert +# Created date: 04/2025 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 28/04/2025 +# Last updated comments:The script is starting a schedule for the project integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + +echo '{"parameters":[{"name":"schedule_parameter_1","value":"1234"}],"runAsUserName":"peter.obert@oracle.com"}' > ./startschedule.json +cat ./startschedule.json + +params='async=true&integrationInstance=<>' + +StartSchedule_Integration_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "Content-Type: application/json" -d @startschedule.json https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<>/integrations/<>%7C<>/schedule/start?integrationInstance=<>) + + + +# Error handling +echo "Start Schedule for Integration response: $StartSchedule_Integration_api" +# Error handling +http_links=$(echo "$StartSchedule_Integration_api" | jq -r '.links') +http_status=$(echo "$StartSchedule_Integration_api" | jq -r '.Schedule') + +# Check if the StartSchedule_Integration_api response is with no content +if [[ -n "$http_status" || -n "$http_links" ]] +then + echo "Integration schedule start succeeded/or schedule is active with with reply: $StartSchedule_Integration_api" >&2 +else + echo "Error: Integration schedule start failed with Response: $StartSchedule_Integration_api" >&2 + exit 1 +fi +exit 0 \ No newline at end of file diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_stopSchedule_project_integration.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_stopSchedule_project_integration.sh new file mode 100644 index 000000000..ea48363fb --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_stopSchedule_project_integration.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_stopSchedule_project_integration.sh +# +# This script is implementing comand to stop a schedule for the project integration - OIC environment as part of CICD Implementation for OCI/OIC or example of trigger integration on system event +# +# Oracle +# Created by: Peter Obert +# Created date: 04/2025 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 28/04/2025 +# Last updated comments:The script is stopping a schedule for the project integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + +echo '{}' > ./stopschedule.json +cat ./stopschedule.json + +StopSchedule_Integration_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "Content-Type: application/json" -d @stopschedule.json https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<>/integrations/<>%7C<>/schedule/stop?integrationInstance=<>) + + + +# Error handling +echo "Stop Schedule for Integration response: $StopSchedule_Integration_api" +# Error handling +http_links=$(echo "$StopSchedule_Integration_api" | jq -r '.links') +http_status=$(echo "$StopSchedule_Integration_api" | jq -r '.Schedule') + +# Check if the StopSchedule_Integration_api response is with no content +if [[ -n "$http_status" || -n "$http_links" ]] +then + echo "Integration schedule stop succeeded/or schedule is not active with with reply: $StopSchedule_Integration_api" >&2 +else + echo "Error: Integration schedule stop failed with Response: $StopSchedule_Integration_api" >&2 + exit 1 +fi +exit 0 \ No newline at end of file diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_updateConnectionFromFile_integration.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_updateConnectionFromFile_integration.sh new file mode 100644 index 000000000..41bd32499 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_updateConnectionFromFile_integration.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_updateConnectionFromFile_integration.sh +# +# This script is implementing comand to geupdatet connection details and test the connection - payload is expected stored in the file where the payload properties can be modified and adjusted according environment. The same payload can be used to import/update the connection the OIC environment as part of CICD Implementation for OCI/OIC +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 25/04/2025 +# Last updated comments:The script is importing/updating connection according payload in the file - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + + + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + + +import_connection_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "X-HTTP-Method-Override: PATCH" -H "Content-Type: application/json" -d @<>.json https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/connections/<>?integrationInstance=<>) + + +# Error handling +status=$(echo "$import_integration_api" | jq -r '.status') +echo "Import connection status: $status" + +if [[ $status == *"409"* ]]; then + update_existing_integration=$(curl -X PUT -H "Authorization: Bearer $access_token" -H "Accept:application/json" -F file=@<>.json -F type=application/octet-stream https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/integrations/archive?integrationInstance=<>) + + status=$(echo "$update_existing_integration" | jq -r '.status') + echo "Replace integration status: $status" +fi diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_updateConnectionFromFile_project.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_updateConnectionFromFile_project.sh new file mode 100644 index 000000000..fbe99a537 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/oic3_updateConnectionFromFile_project.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# **************************************************************************************** +# Script: oic3_updateConnectionFromFile_project.sh +# +# This script is implementing comand to get updated connection details and test the connection project - payload is expected stored in the file where the payload properties can be modified and adjusted according environment. The same payload can be used to import/update the connection the OIC environment as part of CICD Implementation for OCI/OIC +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 25/04/2025 +# VBS adaptation: 25/04/2025 +# Last updated by: Peter Obert +# Last updated date: 25/04/2025 +# Last updated comments:The script is importing/updating project connection according payload in the file - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +# get the token to access OIC REST API +response=$(curl -i -H 'Authorization: Basic <>' --request POST 'https://<>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/') + +access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}') + +# Check if access_token is empty or null +if [ -z "$access_token" ]; then + echo "Failed to retrieve access token from the first API." + exit 1 +fi + + +import_connection_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "X-HTTP-Method-Override: PATCH" -H "Content-Type: application/json" -d @<>.json https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<>/connections/<>?integrationInstance=<>) + + +# Error handling +status=$(echo "$import_connection_api" | jq -r '.status') +echo "Import connection status: $status" + +if [[ $status == *"409"* ]]; then + update_existing_connintegration=$(curl -X PUT -H "Authorization: Bearer $access_token" -H "Accept:application/json" -F file=@<>.json -F type=application/octet-stream https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<>/connections/<>?integrationInstance=<>) + + status=$(echo "$update_existing_connintegration" | jq -r '.status') + echo "Replace integration status: $status" +fi diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/prepare_pem_for_builds.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/prepare_pem_for_builds.sh new file mode 100644 index 000000000..a98a47399 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/prepare_pem_for_builds.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# **************************************************************************************** +# Script: prepare_pem_for_builds.sh +# +# This script is used as prerequisite/part of CI Implementation for OCI/OIC to get and store private PEM key necessary to compose OCI Signature +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 24/04/2025 +# VBS adaptation: 24/04/2025 +# Last updated by: Peter Obert +# Last updated date: 24/04/2025 +# Last updated comments: OCI Digital signature script preparing privatekey in path - adaptation based on https://www.ateam-oracle.com/post/oracle-cloud-infrastructure-oci-rest-call-walkthrough-with-curl. +# After this build step is expected to archive *.pem to be available for the follow-up build steps +# No mandatory parameters: +# this can be custom iplementation that will delived the private key which can be used in follow-up steps with OCI cURL commands with OCI Signature +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +echo "-----BEGIN RSA PRIVATE KEY----- +yourkeyContent +-----END RSA PRIVATE KEY-----" > ./oci_cicduser@oracle.com_api_key_priv.pem diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/start_oic_environment.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/start_oic_environment.sh new file mode 100644 index 000000000..d6f459ca2 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/start_oic_environment.sh @@ -0,0 +1,87 @@ +#!/bin/bash +# **************************************************************************************** +# Script: start_oic_environment.sh +# +# This script is implementing comand to start OIC environment as part of CICD Implementation for OCI/OIC - uses OCI Signature +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 24/04/2025 +# VBS adaptation: 24/04/2025 +# Last updated by: Peter Obert +# Last updated date: 24/04/2025 +# Last updated comments: OCI Digital signature script is preparing preparing privatekey in path - adaptation based on https://www.ateam-oracle.com/post/oracle-cloud-infrastructure-oci-rest-call-walkthrough-with-curl. +# After this build step it is expected to have running OIC environment(eg DR site) +# +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +tenancy_ocid="ocid1.tenancy.oc1..<>" + +# OCID of the user making the rest call +user_ocid="ocid1.user.oc1..<>" + +# path to the private PEM format key for this user +privateKeyPath="./<>.pem" + +# fingerprint of the private key for this user +fingerprint="<>" + +# The REST api you want to call, with any required paramters. +rest_api="/20190131/integrationInstances/<>/actions/start" + +# The host you want to make the call against +host="integration.eu-amsterdam-1.ocp.oraclecloud.com" + +# the json file containing the data you want to POST to the rest endpoint +body="./empty-request.json" +#################################################################################### +touch ./empty-request.json + +# extra headers required for a POST/PUT request +body_arg=(--data-binary @${body}) +content_sha256="$(openssl dgst -binary -sha256 < $body | openssl enc -e -base64)"; +content_sha256_header="x-content-sha256: $content_sha256" +content_length="$(wc -c < $body | xargs)"; +content_length_header="content-length: $content_length" +headers="(request-target) date host" +# add on the extra fields required for a POST/PUT +headers=$headers" x-content-sha256 content-type content-length" +content_type_header="content-type: application/json"; + +date=`date -u "+%a, %d %h %Y %H:%M:%S GMT"` +date_header="date: $date" +host_header="host: $host" +request_target="(request-target): post $rest_api" + +# note the order of items. The order in the signing_string matches the order in the headers, including the extra POST fields +signing_string="$request_target\n$date_header\n$host_header" +# add on the extra fields required for a POST/PUT +signing_string="$signing_string\n$content_sha256_header\n$content_type_header\n$content_length_header" + + + + +echo "=====================================================================================================" +printf '%b' "signing string is $signing_string \n" +signature=`printf '%b' "$signing_string" | openssl dgst -sha256 -sign $privateKeyPath | openssl enc -e -base64 | tr -d '\n'` +printf '%b' "Signed Request is \n$signature\n" + +echo "=====================================================================================================" +set -x +curl -v -X POST --data-binary "@request.json" -sS https://$host$rest_api -H "date: $date" -H "x-content-sha256: $content_sha256" -H "content-type: application/json" -H "content-length: $content_length" -H "Authorization: Signature version=\"1\",keyId=\"$tenancy_ocid/$user_ocid/$fingerprint\",algorithm=\"rsa-sha256\",headers=\"$headers\",signature=\"$signature\"" \ No newline at end of file diff --git a/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/stop_oic_environment.sh b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/stop_oic_environment.sh new file mode 100644 index 000000000..6f1bc2228 --- /dev/null +++ b/app-dev/app-integration-and-automation/oracle-integration-cloud/08-oic-cicd-vbs-shellsteps/files/scripts/stop_oic_environment.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# **************************************************************************************** +# Script: stop_oic_environment.sh +# +# This script is implementing comand to stop OIC environment as part of CICD Implementation for OCI/OIC - uses OCI Signature +# +# Oracle +# Created by: Peter Obert +# Created date: 11/2024 +# Updated date: 24/04/2025 +# VBS adaptation: 24/04/2025 +# Last updated by: Peter Obert +# Last updated date: 24/04/2025 +# Last updated comments: Before the command the OCI Digital signature script is preparing privatekey in path - adaptation based on https://www.ateam-oracle.com/post/oracle-cloud-infrastructure-oci-rest-call-walkthrough-with-curl. +# After this build step is expected to have paused OIC environment +# No mandatory parameters: +# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy +# +# +# Disclaimer: +# +# You expressly understand and agree that your use of the utilities is at your sole risk and that +# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims +# all warranties of any kind, whether express or implied, including, but not limited to, the implied +# warranties of merchantability, fitness for a particular purpose and non-infringement. +# Any material downloaded or otherwise obtained through this delivery is done at your own discretion +# and risk and you will be solely responsible for any damage to your computer system or loss of data +# that results from the download of any such material. +# +# **************************************************************************************** + + +########################## Fill these in with your values or rebuid to parameters ########################## +#OCID of the tenancy calls are being made in to +tenancy_ocid="ocid1.tenancy.oc1..<" + +# OCID of the user making the rest call +user_ocid="ocid1.user.oc1..<>" + +# path to the private PEM format key for this user +privateKeyPath="./<>.pem" + +# fingerprint of the private key for this user +fingerprint="<>" + +# The REST api you want to call, with any required paramters. +rest_api="/20190131/integrationInstances/<>/actions/stop" + +# The host you want to make the call against +host="integration.eu-amsterdam-1.ocp.oraclecloud.com" + +# the json file containing the data you want to POST to the rest endpoint +body="./empty-request.json" +#################################################################################### +touch ./empty-request.json + +# extra headers required for a POST/PUT request +body_arg=(--data-binary @${body}) +content_sha256="$(openssl dgst -binary -sha256 < $body | openssl enc -e -base64)"; +content_sha256_header="x-content-sha256: $content_sha256" +content_length="$(wc -c < $body | xargs)"; +content_length_header="content-length: $content_length" +headers="(request-target) date host" +# add on the extra fields required for a POST/PUT +headers=$headers" x-content-sha256 content-type content-length" +content_type_header="content-type: application/json"; + +date=`date -u "+%a, %d %h %Y %H:%M:%S GMT"` +date_header="date: $date" +host_header="host: $host" +request_target="(request-target): post $rest_api" + +# note the order of items. The order in the signing_string matches the order in the headers, including the extra POST fields +signing_string="$request_target\n$date_header\n$host_header" +# add on the extra fields required for a POST/PUT +signing_string="$signing_string\n$content_sha256_header\n$content_type_header\n$content_length_header" + + + + +echo "=====================================================================================================" +printf '%b' "signing string is $signing_string \n" +signature=`printf '%b' "$signing_string" | openssl dgst -sha256 -sign $privateKeyPath | openssl enc -e -base64 | tr -d '\n'` +printf '%b' "Signed Request is \n$signature\n" + +echo "=====================================================================================================" +set -x +curl -v -X POST --data-binary "@request.json" -sS https://$host$rest_api -H "date: $date" -H "x-content-sha256: $content_sha256" -H "content-type: application/json" -H "content-length: $content_length" -H "Authorization: Signature version=\"1\",keyId=\"$tenancy_ocid/$user_ocid/$fingerprint\",algorithm=\"rsa-sha256\",headers=\"$headers\",signature=\"$signature\"" \ No newline at end of file