{ "info": { "_postman_id": "6bcbcc33-d62b-4e4b-b37e-d0f91f9b4938", "name": "OpenVDS CI/CD v1.0", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "Configure collection", "item": [ { "name": "Refresh Token", "event": [ { "listen": "test", "script": { "exec": [ "// this snippet extracts the new access and id tokens", "// and puts them to environment variables", "cp = pm.environment.get(\"cloud_platform\");", "", "var data = JSON.parse(responseBody)", "pm.environment.set(\"access_token\", data.access_token);", "if (cp == \"AWS\" || cp == \"IBM\") {", " pm.environment.set(\"id_token\", data.id_token);", "}", "// Uncomment if server returns a new refresh_token,", "// otherwise comment out to prevent overwriting it with null", "if (cp == \"Azure\") {", " pm.environment.set(\"refresh_token\", data.refresh_token);", "}" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "noauth" }, "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/x-www-form-urlencoded" }, { "key": "Ocp-Apim-Subscription-Key", "type": "text", "value": "xxxxxxxx", "disabled": true } ], "body": { "mode": "urlencoded", "urlencoded": [ { "key": "grant_type", "value": "refresh_token", "type": "text" }, { "key": "client_id", "value": "{{CLIENT_ID}}", "description": "Supply your client id as an environment variable", "type": "text" }, { "key": "client_secret", "value": "{{CLIENT_SECRET}}", "description": "Supply your client secret as an environment variable", "type": "text" }, { "key": "refresh_token", "value": "{{refresh_token}}", "type": "text" }, { "key": "scope", "value": "{{Scope}}", "type": "text" } ] }, "url": { "raw": "{{Token_Fetch_URL}}", "host": [ "{{Token_Fetch_URL}}" ] } }, "response": [] } ] }, { "name": "OpenVDS", "item": [ { "name": "01 Legal - Create new Legal Tag for Well Copy", "event": [ { "listen": "prerequest", "script": { "exec": [ "pm.environment.set(\"tagName\", \"OpenVDS-Legal-Tag-Test\" + _.random(1, 9999999));", "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 201\", function () {", " pm.response.to.have.status(201);", "});", "/*pm.test(\"Status description - Created LegalTag successfully.\", function () {", " pm.response.to.have.status(\"Created LegalTag successfully.\");", "});*/", "", "", "//capture the legal tag name from response", "try {", " let resBody = pm.response.json();", "", " let createdLegaltagName = resBody.name;", " pm.environment.set(\"tagName\", createdLegaltagName);", " console.log(createdLegaltagName.length);", " tests[\"Leagal tag created: \" + createdLegaltagName] = createdLegaltagName.length > 1;", " }", "catch (e) {", " console.log(e.message);", "}" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "disabledSystemHeaders": {} }, "request": { "method": "POST", "header": [ { "key": "Content-Type", "type": "text", "value": "application/json" }, { "key": "data-partition-id", "type": "text", "value": "{{data-partition-id}}" } ], "body": { "mode": "raw", "raw": "{\n \"name\": \"{{tagName}}\",\n \"description\": \"Legal Tag added for OpenVDS\",\n \"properties\": {\n \"contractId\": \"123456\",\n \"countryOfOrigin\": [\n \"US\",\n \"CA\"\n ],\n \"dataType\": \"Third Party Data\",\n \"exportClassification\": \"EAR99\",\n \"originator\": \"Auto Test\",\n \"personalData\": \"No Personal Data\",\n \"securityClassification\": \"Private\",\n \"expirationDate\": \"2025-12-25\"\n }\n}" }, "url": { "raw": "https://{{LEGAL_HOST}}/legaltags", "protocol": "https", "host": [ "{{LEGAL_HOST}}" ], "path": [ "legaltags" ] } }, "response": [] }, { "name": "02 Legal - Retrieve the created legal tag Copy", "event": [ { "listen": "test", "script": { "exec": [ "// Ensure the API was able to send a successful response", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "pm.test(\"Status description - OK.\", function () {", " pm.response.to.have.status(\"OK\");", "});", "", "//Validate only retrieve one record", "/*responseJson = JSON.parse(responseBody);", "var list = responseBody.length;", "tests[\"Retrieve only one record\"] = list == 1;", "console.log(list);*/", "", "// Ensure the API returned content, and make sure the tag returned matches the tag created in the previous API call that created the tag", "pm.test(\"Proper legal tag returned? : \"+pm.variables.get(\"tagName\"), function () {", " var jsonData = pm.response.json();", " var legalTagName = pm.variables.get(\"tagName\");", " pm.expect(jsonData.name).to.equal(legalTagName);", "});", "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "description": "This value should be the desired data partition id.", "key": "data-partition-id", "type": "text", "value": "{{data-partition-id}}" }, { "key": "Accept", "value": "application/json", "type": "text" } ], "url": { "raw": "https://{{LEGAL_HOST}}/legaltags/{{tagName}}", "protocol": "https", "host": [ "{{LEGAL_HOST}}" ], "path": [ "legaltags", "{{tagName}}" ] } }, "response": [] }, { "name": "03 Create OpenVDS Workflow", "protocolProfileBehavior": { "disabledSystemHeaders": { "content-type": true } }, "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json", "type": "text" }, { "key": "data-partition-id", "value": "{{data-partition-id}}", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"description\": \"SegY To OpenVDS Conversion\",\n \"registrationInstructions\": {\n \"dagName\": \"openvds_import \"\n },\n \"workflowName\": \"openvds_import\"\n}" }, "url": { "raw": "https://{{WORKFLOW_URL}}/workflow", "protocol": "https", "host": [ "{{WORKFLOW_URL}}" ], "path": [ "workflow" ] } }, "response": [] }, { "name": "04 Get Storage Instructions - File", "event": [ { "listen": "test", "script": { "exec": [ "var data = JSON.parse(responseBody)\r", "var SignedURL = data.storageLocation.signedUrl;\r", "var UnsignedUrl = data.storageLocation.unsignedUrl;\r", "var signedUploadFileName = data.storageLocation.signedUploadFileName;\r", "pm.environment.set(\"SignedURL\", SignedURL);\r", "pm.environment.set(\"UnsignedUrl\", UnsignedUrl);\r", "pm.environment.set(\"SignedUploadFileName\", signedUploadFileName);" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "data-partition-id", "type": "text", "value": "{{data-partition-id}}" } ], "url": { "raw": "https://{{DATASET_HOST}}/getStorageInstructions?kindSubType=dataset--File.Generic", "protocol": "https", "host": [ "{{DATASET_HOST}}" ], "path": [ "getStorageInstructions" ], "query": [ { "key": "kindSubType", "value": "dataset--File.Generic" } ] } }, "response": [] }, { "name": "05 Upload Segy File", "request": { "auth": { "type": "noauth" }, "method": "PUT", "header": [], "body": { "mode": "file", "file": { "src": "" } }, "url": { "raw": "{{SignedURL}}", "host": [ "{{SignedURL}}" ] } }, "response": [] }, { "name": "06 Register SEGY Dataset - File", "event": [ { "listen": "test", "script": { "exec": [ "var data = JSON.parse(responseBody)\r", "var datasetRegistryId = data.datasetRegistries[0].id;\r", "pm.environment.set(\"SegyDatasetRegistryId\", datasetRegistryId);" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "cp = pm.environment.get(\"cloud_platform\");\r", "if (cp == \"Azure\") {\r", " pm.environment.set(\"New_OwnerDataGroup\", \"data.default.owner\");\r", " pm.environment.set(\"New_ViewerDataGroup\", \"data.default.viewer\");\r", "}\r", "else {\r", " pm.environment.set(\"New_OwnerDataGroup\", \"data.default.owners\");\r", " pm.environment.set(\"New_ViewerDataGroup\", \"data.default.viewers\");\r", "}\r", "" ], "type": "text/javascript" } } ], "request": { "method": "PUT", "header": [ { "key": "data-partition-id", "type": "text", "value": "{{data-partition-id}}" }, { "key": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"datasetRegistries\": [\n {\n \"id\": \"{{data-partition-id}}:dataset--File.Generic:{{$guid}}\",\n \"kind\": \"{{data-partition-id}}:{{schemaSource}}:dataset--File.Generic:1.0.0\",\n \"acl\": {\n \"viewers\": [\n \"{{New_ViewerDataGroup}}@{{data-partition-id}}{{domain}}\"\n ],\n \"owners\": [\n \"{{New_OwnerDataGroup}}@{{data-partition-id}}{{domain}}\"\n ]\n },\n \"legal\": {\n \"legaltags\": [\n \"{{tagName}}\"\n ],\n \"otherRelevantDataCountries\": [\n \"US\"\n ],\n \"status\": \"compliant\"\n },\n \"data\": {\n \"DatasetProperties\": {\n \"FileSourceInfo\": {\n \"FileSource\": \"{{UnsignedUrl}}{{SignedUploadFileName}}\",\n \"PreLoadFilePath\": \"\"\n }\n },\n \"ResourceSecurityClassification\": \"{{data-partition-id}}:reference-data--ResourceSecurityClassification:RESTRICTED:\"\n },\n \"meta\": [],\n \"tags\": {}\n }\n ]\n}" }, "url": { "raw": "https://{{DATASET_HOST}}/registerDataset", "protocol": "https", "host": [ "{{DATASET_HOST}}" ], "path": [ "registerDataset" ] } }, "response": [] }, { "name": "07 Get Retrieval Instructions (All types)", "event": [ { "listen": "test", "script": { "exec": [ "var data = JSON.parse(responseBody)\r", "var retrievalProperties = data.delivery[0].retrievalProperties;\r", "\r", "pm.environment.set(\"vdsInputConnectionStringRegion\", retrievalProperties.region);\r", "pm.environment.set(\"vdsInputConnectionStringAccessKeyId\", retrievalProperties.credentials.accessKeyId);\r", "pm.environment.set(\"vdsInputConnectionStringSecretAccessKey\", retrievalProperties.credentials.secretAccessKey);\r", "pm.environment.set(\"vdsInputConnectionStringSessionToken\", retrievalProperties.credentials.sessionToken);\r", "pm.environment.set(\"vdsInputConnectionStringExpiration\", retrievalProperties.credentials.expiration);\r", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "data-partition-id", "type": "text", "value": "{{data-partition-id}}" } ], "body": { "mode": "raw", "raw": "{\n \"datasetRegistryIds\": [\n \"{{SegyDatasetRegistryId}}\"\n ]\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://{{DATASET_HOST}}/getRetrievalInstructions", "protocol": "https", "host": [ "{{DATASET_HOST}}" ], "path": [ "getRetrievalInstructions" ] } }, "response": [] }, { "name": "08 Get Storage Instructions - File Collection", "event": [ { "listen": "test", "script": { "exec": [ "var data = JSON.parse(responseBody)\r", "var storageLocation = data.storageLocation;\r", "pm.environment.set(\"vdsUrlPath\", storageLocation.unsignedUrl);\r", "pm.environment.set(\"vdsUrlConnectionStringRegion\", storageLocation.region);\r", "pm.environment.set(\"vdsUrlConnectionStringAccessKeyId\", storageLocation.credentials.accessKeyId);\r", "pm.environment.set(\"vdsUrlConnectionStringSecretAccessKey\", storageLocation.credentials.secretAccessKey);\r", "pm.environment.set(\"vdsUrlConnectionStringSessionToken\", storageLocation.credentials.sessionToken);\r", "pm.environment.set(\"vdsUrlConnectionStringExpiration\", storageLocation.credentials.expiration);" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "data-partition-id", "type": "text", "value": "{{data-partition-id}}" } ], "url": { "raw": "https://{{DATASET_HOST}}/getStorageInstructions?kindSubType=dataset--FileCollection.Generic", "protocol": "https", "host": [ "{{DATASET_HOST}}" ], "path": [ "getStorageInstructions" ], "query": [ { "key": "kindSubType", "value": "dataset--FileCollection.Generic" } ] } }, "response": [] }, { "name": "09 Trigger OpenVDS Workflow", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", function() {\r", " var jsonData = pm.response.json();\r", " if (jsonData != null) {\r", " console.log(\"RunID: \", jsonData.runId)\r", " pm.collectionVariables.set(\"runId\", jsonData.runId);\r", " }\r", " else {\r", " pm.collectionVariables.set(\"runId\", null);\r", " }\r", " pm.collectionVariables.set(\"tries\", 0);\r", " pm.response.to.have.status(200);\r", "});" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "disabledSystemHeaders": { "content-type": true } }, "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json", "type": "text" }, { "key": "data-partition-id", "value": "{{data-partition-id}}", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"executionContext\": {\n \"url_connection\":\"Region={{vdsUrlConnectionStringRegion}};AccessKeyId={{vdsUrlConnectionStringAccessKeyId}};SecretKey={{vdsUrlConnectionStringSecretAccessKey}};SessionToken={{vdsUrlConnectionStringSessionToken}};Expiration={{vdsUrlConnectionStringExpiration}}\",\n \"input_connection\":\"Region={{vdsInputConnectionStringRegion}};AccessKeyId={{vdsInputConnectionStringAccessKeyId}};SecretKey={{vdsInputConnectionStringSecretAccessKey}};SessionToken={{vdsInputConnectionStringSessionToken}};Expiration={{vdsInputConnectionStringExpiration}}\",\n \"segy_file\":\"s3://561735291427-r3m5-artifacts-ohio/volve/seismic/st0202/stacks/ST0202R08_PS_PSDM_RAW_PP_TIME.MIG_RAW.POST_STACK.3D.JS-017534.segy\",\n \"url\":\"{{vdsUrlPath}}\"\n \n } \n}\n" }, "url": { "raw": "https://{{WORKFLOW_URL}}/workflow/openvds_import/workflowRun", "protocol": "https", "host": [ "{{WORKFLOW_URL}}" ], "path": [ "workflow", "openvds_import", "workflowRun" ] } }, "response": [] }, { "name": "10 Get OpenVDS Run Status", "event": [ { "listen": "test", "script": { "exec": [ "// Ensure the API was able to send a successful response\r", "pm.test(\"Status code is 200\", function () {\r", " pm.response.to.have.status(200);\r", "});\r", "pm.test(\"Status description - OK.\", function () {\r", " pm.response.to.have.status(\"OK\");\r", "});\r", "\r", "maxNumberOfTries = pm.environment.get(\"NumOfIterForDagStatus\"); // max number of tries\r", "sleepBetweenTries = pm.environment.get(\"sleepIntervalBetweenAttempts\"); // your interval between attempts\r", "\r", "try{\r", " local_tries = pm.collectionVariables.get(\"tries\");\r", " if (local_tries == null)\r", " pm.collectionVariables.set(\"tries\", 0);\r", " console.log(\"num of tries: \", pm.collectionVariables.get(\"tries\"))\r", " const jsonData = pm.response.json();\r", " if (( (jsonData.status == \"running\") || (jsonData.status == \"submitted\") ) && (pm.collectionVariables.get(\"tries\") < maxNumberOfTries)) {\r", " console.log(\"Status: \", jsonData.status);\r", " var tries = parseInt(pm.collectionVariables.get(\"tries\"), 10);\r", " pm.collectionVariables.set(\"tries\", tries + 1);\r", " console.log(\"num of tries: \", pm.collectionVariables.get(\"tries\"));\r", " setTimeout(function() {}, sleepBetweenTries);\r", " console.log(tries);\r", " postman.setNextRequest(\"10 Get OpenVDS Run Status\");\r", " } else {\r", " pm.collectionVariables.unset(\"tries\");\r", " console.log(\"Completed running with status: \", jsonData.status);\r", " pm.collectionVariables.set(\"ingestStatus\", jsonData.status);\r", "}\r", "}catch (e) {\r", " console.log(e.message);\r", "}" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "disabledSystemHeaders": { "content-type": true } }, "request": { "method": "GET", "header": [ { "key": "Content-Type", "value": "application/json", "type": "text" }, { "key": "data-partition-id", "value": "{{data-partition-id}}", "type": "text" } ], "url": { "raw": "https://{{WORKFLOW_URL}}/workflow/openvds_import/workflowRun/{{runId}}", "protocol": "https", "host": [ "{{WORKFLOW_URL}}" ], "path": [ "workflow", "openvds_import", "workflowRun", "{{runId}}" ] } }, "response": [] }, { "name": "11 Query Data", "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" }, { "key": "data-partition-id", "type": "text", "value": "{{data-partition-id}}" }, { "key": "account-id", "type": "text", "value": "common", "disabled": true } ], "body": { "mode": "raw", "raw": "{\r\n\t\"kind\": \"{{data-partition-id}}:{{schemaSource}}:reference-data--ContractorType:1.0.0\"\r\n}\r\n" }, "url": { "raw": "https://{{SEARCH_HOST}}/query", "protocol": "https", "host": [ "{{SEARCH_HOST}}" ], "path": [ "query" ] } }, "response": [] } ] } ], "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ], "variable": [ { "key": "runId", "value": "" }, { "key": "tries", "value": "" } ] }