vRealize Suite Lifecycle Manager API Programming Guide ...Lifecycle Manager functions...

31
vRealize Suite Lifecycle Manager API Programming Guide 14 APR 2020 VMware vRealize Suite Lifecycle Manager 8.1

Transcript of vRealize Suite Lifecycle Manager API Programming Guide ...Lifecycle Manager functions...

vRealize Suite Lifecycle Manager API Programming Guide

14 APR 2020VMware vRealize Suite Lifecycle Manager 8.1

You can find the most up-to-date technical documentation on the VMware website at:

https://docs.vmware.com/

If you have comments about this documentation, submit your feedback to

[email protected]

VMware, Inc.3401 Hillview Ave.Palo Alto, CA 94304www.vmware.com

Copyright © 2020 VMware, Inc. All rights reserved. Copyright and trademark information.

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 2

Contents

1 Overview of the Content Management REST API 4

2 Content Lifecycle Management 5Working with content endpoints 5

Add a Source Control Management Server and Content Endpoint 6

Add a vRealize Orchestrator endpoint 12

Add a vRealize Automation endpoint 14

Add a vRealize Operations Manager endpoint 16

Add a VMware vSphere Endpoint 19

Managing your content 24

Capture content 24

Test content in a staging environment 27

Deploy content 28

Delete content 30

VMware, Inc. 3

Overview of the Content Management REST API 1As a VMware vRealize® Suite Lifecycle Manager™ user or customer, you can perform vRealize Suite Lifecycle Manager functions programmatically by using REST API service calls. The API follows the REST style and is available to all licensed users.

About the Content Management API ReferenceThe Content Management APIs are installed with vRealize Suite Lifecycle Manager. The API reference is available at the following URL.

https://$vRLCM/lcm/cms/api/swagger-ui.html

$vRLCM denotes an instance of vRealize Suite Lifecycle Manager.

How Developers Use the Content Management APIsTo make API service calls, you use a browser application or an HTTP client application to send requests and review responses. The following open-source applications are commonly used:

n cURL. http://curl.haxx.se

n jq parser. https://stedolan.github.io/jq/

n Postman application. https://www.getpostman.com/

To learn how to use the Content Management APIs, you can start by performing the steps outlined in the following use case:

n Managing Your Content Using Content Management APIs

The use case includes curl commands in request examples. To use the commands, ensure that the jq command-line JSON processor is installed with curl. The jq parser ensures that responses are formatted for optimum readability.

VMware, Inc. 4

Content Lifecycle Management Using Content Management APIs 2As a release manager or content developer, you use the content management APIs to manage software-defined data center (SDDC) content. Managing your software-defined content, requires setting up content endpoints and adding content that you want to manage.

To use content management, your system must include content endpoints that are configured in vRealize Suite Lifecycle Manager with details such as credentials and policies. Supported content includes entities from:

n Source Control Servers:

n Gitlab: All latest version up to 11.6.5

n Bitbucket Server 6.5.1

n Bitbucket Cloud: All latest versions

n vRealize Orchestrator 7.x or later. vRealize Orchestrator8.0 is not supported as an endpoint.

n vRealize Automation 7.2 or later. vRealize Automation 8.0 is not supported as an endpoint.

n vRealize Operations Manager 6.6.1 or later.

n VMware vSphere 6.0 or later.

For information about content lifecycle management using the UI, see vRealize Suite Lifecycle Manager Installation, Upgrade, and Management.

This chapter includes the following topics:

n Working with Content Endpoints Using Content Management APIs

n Managing Your Content Using Content Management APIs

Working with Content Endpoints Using Content Management APIsTo perform content management, you must have content endpoints configured in your system. A content endpoint is an infrastructure endpoint in the SDDC that is targeted for the capture, test, and deployment of managed content in the form of a content package. Either a DevOps administrator or a content developer role is required to configure endpoints.

VMware, Inc. 5

When adding the endpoint, you select appropriate policies to capture, test, or release content. Policies vary depending on the endpoint type

Policy Description

Allow content to be captured from the endpoint

Capture content from the endpoint and mark it as source content.

Allow unit tests to be run on the endpoint

Test content on the endpoint and acts as a unit test server.

Mark as Production Endpoint Only applicable to a vSphere endpoint. Deploy content to production. When you mark a production endpoint, the Enable vCenter Template support is enabled.

Source-controlled Content only

Deploy content to an endpoint that comes only from a Source Control branch. Used in cases where the customization specification is code reviewed and checked in prior to release to a vCenter Server.

This policy does not apply to vSphere templates because they are not checked in to Source Control. vSphere templates have versions in a vSphere Content Library.

Enable vCenter Template Support

Only applicable to a vSphere endpoint. Enable this option to open more fields. The vCenter Server details page stores information as to where the template is deployed in each vCenter Server. During the release process, the templates are retrieved from the local Content Library and turned into a Virtual Machine Template.

Select vRealize Orchestrator package

Only applicable to a vRealize Orchestrator endpoint. The vRealize Orchestrator package is also known as an overlay package. Use the overlay package to preserve environment specific settings such as locale and passwords in a configuration element.

Add Source Control Management EndpointsvRealize Suite Lifecycle Manager can include multiple repositories with branches on a source control server. By adding a Source Control Management (SCM) endpoint, you can check in and check out SDDC content on the source control server.

As a DevOps administrator, you create a project with a branch on the source control server. Then you assign access rights for the branch to developers. After that, you use the API to add a source control server endpoint in vRealize Suite Lifecycle Manager.

