Preview a consumer definition

Ops Center Analyzer REST API Reference Guide

Version
11.0.x
Audience
anonymous
Part Number
MK-99ANA003-18

You can preview a result of consumer auto creation for a consumer definition.

Execution permission

Admin

Request line

POST baseURL/v1/objects/GroupsDefinition/{id}/actions/preview/invoke

Request body

The structure of the request body and the object attributes are as follows:

Action

{
        "name":"...",
        "href":"...",
        "method":"...",
        "type":"...",
        "parameters":["...", ...]
}

Action (Type: Action)

Attribute

Type

Description

name

string

Name of the action.

href

string

URL for the action.

method

string

Name of the method.

type

string

Data format for the object.

parameters

anyType[]

A list of objects necessary to execute an operation. No value is set.

Response body

The structure of the response body and the object attributes is as follows:

Job

{
        "instanceID":"...",
        "created":"...",
        "updated":"...",
        "completed":"...",
        "state":"...",
        "affectedResource":["...", ...],
        "result":["...", ...]
}

Job (Type: Job)

Attribute

Type

Description

instanceID

string

ID of the Instance.

created

string

Date the object is generated in "yyyy-mm-ddThh:mm:ss.mmmTZD" format (e.g., 2017-08-25T20:07:39.472+09:00).

updated

string

Time the object is updated in "yyyy-mm-ddThh:mm:ss.mmmTZD" format (e.g., 2017-08-25T20:07:39.472+09:00).

completed

string

Time the processing completed in "yyyy-mm-ddThh:mm:ss.mmmTZD" format (e.g., 2017-08-25T20:07:39.472+09:00).

state

string

One of the following values is set:

"failed": The operation failed.

"success": The operation completed successfully.

affectedResource

string[]

A blank space is set.

result

anyType[]

A list of ConsumerDefinitionPreviewResponse objects. For details, see the table below.

ConsumerDefinitionPreviewResponse

{
        "totalConsumer":"...",
        "existingConsumer":"...",
        "largestResource":"...",
        "previewConsumerList":[{
            "consumerName":"...",
            "baseSample":"...",
            "count":"...",
            "type":"...",
            "grade":"..."
        },
        :
        ],
        "isSubmittable":"...",
        "errorMessage":"..."
}

ConsumerDefinitionPreviewResponse (Type: ConsumerDefinitionPreviewResponse)

Attribute

Type

Description

totalConsumer

int

The number of new consumers to create.

existingConsumer

int

The number of consumers that already exist.

largestResource

int

Largest number of resources per consumer.

previewConsumerList

ConsumerDefinitionPreviewConsumer[]

A list of consumers created by specified parameters.

isSubmittable

boolean

Whether user can submit consumer auto creation.

errorMessage

string

Error message.

previewConsumerList (Type: ConsumerDefinitionPreviewConsumer)

Attribute

Type

Description

consumerName

string

Name of the consumer.

baseSample

string

Sample base parameters of resources that are assigned to.

count

int

Number of resources assigned to the consumer.

type

enum

Whether the consumer is new or existing.

(For details about the valid values, see the table ConsumerExistenceType in List of enumerators.)

grade

string

Grade of consumer.

Status codes

Status code

Reason phrase

Description

200

OK

Success.

400

Bad Request

The format of the request body is invalid.

401

Unauthorized

No login privilege.

403

Forbidden

No execute privilege.

412

Precondition Failed

The server is not available.

500

Internal Server Error

Server processing error.

Example code

[Request Header]
POST Analytics/v1/objects/GroupsDefinition/consumerDefinition%23786722c0-24c0-44ac-b436-cb4d4e52c564/actions/preview/invoke
authorization:
Basic c3lzdGVtOm1hbmFnZXI=
Host: localhost:22015
Accept: application/json
Content-Type: application/json

[Request Body]
{
  "name": "preview",
  "href": "http://localhost:22015/Analytics/v1/objects/GroupsDefinition/consumerDefinition%23786722c0%2d24c0%2d44ac%2db436%2dcb4d4e52c564/actions/preview/invoke",
  "method": "POST",
  "type": "application/json",
  "parameters": []
}

[Response Header]
HTTP/1.1 200 OK
date: Fri, 01 Apr 2022 02:36:22 GMT
server: CosminexusComponentContainer
cache-control: no-cache, must-revalidate, private, max-age=0
www-authenticate: HSSO 27fe10c5c21c92b222d62ab1f9b9fb4640758da2_Wm0HGnlmckFqXXwA_V0810
content-type: application/json
content-length: 544
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
content-security-policy: frame-ancestors 'self'

[Response Body]
{
  "instanceID" : "1479050e-5198-4185-925f-5eaf5d543ce4",
  "created" : "2022-03-31T19:36:22.899-07:00",
  "updated" : "2022-03-31T19:36:22.899-07:00",
  "completed" : "2022-03-31T19:36:22.899-07:00",
  "state" : "success",
  "affectedResource" : [ ],
  "result" : [ {
    "totalConsumer" : 1,
    "existingConsumer" : 0,
    "largestResource" : 40,
    "previewConsumerList" : [ {
      "consumerName" : "_A_HostGroup",
      "baseSample" : "HostGroup-1A001",
      "count" : 40,
      "type" : "New",
      "grade" : "Bronze"
    } ]
  } ]
}