-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConnectionUpdateScript
51 lines (47 loc) · 2.48 KB
/
ConnectionUpdateScript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
pipeline {
agent any
stages {
stage('Read CSV') {
steps {
script {
def csvFile = readFile('ConnectionDetails.csv').trim()
def records = csvFile.readLines().drop(1).collect { line -> line.tokenize(',') }
records.each { record ->
def field1 = record[0]
def field2 = record[1]
def field3 = record[2]
def field4 = record[3]
def conProperties = """
{
"connectionProperties": {
"propertyGroup": "CONNECTION_PROPS",
"propertyName": "connectionUrl",
"propertyType": "URL",
"propertyValue": "${field1}"
},
"securityPolicy": "BASIC_AUTH",
"securityProperties": [
{
"propertyGroup": "CREDENTIALS",
"propertyName": "username",
"propertyValue": "${field2}"
},
{
"propertyGroup": "CREDENTIALS",
"propertyName": "password",
"propertyValue": "${field3}"
}
]
}
"""
def payload = conProperties.replace('\n', '').trim()
writeFile file: 'payload.json', text: payload
def integURL = "https://testinstance-idevjxz332qf-ia.integration.ocp.oraclecloud.com/ic/api/integration/v1/connections/${field4}"
bat"""
curl -X POST --user "Devops_user:Oic_Jenkins#2023" --header "X-HTTP-Method-Override:PATCH" --header "Content-Type:application/json" -d @payload.json "https://testinstance-idevjxz332qf-ia.integration.ocp.oraclecloud.com/ic/api/integration/v1/connections/${field4}" """
}
}
}
}
}
}