Enable, Disable, or Delete an Access Rule
/paas/api/v1.1/instancemgmt/{identityDomainId}/services/MySQLCS/instances/{serviceId}/accessrules/{ruleName}
Request
- application/json
-
identityDomainId: string
Name of the identity domain for the MySQL Cloud Service account.
-
ruleName: string
Name of the access rule to enable, disable, or delete. Must start with a letter, followed by letters, numbers, hyphens, or underscores. Must not exceed 50 characters, and is unique to the service.
-
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
-
operation:
string
Type of operation to perform on the access rule. Valid values are:
update
(to disable or enable a rule) anddelete
(to delete a rule). -
status(optional):
string
State of the access rule to update to. This attribute is required only when you disable or enable a rule. Valid values are
disabled
orenabled
.
Response
- application/json
200 Response
object
-
description(optional):
string
Description of the rule.
-
destination(optional):
string
The service component to allow traffic to. For example,
mysql_MASTER
. -
ports(optional):
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(optional):
string
Name of the rule.
-
ruleType(optional):
string
Type of rule. For example,
SYSTEM
,DEFAULT
, orUSER
. -
source(optional):
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
.
202 Response
object
-
description(optional):
string
Description of the rule.
-
destination(optional):
string
The service component to allow traffic to. For example,
mysql_MASTER
. -
ports(optional):
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(optional):
string
Name of the rule.
-
ruleType(optional):
string
Type of rule. For example,
SYSTEM
,DEFAULT
, orUSER
. -
source(optional):
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
.
Examples
The following example shows how to enable a rule by submitting a PUT 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 updates an access rule named ora_p2admin_mysql
by enabling it.
curl -i -X PUT \ -u "username:password" \ -H "X-ID-TENANT-NAME: ExampleIdentityDomain" \ -d '{"operation":"update","status":"enabled"}' \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ https://rest_server_url/paas/api/v1.1/instancemgmt/ExampleIdentityDomain/services/MySQLCS/instances/MyTestInstance/accessrules/ora_p2admin_mysql
Example of Response Header
The following shows an example of the response header.
HTTP/1.1 200 OK
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: 1p2050uI5Gl0003i0HB00x4RW9Ep65Sd0F
X-ORACLE-DMS-ECID: 1p2050uI5Gl0003i0HB00x4RW9Ep65Sd0F
Access-Control-Allow-Origin: *
X-Frame-Options: DENY
Content-Type: application/json
Vary: user-agent
Date: Thu, 24 Nov 2016 02:35:54 GMT
Content-Length: 211
Connection: keep-alive
Example of Response Body
The following shows an example of the response body in JSON format.
{
"ruleName": "ora_p2admin_mysql",
"description": "Permit public access to MySQL port",
"status": "enabled",
"source": "PUBLIC-INTERNET",
"destination": "mysql_MASTER",
"ports": "3306",
"protocol": "tcp",
"ruleType": "DEFAULT"
}