As a content developer with access rights to the branch on the source control server, you can generate a user token. Then you attach the token to the source control server and create an SCM content endpoint.

Prerequisites

n Verify that the appliance name and fully qualified domain name of the vRealize Suite Lifecycle Manager instance are available.

n Verify that the URL variable is assigned.

url='https://LCM-Hostname'

n Verify that you have correct permissions.

n As DevOps administrator, verify that you are an organization owner in vRealize Suite Lifecycle Manager with an administrator role.

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 6

n As a developer, verify that you are an organization owner in vRealize Suite Lifecycle Manager with a user role.

n Verify that vRealize Suite Lifecycle Manager supports the version of the source control server that you plan to use.

Table 2-1. Supported Source Control Server Versions

SCM Server Type Version n Version (n-1)

GitLab 12.8 12.7

GitHub 2.20.1 2.19.8

BitBucket Cloud Version 2.0 N/A

Bitbucket Server 7.0 6.10

Procedure

1 As a DevOps administrator, add a source control server endpoint in vRealize Suite Lifecycle Manager. In this example, the source control server type is GitLab. vRealize Suite Lifecycle Manager also supports GitHub, Bitbucket Cloud, and Bitbucket Server types.

curl -X POST \

'$url/lcm/cms/api/v1/endpoints' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' \

-d '{

"sourceControlType": "gitlab",

"endpointType": "SERVER_ENDPOINT",

"category": "SourceControl",

"name": "gitlab.vmware.com",

"server": "gitlab.vmware.com"

}' | jq "."

2 Examine the response and note the reference ID.

A snippet of the response shows the endpoint ID listed as the referenceID.

{

"requestId":"2688b287-d50c-4f89-be42-2d707af26758",

"status":"IN_PROGRESS",

"message":"Endpoint Successfully Created",

"referenceId":"567a280d-3419-4eb7-81c0-219902b8447c"

}

3 Set up access control in GitLab for the branch.

a Assign access rights for the branch to your developer.

b Provide your developer with the ID of the source control server endpoint.

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 7

4 As a developer with access rights to the branch on the source control server, generate a userToken with full access for source control and assign the token to a variable name.

SourceControlAccessToken = '<userToken>'

5 Assign the reference ID of the source control server endpoint that you received from the DevOps administrator to a variable name.

SourceControlServerEndpointID = '<referenceID>'

6 Attach the token to the server endpoint.

curl -X POST \

'$url/lcm/cms/api/v1/sourcecontrol/token/' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' \

-d '{

"endpointId": "{$SourceControlServerEndpointID}",

"token": "{$SourceControlAccessToken}"

}' | jq "."

Note GitHub servers support credential-based access in addition to token-based access as shown in the following request example.

curl -X POST \

'$url/lcm/cms/api/v1/sourcecontrol/token/' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' \

-d '{

"endpointId": "{$SourceControl_GitHubServer_EndpointID}",

"userName": "{$SourceControlUserName}",

"password": "{$SourceControlPassword}"

}' | jq "."

7 Create an SCM content endpoint to perform source control operations. In this example, you can perform operations such as checkin, checkout, and raise code reviews through the new endpoint.

curl -X POST \

'$url/lcm/cms/api/v1/endpoints' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' \

-d '{

"tagNames": ["test123"],

"supportCapture": true,

"supportTest": true,

"supportRelease": true,

"name": "git-lab-content-endpoint",

"category": "SourceControl",

"sourceControlServerId": "{$SourceControlServerEndpointID}",

"branch": "master",

"repository": "example-test/feature",

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 8

"server": "gitlab.vmware.com",

"sourceControlType": "gitlab",

"endpointType": "CONTENT_ENDPOINT"

}' | jq "."

What to do next

Use your SCM endpoint to manage the following types of content:

n Automation-Component Profile

n Automation-Composite Blueprint

n Automation-Custom Form

n Automation-Property Definition

n Automation-Property Group

n Automation-Resource Map

n Automation-Resource Type

n Automation-Resource Action

n Automation-Software

n Automation-Subscription

n Automation-XaaS Blueprint

n Orchestrator-Package

n vSphere-Custom Spec

n Operations-Alert

n Operations-Dashboard

n Operations-Report

n Operations-ResourceKindMetricConfig

n Operations-SuperMetric

n Operations-Symptom

n Operations-TextWidgetContent

n Operations-TopoWidgetContent

n Operations-View

Enable Proxy for Source Control Management EndpointsIf a proxy server is configured in vRealize Suite Lifecycle Manager, you can enable proxy for your source control server and automatically enable the proxy for all endpoints using that source control server.

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 9

As a vRealize Suite Lifecycle Manager administrator or DevOps administrator, you check to see if a proxy is configured in vRealize Suite Lifecycle Manager. Then you list the proxy status of Source Control Management (SCM) servers and enable proxy on selected servers.

Prerequisites

n Verify that the appliance name and fully qualified domain name of the vRealize Suite Lifecycle Manager instance are available.

n Verify that the URL variable is assigned.

url='https://LCM-Hostname'

Procedure

1 Check to see if a proxy server is configured in vRealize Suite Lifecycle Manager.

curl -X GET \

'$url/lcm/cms/api/v1/proxy' \

-H 'Accept: application/json'\

| jq "."

2 Examine the response for the proxy details.

{

"proxyEnabled": true,

"hostName": "proxyserver.domain.com",

"port": 3128,

"userName": "admin",

"proxyEnabledInContentMgmt": false

}

