Create oci tenancy

post

/appstore/publisher/v1/ocitenancies

Pre-requisite to create a tenancy.
Policy statements needs to be configured by Partner in their Tenancy to allow Marketplace to access required objects.
Navigation to create policy under Partner Tenancy.
OCI Console -> Identity -> Policies
1. Select root compartment in LHS Compartment drop-down.
2. Click the "Create Policy" button.
3. Fill the details in the Create Policy form
    3.1. Name - Policy Name (for example, Marketplace Service Policy)
    3.2. Description - Description for Policy
    3.3. Policy Versioning - Keep Policy Current
    3.4. Statement - Add the following policy statements
       i. ALLOW SERVICE marketplace to manage App-catalog-publisher-listing IN TENANCY
       ii. ALLOW SERVICE marketplace to read tenant IN TENANCY
       iii. ALLOW SERVICE marketplace to read compartments IN TENANCY
       iv. ALLOW SERVICE marketplace to inspect instance-images IN TENANCY
       v. ALLOW SERVICE marketplace to inspect instances IN TENANCY
4. Click the "Create" button.

Request

Supported Media Types
Query Parameters
Body ()
Root Schema : TenancyConfiguration
Type: object
Show Source
Nested Schema : AppCatalogSetting
Type: object
Show Source
Back to Top

Response

Supported Media Types

200 Response

Successful Operation
Body ()
Root Schema : acknowledgement
Type: object
Show Source

400 Response

Invalid Parameter Value

401 Response

Not Authorized

404 Response

Entity Not Found

500 Response

System Error
Back to Top

Examples

1. Create an OCI Tenancy Configuration

The following example creates a new OCI tenancy configuration, by submitting a POST request on the REST resource using cURL.

cURL Example

curl -X POST -H "X-Oracle-UserId: partner-email" -H "Authorization: Bearer Access-token" -H "Content-Type: application/json" -F "file=@file-path" -F "file=@file-path" -F "json=JSON-data-as-shown-in-following-example"  "https://ocm-apis.cloud.oracle.com/appstore/publisher/v1/ocitenancies"

Request Header

X-Oracle-UserId: fname.lname@oracle.com 
Authorization: Bearer Access-token 

Request Body

{  
   "tenancyName":"marketplace_dev",
   "tenancyOCID":"ocid1.tenancy.oc1..aaaaaaaavdytn45iavk7xwhirfjydmffne3zxae2kwlprhsm4aioi7c7pntq",
   "homeRegion":"IAD",
   "appCatalogSetting":{  
      "compartmentOCID":"ocid1.compartment.region1..aaaaaaaaelzb6xjh2zsebgziqnbsdva7sk4ngmfq3m3r2vcgwkss4efum7gq"
   }
}

HTTP Status Code:

200 OK

JSON Response:

{
    "message":"Tenancy created successfully.",
    "entityId":"15813902",
    "name":"Tenancy Id : 15813902"
}

2. Test an OCI Tenancy Configuration

The following example tests a new OCI tenancy configuration, by submitting a POST request on the REST resource using cURL.

cURL Example

curl -X POST -H "X-Oracle-UserId: partner-email" -H "Authorization: Bearer Access-token" -H "Content-Type: application/json" -F "file=@file-path" -F "file=@file-path" -F "json=JSON-data-as-shown-in-following-example"  "https://ocm-apis.cloud.oracle.com/appstore/publisher/v1/ocitenancies?action=test"

Request Header

X-Oracle-UserId: fname.lname@oracle.com 
Authorization: Bearer Access-token 

Request Body

{  
   "tenancyName":"marketplace_dev",
   "tenancyOCID":"ocid1.tenancy.oc1..aaaaaaaavdytn45iavk7xwhirfjydmffne3zxae2kwlprhsm4aioi7c7pntq",
   "homeRegion":"IAD",
   "appCatalogSetting":{  
      "compartmentOCID":"ocid1.compartment.region1..aaaaaaaaelzb6xjh2zsebgziqnbsdva7sk4ngmfq3m3r2vcgwkss4efum7gq"
   }
}

HTTP Status Code:

200 OK

JSON Response:

{
    "serviceTestResults":[
        { "actionOnResource":"read tenant", 
          "servicePolicy": "ALLOW SERVICE marketplace to read tenant IN TENANCY", 
          "result": "success" 
        },
        { "actionOnResource": "read compartments", 
          "servicePolicy": "ALLOW SERVICE marketplace to read compartments IN TENANCY", 
          "result": "success"
        },
        { "actionOnResource": "inspect instance-images", 
          "servicePolicy": "ALLOW SERVICE marketplace to inspect instance-images IN TENANCY", 
          "result": "success" 
        },
        { "actionOnResource": "inspect instances", 
          "servicePolicy": "ALLOW SERVICE marketplace to inspect instances IN TENANCY", 
          "result": "success" 
        },
        { "actionOnResource": "manage App-catalog-publisher-listing",
          "servicePolicy": "ALLOW SERVICE marketplace to manage App-catalog-publisher-listing IN TENANCY",
          "result": "fail",
          "message": "Invalid Compartment OCID or Service Policy",
          "error": "Authorization failed or requested resource not found."
        }
    ]
}

Back to Top