DimensionDataResearch / didata_cli

Command-line interface for Dimension Data CloudControl
https://developer.dimensiondata.com/
Apache License 2.0
2 stars 1 forks source link

API v2.4 support #1

Open tintoy opened 7 years ago

tintoy commented 7 years ago

Copied from DimensionDataDevOps/didata_cli#35.

tintoy commented 7 years ago

@airmetal - I finally have some time to work on this. What functionality are you after?

airmetal commented 7 years ago

I can start with the one my colleague was struggling with. Ability to bulk load users from a CSV file. Also bring it to parity with some of the 2.4 key features around clusters, NGOC and network operations. Thanks again

tintoy commented 7 years ago

@airmetal - as far as I can tell, there's no CloudControl API for bulk user-creation, but there is an API for one-by-one user creation which could be called for each user to be created.

Add Sub-Administrator Account (with Phone Number)

Adds a new Sub-Administrator Account to the organisation.

The account is created with a set of roles defining the level of access to the organisation’s Cloud resources or the account can be created as “read only”, restricted to just viewing Cloud resources and unable to generate Cloud Reports.

Request Details

URL: https://<Cloud API URL>/oec/0.9/{org-id}/accountWithPhoneNumber Method: POST

Body:

<AccountWithPhoneNumber xmlns="http://oec.api.opsource.net/schemas/directory">
    <!-- required, string, max 32 characters, valid characters A-Z, a-z, 0-9, ".", "-" and "_". First character cannot be "-"" -->
    <userName>smorris</userName>
    <!-- required, string, max 75 characters -->
    <fullName>Stuart Morris</fullName>
    <!-- required, string, max 75 characters -->
    <firstName>Stuart</firstName>
    <!-- required, string, max 75 characters -->
    <lastName>Morris</lastName>
    <!-- required, string, see above for restrictions -->
    <password>GdP$@$w2rd</password>
    <!-- required, string, max 75 characters, valid email address -->
    <emailAddress>smorris@example.com</emailAddress>
    <phoneCountryCode>1</phoneCountryCode>
    <phoneNumber>20232322232</phoneNumber>
    <!-- optional, string, max 255 characters -->
    <department>Research and Development</department>
    <!-- optional, string, max 255 characters -->
    <customDefined1></customDefined1>
    <!-- optional, string, max 255 characters -->
    <customDefined2></customDefined2>
    <!-- required, string, must match the orgId on the request URL -->
    <orgId>657e0d5c-61ca-48ed-a6a3-c50ba75ebced</orgId>
    <!-- optional, none or "read only" creates a user with read only access-->
    <!-- include any of the following to give the user the given role -->
    <roles>
        <role>
            <!-- enables the user to create, manage & remove network resources -->
            <name>network</name>
        </role>
        <role>
            <!-- enables the user to create, manage & remove server resources -->
            <name>server</name>
        </role>
        <role>
            <!-- enables the user to enable, manage & disable backup services-->
            <name>backup</name>
        </role>
        <role>
            <!-- enables the user to create, manage & remove customer image -->
            <name>create image</name>
        </role>
        <role>
            <!-- enables the user to create, manage & remove Cloud Files accounts -->
            <name>storage</name>
        </role>
        <role>
            <!-- enables the user to view Reports -->
            <name>reports</name>
        </role>
        <role>
            <!-- enables the user to manage Tagging. Refer to API 2.2 (or greater) documentation for the Tagging API. -->
            <name>tag</name>
        </role>
    </roles>
</AccountWithPhoneNumber>

Response body

<Status>
    <operation>Add Account</operation>
    <result>SUCCESS</result>
    <resultDetail>Account smorris created</resultDetail>
    <resultCode>REASON_0</resultCode>
</Status>

Fault codes

HTTP Code Reason Code Description
400 (Error) REASON_10 Unexpected Error – Integration.
400 (Error) REASON_100 {org-id} invalid (does not match credentials).
400 (Error) REASON_120 Username already exists (must be unique).
400 (Error) REASON_121 Invalid Username (check allowed characters).
400 (Error) REASON_122 Invalid Password.
400 (Error) REASON_123 Invalid Roles (check rules above).
400 (Error) REASON_320 in request body does not match {org-id} on URL.
tintoy commented 7 years ago

From memory it won't be fast though - I believe CloudControl contacts all datacenters available to the user's organisation each time you create or modify a user. Might be able to parallelise requests though.

airmetal commented 7 years ago

Yeah recall that. I used a legacy version of this. Anyway I have this functionality in a web client now. But thanks for looking into it. Perhaps as you stated we just need to create inventory of what's available in the CLI and then determine what remains to be added to replicate the Cloud Control UI.

tintoy commented 7 years ago

Sure, no worries.

On 17 Feb 2017, at 8:36 AM, Andrew Das notifications@github.com<mailto:notifications@github.com> wrote:

Yeah recall that. I used a legacy version of this. Anyway I have this functionality in a web client now. But thanks for looking into it. Perhaps as you stated we just need to create inventory of what's available in the CLI and then determine what remains to be added to replicate the Cloud Control UI.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/DimensionDataResearch/didata_cli/issues/1#issuecomment-280468703, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABkezJ23Ny5wiV97fi2uLRlWXjBHCR5vks5rdMFGgaJpZM4LOqBn.

itevomcid