"proxyEnabled": true indicates that a vRealize Suite Lifecycle Manager proxy is configured and "proxyEnabledInContentMgmt": false indicates that no SCM server is configured to use it.

If "proxyEnabled": false, a vRealize Suite Lifecycle Manager administrator must configure a proxy server in vRealize Suite Lifecycle Manager before you can enable an SCM server to use it.

3 List the proxy status of the SCM servers.

curl -X GET \

'$url/lcm/cms/api/v1/endpoint-servers?page=1&size=20&sortBy=lastUpdatedOn&sortByDirection=DESC'

\

-H 'Accept: application/json' \

| jq "."

The response shows the proxy status of each server.

{

"contents": [

{

"name": "github.com",

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 10

"proxyEnabled": false,

"requestId": "bd2cc2c7-cefc-43ef-8fa7-11e16de751e6",

"requestedBy": "admin@local",

"lastUpdatedBy": "admin@local"

},

{

"name": "gitlab.com",

"proxyEnabled": false,

"requestId": "053b29bc-cac9-4bbb-a8e5-17d616b5ef57",

"requestedBy": "admin@local",

"lastUpdatedBy": "admin@local"

},

{

"name": "bitbucket.org",

"proxyEnabled": false,

"requestId": "05fde491-1b1d-43f0-a413-f7db8af11b01",

"requestedBy": "admin@local",

"lastUpdatedBy": "admin@local"

},

{

"name": "gitlab.vmware.com",

"proxyEnabled": false,

"requestId": "9088c23b-51d5-4dd8-8165-621d2aa21787",

"requestedBy": "admin@local",

"lastUpdatedBy": "admin@local"

}

],

"metaData": {

"totatlPages": 1,

"totalElements": 5,

"pageElements": 5,

"size": 20,

"page": 1

}

}

4 Enable proxy mapping for selected SCM servers such as the gitlab.vmware.com and bitbucket.org servers.

curl -X PUT \

'$url/lcm/cms/api/v1/endpoint-servers' \

-H 'Accept: application/json' \

-H 'Content-Type: applications/json' \

-d '{

"endpointServersList":[

{"name":"gitlab.vmware.com","proxyEnabled":true },

{"name":"bitbucket.org","proxyEnabled":true },

{"name":"gitlab.com","proxyEnabled":false }

]

}'| jq "."

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 11

Results

Enabling proxy for a source control server routes REST API calls from vRealize Suite Lifecycle Manager to all endpoints using that server through the proxy.

Note Once the vRealize Suite Lifecycle Manager proxy is used by Content Management, the proxy cannot be disabled on the vRealize Suite Lifecycle Manager settings page until the SCM servers are configured to stop using the proxy.

Add a vRealize Orchestrator EndpointTo create a vRealize Orchestrator endpoint, you make a POST request with a request body that includes vRealize Orchestrator specific parameters.

As a content developer, you use the API to create a vRealize Orchestrator endpoint. The vRealize Orchestrator endpoint is required to create vRealize Automation endpoints and to capture content.

Prerequisites

n Verify that the appliance name and fully qualified domain name of the vRealize Suite Lifecycle Manager instance are available.

n Verify that the URL variable is assigned.

url='https://LCM-Hostname'

n If you are using the vRealize Orchestrator endpoint for unit testing, verify that the vRealize Orchestrator instance has been configured as a unit test server.

Procedure

1 Create an endpoint to capture vRealize Orchestrator content such as workflows, configuration elements, and actions individually or in a folder where they reside. For the server, use the FQDN, IP address, or host name of the vRealize Orchestrator instance that you are adding to vRealize Suite Lifecycle Manager.

curl -X POST \

'$url/lcm/cms/api/v1/endpoints' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' \

-d '{

"tagIds": ["vro-prod-env"],

"supportCapture": false,

"supportTest": false,

"supportRelease": true,

"supportTemplates": false,

"supportOnlySourceControlledContent": false,

"storeTemplates": true,

"requestedBy": "VLCMADMIN",

"name": "vro-prod",

"enabled": true,

"category": "Orchestration",

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 12

"ignoreModules": "com.vmware",

"ignoreWorkflowFolders": "/Library,/System",

"version": "7.x",

"server": "<VRO_IP_FQDN>",

"userName": "<username_to_access_content_endpoint>",

"password": "<password>",

"endpointType": "CONTENT_ENDPOINT"

}' | jq "."

2 Examine the response.

{

"requestId":"938281c0-32da-4c55-9852-9074289bd813",

"status":"IN_PROGRESS",

"message":"Endpoint Successfully Created",

"referenceId":"7be2d7f0-bb34-4779-809f-904c328e1a7c"

}

3 Assign the reference ID of the endpoint to a variable name.

vROEndpoint = '<referenceID>'

4 Get information about the vRealize Orchestrator endpoint.

curl -X GET \

'$url/lcm/cms/api/v1/endpoints/{$vROEndpoint}' \

-H 'Accept: application/json' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' | jq "."

5 Examine the response for information about the vRealize Orchestrator endpoint.

Response:

