#!/bin/bash # v.01 initial release # v.02 add Target Server if [ $# -ne 3 ] then echo "Wrong number of arguments supplied." echo echo "createenvconf " echo "i.e.:" echo "createenvconf http://10.10.10.1:8080 comp env" exit 1 fi # I.e.: #USER=: USER=$USER # I.e.: #MGMTSVR=http://10.119.3.151:8080 #ORG=comp #ENV=env MGMTSVR=$1 ORG=$2 ENV=$3 # Create KVMs curl -v -X POST \ -H "Content-Type: application/json" \ -u $USER \ $MGMTSVR/v1/organizations/$ORG/apis/Deals/keyvaluemaps \ -d @- << EOF { "entry": [ { "name": "LogLevel", "value": "DEBUG" }, { "name": "FileName", "value": "AccountTransactions" } ], "name": "AccountTransactionsKVM" } EOF curl -v -X POST \ -H "Content-Type: application/json" \ -u $USER \ $MGMTSVR/v1/organizations/$ORG/apis/Rates/keyvaluemaps \ -d @- << EOF { "entry": [ { "name": "LogLevel", "value": "DEBUG" }, { "name": "FileName", "value": "Rates" } ], "name": "RatesKVM" } EOF curl -v -X POST \ -H "Content-Type: application/json" \ -u $USER \ $MGMTSVR/v1/organizations/$ORG/apis/Trans/keyvaluemaps \ -d @- << EOF { "entry": [ { "name": "LogLevel", "value": "DEBUG" }, { "name": "FileName", "value": "Trans" } ], "name": "TransKVM" } EOF curl -v -X POST \ -H "Content-Type: application/json" \ -u $USER \ $MGMTSVR/v1/organizations/$ORG/apis/Confs/keyvaluemaps \ -d @- << EOF { "entry": [ { "name": "LogLevel", "value": "DEBUG" }, { "name": "FileName", "value": "Confs" } ], "name": "ConfsKVM" } EOF curl -v -X POST \ -H "Content-Type: application/json" \ -u $USER \ $MGMTSVR/v1/organizations/$ORG/apis/IPPEligibility/keyvaluemaps \ -d @- << EOF { "entry": [ { "name": "LogLevel", "value": "DEBUG" }, { "name": "FileName", "value": "IPPEligibility" } ], "name": "IPPEligibilityKVM" } EOF curl -v -X POST \ -H "Content-Type: application/json" \ -u $USER \ $MGMTSVR/v1/organizations/$ORG/keyvaluemaps \ -d @- << EOF { "entry": [ { "name": "client-id", "value": "YXA6nj_RuAI6EeakWgBQVqN1pA" }, { "name": "client-secret", "value": "YXA6RzSE4VYD8m-F5kUYK50573WPPZk" }, { "name": "baas-path", "value": "/$ORG/openapi" } ], "name": "baas" } EOF curl -v -X POST \ -H "Content-Type: application/json" \ -u $USER \ $MGMTSVR/v1/organizations/$ORG/environments/$ENV/caches?name=baastokencache \ -d @- << EOF { "description": "baastokencache", "diskSizeInMB": 0, "distributed": true, "expirySettings": { "timeoutInSec": { "value": "0" }, "valuesNull": true }, "inMemorySizeInKB": 0, "maxElementsInMemory": 2000, "maxElementsOnDisk": 1000, "name": "baastokencache", "overflowToDisk": true, "persistent": false, "skipCacheIfElementSizeInKBExceeds": 512 } EOF curl -v -X POST \ -H "Content-Type: application/json" \ -u $USER \ $MGMTSVR/v1/organizations/$ORG/environments/$ENV/caches?name=eaierrorcodes \ -d @- << EOF { "description": "errorcodes", "diskSizeInMB": 0, "distributed": true, "expirySettings": { "timeoutInSec": { "value": "0" }, "valuesNull": true }, "inMemorySizeInKB": 0, "maxElementsInMemory": 2000, "maxElementsOnDisk": 1000, "name": "errorcodes", "overflowToDisk": true, "persistent": false, "skipCacheIfElementSizeInKBExceeds": 512 } EOF createTargetServer(){ BODY="$1" curl -v -X POST \ -H "Content-Type: application/json" \ -u $USER \ $MGMTSVR/v1/organizations/$ORG/environments/$ENV/targetservers \ -d "$BODY" } # Create keystore curl -v -X POST \ -H "Content-Type: application/json" \ -u $USER \ $MGMTSVR/v1/organizations/$ORG/environments/$ENV/keystores \ -d @- << EOF { "name": "OpenAPITruststore" } EOF # Import certificate curl -v -X POST \ -H "Content-Type: multipart/form-data" \ -F file="@Cert.pem" \ -u $USER \ $MGMTSVR/v1/organizations/$ORG/environments/$ENV/keystores/Truststore/certs?alias=Cert \ # Create Target Servers createTargetServer "$(cat <<- EOF { "name" : "SERVER", "host" : "10.10.10.10", "isEnabled" : true, "port": 9001 } EOF )" createTargetServer "$(cat <<- EOF { "name" : "BaaS", "host" : "10.10.10.12", "isEnabled" : true, "port": 8080 } EOF )" createTargetServer "$(cat <<- EOF { "name" : "Transactions", "host" : "10.10.10.06", "isEnabled" : true, "port": 40006, "sSLInfo": { "enabled": true, "clientAuthEnabled": "false", "trustStore": "Truststore", "keyAlias": "Cert" } } EOF )" createTargetServer "$(cat <<- EOF { "name" : "SERVER", "host" : "10.119.5.108", "isEnabled" : true, "port": 40007, "sSLInfo": { "enabled": true, "clientAuthEnabled": "false", "trustStore": "Truststore", "keyAlias": "Cert" } } EOF )" createTargetServer "$(cat <<- EOF { "name" : "SERVER", "host" : "10.10.10.14", "isEnabled" : true, "port": 40002, "sSLInfo": { "enabled": true, "clientAuthEnabled": "false", "trustStore": "Truststore", "keyAlias": "Cert" } } EOF )" createTargetServer "$(cat <<- EOF { "name" : "SERVER", "host" : "10.10.10.16", "isEnabled" : true, "port": 40003, "sSLInfo": { "enabled": true, "clientAuthEnabled": "false", "trustStore": "Truststore", "keyAlias": "Cert" } } EOF )" # List Target Servers curl -X GET \ -u $USER \ $MGMTSVR/v1/organizations/$ORG/environments/$ENV/targetservers #