Clusters

This contains APIs related to Gitops Clusters

Get a Cluster linked to an environment by identifier

Securityx-api-key
Request
path Parameters
identifier
required
string

Cluster Identifier for the entity

query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

environmentIdentifier
required
string

environmentIdentifier

agentIdentifier
string

agentIdentifier

deleted
boolean
Default: false

Specify whether cluster is deleted or not

Responses
400

Bad Request

500

Internal Server Error

default

The saved Cluster

get/ng/api/gitops/clusters/{identifier}
Request samples
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Unlink a cluster by identifier

Unlink a cluster from an environment by identifier

Securityx-api-key
Request
path Parameters
identifier
required
string

Cluster Identifier for the entity

query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

environmentIdentifier
required
string

environmentIdentifier

agentIdentifier
string

agentIdentifier

scope
string

Scope for the gitops cluster

Enum: "ACCOUNT" "ORGANIZATION" "PROJECT"
Responses
400

Bad Request

500

Internal Server Error

default

Returns true if the Cluster is deleted

delete/ng/api/gitops/clusters/{identifier}
Request samples
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Gets cluster list

Securityx-api-key
Request
query Parameters
page
integer <int32>
Default: 0

Page Index of the results to fetch.Default Value: 0

size
integer <int32>
Default: 100

Results per page

accountIdentifier
required
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

environmentIdentifier
required
string

Environment Identifier of the clusters

searchTerm
string

The word to be searched and included in the list response

identifiers
Array of strings

List of cluster identifiers

sort
Array of strings

Specifies the sorting criteria of the list. Like sorting based on the last updated entity, alphabetical sorting in an ascending or descending order

scope
string

Scope of linked clusters to be returned, ACCOUNT/ORGANIZATION/PROJECT. Returns all by default if this is not specified

Enum: "ACCOUNT" "ORGANIZATION" "PROJECT"
Responses
400

Bad Request

500

Internal Server Error

default

Returns the list of cluster for a Project

get/ng/api/gitops/clusters
Request samples
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Link a Cluster

Link a GitOps cluster to an environment by identifier

Securityx-api-key
Request
query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

Request Body schema:

Details of the createCluster to be linked

identifier
string

identifier of the cluster

orgIdentifier
string

organization identifier of the cluster

agentIdentifier
string

agent identifier of the cluster

projectIdentifier
string

project identifier of the cluster

envRef
required
string

environment identifier of the cluster

scope
string

scope at which the cluster exists in harness gitops, project vs org vs account

Enum: "ACCOUNT" "ORGANIZATION" "PROJECT"
Responses
400

Bad Request

500

Internal Server Error

default

Returns the linked Cluster

post/ng/api/gitops/clusters
Request samples
{
  • "identifier": "string",
  • "orgIdentifier": "string",
  • "agentIdentifier": "string",
  • "projectIdentifier": "string",
  • "envRef": "string",
  • "scope": "ACCOUNT"
}
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Link Clusters

Securityx-api-key
Request
query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

Request Body schema:

Details of the createCluster to be created

orgIdentifier
string

organization identifier of the cluster

projectIdentifier
string

project identifier of the cluster

envRef
required
string

environment identifier of the cluster

linkAllClusters
boolean

link all clusters

unlinkAllClusters
boolean

unlink all clusters

searchTerm
string

search term if applicable. only valid if linking all clusters

Array of objects (ClusterBasicDTO)

list of cluster identifiers and names

Responses
400

Bad Request

500

Internal Server Error

default

Returns the linked Clusters

post/ng/api/gitops/clusters/batch
Request samples
{
  • "orgIdentifier": "string",
  • "projectIdentifier": "string",
  • "envRef": "string",
  • "linkAllClusters": true,
  • "unlinkAllClusters": true,
  • "searchTerm": "string",
  • "clusters": [
    ]
}
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Unlink Clusters

Securityx-api-key
Request
query Parameters
accountIdentifier
required
string

Account Identifier for the Entity.

Request Body schema:

Details of the createCluster to be created

orgIdentifier
string

organization identifier of the cluster

projectIdentifier
string

project identifier of the cluster

envRef
required
string

environment identifier of the cluster

linkAllClusters
boolean

link all clusters

unlinkAllClusters
boolean

unlink all clusters

searchTerm
string

search term if applicable. only valid if linking all clusters

Array of objects (ClusterBasicDTO)

list of cluster identifiers and names

Responses
400

Bad Request

500

Internal Server Error

default

Returns true if all the Clusters are deleted

