4 Replies Latest reply on Nov 8, 2018 9:15 PM by RobertMesropyan

    Help - Adding vSAN adapter instance to vROps using REST APIs

    niall360 Novice

      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.

        • 2. Re: Help - Adding vSAN adapter instance to vROps using REST APIs
          RobertMesropyan Enthusiast
          VMware Employees

          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" : ""
                                   }
                             ]
                       }
          }
          • 3. Re: Help - Adding vSAN adapter instance to vROps using REST APIs
            niall360 Novice

            Thanks for your help Robert.

             

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

            • 4. Re: Help - Adding vSAN adapter instance to vROps using REST APIs
              RobertMesropyan Enthusiast
              VMware Employees

              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>