{

"id": "7be2d7f0-bb34-4779-809f-904c328e1a7c",

"createdOn": 1573121755916,

"lastUpdatedOn": 1573121756159,

"supportCapture": false,

"supportTest": false,

"supportRelease": true,

"supportTemplates": false,

"supportOnlySourceControlledContent": false,

"storeTemplates": true,

"requestedBy": "admin@local",

"name": "vro-prod",

"enabled": true,

"category": "Orchestration",

"systemEndpoint": false,

"version": "7.x",

"server": "vROserver.my.company.com",

"userName": "[email protected]",

"password": "example_user_password",

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 13

"ignoreModules": "com.vmware",

"ignoreWorkflowFolders": "/Library,/System",

"reviewRequired": false,

"endpointType": "CONTENT_ENDPOINT",

"userIdentity": "admin@local"

}

What to do next

Use your endpoint to manage the following types of vRealize Orchestrator content:

n Orchestrator-Workflow

n Orchestrator-Action

n Orchestrator-Configuration-Element

n Orchestrator-Package

Add a vRealize Automation EndpointTo create a vRealize Automation endpoint, you make a POST request with a request body that includes vRealize Automation specific parameters.

As a content developer, you use the API to create a vRealize Automation endpoint.

Prerequisites

n Verify that the appliance name and fully qualified domain name of the vRealize Suite Lifecycle Manager instance are available.

n Verify that the URL variable is assigned.

url='https://LCM-Hostname'

n Verify that you have added at least one vRealize Automation endpoint.

Procedure

1 Create an endpoint to capture vRealize Automation content. In this example, the vroServerId is from the vRealize Orchestrator endpoint that you created in Add a vRealize Orchestrator Endpoint.

curl -X POST \

'$url/lcm/cms/api/v1/endpoints' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' \

-d '{

"tagNames": [

"vra-prod-env"

],

"supportCapture": true,

"supportTest": true,

"supportRelease": true,

"supportOnlySourceControlledContent": false,

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 14

"name": "vra-prod",

"vroServerId":"7be2d7f0-bb34-4779-809f-904c328e1a7c",

"enabled": true,

"category": "Automation",

"version": "7.x",

"server": "<LCM-Hostname>",

"userName": "<username_to_access_content_endpoint>",

"password": "<password>",

"tenant": "qe",

"endpointType": "CONTENT_ENDPOINT"

}' | jq "."

2 Examine the response.

{

"requestId":"fcb8040a-e44a-48b1-8cb4-ff7f793becf6",

"status":"IN_PROGRESS",

"message":"Endpoint Successfully Created",

"referenceId":"e321e9f5-37a3-497c-93c9-b579fe8ba8fd"

}

3 Assign the reference ID of the endpoint to a variable name.

vRAEndpoint = '<referenceID>'

4 Get information about the vRealize Automation endpoint.

curl -X GET \

'$url/lcm/cms/api/v1/endpoints/{$vRAEndpoint}' \

-H 'Accept: application/json' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' | jq "."

5 Examine the response for information about the vRealize Automation endpoint.

Response:

{

"id": "e321e9f5-37a3-497c-93c9-b579fe8ba8fd",

"createdOn": 1573126732254,

"lastUpdatedOn": 1573126732334,

"tagNames": [

"vra-prod-env"

],

"supportCapture": true,

"supportTest": true,

"supportRelease": true,

"supportTemplates": false,

"supportOnlySourceControlledContent": false,

"storeTemplates": false,

"requestedBy": "admin@local",

"name": "vra-prod",

"enabled": true,

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 15

"category": "Automation",

"systemEndpoint": false,

"version": "7.x",

"server": "vRAserver.my.company.com",

"userName": "[email protected]",

"password": "example_user_password",

"tenant": "qe",

"vroServerId": "7be2d7f0-bb34-4779-809f-904c328e1a7c",

"reviewRequired": false,

"endpointType": "CONTENT_ENDPOINT",

"userIdentity": "admin@local"

}

What to do next

Use your endpoint to manage the following types of vRealize Automation content:

n Automation-Component Profile

n Automation-Composite Blueprint

n Automation-Custom Form

n Automation-Property Definition

n Automation-Property Group

n Automation-Resource Map

n Automation-Resource Type

n Automation-Resource Action

n Automation-Software

n Automation-Subscription

n Automation-XaaS Blueprint

Add a vRealize Operations Manager EndpointTo create a vRealize Operations Manager endpoint, you make a POST request with a request body that includes vRealize Operations Manager specific parameters.

As a content developer, you use the API to create a vRealize Operations Manager content endpoint.

Prerequisites

n Verify that the appliance name and fully qualified domain name of the vRealize Suite Lifecycle Manager instance are available.

n Verify that the URL variable is assigned.

url='https://LCM-Hostname'

n Verify that the SSH user account is configured.

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 16

n Verify that all vRealize Operations Manager instances have the same management packs installed and required adapter instances configured.

Procedure

1 Create an endpoint to capture vRealize Operations Manager content. For the server, use the FQDN, IP address, or host name of the vRealize Operations Manager instance that you are adding to vRealize Suite Lifecycle Manager.

curl -X POST \

'$url/lcm/cms/api/v1/endpoints' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' \

-d '{

"userName": "admin",

"sshUserName": "root",

"tagNames": [

"tag-1"

],

"endpointType": "CONTENT_ENDPOINT",

"category": "Operations",

"name": "vrops",

"server": "{<endpoint_IP_FQDN>}",

"password": "<example_password>",

"sshPassword": "<example_sshPassword>",

"supportCapture": true,

"supportTest": true,

"supportRelease": true,

"sourceControlEnvironment": false

}' | jq "."

2 Examine the response.

