# FirewallRulesApi

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

| Method                                                                                          | HTTP request                                                                                          | Description                     |
| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------- |
| [**DatacentersServersNicsFirewallrulesDelete**](#DatacentersServersNicsFirewallrulesDelete)     | **Delete** /datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId} | Delete firewall rules           |
| [**DatacentersServersNicsFirewallrulesFindById**](#DatacentersServersNicsFirewallrulesFindById) | **Get** /datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId}    | Retrieve firewall rules         |
| [**DatacentersServersNicsFirewallrulesGet**](#DatacentersServersNicsFirewallrulesGet)           | **Get** /datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules                     | List firewall rules             |
| [**DatacentersServersNicsFirewallrulesPatch**](#DatacentersServersNicsFirewallrulesPatch)       | **Patch** /datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId}  | Partially modify firewall rules |
| [**DatacentersServersNicsFirewallrulesPost**](#DatacentersServersNicsFirewallrulesPost)         | **Post** /datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules                    | Create a Firewall Rule          |
| [**DatacentersServersNicsFirewallrulesPut**](#DatacentersServersNicsFirewallrulesPut)           | **Put** /datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId}    | Modify a Firewall Rule          |

## DatacentersServersNicsFirewallrulesDelete

```go
var result  = DatacentersServersNicsFirewallrulesDelete(ctx, datacenterId, serverId, nicId, firewallruleId)
                      .Pretty(pretty)
                      .Depth(depth)
                      .XContractNumber(xContractNumber)
                      .Execute()
```

Delete firewall rules

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)

func main() {
    datacenterId := "datacenterId_example" // string | The unique ID of the data center.
    serverId := "serverId_example" // string | The unique ID of the server.
    nicId := "nicId_example" // string | The unique ID of the NIC.
    firewallruleId := "firewallruleId_example" // string | The unique ID of the firewall rule.
    pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
    depth := int32(56) // int32 | 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's children are included.  - depth=... and so on (optional) (default to 0)
    xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)

    configuration := ionoscloud.NewConfiguration()
    apiClient := ionoscloud.NewAPIClient(configuration)
    resp, err := apiClient.FirewallRulesApi.DatacentersServersNicsFirewallrulesDelete(context.Background(), datacenterId, serverId, nicId, firewallruleId).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `FirewallRulesApi.DatacentersServersNicsFirewallrulesDelete``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
}
```

### Path Parameters

| Name               | Type                | Description                                                                 | Notes |
| ------------------ | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**            | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **datacenterId**   | **string**          | The unique ID of the data center.                                           |       |
| **serverId**       | **string**          | The unique ID of the server.                                                |       |
| **nicId**          | **string**          | The unique ID of the NIC.                                                   |       |
| **firewallruleId** | **string**          | The unique ID of the firewall rule.                                         |       |

### Other Parameters

Other parameters are passed through a pointer to a apiDatacentersServersNicsFirewallrulesDeleteRequest struct via the builder pattern

| Name                | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                              | Notes              |
| ------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| **pretty**          | **bool**  | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                       | \[default to true] |
| **depth**           | **int32** | 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's children are included. - depth=... and so on | \[default to 0]    |
| **xContractNumber** | **int32** | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                           |                    |

### Return type

(empty response body)

### HTTP request headers

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

## DatacentersServersNicsFirewallrulesFindById

```go
var result FirewallRule = DatacentersServersNicsFirewallrulesFindById(ctx, datacenterId, serverId, nicId, firewallruleId)
                      .Pretty(pretty)
                      .Depth(depth)
                      .XContractNumber(xContractNumber)
                      .Execute()
```

Retrieve firewall rules

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)

func main() {
    datacenterId := "datacenterId_example" // string | The unique ID of the data center.
    serverId := "serverId_example" // string | The unique ID of the server.
    nicId := "nicId_example" // string | The unique ID of the NIC.
    firewallruleId := "firewallruleId_example" // string | The unique ID of the firewall rule.
    pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
    depth := int32(56) // int32 | 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's children are included.  - depth=... and so on (optional) (default to 0)
    xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)

    configuration := ionoscloud.NewConfiguration()
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.FirewallRulesApi.DatacentersServersNicsFirewallrulesFindById(context.Background(), datacenterId, serverId, nicId, firewallruleId).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `FirewallRulesApi.DatacentersServersNicsFirewallrulesFindById``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `DatacentersServersNicsFirewallrulesFindById`: FirewallRule
    fmt.Fprintf(os.Stdout, "Response from `FirewallRulesApi.DatacentersServersNicsFirewallrulesFindById`: %v\n", resp)
}
```

### Path Parameters

| Name               | Type                | Description                                                                 | Notes |
| ------------------ | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**            | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **datacenterId**   | **string**          | The unique ID of the data center.                                           |       |
| **serverId**       | **string**          | The unique ID of the server.                                                |       |
| **nicId**          | **string**          | The unique ID of the NIC.                                                   |       |
| **firewallruleId** | **string**          | The unique ID of the firewall rule.                                         |       |

### Other Parameters

Other parameters are passed through a pointer to a apiDatacentersServersNicsFirewallrulesFindByIdRequest struct via the builder pattern

| Name                | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                              | Notes              |
| ------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| **pretty**          | **bool**  | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                       | \[default to true] |
| **depth**           | **int32** | 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's children are included. - depth=... and so on | \[default to 0]    |
| **xContractNumber** | **int32** | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                           |                    |

### Return type

[**FirewallRule**](/golang-sdk/models/firewallrule.md)

### HTTP request headers

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

## DatacentersServersNicsFirewallrulesGet

```go
var result FirewallRules = DatacentersServersNicsFirewallrulesGet(ctx, datacenterId, serverId, nicId)
                      .Pretty(pretty)
                      .Depth(depth)
                      .XContractNumber(xContractNumber)
                      .Offset(offset)
                      .Limit(limit)
                      .Execute()
```

List firewall rules

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)

func main() {
    datacenterId := "datacenterId_example" // string | The unique ID of the data center.
    serverId := "serverId_example" // string | The unique ID of the server.
    nicId := "nicId_example" // string | The unique ID of the NIC.
    pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
    depth := int32(56) // int32 | 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's children are included.  - depth=... and so on (optional) (default to 0)
    xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)
    offset := int32(56) // int32 | 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 := int32(56) // int32 | The maximum number of elements to return (use together with offset for pagination). (optional) (default to 1000)

    configuration := ionoscloud.NewConfiguration()
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.FirewallRulesApi.DatacentersServersNicsFirewallrulesGet(context.Background(), datacenterId, serverId, nicId).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Offset(offset).Limit(limit).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `FirewallRulesApi.DatacentersServersNicsFirewallrulesGet``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `DatacentersServersNicsFirewallrulesGet`: FirewallRules
    fmt.Fprintf(os.Stdout, "Response from `FirewallRulesApi.DatacentersServersNicsFirewallrulesGet`: %v\n", resp)
}
```

### Path Parameters

| Name             | Type                | Description                                                                 | Notes |
| ---------------- | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**          | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **datacenterId** | **string**          | The unique ID of the data center.                                           |       |
| **serverId**     | **string**          | The unique ID of the server.                                                |       |
| **nicId**        | **string**          | The unique ID of the NIC.                                                   |       |

### Other Parameters

Other parameters are passed through a pointer to a apiDatacentersServersNicsFirewallrulesGetRequest struct via the builder pattern

| Name                | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                              | Notes              |
| ------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| **pretty**          | **bool**  | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                       | \[default to true] |
| **depth**           | **int32** | 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's children are included. - depth=... and so on | \[default to 0]    |
| **xContractNumber** | **int32** | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                           |                    |
| **offset**          | **int32** | 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).                                                                                                                                                                                                                                                                                       | \[default to 0]    |
| **limit**           | **int32** | The maximum number of elements to return (use together with offset for pagination).                                                                                                                                                                                                                                                                                                                                                      | \[default to 1000] |

### Return type

[**FirewallRules**](/golang-sdk/models/firewallrules.md)

### HTTP request headers

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

## DatacentersServersNicsFirewallrulesPatch

```go
var result FirewallRule = DatacentersServersNicsFirewallrulesPatch(ctx, datacenterId, serverId, nicId, firewallruleId)
                      .Firewallrule(firewallrule)
                      .Pretty(pretty)
                      .Depth(depth)
                      .XContractNumber(xContractNumber)
                      .Execute()
```

Partially modify firewall rules

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)

func main() {
    datacenterId := "datacenterId_example" // string | The unique ID of the data center.
    serverId := "serverId_example" // string | The unique ID of the server.
    nicId := "nicId_example" // string | The unique ID of the NIC.
    firewallruleId := "firewallruleId_example" // string | The unique ID of the firewall rule.
    firewallrule := *openapiclient.NewFirewallruleProperties() // FirewallruleProperties | The properties of the firewall rule to be updated.
    pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
    depth := int32(56) // int32 | 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's children are included.  - depth=... and so on (optional) (default to 0)
    xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)

    configuration := ionoscloud.NewConfiguration()
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.FirewallRulesApi.DatacentersServersNicsFirewallrulesPatch(context.Background(), datacenterId, serverId, nicId, firewallruleId).Firewallrule(firewallrule).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `FirewallRulesApi.DatacentersServersNicsFirewallrulesPatch``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `DatacentersServersNicsFirewallrulesPatch`: FirewallRule
    fmt.Fprintf(os.Stdout, "Response from `FirewallRulesApi.DatacentersServersNicsFirewallrulesPatch`: %v\n", resp)
}
```

### Path Parameters

| Name               | Type                | Description                                                                 | Notes |
| ------------------ | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**            | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **datacenterId**   | **string**          | The unique ID of the data center.                                           |       |
| **serverId**       | **string**          | The unique ID of the server.                                                |       |
| **nicId**          | **string**          | The unique ID of the NIC.                                                   |       |
| **firewallruleId** | **string**          | The unique ID of the firewall rule.                                         |       |

### Other Parameters

Other parameters are passed through a pointer to a apiDatacentersServersNicsFirewallrulesPatchRequest struct via the builder pattern

| Name                | Type                                                                       | Description                                                                                                                                                                                                                                                                                                                                                                                                                              | Notes              |
| ------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| **firewallrule**    | [**FirewallruleProperties**](/golang-sdk/models/firewallruleproperties.md) | The properties of the firewall rule to be updated.                                                                                                                                                                                                                                                                                                                                                                                       |                    |
| **pretty**          | **bool**                                                                   | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                       | \[default to true] |
| **depth**           | **int32**                                                                  | 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's children are included. - depth=... and so on | \[default to 0]    |
| **xContractNumber** | **int32**                                                                  | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                           |                    |

### Return type

[**FirewallRule**](/golang-sdk/models/firewallrule.md)

### HTTP request headers

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

## DatacentersServersNicsFirewallrulesPost

```go
var result FirewallRule = DatacentersServersNicsFirewallrulesPost(ctx, datacenterId, serverId, nicId)
                      .Firewallrule(firewallrule)
                      .Pretty(pretty)
                      .Depth(depth)
                      .XContractNumber(xContractNumber)
                      .Execute()
```

Create a Firewall Rule

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)

func main() {
    datacenterId := "datacenterId_example" // string | The unique ID of the data center.
    serverId := "serverId_example" // string | The unique ID of the server.
    nicId := "nicId_example" // string | The unique ID of the NIC.
    firewallrule := *openapiclient.NewFirewallRule(*openapiclient.NewFirewallruleProperties()) // FirewallRule | The firewall rule to create.
    pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
    depth := int32(56) // int32 | 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's children are included.  - depth=... and so on (optional) (default to 0)
    xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)

    configuration := ionoscloud.NewConfiguration()
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.FirewallRulesApi.DatacentersServersNicsFirewallrulesPost(context.Background(), datacenterId, serverId, nicId).Firewallrule(firewallrule).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `FirewallRulesApi.DatacentersServersNicsFirewallrulesPost``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `DatacentersServersNicsFirewallrulesPost`: FirewallRule
    fmt.Fprintf(os.Stdout, "Response from `FirewallRulesApi.DatacentersServersNicsFirewallrulesPost`: %v\n", resp)
}
```

### Path Parameters

| Name             | Type                | Description                                                                 | Notes |
| ---------------- | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**          | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **datacenterId** | **string**          | The unique ID of the data center.                                           |       |
| **serverId**     | **string**          | The unique ID of the server.                                                |       |
| **nicId**        | **string**          | The unique ID of the NIC.                                                   |       |

### Other Parameters

Other parameters are passed through a pointer to a apiDatacentersServersNicsFirewallrulesPostRequest struct via the builder pattern

| Name                | Type                                                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                              | Notes              |
| ------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| **firewallrule**    | [**FirewallRule**](/golang-sdk/models/firewallrule.md) | The firewall rule to create.                                                                                                                                                                                                                                                                                                                                                                                                             |                    |
| **pretty**          | **bool**                                               | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                       | \[default to true] |
| **depth**           | **int32**                                              | 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's children are included. - depth=... and so on | \[default to 0]    |
| **xContractNumber** | **int32**                                              | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                           |                    |

### Return type

[**FirewallRule**](/golang-sdk/models/firewallrule.md)

### HTTP request headers

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

## DatacentersServersNicsFirewallrulesPut

```go
var result FirewallRule = DatacentersServersNicsFirewallrulesPut(ctx, datacenterId, serverId, nicId, firewallruleId)
                      .Firewallrule(firewallrule)
                      .Pretty(pretty)
                      .Depth(depth)
                      .XContractNumber(xContractNumber)
                      .Execute()
```

Modify a Firewall Rule

### Example

```go
package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)

func main() {
    datacenterId := "datacenterId_example" // string | The unique ID of the data center.
    serverId := "serverId_example" // string | The unique ID of the server.
    nicId := "nicId_example" // string | The unique ID of the NIC.
    firewallruleId := "firewallruleId_example" // string | The unique ID of the firewall rule.
    firewallrule := *openapiclient.NewFirewallRule(*openapiclient.NewFirewallruleProperties()) // FirewallRule | The modified firewall rule.
    pretty := true // bool | Controls whether the response is pretty-printed (with indentations and new lines). (optional) (default to true)
    depth := int32(56) // int32 | 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's children are included.  - depth=... and so on (optional) (default to 0)
    xContractNumber := int32(56) // int32 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed. (optional)

    configuration := ionoscloud.NewConfiguration()
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.FirewallRulesApi.DatacentersServersNicsFirewallrulesPut(context.Background(), datacenterId, serverId, nicId, firewallruleId).Firewallrule(firewallrule).Pretty(pretty).Depth(depth).XContractNumber(xContractNumber).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `FirewallRulesApi.DatacentersServersNicsFirewallrulesPut``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `DatacentersServersNicsFirewallrulesPut`: FirewallRule
    fmt.Fprintf(os.Stdout, "Response from `FirewallRulesApi.DatacentersServersNicsFirewallrulesPut`: %v\n", resp)
}
```

### Path Parameters

| Name               | Type                | Description                                                                 | Notes |
| ------------------ | ------------------- | --------------------------------------------------------------------------- | ----- |
| **ctx**            | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. |       |
| **datacenterId**   | **string**          | The unique ID of the data center.                                           |       |
| **serverId**       | **string**          | The unique ID of the server.                                                |       |
| **nicId**          | **string**          | The unique ID of the NIC.                                                   |       |
| **firewallruleId** | **string**          | The unique ID of the firewall rule.                                         |       |

### Other Parameters

Other parameters are passed through a pointer to a apiDatacentersServersNicsFirewallrulesPutRequest struct via the builder pattern

| Name                | Type                                                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                              | Notes              |
| ------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| **firewallrule**    | [**FirewallRule**](/golang-sdk/models/firewallrule.md) | The modified firewall rule.                                                                                                                                                                                                                                                                                                                                                                                                              |                    |
| **pretty**          | **bool**                                               | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                       | \[default to true] |
| **depth**           | **int32**                                              | 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's children are included. - depth=... and so on | \[default to 0]    |
| **xContractNumber** | **int32**                                              | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                           |                    |

### Return type

[**FirewallRule**](/golang-sdk/models/firewallrule.md)

### HTTP request headers

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/golang-sdk/api/firewallrulesapi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