post/ng/api/gitops/clusters/batchunlink
Request samples
{
  • "orgIdentifier": "string",
  • "projectIdentifier": "string",
  • "envRef": "string",
  • "linkAllClusters": true,
  • "unlinkAllClusters": true,
  • "searchTerm": "string",
  • "clusters": [
    ]
}
Response samples
{
  • "status": "SUCCESS",
  • "code": "DEFAULT_ERROR_CODE",
  • "message": "string",
  • "correlationId": "string",
  • "errors": [
    ]
}

Get a cluster managed by an agent by name

Get a cluster managed by agent using name

Securityx-api-key
Request
path Parameters
agentIdentifier
required
string

Agent identifier for entity.

query Parameters
accountIdentifier
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

name
string
fetchScopePrefixedIdentifier
boolean

Indicates whether the identifier of cluster fetched must contain harness scope prefix (account./org.)

Responses
200

A successful response.

default

An unexpected error response.

get/gitops/api/v1/agents/{agentIdentifier}/cluster_byname
Request samples
Response samples
application/json
{
  • "accountIdentifier": "string",
  • "orgIdentifier": "string",
  • "projectIdentifier": "string",
  • "agentIdentifier": "string",
  • "identifier": "string",
  • "cluster": {
    },
  • "createdAt": "2019-08-24T14:15:22Z",
  • "lastModifiedAt": "2019-08-24T14:15:22Z",
  • "stale": true,
  • "tags": {
    }
}

Get a cluster managed by an agent by URL

Get a cluster managed by agent using URL

Securityx-api-key
Request
path Parameters
agentIdentifier
required
string

Agent identifier for entity.

query Parameters
accountIdentifier
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

server
string
fetchScopePrefixedIdentifier
boolean

Indicates whether the identifier of cluster fetched must contain harness scope prefix (account./org.)

Responses
200

A successful response.

default

An unexpected error response.

get/gitops/api/v1/agents/{agentIdentifier}/cluster_byurl
Request samples
Response samples
application/json
{
  • "accountIdentifier": "string",
  • "orgIdentifier": "string",
  • "projectIdentifier": "string",
  • "agentIdentifier": "string",
  • "identifier": "string",
  • "cluster": {
    },
  • "createdAt": "2019-08-24T14:15:22Z",
  • "lastModifiedAt": "2019-08-24T14:15:22Z",
  • "stale": true,
  • "tags": {
    }
}

List returns list of clusters

List clusters.

Securityx-api-key
Request
path Parameters
agentIdentifier
required
string

Agent identifier for entity.

query Parameters
accountIdentifier
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

identifier
string
query.server
string
query.name
string
query.id.type
string

type is the type of the specified cluster identifier ( "server" - default, "name" ).

query.id.value
string

value holds the cluster server URL or cluster name.

query.project
string
Responses
200

A successful response.

default

An unexpected error response.

get/gitops/api/v1/agents/{agentIdentifier}/clusters
Request samples
Response samples
application/json
{
  • "metadata": {
    },
  • "items": [
    ]
}

Create creates a cluster

Create cluster.

Securityx-api-key
Request
path Parameters
agentIdentifier
required
string

Agent identifier for entity.

query Parameters
accountIdentifier
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

identifier
string
Request Body schema: application/json
required
object (Cluster is the definition of a cluster resource)
upsert
boolean
object
Responses
200

A successful response.

default

An unexpected error response.

post/gitops/api/v1/agents/{agentIdentifier}/clusters
Request samples
application/json
{
  • "cluster": {
    },
  • "upsert": true,
  • "tags": {
    }
}
Response samples
application/json
{
  • "accountIdentifier": "string",
  • "orgIdentifier": "string",
  • "projectIdentifier": "string",
  • "agentIdentifier": "string",
  • "identifier": "string",
  • "cluster": {
    },
  • "createdAt": "2019-08-24T14:15:22Z",
  • "lastModifiedAt": "2019-08-24T14:15:22Z",
  • "stale": true,
  • "tags": {
    }
}

Get returns a cluster by identifier

Get cluster.

Securityx-api-key
Request
path Parameters
agentIdentifier
required
string

Agent identifier for entity.

identifier
required
string
query Parameters
accountIdentifier
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

query.server
string
query.name
string
query.id.type
string

type is the type of the specified cluster identifier ( "server" - default, "name" ).

query.id.value
string

value holds the cluster server URL or cluster name.

query.project
string
Responses
200

A successful response.

default

An unexpected error response.

get/gitops/api/v1/agents/{agentIdentifier}/clusters/{identifier}
Request samples
Response samples
application/json
{
  • "accountIdentifier": "string",
  • "orgIdentifier": "string",
  • "projectIdentifier": "string",
  • "agentIdentifier": "string",
  • "identifier": "string",
  • "cluster": {
    },
  • "createdAt": "2019-08-24T14:15:22Z",
  • "lastModifiedAt": "2019-08-24T14:15:22Z",
  • "stale": true,
  • "tags": {
    }
}

