CasC bundle management on Operations Center

The CasC bundle management on Operations Center CLI commands allow users to view the master paths and tokens for all CasC bundles on an Operations Center. They also allow users to assign master paths and regenerate tokens.

Authentication and authorization

To access the Jenkins CLI tool you need to set up authentication with SSL or using an API token.

Administrator permissions are required for authorization.

Commands

Table 1. Commands
Command Description Parameters

casc-bundle-list

Lists all of the available CasC bundles on the Operations Center.

None.

casc-bundle-regenerate-token -b (--bundle-id) <bundle id>

Regenerates the token and returns the new bundle information when successful.

  • Name: bundle-id

    • Parameter type: Query string parameter

    • Data type: string

    • Description: The name of the file that contains the CasC bundle. Ex. casc-bundle-java

casc-bundle-set-master -b (--bundle-id) <bundle id> -m (--master-path) <master path>

Assigns a new master path and returns the new bundle information when successful.

  • Name: bundle-id

    • Parameter type: Query string parameter

    • Data type: string

    • Description: The bundle id is the name of the file that contains the CasC bundle. Ex. casc-bundle-java.

  • Name: master-path

    • Parameter type: Query string parameter

    • Data type: string

    • Description: The Master Path attribute is the full path of the master item in Operations Center. Ex. folder1/mm-example-casc.

Command examples

Table 2. Command examples
Command Command example

casc-bundle-list

java -jar jenkins-cli.jar -auth admin:rG57xFa2eFrCeWjG4NKU5QMJeW9TzfSkym -s https://my-operation-center.com/cjoc/ -webSocket casc-bundle-list

casc-bundle-regenerate-token -b (--bundle-id) <bundle id>

java -jar jenkins-cli.jar -auth admin:rG57xFa2eFrCeWjG4NKU5QMJeW9TzfSkym -s https://my-operation-center.com/cjoc/ -webSocket casc-bundle-regenerate-token -b casc-bundle-java

casc-bundle-set-master -b (--bundle-id) <bundle id> -m (--master-path) <master path>

java -jar jenkins-cli.jar -auth admin:rG57xFa2eFrCeWjG4NKU5QMJeW9TzfSkym -s https://my-operation-center.com/cjoc/ -webSocket casc-bundle-set-master -b casc-bundle-java -m /new/new-path
In the command examples "admin" is the name of the user attempting to send the request and "https://my-operations-center.com/cjoc/" is the url for the Operations Center. These examples authenticate using an API token.

Response examples

casc-bundle-list casc-bundle-regenerate-token -b (--bundle-id) <bundle id> casc-bundle-set-master -b (--bundle-id) <bundle id> -m (--master-path) <master path>
{
    "bundles":[
        {
            "linkFileContent":"url: \"https://my-operation-center.com/cjoc/config-bundle/casc-bundle-java\"\ntoken: \"048f49a4-3b37-4ccf-b536-0cc7a3b148d5\"\n",
            "masterPath":"/controllers/path",
            "name":"casc-bundle-java",
            "url":"https://my-operation-center.com/cjoc/config-bundle/casc-bundle-java",
            "token":"048f49a4-3b37-4ccf-b536-0cc7a3b148d5"
        }
    ]
}
{
    "linkFileContent":"url: \"https://my-operation-center.com/config-bundle/casc-bundle-java\"\ntoken: \"e33d986f-b11b-43c2-8d20-8109854241e0\"\n",
    "masterPath":"/new/path",
    "name":"casc-bundle-java",
    "url":"https://my-operation-center.com/config-bundle/casc-bundle-java",
    "token":"e33d986f-b11b-43c2-8d20-8109854241e0"
}
{
    "linkFileContent": "url: \"https://my-operation-center.com/config-bundle/casc-bundle-java\"\ntoken: \"4b0c02cc-6a7f-4bab-8d8f-38e98684994d\"\n",
    "masterPath":"/My-new/path",
    "name":"casc-bundle-java",
    "url":"https://my-operation-center.com/config-bundle/casc-bundle-java",
    "token":"4b0c02cc-6a7f-4bab-8d8f-38e98684994d"}
Response examples are formatted for better readability.

Response model

Table 3. Response model
Element Type Description

bundles

array of objects

List of all bundles available on an Operations Center.

linkFileContent

string

Contains two entries in string format wrapped in quotes and separated by newline characters: url and token. The url is the the bundle URL where Operations Center exposes its content. The token is the access token for the bundle.

masterPath

string

The Master Path attribute is the full path of the master item in Operations Center. Ex. folder1/mm-example-casc.

name

string

The name is the name of the file that contains the CasC bundle. Ex. casc-bundle-java.

url

string

The url is the bundle URL where Operations Center exposes its content.

token

string

The token is the access token for the bundle.

Status and exit codes

Table 4. Status and exit codes
Code Description

0

Success

6

Not authorized. Administrator permission required.

3

The provided parameter (bundle id or master-path) does not match with the available bundles.