Add an Access Rule
/paas/api/v1.1/instancemgmt/{identityDomainId}/services/MySQLCS/instances/{serviceId}/accessrules
Request
- application/json
-
identityDomainId: string
Name of the identity domain for the MySQL Cloud Service account.
-
serviceId: string
The user-defined name of the Oracle MySQL Cloud Service instance.
-
X-ID-TENANT-NAME: string
Name of the identity domain for the MySQL Cloud Service account.
object
-
description(optional):
string
Description of the rule.
-
destination:
string
The service component to allow traffic to. For example,
mysql_MASTER
. -
ports:
string
Ports for the rule. This can be a single port or a port range.
-
protocol(optional):
string
Communication protocol for the rule. For example,
tcp
. -
ruleName:
string
Name of the rule.
-
ruleType(optional):
string
Type of rule. For example,
SYSTEM
,DEFAULT
, orUSER
. -
source:
string
The hosts from which traffic is allowed. For example,
PUBLIC-INTERNET
for any host on the Internet, a single IP address or a comma-separated list of subnets (in CIDR format) or IPv4 addresses. -
status(optional):
string
Status of the rule. Valid value:
disabled
orenabled
.
Response
- application/json
202 Response
Examples
The following example shows how to create an access rule by submitting a POST request on the REST endpoint using cURL
Note: The command in this example uses the URL structure https://rest_server_url/resource-path
, where rest_server_url
is the Oracle Public Cloud or Oracle Cloud Machine REST server to contact for your identity domain or tenant name. See Send Requests for the appropriate URL structure to use on Oracle Public Cloud or Oracle Cloud Machine.
cURL Command
The following example creates a new access rule named my_test_rule
.
curl -i -X POST \ -u "username:password" \ -H "X-ID-TENANT-NAME: ExampleIdentityDomain" \ -d '{"ruleName":"my_test_rule","ruleType":"USER","description":"","source":"PUBLIC-INTERNET","destination":"mysql_MASTER","ports":"3308","protocol":"tcp","status":"disabled"}' \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ https://rest_server_url/paas/api/v1.1/instancemgmt/ExampleIdentityDomain/services/MySQLCS/instances/MyTestInstance/accessrules
The request body passed into curl's -d parameter is:
{ "ruleName":"my_test_rule", "ruleType":"USER", "description":"", "source":"PUBLIC-INTERNET", "destination":"mysql_MASTER", "ports":"3308", "protocol":"tcp", "status":"disabled" }
Example of Response Header
The following shows an example of the response header.
HTTP/1.1 202 Accepted
Server: Oracle-Application-Server-11g
Content-Language: en
Access-Control-Allow-Headers: Content-Type, api_key, Authorization
Access-Control-Allow-Methods: GET, POST, DELETE, PUT, OPTIONS, HEAD
X-ORACLE-DMS-ECID: P0rRGFC00d5906Ez0iWspH505000Iu90^d
X-ORACLE-DMS-ECID: P0rRGFC00d5906Ez0iWspH505000Iu90^d
Access-Control-Allow-Origin: *
X-Frame-Options: DENY
Content-Type: application/json
Vary: user-agent
Date: Thu, 24 Nov 2016 03:01:17 GMT
Connection: close
Example of Response Body
The following shows an example of the response body.
null