{

"requestId":"fcb8040a-e44a-48b1-8cb4-ff7f793becf6",

"status":"IN_PROGRESS",

"message":"Endpoint Successfully Created",

"referenceId":"1e8be9df-893f-4545-b99a-432f90a88e10"

}

3 Assign the reference ID of the endpoint to a variable name.

vROpsEndpoint = '<referenceID>'

4 Get information about the vRealize Operations Manager endpoint.

curl -X GET \

'$url/lcm/cms/api/v1/endpoints/{$vROpsEndpoint}' \

-H 'Accept: application/json' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' | jq "."

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 17

5 Examine the response for information about the vRealize Operations Manager endpoint.

Response:

{

"id": "1e8be9df-893f-4545-b99a-432f90a88e10",

"createdOn": 1573449661631,

"lastUpdatedOn": 1573449661712,

"errorMessage": "Endpoint test connection failed",

"tagNames": [

"tag-1"

],

"supportCapture": true,

"supportTest": true,

"supportRelease": true,

"supportTemplates": false,

"supportOnlySourceControlledContent": false,

"storeTemplates": false,

"requestedBy": "admin@local",

"name": "vrops",

"enabled": false,

"category": "Operations",

"systemEndpoint": false,

"server": "vROpsserver.my.company.com",

"userName": "[email protected]",

"password": "example_user_password",

"sshUserName": "ssh_user",

"sshPassword": "example_ssh_password",

"reviewRequired": false,

"endpointType": "CONTENT_ENDPOINT",

"userIdentity": "admin@local"

}

What to do next

Use your endpoint to manage the following types of vRealize Operations Manager content:

n Operations-Dashboard

n Operations-Report

n Operations-ResourceKindMetricConfig

n Operations-SuperMetric

n Operations-Symptom

n Operations-TextWidgetContent

n Operations-TopoWidgetConfig

n Operations-View

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 18

Add a VMware vSphere EndpointAs a DevOps administrator, you create a publisher in vCenter Server to store all captured vSphere templates. Then you configure the publisher endpoint in vRealize Suite Lifecycle Manager. As a developer, you create a vSphere capture endpoint.

In addition, you can create a vSphere test and deploy endpoint. But because vRealize Suite Lifecycle Manager uses the vSphere subscriber for versioning templates, your DevOps administrator must use vCenter Server to create a subscriber to the publisher before you create your endpoint. In this way, you can configure your test and deploy endpoint with the subscriber that has template support.

Prerequisites

n Verify that the appliance name and fully qualified domain name of the vRealize Suite Lifecycle Manager instance are available.

n Verify that the URL variable is assigned.

url='https://LCM-Hostname'

n Verify that the DevOps administrator has used vCenter Server to create the publisher that will be used to store templates captured from various vSphere capture points.

Procedure

1 As a DevOps administrator, configure a vSphere publisher endpoint in vRealize Suite Lifecycle Manager. For the server, use the FQDN, IP address, or host name of the vCenter Server that you are adding to vRealize Suite Lifecycle Manager. The parameter contentLibraryId identifies the publisher content library.

curl -X POST \

'$url/lcm/cms/api/v1/endpoints' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' \

-d '{

"supportCapture":false,

"supportTest":false,

"supportRelease":false,

"supportTemplates":true,

"supportOnlySourceControlledContent":false,

"storeTemplates":false,

"requestedBy":"admin@local",

"name":"system-virtualcenter",

"enabled":false,

"category":"vSphere",

"systemEndpoint":true,

"server": "{<VC_IP_FQDN>}",

"userName": "{<vcUsername>}",

"password": "{<vcPassword>}",

"reviewRequired":false,

"contentLibraryId":"6036cf9a-2833-40a0-9c46-13dbd567e5e1",

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 19

"endpointType":"SERVER_ENDPOINT",

"userIdentity":"admin@local",

"contentLibraryName":""

}' | jq "."

2 Examine the response to check the progress of the request and get the reference ID.

{

requestId":"eb405741-81fa-479c-912e-875644a1e392",

"status":"IN_PROGRESS",

"message":"Endpoint Successfully Created",

"referenceId":"system-virtualcenter"

}

3 Assign the reference ID of the endpoint to a variable name.

vSpherePublisherEndpoint = '<referenceID>'

4 Get information about the vSphere publisher endpoint.

curl -X GET \

'$url/lcm/cms/api/v1/endpoints/{$vSpherePublisherEndpoint}' \

-H 'Accept: application/json' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' | jq "."

5 To validate the information provided to create the vSphere publisher endpoint, examine the response.

{

"id":"system-virtualcenter",

"createdOn":1579251621392,

"lastUpdatedOn":1579251621736,

"errorMessage":"Endpoint policies are not configured",

"supportCapture":false,

"supportTest":false,

"supportRelease":false,

"supportTemplates":true,

"supportOnlySourceControlledContent":false,

"storeTemplates":false,

"requestedBy":"admin@local",

"name":"system-virtualcenter",

"enabled":false,

"category":"vSphere",

"systemEndpoint":true,

"server": "vCserver.my.company.com",

"userName": "[email protected]",

"password": "example_user_password",

"reviewRequired":false,

"contentLibraryId":"6036cf9a-2833-40a0-9c46-13dbd567e5e1",

"endpointType":"SERVER_ENDPOINT",

"userIdentity":"admin@local"

}

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 20

6 As a developer, create a vSphere endpoint to capture templates.

curl -X POST \

'$url/lcm/cms/api/v1/endpoints' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' \

-d '{

"supportTemplates": false,

"tagNames": ["tag1"],

"endpointType": "CONTENT_ENDPOINT",

"category": "vSphere",

"name": "vc-endpoint",

"server": "{<VC_IP_FQDN>}",

"userName": "{<vcUsername>}",

"password": "{<vcPassword>}",

"supportCapture": true,

"supportRelease": false

}' | jq "."

7 Examine the response to check the progress of the request and to get the reference ID.

{

"requestId":"eb405741-81fa-479c-912e-875644a1e392",

"status":"IN_PROGRESS",

"message":"Endpoint Successfully Created",

"referenceId":"06f793ba-606f-4838-803d-c6819255d50b"

}

8 Assign the reference ID of the endpoint to a variable name.

vSphereCaptureEndpoint = '<referenceID>'

9 Get information about the vSphere capture endpoint.

curl -X GET \

'$url/lcm/cms/api/v1/endpoints/{$vSphereCaptureEndpoint}' \

-H 'Accept: application/json' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' | jq "."

10 To validate the information provided to create the vSphere capture endpoint, examine the response.

{

"id":"06f793ba-606f-4838-803d-c6819255d50b",

"createdOn":1579251801788,

"lastUpdatedOn":1579251801870,

"supportCapture":true,

"supportTest":false,

"supportRelease":false,

"supportTemplates":false,

"supportOnlySourceControlledContent":false,

"storeTemplates":false,

"requestedBy":"admin@local",

"name":"vc-endpoint",

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 21

"enabled":true,

"category":"vSphere",

"systemEndpoint":false,

"server": "vCserver.my.company.com",

"userName": "[email protected]",

"password": "example_user_password",

"reviewRequired":false,

"endpointType":"CONTENT_ENDPOINT",

"userIdentity":"admin@local"

}

11 As a DevOps administrator, use vCenter Server to configure a library that subscribes to the vSphere environment where the developer wants to deploy templates.

12 As a developer, add a vSphere endpoint that is configured with vCenter Server details to deploy a template to a network, datastore, or folder.

curl -X POST \

'$url/lcm/cms/api/v1/endpoints' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' \

-d '{

"supportCapture": false,

"supportTest": true,

"supportRelease": true,

"supportTemplates": true,

"supportOnlySourceControlledContent": false,

"storeTemplates": false,

"requestedBy": "admin@local",

"name": "lcm-vc1",

"enabled": true,

"category": "vSphere",

"systemEndpoint": false,

"server": "{<VC_IP_FQDN>}",

"userName": "{<vcUsername>}",

"password": "{<vcPassword>}",

"targetDatacenter": "example_DC",

"vcTargetHostName": "example_cluster,

"vmTargetDatastore": "example_datastore",

"vmTargetFolderPath": "/example_folder/",

"vmTargetNetwork": "example_network",

"reviewRequired": false,

"endpointType": "CONTENT_ENDPOINT",

"userIdentity": "admin@local",

"tagNames": []

}' | jq "."

13 Examine the response to check the progress of the request and to get the reference ID.

{

"requestId":"eb405741-81fa-479c-912e-875644a1e392",

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 22

"status":"IN_PROGRESS",

"message":"Endpoint Successfully Created",

"referenceId":"06f793ba-606f-4838-803d-c6819255d50b"

}

14 Assign the reference ID of the endpoint to a variable name.

vSphereDeployEndpoint = '<referenceID>'

15 Get information about the vSphere deploy endpoint.

curl -X GET \

'$url/lcm/cms/api/v1/endpoints/{$vSphereDeployEndpoint}' \

-H 'Accept: application/json' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' | jq "."

16 To validate the information provided to create the vSphere deploy endpoint, examine the response.

{

"id":"06f793ba-606f-4838-803d-c6819255d50b",

"createdOn":1579251801788,

"lastUpdatedOn":1579251801870,

"supportCapture": false,

"supportTest": true,

"supportRelease": true,

"supportTemplates": true,

"supportOnlySourceControlledContent": false,

"storeTemplates": false,

"requestedBy": "admin@local",

"name": "lcm-vc1",

"enabled": true,

"category": "vSphere",

"systemEndpoint": false,

"server": "vCserver.my.company.com",

"userName": "[email protected]",

"password": "example_user_password",

"targetDatacenter": "example_DC",

"vcTargetHostName": "example_cluster,

"vmTargetDatastore": "example_datastore",

"vmTargetFolderPath": "/example_folder/",

"vmTargetNetwork": "example_network",

"reviewRequired": false,

"endpointType": "CONTENT_ENDPOINT",

"userIdentity": "admin@local",

"tagNames": []

}

What to do next

Use your endpoint to manage the following types of vSphere content:

n vSphere-Template

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 23

n vSphere-Custom Spec

Managing Your Content Using Content Management APIsYour content is a collection of files with definitions that represent software defined services. After you add a content endpoint, you can manage the content of that endpoint.

You use content endpoints in vRealize Suite Lifecycle Manager's Content Management to perform the following actions:

n Capture content.

n Test content in a staging environment.

n Release content to a production environment.

Capture ContentTo capture content from an existing Content Management endpoint, you make a POST request. More than one type of content can be captured at the same time.

The following procedure shows how to capture content from a vRealize Operations Manager endpoint and how to list the dependencies of that content.

You list the dependencies because you want to ensure that the package you test or deploy later includes all required content.

Prerequisites

n Verify that the appliance name and fully qualified domain name of the vRealize Suite Lifecycle Manager instance are available.

n Verify that the URL variable is assigned.

url='https://LCM-Hostname'

n Verify that you have added at least one content endpoint.

Procedure

1 Assign the reference ID of an existing vRealize Operations Manager endpoint to a variable name.

vROpsEndpoint = '<referenceID>'

2 As a developer, capture the content from the vRealize Operations Manager endpoint.

In this example, the content you are capturing includes:

n Operations-Alert

n Operations-Report

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 24

n Parameters to capture dependencies with "includeDependencies":true and to mark the content as production ready with "productionReady":true.

curl -X POST \

'$url/lcm/cms/api/v1/contents/pipelines' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json' \

-d '{

"stages": [

{

"comment": "test-capture",

"endpointIds": ["{$vROEndpoint}"],

"tagNames": ["test-tag"],

"contents": [

{

"contentDetails": [

{

"contentName": "A PCIe error occurred during system boot, but the error is

recoverable - [objId=AlertDefinition-VMWARE-RecoverablePCIeErrorAlert]"

}

],

"contentType": "Operations-Alert"

},

{

"contentDetails": [

{

"contentName": "Capacity Report - Datastores - [objId=59c32c79-adea-4c58-

bb6f-56daa23bcb5e]"

}

],

"contentType": "Operations-Report"

}

],

"contentVersionIds": [],

"stage": "CAPTURE",

"includeDependencies": true,

"productionReady": true

}

]

}' | jq "."

3 Open the UI and copy the content-version-id from the URL. In this example, the content-version-id is 4b014331-c496-4eef-92a4-4061f69a94a6.

In this example, the content-version-id is 4b014331-c496-4eef-92a4-4061f69a94a6.

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 25

4 To retrieve the dependencies of your captured content, enter the following command with the content-version-id from the URL.

curl -X GET \

'$url/lcm/cms/api/v1/contents/versions/4b014331-c496-4eef-92a4-4061f69a94a6/dependency-

artifacts' \

-H 'Accept: application/json' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' | jq "."

5 A snippet of the response lists dependencies for the content.

{

"contentVersionId": "4b014331-c496-4eef-92a4-4061f69a94a6",

"dependencyArtifacts": [

{

"contentVersionId": "e643b796-f49b-4084-86e9-70be9fd13d14",

"contentName": "Create Disk-vro",

"contentType": "Orchestrator-Package",

"files": [

{

"file": "/vco/content/Create Disk-vro-manifest.json",

"fileId": "659c47a6-99e3-4439-8f6e-17a0be02de22",

"sourceControlFile": "Orchestrator-Package/Create Disk-vro/Create Disk-vro-

manifest.json",

"sourceControlReference": null

},

{

"file": "/vco/content/Workflow/Library/AMQP/Unbind.element_info.xml",

"fileId": "5b3d56a5-ec14-4663-b18c-6840fae80259",

"sourceControlFile": "Orchestrator-Package/Create Disk-vro/Workflow/Library/

AMQP/Unbind.element_info.xml",

"sourceControlReference": null

},

{

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 26

"file": "/vco/content/Workflow/Library/AMQP/Unbind.xml",

"fileId": "5ec353c6-2962-4ff6-a121-37927d446e76",

"sourceControlFile": "Orchestrator-Package/Create Disk-vro/Workflow/Library/

AMQP/Unbind.xml",

"sourceControlReference": null

}

...

{

"file": "/vco/content/Workflow/Content Management Tests/Orchestrator-Package/

Common/Check Package Exists.element_info.xml",

"fileId": "1b215f31-446f-4ba6-8e92-a9bd8462cd67",

"sourceControlFile": "Orchestrator-Package/Create Disk-vro/Workflow/Content

Management Tests/Orchestrator-Package/Common/Check Package Exists.element_info.xml",

"sourceControlReference": null

}

]

}

]

}

The response lists all the additional content required to correctly deploy the captured content to another endpoint of the same type.

Test ContentAfter adding content, you can test your content in a staging environment. You test content to ensure that it is ready for release.

The following procedure shows how to test content obtained from a vRealize Orchestrator endpoint.

Prerequisites

n Verify that the appliance name and fully qualified domain name of the vRealize Suite Lifecycle Manager instance are available.

n Verify that the URL variable is assigned.

url='https://LCM-Hostname'

n Verify that the content package you want to test has been added to vRealize Suite Lifecycle Manager.

Procedure

1 Assign the reference ID of an existing vRealize Orchestrator endpoint to a variable name.

vROEndpoint = '<referenceID>'

2 To test your captured content in a staging environment, execute the following command. This example uses a vRealize Orchestrator endpoint as a unit test server to perform basic pre-defined tests on content, so its endpoint ID is specified for the unitTestEndpointID.

curl -X POST \

'$url/lcm/cms/api/v1/contents/pipelines' \

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 27

-H 'Accept: application/json' \

-H 'Content-Type: application/json' \

-d '{

"stages": [

{

"comment": "bjbhbj",

"endpointIds": ["0a712e24-14ce-4aa9-aeb6-3651a7480a3b"],

"tagNames": [],

"contents": [],

"contentVersionIds": ["2ebc459f-617a-4470-9108-1df61aaa269c"],

"stage": "TEST",

"deployLatest": true,

"includeDependencies": true,

"stopUnitTestsOnFirstFailure": true,

"stopDeployOnFirstFailure": true,

"enableUnitTests": true,

"enableDeploy": true,

"deployAllFiles": true,

"unitTestEndpointId": "{$vROEndpoint}"

}

]

}'| jq "."

3 To track the status of the request, examine the response.

{

"requestId":"f8951a41-b811-4645-81bb-3eb1b09a25cc",

"status":"IN_PROGRESS"

}

Deploy ContentTo deploy content from an existing vRealize Suite Lifecycle Manager endpoint, you make a POST request.

The following procedure shows how to deploy content to a vRealize Orchestrator endpoint. An example shows how to capture, test, and deploy content to a vRealize Orchestrator endpoint using a single command.

Prerequisites

n Verify that the appliance name and fully qualified domain name of the vRealize Suite Lifecycle Manager instance are available.

n Verify that the URL variable is assigned.

url='https://LCM-Hostname'

n Verify that the content package you want to deploy has been added to vRealize Suite Lifecycle Manager.

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 28

Procedure

1 Assign the reference ID of an existing vRealize Orchestrator endpoint to a variable name.

vROEndpoint = '<referenceID>'

2 To deploy captured content to the vRealize Orchestrator endpoint, execute the following command.

curl -X POST \

'$url/lcm/cms/api/v1/contents/pipelines' \

-H 'Accept: application/json' \

-H 'Content-Type: application/json' \

-d '{

"stages":[

{

"comment":"test-deploy",

"endpointIds":["{$vROEndpoint}"],

"tagNames":[],

"contents":[],

"contentVersionIds":["db118fe4-7ad2-42b2-895b-f53195b8a361"],

"stage":"DEPLOY",

"deployLatest":true,

"includeDependencies":true,

"deployAllFiles":true,

"stopDeployOnFirstFailure":true

}

]

}'| jq "."

3 To track the status of the request, examine the response.

{

"requestId":"f8951a41-b811-4645-81bb-3eb1b09a25cc",

"status":"IN_PROGRESS"

}

Example: Perform multiple operations with a single commandThe following example shows how to capture, test, and deploy content to a vRealize Orchestrator endpoint with a single command.

$ vROEndpoint = '<referenceID>'

$ curl -X POST \

'$url/lcm/cms/api/v1/contents/pipelines' \

-H 'Accept: application/json' \

-H 'Content-Type: application/json' \

-d '{

"stages":[

{

"comment":"multiple actions at a time",

"endpointIds":["{$vROEndpoint}"],

"tagNames":[],

"contents":[

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 29

{

"contentDetails":[

{

"contentName":"Container host properties with certificate authentication -

[id=ContainerHostPropertiesWithCertificate, name=Container host properties with certificate

authentication]"

},

{

"contentName":"Container host properties with user/password authentication -

[id=ContainerHostPropertiesWithPassword, name=Container host properties with user/password

authentication]"

}

],

"contentType":"Automation-PropertyGroup"

}

],

"contentVersionIds":[],

"stage":"CAPTURE",

"includeDependencies":true,

"productionReady":true

},

{

"comment":"",

"endpointIds":["0a712e24-14ce-4aa9-aeb6-3651a7480a3b"],

"tagNames":[],

"contents":[],

"contentVersionIds":[],

"stage":"TEST",

"enableDeploy":true,

"stopUnitTestsOnFirstFailure":true,

"stopDeployOnFirstFailure":true,

"enableUnitTests":true,

"unitTestEndpointId":"3013d6a5-7ab0-4edd-ad2f-7f27d6ecb84b"

},

{

"comment":"multiple actions at a time",

"endpointIds":["0a712e24-14ce-4aa9-aeb6-3651a7480a3b"],

"tagNames":[],

"contents":[],

"contentVersionIds":[],

"stage":"DEPLOY",

"stopDeployOnFirstFailure":true

}

]

}'| jq "."

Delete Content or Content VersionsAfter capturing content to vRealize Suite Lifecycle Manager, you can use a POST request to delete the content or content versions you no longer want.

As a content developer, you can delete content from vRealize Suite Lifecycle Manager. When content is deleted, all versions of content are deleted. If you want to retain some versions of content, you can specify only the versions of content that you want to delete. Not all content has multiple versions.

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 30

Prerequisites

n Verify that the appliance name and fully qualified domain name of the vRealize Suite Lifecycle Manager instance are available.

n Verify that the URL variable is assigned.

url='https://LCM-Hostname'

n Verify that you have the IDs of the content or content versions that you want to delete.

Procedure

1 To delete content from vRealize Suite Lifecycle Manager, pass an array of content IDs in the request body.

curl -X POST \

'$url/lcm/cms/api/v1/contents/delete' \

-H 'Accept: application/json' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json'

-d '{

"30318333-8086-415d-937e-08b79edfbb6d",

"a99eb036-4c9a-45bf-886a-7d5f03317f35",

"6aee3b2a-c975-4184-be0d-bd81ee776259"

}'| jq "."

2 To delete content versions, pass an array of content version IDs in the request body.

curl -X POST \

'$url/lcm/cms/api/v1/contents/versions/delete' \

-H 'Accept: application/json' \

-H 'Authorization: Basic YWRtaW5AbG9jYWw6Vk13YXJlMSE=' \

-H 'Content-Type: application/json'

-d '{

"30318333-8086-415d-937e-08b79edfbb6d",

"a99eb036-4c9a-45bf-886a-7d5f03317f35",

"6aee3b2a-c975-4184-be0d-bd81ee776259"

}'| jq "."

vRealize Suite Lifecycle Manager API Programming Guide

VMware, Inc. 31