Delete deletes a cluster

Delete cluster.

Securityx-api-key
Request
path Parameters
agentIdentifier
required
string

Agent identifier for entity.

identifier
required
string
query Parameters
accountIdentifier
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

query.server
string
query.name
string
query.id.type
string

type is the type of the specified cluster identifier ( "server" - default, "name" ).

query.id.value
string

value holds the cluster server URL or cluster name.

query.project
string
Responses
200

A successful response.

default

An unexpected error response.

delete/gitops/api/v1/agents/{agentIdentifier}/clusters/{identifier}
Request samples
Response samples
application/json
{ }

Update updates a cluster

Update cluster.

Securityx-api-key
Request
path Parameters
agentIdentifier
required
string

Agent identifier for entity.

identifier
required
string
query Parameters
accountIdentifier
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

Request Body schema: application/json
required
object (Cluster is the definition of a cluster resource)
updatedFields
Array of strings
object (`FieldMask` represents a set of symbolic field paths, for example:)

paths: "f.a" paths: "f.b.d"

Here f represents a field in some root message, a and b fields in the message found in f, and d a field found in the message in f.b.

Field masks are used to specify a subset of fields that should be returned by a get operation or modified by an update operation. Field masks also have a custom JSON encoding (see below).

Field Masks in Projections

When used in the context of a projection, a response message or sub-message is filtered by the API to only contain those fields as specified in the mask. For example, if the mask in the previous example is applied to a response message as follows:

f {
  a : 22
  b {
    d : 1
    x : 2
  }
  y : 13
}
z: 8

The result will not contain specific values for fields x,y and z (their value will be set to the default, and omitted in proto text output):

f {
  a : 22
  b {
    d : 1
  }
}

A repeated field is not allowed except at the last position of a paths string.

If a FieldMask object is not present in a get operation, the operation applies to all fields (as if a FieldMask of all fields had been specified).

Note that a field mask does not necessarily apply to the top-level response message. In case of a REST get operation, the field mask applies directly to the response, but in case of a REST list operation, the mask instead applies to each individual message in the returned resource list. In case of a REST custom method, other definitions may be used. Where the mask applies will be clearly documented together with its declaration in the API. In any case, the effect on the returned resource/resources is required behavior for APIs.

Field Masks in Update Operations

A field mask in update operations specifies which fields of the targeted resource are going to be updated. The API is required to only change the values of the fields as specified in the mask and leave the others untouched. If a resource is passed in to describe the updated values, the API ignores the values of all fields not covered by the mask.

If a repeated field is specified for an update operation, new values will be appended to the existing repeated field in the target resource. Note that a repeated field is only allowed in the last position of a paths string.

If a sub-message is specified in the last position of the field mask for an update operation, then new value will be merged into the existing sub-message in the target resource.

For example, given the target message:

f {
  b {
    d: 1
    x: 2
  }
  c: [1]
}

And an update message:

f {
  b {
    d: 10
  }
  c: [2]
}

then if the field mask is:

paths: ["f.b", "f.c"]

then the result will be:

f {
  b {
    d: 10
    x: 2
  }
  c: [1, 2]
}

An implementation may provide options to override this default behavior for repeated and message fields.

In order to reset a field's value to the default, the field must be in the mask and set to the default value in the provided resource. Hence, in order to reset all fields of a resource, provide a default instance of the resource and set all fields in the mask, or do not provide a mask as described below.

If a field mask is not present on update, the operation applies to all fields (as if a field mask of all fields has been specified). Note that in the presence of schema evolution, this may mean that fields the client does not know and has therefore not filled into the request will be reset to their default. If this is unwanted behavior, a specific service may require a client to always specify a field mask, producing an error if not.

As with get operations, the location of the resource which describes the updated values in the request message depends on the operation kind. In any case, the effect of the field mask is required to be honored by the API.

Considerations for HTTP REST

The HTTP kind of an update operation which uses a field mask must be set to PATCH instead of PUT in order to satisfy HTTP semantics (PUT must only be used for full updates).

JSON Encoding of Field Masks

In JSON, a field mask is encoded as a single string where paths are separated by a comma. Fields name in each path are converted to/from lower-camel naming conventions.

As an example, consider the following message declarations:

message Profile {
  User user = 1;
  Photo photo = 2;
}
message User {
  string display_name = 1;
  string address = 2;
}

In proto a field mask for Profile may look as such:

mask {
  paths: "user.display_name"
  paths: "photo"
}

In JSON, the same mask is represented as below:

{
  mask: "user.displayName,photo"
}

Field Masks and Oneof Fields

Field masks treat fields in oneofs just as regular fields. Consider the following message:

message SampleMessage {
  oneof test_oneof {
    string name = 4;
    SubMessage sub_message = 9;
  }
}

The field mask can be:

mask {
  paths: "name"
}

Or:

mask {
  paths: "sub_message"
}

Note that oneof type names ("test_oneof" in this case) cannot be used in paths.

Field Mask Verification

The implementation of any API method which has a FieldMask type field in the request should verify the included field paths, and return an INVALID_ARGUMENT error if any path is unmappable.

object
object (ClusterID holds a cluster server URL or cluster name)
Responses
200

A successful response.

default

An unexpected error response.

put/gitops/api/v1/agents/{agentIdentifier}/clusters/{identifier}
Request samples
application/json
{
  • "cluster": {
    },
  • "updatedFields": [
    ],
  • "updateMask": {
    },
  • "tags": {
    },
  • "id": {
    }
}
Response samples
application/json
{
  • "accountIdentifier": "string",
  • "orgIdentifier": "string",
  • "projectIdentifier": "string",
  • "agentIdentifier": "string",
  • "identifier": "string",
  • "cluster": {
    },
  • "createdAt": "2019-08-24T14:15:22Z",
  • "lastModifiedAt": "2019-08-24T14:15:22Z",
  • "stale": true,
  • "tags": {
    }
}

List all available repository certificates

List all available repository certificates.

Securityx-api-key
Request
path Parameters
agentIdentifier
required
string

Agent identifier for entity.

query Parameters
accountIdentifier
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

query.keyID
string

The GPG key ID to query for.

Responses
200

A successful response.

default

An unexpected error response.

get/gitops/api/v1/agents/{agentIdentifier}/gpgkeys
Request samples
Response samples
application/json
{
  • "metadata": {
    },
  • "items": [
    ]
}

CreateHosted creates a harness hosted cluster

Creates Harness hosted cluster.

Securityx-api-key
Request
path Parameters
agentIdentifier
required
string

Agent identifier for entity.

Responses
200

A successful response.

default

An unexpected error response.

post/gitops/api/v1/agents/{agentIdentifier}/hosted/cluster
Request samples
Response samples
application/json
{
  • "accountIdentifier": "string",
  • "orgIdentifier": "string",
  • "projectIdentifier": "string",
  • "agentIdentifier": "string",
  • "identifier": "string",
  • "cluster": {
    },
  • "createdAt": "2019-08-24T14:15:22Z",
  • "lastModifiedAt": "2019-08-24T14:15:22Z",
  • "stale": true,
  • "tags": {
    }
}

List clusters

ListClusters returns a list of clusters.

Securityx-api-key
Request
Request Body schema: application/json
required
accountIdentifier
string

Account Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

agentIdentifier
string

Agent identifier for entity.

identifier
string
searchTerm
string
pageSize
integer <int32>
pageIndex
integer <int32>
filter
object

Filters for Clusters. Eg. "identifier": { "$in": ["id1", "id2"]

sortBy
string (ClusterQueryClusterSortByOptions)
Default: "SORT_BY_NOT_SET"
Enum: "SORT_BY_NOT_SET" "NAME" "GITOPS_AGENT" "URL" "VERSION" "CONNECTIVITY_STATUS"
sortOrder
string (v1SortOrderOptions)
Default: "SORT_ORDER_NOT_SET"
Enum: "SORT_ORDER_NOT_SET" "ASC" "DESC"
Responses
200

A successful response.

default

An unexpected error response.

post/gitops/api/v1/clusters
Request samples
application/json
{
  • "accountIdentifier": "string",
  • "projectIdentifier": "string",
  • "orgIdentifier": "string",
  • "agentIdentifier": "string",
  • "identifier": "string",
  • "searchTerm": "string",
  • "pageSize": 0,
  • "pageIndex": 0,
  • "filter": { },
  • "sortBy": "SORT_BY_NOT_SET",
  • "sortOrder": "SORT_ORDER_NOT_SET"
}
Response samples
application/json
{
  • "content": [
    ],
  • "totalPages": 0,
  • "totalItems": 0,
  • "pageItemCount": 0,
  • "pageSize": 0,
  • "pageIndex": 0,
  • "empty": true
}

Check if a cluster exists

Exists checks whether a cluster with the given identifier exists.

Securityx-api-key
Request
query Parameters
accountIdentifier
string

Account Identifier for the Entity.

orgIdentifier
string

Organization Identifier for the Entity.

projectIdentifier
string

Project Identifier for the Entity.

agentIdentifier
string

Agent identifier for entity.

server
string
Responses
200

A successful response.

default

An unexpected error response.

get/gitops/api/v1/clusters/exists
Request samples
Response samples
application/json
true