Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## create tag namespace
- ubuntu@FAKELES-7310:~/$ oci raw-request --http-method POST --target-uri https://identity.<region>.oraclecloud.com/20160918/tagNamespaces --request-body '{"compartmentId" : "ocid1.tenancy.oc1..<tenancy-id>","name" : "UseOCIResourceViewsOnAutonomous","description" : "Allow Autonomous database instances with this tag to use resource views"}'
- {
- "data": {
- "compartmentId": "ocid1.tenancy.oc1..<tenancy-id>",
- "definedTags": {
- "Oracle-Tags": {
- "CreatedBy": "default/<my-email>@oracle.com",
- "CreatedOn": "2023-05-16T18:29:29.505Z"
- }
- },
- "description": "Allow Autonomous database instances with this tag to use resource views",
- "freeformTags": {},
- "id": "ocid1.tagnamespace.oc1..<tagnamespace-id>",
- "isRetired": false,
- "lifecycleState": "ACTIVE",
- "locks": [],
- "name": "UseOCIResourceViewsOnAutonomous",
- "systemTags": {},
- "timeCreated": "2023-05-16T18:29:29.624Z"
- },
- "headers": {
- "Content-Length": "568",
- "Content-Type": "application/json",
- "Date": "Tue, 16 May 2023 18:29:29 GMT",
- "ETag": "655553e5ae32aad0c311a7ecc0c663298be5d1af",
- "Location": "https://tagging-control-plane.svc.ad1.<region>/20160918/tagNamespaces/ocid1.tagnamespace.oc1..<tagnamespace-id>",
- "X-Content-Type-Options": "nosniff",
- "opc-request-id": "3B18208D05D24C8C8D53479868ED7F1E/08847CD0B5018368B03C8AABBD3CC700/E02FA1EB97EAE2D330EA75457FEEC9FC"
- },
- "status": "200 OK"
- }
- ## create tag key
- ubuntu@FAKELES-7310:~/py-projects$ oci raw-request --http-method POST --target-uri https://identity.<region>.oraclecloud.com/20160918/tagNamespaces/ocid1.tagnamespace.oc1..<tagnamespace-id>/tags --request-body '{"name" : "Allowed","description" : "Allow using resource views","type" : "string","validator": {"validatorType": "ENUM","values": ["True","False"]}}'
- {
- "data": {
- "compartmentId": "ocid1.tenancy.oc1..<tenancy-id>",
- "definedTags": {
- "Oracle-Tags": {
- "CreatedBy": "default/<my-email>@oracle.com",
- "CreatedOn": "2023-05-16T18:31:21.630Z"
- }
- },
- "description": "Allow running commands",
- "freeformTags": {},
- "id": "ocid1.tagdefinition.oc1..<tagdefinition-id>",
- "isCostTracking": false,
- "isRetired": false,
- "lifecycleState": "ACTIVE",
- "locks": [],
- "name": "Allowed",
- "systemTags": {},
- "tagNamespaceId": "ocid1.tagnamespace.oc1..<tagnamespace-id>",
- "tagNamespaceName": "UseOCIResourceViewsOnAutonomous",
- "timeCreated": "2023-05-16T18:31:21.693Z",
- "validator": {
- "validatorType": "ENUM",
- "values": [
- "True",
- "False"
- ]
- }
- },
- "headers": {
- "Content-Length": "739",
- "Content-Type": "application/json",
- "Date": "Tue, 16 May 2023 18:31:21 GMT",
- "ETag": "1c8289ccec78729d558f95e4509c8ddfc6a03fc1",
- "Location": "https://tagging-control-plane.svc.ad2.<region>/20160918/tagNamespaces/ocid1.tagnamespace.oc1..<tagnamespace-id>/tags/ocid1.tagdefinition.oc1..<tagdefinition-id>",
- "X-Content-Type-Options": "nosniff",
- "opc-request-id": "69C16ADDD731431F946C113DAC1B5B45/26F6295599052BF19DB0CBDE7EED1D09/D1702FE635E03D742EFD62A95CCCBE84"
- },
- "status": "200 OK"
- }
- ## get autonomous database
- oci db autonomous-database get --autonomous-database-id ocid1.autonomousdatabase.oc1.<region>.<autonomousdatabase-id>
- ## update and add tags
- oci db autonomous-database update --autonomous-database-id ocid1.autonomousdatabase.oc1.<region>.<autonomousdatabase-id> --defined-tags '{"Oracle-Tags": {"CreatedBy": "default/<my-email>@oracle.com","CreatedOn": "2023-04-05T12:50:56.061Z"},"Schedule": {"WeekDay": "0,0,0,0,0,*,*,*,*,*,*,*,*,*,*,*,*,0,0,0,0,0,0,0","Weekend": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"},"UseOCIResourceViewsOnAutonomous":{"Allowed": "True"}}'
- ## create dynamic group
- oci iam dynamic-group create --compartment-id ocid1.tenancy.oc1..<tenancy-id> --description "Allow autonomous database instances with specific tags to use resource views " --name UseOCIResourceViewsDynamicGroup --matching-rule "tag.UseOCIResourceViewsOnAutonomous.Allowed.value='True'"
- ## update policy
- oci iam policy update --policy-id ocid1.policy.oc1..<policy-id> --statements '["Define tenancy usage-report as ocid1.tenancy.oc1..aaaaaaaaned4fkpkisbwjlr56u7cj63lf3wffbilvqknstgtvzub7vhqkggq","existing statement 1","existing statement 2","Endorse dynamic-group UseOCIResourceViewsDynamicGroup to read objects in tenancy usage-report","Allow dynamic-group UseOCIResourceViewsDynamicGroup to read buckets in tenancy","Allow dynamic-group UseOCIResourceViewsDynamicGroup to read autonomous-database in tenancy","Allow dynamic-group UseOCIResourceViewsDynamicGroup to read usage-budgets in tenancy"]' --version-date ''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement