# TargetGroupsApi

All URIs are relative to *<https://api.ionos.com/cloudapi/v6>*

| Method                                                                  | HTTP request                             | Description                           |
| ----------------------------------------------------------------------- | ---------------------------------------- | ------------------------------------- |
| [**targetGroupsDelete**](#targetgroupsdelete)                           | **DELETE** /targetgroups/{targetGroupId} | Delete a Target Group by ID           |
| [**targetgroupsFindByTargetGroupId**](#targetgroupsfindbytargetgroupid) | **GET** /targetgroups/{targetGroupId}    | Get a Target Group by ID              |
| [**targetgroupsGet**](#targetgroupsget)                                 | **GET** /targetgroups                    | Get Target Groups                     |
| [**targetgroupsPatch**](#targetgroupspatch)                             | **PATCH** /targetgroups/{targetGroupId}  | Partially Modify a Target Group by ID |
| [**targetgroupsPost**](#targetgroupspost)                               | **POST** /targetgroups                   | Create a Target Group                 |
| [**targetgroupsPut**](#targetgroupsput)                                 | **PUT** /targetgroups/{targetGroupId}    | Modify a Target Group by ID           |

## targetGroupsDelete

> targetGroupsDelete(targetGroupId, opts)

Delete a Target Group by ID

Deletes the target group specified by its ID.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.TargetGroupsApi(config);
// Delete a Target Group by ID
api_instance
  .targetGroupsDelete({
    targetGroupId: targetGroupId_example,
    pretty: true,
    depth: 56,
    xContractNumber: 56, 
        options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                | Type        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                   | Notes                              |
| ------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **targetGroupId**   | **string**  | The unique ID of the target group.                                                                                                                                                                                                                                                                                                                                                                                                            | \[default to undefined]            |
| **pretty**          | **boolean** | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                            | \[optional]\[default to true]      |
| **depth**           | **number**  | Controls the detail depth of the response objects. GET /datacenters/\[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children\&#39;s children are included. - depth=... and so on | \[optional]\[default to 0]         |
| **xContractNumber** | **number**  | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                                | \[optional]\[default to undefined] |

### Return type

nil (empty response body)

### Authorization

Basic Authentication, Token Authentication

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## targetgroupsFindByTargetGroupId

> targetgroupsFindByTargetGroupId(targetGroupId, opts)

Get a Target Group by ID

Retrieves the properties of the target group specified by its ID.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.TargetGroupsApi(config);
// Get a Target Group by ID
api_instance
  .targetgroupsFindByTargetGroupId({
    targetGroupId: targetGroupId_example,
    pretty: true,
    depth: 56,
    xContractNumber: 56, 
        options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                | Type        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                   | Notes                              |
| ------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **targetGroupId**   | **string**  | The unique ID of the target group.                                                                                                                                                                                                                                                                                                                                                                                                            | \[default to undefined]            |
| **pretty**          | **boolean** | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                            | \[optional]\[default to true]      |
| **depth**           | **number**  | Controls the detail depth of the response objects. GET /datacenters/\[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children\&#39;s children are included. - depth=... and so on | \[optional]\[default to 0]         |
| **xContractNumber** | **number**  | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                                | \[optional]\[default to undefined] |

### Return type

[**TargetGroup**](https://docs.ionos.com/sections-test/nodejs-sdk/cloud-api-nodejs-sdk/models/targetgroup)

### Authorization

Basic Authentication, Token Authentication

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## targetgroupsGet

> targetgroupsGet(opts)

Get Target Groups

Lists target groups. A target group is a set of one or more registered targets. You must specify an IP address, a port number, and a weight for each target. Any object with an IP address in your VDC can be a target, for example, a VM, another load balancer, etc. You can register a target with multiple target groups.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.TargetGroupsApi(config);
var filterMap = new Map()
filterMap.set("<property_name>", "<property_value>")
// Get Target Groups
api_instance
  .targetgroupsGet({
    pretty: true,
    depth: 56,
    xContractNumber: 56,
    offset: 56,
    limit: 56
    orderBy: "<property_name>"
    maxResults: 2,
    filters: filterMap
    options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                | Type        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                   | Notes                              |
| ------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **pretty**          | **boolean** | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                            | \[optional]\[default to true]      |
| **depth**           | **number**  | Controls the detail depth of the response objects. GET /datacenters/\[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children\&#39;s children are included. - depth=... and so on | \[optional]\[default to 0]         |
| **xContractNumber** | **number**  | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                                | \[optional]\[default to undefined] |
| **offset**          | **number**  | The first element (from the complete list of the elements) to include in the response (used together with \<b>\<i>limit\</i>\</b> for pagination).                                                                                                                                                                                                                                                                                            | \[optional]\[default to 0]         |
| **limit**           | **number**  | The maximum number of elements to return (used together with \<b>\<i>offset\</i>\</b> for pagination). It must not exceed \<b>\<i>200\</i>\</b>.                                                                                                                                                                                                                                                                                              | \[optional]\[default to 100]       |

### Return type

[**TargetGroups**](https://docs.ionos.com/sections-test/nodejs-sdk/cloud-api-nodejs-sdk/models/targetgroups)

### Authorization

Basic Authentication, Token Authentication

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## targetgroupsPatch

> targetgroupsPatch(targetGroupId, targetGroupProperties, opts)

Partially Modify a Target Group by ID

Updates the properties of the target group specified by its ID.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.TargetGroupsApi(config);
// Partially Modify a Target Group by ID
api_instance
  .targetgroupsPatch({
    targetGroupId: targetGroupId_example,
    targetGroupProperties: targetGroupProperties_example,
    pretty: true,
    depth: 56,
    xContractNumber: 56, 
        options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                      | Type                                                                                                                           | Description                                                                                                                                                                                                                                                                                                                                                                                                                                   | Notes                              |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **targetGroupId**         | **string**                                                                                                                     | The unique ID of the target group.                                                                                                                                                                                                                                                                                                                                                                                                            | \[default to undefined]            |
| **targetGroupProperties** | [**TargetGroupProperties**](https://docs.ionos.com/sections-test/nodejs-sdk/cloud-api-nodejs-sdk/models/targetgroupproperties) | The target group properties to be updated.                                                                                                                                                                                                                                                                                                                                                                                                    |                                    |
| **pretty**                | **boolean**                                                                                                                    | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                            | \[optional]\[default to true]      |
| **depth**                 | **number**                                                                                                                     | Controls the detail depth of the response objects. GET /datacenters/\[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children\&#39;s children are included. - depth=... and so on | \[optional]\[default to 0]         |
| **xContractNumber**       | **number**                                                                                                                     | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                                | \[optional]\[default to undefined] |

### Return type

[**TargetGroup**](https://docs.ionos.com/sections-test/nodejs-sdk/cloud-api-nodejs-sdk/models/targetgroup)

### Authorization

Basic Authentication, Token Authentication

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## targetgroupsPost

> targetgroupsPost(targetGroup, opts)

Create a Target Group

Creates a target group.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.TargetGroupsApi(config);
// Create a Target Group
api_instance
  .targetgroupsPost({
    targetGroup: targetGroup_example,
    pretty: true,
    depth: 56,
    xContractNumber: 56, 
        options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                | Type                                                                                                       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                   | Notes                              |
| ------------------- | ---------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **targetGroup**     | [**TargetGroup**](https://docs.ionos.com/sections-test/nodejs-sdk/cloud-api-nodejs-sdk/models/targetgroup) | The target group to create.                                                                                                                                                                                                                                                                                                                                                                                                                   |                                    |
| **pretty**          | **boolean**                                                                                                | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                            | \[optional]\[default to true]      |
| **depth**           | **number**                                                                                                 | Controls the detail depth of the response objects. GET /datacenters/\[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children\&#39;s children are included. - depth=... and so on | \[optional]\[default to 0]         |
| **xContractNumber** | **number**                                                                                                 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                                | \[optional]\[default to undefined] |

### Return type

[**TargetGroup**](https://docs.ionos.com/sections-test/nodejs-sdk/cloud-api-nodejs-sdk/models/targetgroup)

### Authorization

Basic Authentication, Token Authentication

### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

## targetgroupsPut

> targetgroupsPut(targetGroupId, targetGroup, opts)

Modify a Target Group by ID

Modifies the properties of the target group specified by its ID.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.TargetGroupsApi(config);
// Modify a Target Group by ID
api_instance
  .targetgroupsPut({
    targetGroupId: targetGroupId_example,
    targetGroup: targetGroup_example,
    pretty: true,
    depth: 56,
    xContractNumber: 56, 
        options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                | Type                                                                                                             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                   | Notes                              |
| ------------------- | ---------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **targetGroupId**   | **string**                                                                                                       | The unique ID of the target group.                                                                                                                                                                                                                                                                                                                                                                                                            | \[default to undefined]            |
| **targetGroup**     | [**TargetGroupPut**](https://docs.ionos.com/sections-test/nodejs-sdk/cloud-api-nodejs-sdk/models/targetgroupput) | The modified target group.                                                                                                                                                                                                                                                                                                                                                                                                                    |                                    |
| **pretty**          | **boolean**                                                                                                      | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                            | \[optional]\[default to true]      |
| **depth**           | **number**                                                                                                       | Controls the detail depth of the response objects. GET /datacenters/\[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children\&#39;s children are included. - depth=... and so on | \[optional]\[default to 0]         |
| **xContractNumber** | **number**                                                                                                       | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                                | \[optional]\[default to undefined] |

### Return type

[**TargetGroup**](https://docs.ionos.com/sections-test/nodejs-sdk/cloud-api-nodejs-sdk/models/targetgroup)

### Authorization

Basic Authentication, Token Authentication

### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json
