VMware Cloud Community
niall360
Contributor
Contributor
Jump to solution

Help - Adding vSAN adapter instance to vROps using REST APIs

Hello,

I am currently attempting to add a vSAN adapter instance to vROps using the REST APIs provided, however I can't seem to get the input format correct.

This is current input I have been trying, via postman:

{

     "name": "",

                "adapterKindKey": "VirtualAndPhysicalSANAdapter",

                "resourceKindKey": "VirtualAndPhysicalSANAdapter Instance",

                "description": "",

                "collectorId": "",

                "collectorGroupId": "",

                "monitoringInterval": 5,

                "resourceIdentifiers": [

                    {

                        "name": "AutoDiscovery",

                        "value": "true"

                    },

                    {

                        "name": "EnableCimApi",

                        "value": "false"

                    },

                    {

                        "name": "VCServer",

                        "value": ""

                    }

                ],

                "credential" : {

                     "id" : null,

                     "name" : "VC-Credential-2",

                     "adapterKindKey" : "VirtualAndPhysicalSANAdapter",

                     "credentialKindKey" : "PRINCIPALCREDENTIAL",

                     "fields" : [

                         {

                              "name" : "USER",

                              "value" : ""

                         },

                         {

                              "name" : "PASSWORD",

                              "value" : ""

                         }

                   ]

             }

}

With this input, I receive the following response:

{

    "message": "Request Validation Failed. Reason is \"null\".",

    "httpStatusCode": 400,

    "apiErrorCode": 1517

}

I then change the "id" on line 24. to "null", I get:

{

    "message": "Invalid input format.",

    "moreInformation": [

        {

            "name": "api-uri",

            "value": "/suite-api/api/adapters"

        }

    ],

    "httpStatusCode": 400,

    "apiErrorCode": 400

}

I have played about with a few different input formats, but no dice.

Previously we have been able to get the correct format to add a vSphere adapter instance.

If more information is required, please ask.

Thanks in advance.

0 Kudos
1 Solution

Accepted Solutions
RobertMesropyan
VMware Employee
VMware Employee
Jump to solution

Hello, please see atatched sample for exact keywords (take from adpater describe.xml):

 

{ "name": "VSAN AI name",

                "adapterKindKey": "VirtualAndPhysicalSANAdapter",

                "description": "",

                "collectorId": "",

                "collectorGroupId": "",

                "monitoringInterval": 5,

                "resourceIdentifiers": [

                    {

                        "name": "AutoDiscovery",

                        "value": "true"

                    },

                    {

                        "name": "EnableCimApi",

                        "value": "false"

                    },

                    {

                        "name": "VCServer",

                        "value": "10.10.10.10"

                    }

                ],

                "credential" : {

                     "id" : null,

                     "name" : "VC-Credential-forVSAN",

                     "adapterKindKey" : "VirtualAndPhysicalSANAdapter",

                     "credentialKindKey" : "VCCredential",

                     "fields" : [

                         {

                              "name" : "VCUSER",

                              "value" : ""

                         },

                         {

                              "name" : "VCPASSWORD",

                              "value" : ""

                         }

                   ]

             }

}

 

 

{ "name": "aaa",
                "adapterKindKey": "VirtualAndPhysicalSANAdapter",
                "description": "",
                "collectorId": "",
                "collectorGroupId": "",
                "monitoringInterval": 5,
                "resourceIdentifiers": [
                    {
                        "name": "AutoDiscovery",
                        "value": "true"
                    },
                    {
                        "name": "EnableCimApi",
                        "value": "false"
                    },
                    {
                        "name": "VCServer",
                        "value": "10.10.10.10"
                    }
                ],
                "credential" : {
                     "id" : null,
                     "name" : "VC-Credential-forVSAN",
                     "adapterKindKey" : "VirtualAndPhysicalSANAdapter",
                     "credentialKindKey" : "VCCredential",
                     "fields" : [
                         {
                              "name" : "VCUSER",
                              "value" : ""
                         },
                         {
                              "name" : "VCPASSWORD",
                              "value" : ""
                         }
                   ]
             }
}

View solution in original post

0 Kudos
4 Replies
niall360
Contributor
Contributor
Jump to solution

I am referencing the createAdapterInstance API in https://vrops-server/suite-api/docs/rest/index.html

Making a POST to /suite-api/api/adapters.https://vckip-hvrpsm01.lmig.com/suite-api/docs/rest/index.html

0 Kudos
RobertMesropyan
VMware Employee
VMware Employee
Jump to solution

Hello, please see atatched sample for exact keywords (take from adpater describe.xml):

 

{ "name": "VSAN AI name",

                "adapterKindKey": "VirtualAndPhysicalSANAdapter",

                "description": "",

                "collectorId": "",

                "collectorGroupId": "",

                "monitoringInterval": 5,

                "resourceIdentifiers": [

                    {

                        "name": "AutoDiscovery",

                        "value": "true"

                    },

                    {

                        "name": "EnableCimApi",

                        "value": "false"

                    },

                    {

                        "name": "VCServer",

                        "value": "10.10.10.10"

                    }

                ],

                "credential" : {

                     "id" : null,

                     "name" : "VC-Credential-forVSAN",

                     "adapterKindKey" : "VirtualAndPhysicalSANAdapter",

                     "credentialKindKey" : "VCCredential",

                     "fields" : [

                         {

                              "name" : "VCUSER",

                              "value" : ""

                         },

                         {

                              "name" : "VCPASSWORD",

                              "value" : ""

                         }

                   ]

             }

}

 

 

{ "name": "aaa",
                "adapterKindKey": "VirtualAndPhysicalSANAdapter",
                "description": "",
                "collectorId": "",
                "collectorGroupId": "",
                "monitoringInterval": 5,
                "resourceIdentifiers": [
                    {
                        "name": "AutoDiscovery",
                        "value": "true"
                    },
                    {
                        "name": "EnableCimApi",
                        "value": "false"
                    },
                    {
                        "name": "VCServer",
                        "value": "10.10.10.10"
                    }
                ],
                "credential" : {
                     "id" : null,
                     "name" : "VC-Credential-forVSAN",
                     "adapterKindKey" : "VirtualAndPhysicalSANAdapter",
                     "credentialKindKey" : "VCCredential",
                     "fields" : [
                         {
                              "name" : "VCUSER",
                              "value" : ""
                         },
                         {
                              "name" : "VCPASSWORD",
                              "value" : ""
                         }
                   ]
             }
}
0 Kudos
niall360
Contributor
Contributor
Jump to solution

Thanks for your help Robert.

For future reference, where were you able to find the adapter describe.xml?

0 Kudos
RobertMesropyan
VMware Employee
VMware Employee
Jump to solution

Corresponding describe.xml can be found under Adapters installation folder (/usr/lib/vmware-vcops/user/plugins/inbound), but you also can get the same information by "GET /api/credentialkinds" REST API:

<ops:credential-kind id="VCCredential">
<ops:name>vCenter Server Credential</ops:name>
<ops:adapterKindKey>VirtualAndPhysicalSANAdapter</ops:adapterKindKey>
<ops:fields>
<ops:field key="VCUser" valueType="string" required="false" enumerated="false"/>
<ops:field key="VCPassword" valueType="string" required="false" enumerated="false"/>
</ops:fields>
0 Kudos