Chilkat Online Tools

TCL / Core Services API / ConnectLocalPeeringGateways

Back to Collection Items

load ./chilkat.dll

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

set http [new_CkHttp]

# Use this online tool to generate code from sample JSON: Generate Code to Create JSON

# The following JSON is sent in the request body.

# {
#   "peerId": "exercitation"
# }

set json [new_CkJsonObject]

CkJsonObject_UpdateString $json "peerId" "exercitation"

CkHttp_SetRequestHeader $http "Content-Type" "application/json"
CkHttp_SetRequestHeader $http "x-content-sha256" "{{content_sha256}}"
CkHttp_SetRequestHeader $http "Authorization" "{{signature}}"
CkHttp_SetRequestHeader $http "Date" "{{date}}"

# resp is a CkHttpResponse
set resp [CkHttp_PostJson3 $http "https://iaas.{{region}}.oraclecloud.com/20160918/localPeeringGateways/:localPeeringGatewayId/actions/connect" "application/json" $json]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkJsonObject $json
    exit
}

set respStatusCode [CkHttpResponse_get_StatusCode $resp]
puts "Response Status Code = $respStatusCode"
if {$respStatusCode != 204} then {
    puts "Response Header:"
    puts [CkHttpResponse_header $resp]
    puts "Response Body:"
    puts [CkHttpResponse_bodyStr $resp]
    puts "Failed."
    delete_CkHttpResponse $resp

    delete_CkHttp $http
    delete_CkJsonObject $json
    exit
}

delete_CkHttpResponse $resp

puts "Success."

delete_CkHttp $http
delete_CkJsonObject $json

Curl Command

curl -X POST
	-H "Content-Type: application/json"
	-H "Date: {{date}}"
	-H "Authorization: {{signature}}"
	-H "x-content-sha256: {{content_sha256}}"
	-d '{
    "peerId": "exercitation"
}'
https://iaas.{{region}}.oraclecloud.com/20160918/localPeeringGateways/:localPeeringGatewayId/actions/connect

Postman Collection Item JSON

{
  "name": "ConnectLocalPeeringGateways",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      },
      {
        "key": "Date",
        "value": "{{date}}",
        "description": "(Required) Current Date",
        "type": "text"
      },
      {
        "key": "Authorization",
        "value": "{{signature}}",
        "description": "(Required) Signature Authentication on Authorization header",
        "type": "text"
      },
      {
        "key": "x-content-sha256",
        "value": "{{content_sha256}}",
        "description": "(Required) Content sha256 for POST, PUT and PATCH operations",
        "type": "text"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"peerId\": \"exercitation\"\n}"
    },
    "url": {
      "raw": "{{baseUrl}}/localPeeringGateways/:localPeeringGatewayId/actions/connect",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "localPeeringGateways",
        ":localPeeringGatewayId",
        "actions",
        "connect"
      ],
      "variable": [
        {
          "key": "localPeeringGatewayId",
          "value": "amet ut",
          "description": "(Required) The [OCID](/Content/General/Concepts/identifiers.htm) of the local peering gateway."
        }
      ]
    },
    "description": "Connects this local peering gateway (LPG) to another one in the same region.\n\nThis operation must be called by the VCN administrator who is designated as\nthe *requestor* in the peering relationship. The *acceptor* must implement\nan Identity and Access Management (IAM) policy that gives the requestor permission\nto connect to LPGs in the acceptor's compartment. Without that permission, this\noperation will fail. For more information, see\n[VCN Peering](/iaas/Content/Network/Tasks/VCNpeering.htm).\n"
  },
  "response": [
    {
      "name": "The connect request was accepted and a peering is being established.",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"peerId\": \"exercitation\"\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/localPeeringGateways/:localPeeringGatewayId/actions/connect",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "localPeeringGateways",
            ":localPeeringGatewayId",
            "actions",
            "connect"
          ],
          "variable": [
            {
              "key": "localPeeringGatewayId"
            }
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Bad Request",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"peerId\": \"exercitation\"\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/localPeeringGateways/:localPeeringGatewayId/actions/connect",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "localPeeringGateways",
            ":localPeeringGatewayId",
            "actions",
            "connect"
          ],
          "variable": [
            {
              "key": "localPeeringGatewayId"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    },
    {
      "name": "Unauthorized",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"peerId\": \"exercitation\"\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/localPeeringGateways/:localPeeringGatewayId/actions/connect",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "localPeeringGateways",
            ":localPeeringGatewayId",
            "actions",
            "connect"
          ],
          "variable": [
            {
              "key": "localPeeringGatewayId"
            }
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    },
    {
      "name": "Not Found",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"peerId\": \"exercitation\"\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/localPeeringGateways/:localPeeringGatewayId/actions/connect",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "localPeeringGateways",
            ":localPeeringGatewayId",
            "actions",
            "connect"
          ],
          "variable": [
            {
              "key": "localPeeringGatewayId"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    },
    {
      "name": "Conflict",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"peerId\": \"exercitation\"\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/localPeeringGateways/:localPeeringGatewayId/actions/connect",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "localPeeringGateways",
            ":localPeeringGatewayId",
            "actions",
            "connect"
          ],
          "variable": [
            {
              "key": "localPeeringGatewayId"
            }
          ]
        }
      },
      "status": "Conflict",
      "code": 409,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    },
    {
      "name": "Precondition Failed",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"peerId\": \"exercitation\"\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/localPeeringGateways/:localPeeringGatewayId/actions/connect",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "localPeeringGateways",
            ":localPeeringGatewayId",
            "actions",
            "connect"
          ],
          "variable": [
            {
              "key": "localPeeringGatewayId"
            }
          ]
        }
      },
      "status": "Precondition Failed",
      "code": 412,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    },
    {
      "name": "Internal Server Error",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"peerId\": \"exercitation\"\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/localPeeringGateways/:localPeeringGatewayId/actions/connect",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "localPeeringGateways",
            ":localPeeringGatewayId",
            "actions",
            "connect"
          ],
          "variable": [
            {
              "key": "localPeeringGatewayId"
            }
          ]
        }
      },
      "status": "Internal Server Error",
      "code": 500,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    },
    {
      "name": "An error has occurred.",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"peerId\": \"exercitation\"\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/localPeeringGateways/:localPeeringGatewayId/actions/connect",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "localPeeringGateways",
            ":localPeeringGatewayId",
            "actions",
            "connect"
          ],
          "variable": [
            {
              "key": "localPeeringGatewayId"
            }
          ]
        }
      },
      "status": "Internal Server Error",
      "code": 500,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "opc-request-id",
          "value": "officia sed",
          "description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
    }
  ]
}