Skip to content

Latest commit

 

History

History
775 lines (514 loc) · 24 KB

File metadata and controls

775 lines (514 loc) · 24 KB

hostinger_api.VPSFirewallApi

All URIs are relative to https://developers.hostinger.com

Method HTTP request Description
activate_firewall_v1 POST /api/vps/v1/firewall/{firewallId}/activate/{virtualMachineId} Activate firewall
create_firewall_rule_v1 POST /api/vps/v1/firewall/{firewallId}/rules Create firewall rule
create_new_firewall_v1 POST /api/vps/v1/firewall Create new firewall
deactivate_firewall_v1 POST /api/vps/v1/firewall/{firewallId}/deactivate/{virtualMachineId} Deactivate firewall
delete_firewall_rule_v1 DELETE /api/vps/v1/firewall/{firewallId}/rules/{ruleId} Delete firewall rule
delete_firewall_v1 DELETE /api/vps/v1/firewall/{firewallId} Delete firewall
get_firewall_details_v1 GET /api/vps/v1/firewall/{firewallId} Get firewall details
get_firewall_list_v1 GET /api/vps/v1/firewall Get firewall list
sync_firewall_v1 POST /api/vps/v1/firewall/{firewallId}/sync/{virtualMachineId} Sync firewall
update_firewall_rule_v1 PUT /api/vps/v1/firewall/{firewallId}/rules/{ruleId} Update firewall rule

activate_firewall_v1

VPSV1ActionActionResource activate_firewall_v1(firewall_id, virtual_machine_id)

Activate firewall

Activate a firewall for a specified virtual machine.

Only one firewall can be active for a virtual machine at a time.

Use this endpoint to apply firewall rules to VPS instances.

Example

  • Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
from hostinger_api.rest import ApiException
from pprint import pprint


# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hostinger_api.VPSFirewallApi(api_client)
    firewall_id = 9449049 # int | Firewall ID
    virtual_machine_id = 1268054 # int | Virtual Machine ID

    try:
        # Activate firewall
        api_response = api_instance.activate_firewall_v1(firewall_id, virtual_machine_id)
        print("The response of VPSFirewallApi->activate_firewall_v1:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VPSFirewallApi->activate_firewall_v1: %s\n" % e)

Parameters

Name Type Description Notes
firewall_id int Firewall ID
virtual_machine_id int Virtual Machine ID

Return type

VPSV1ActionActionResource

Authorization

apiToken

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Success response -
422 Validation error response -
401 Unauthenticated response -
500 Error response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_firewall_rule_v1

VPSV1FirewallFirewallRuleResource create_firewall_rule_v1(firewall_id, vpsv1_firewall_rules_store_request)

Create firewall rule

Create new firewall rule for a specified firewall.

By default, the firewall drops all incoming traffic, which means you must add accept rules for all ports you want to use.

Any virtual machine that has this firewall activated will lose sync with the firewall and will have to be synced again manually.

Use this endpoint to add new security rules to firewalls.

Example

  • Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_firewall_firewall_rule_resource import VPSV1FirewallFirewallRuleResource
from hostinger_api.models.vpsv1_firewall_rules_store_request import VPSV1FirewallRulesStoreRequest
from hostinger_api.rest import ApiException
from pprint import pprint


# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hostinger_api.VPSFirewallApi(api_client)
    firewall_id = 9449049 # int | Firewall ID
    vpsv1_firewall_rules_store_request = hostinger_api.VPSV1FirewallRulesStoreRequest() # VPSV1FirewallRulesStoreRequest | 

    try:
        # Create firewall rule
        api_response = api_instance.create_firewall_rule_v1(firewall_id, vpsv1_firewall_rules_store_request)
        print("The response of VPSFirewallApi->create_firewall_rule_v1:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VPSFirewallApi->create_firewall_rule_v1: %s\n" % e)

Parameters

Name Type Description Notes
firewall_id int Firewall ID
vpsv1_firewall_rules_store_request VPSV1FirewallRulesStoreRequest

Return type

VPSV1FirewallFirewallRuleResource

Authorization

apiToken

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Success response -
422 Validation error response -
401 Unauthenticated response -
500 Error response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_new_firewall_v1

VPSV1FirewallFirewallResource create_new_firewall_v1(vpsv1_firewall_store_request)

Create new firewall

Create a new firewall.

Use this endpoint to set up new firewall configurations for VPS security.

Example

  • Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_firewall_firewall_resource import VPSV1FirewallFirewallResource
from hostinger_api.models.vpsv1_firewall_store_request import VPSV1FirewallStoreRequest
from hostinger_api.rest import ApiException
from pprint import pprint


# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hostinger_api.VPSFirewallApi(api_client)
    vpsv1_firewall_store_request = hostinger_api.VPSV1FirewallStoreRequest() # VPSV1FirewallStoreRequest | 

    try:
        # Create new firewall
        api_response = api_instance.create_new_firewall_v1(vpsv1_firewall_store_request)
        print("The response of VPSFirewallApi->create_new_firewall_v1:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VPSFirewallApi->create_new_firewall_v1: %s\n" % e)

Parameters

Name Type Description Notes
vpsv1_firewall_store_request VPSV1FirewallStoreRequest

Return type

VPSV1FirewallFirewallResource

Authorization

apiToken

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Success response -
422 Validation error response -
401 Unauthenticated response -
500 Error response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

deactivate_firewall_v1

VPSV1ActionActionResource deactivate_firewall_v1(firewall_id, virtual_machine_id)

Deactivate firewall

Deactivate a firewall for a specified virtual machine.

Use this endpoint to remove firewall protection from VPS instances.

Example

  • Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
from hostinger_api.rest import ApiException
from pprint import pprint


# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hostinger_api.VPSFirewallApi(api_client)
    firewall_id = 9449049 # int | Firewall ID
    virtual_machine_id = 1268054 # int | Virtual Machine ID

    try:
        # Deactivate firewall
        api_response = api_instance.deactivate_firewall_v1(firewall_id, virtual_machine_id)
        print("The response of VPSFirewallApi->deactivate_firewall_v1:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VPSFirewallApi->deactivate_firewall_v1: %s\n" % e)

Parameters

Name Type Description Notes
firewall_id int Firewall ID
virtual_machine_id int Virtual Machine ID

Return type

VPSV1ActionActionResource

Authorization

apiToken

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Success response -
422 Validation error response -
401 Unauthenticated response -
500 Error response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_firewall_rule_v1

CommonSuccessEmptyResource delete_firewall_rule_v1(firewall_id, rule_id)

Delete firewall rule

Delete a specific firewall rule from a specified firewall.

Any virtual machine that has this firewall activated will lose sync with the firewall and will have to be synced again manually.

Use this endpoint to remove specific firewall rules.

Example

  • Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.common_success_empty_resource import CommonSuccessEmptyResource
from hostinger_api.rest import ApiException
from pprint import pprint


# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hostinger_api.VPSFirewallApi(api_client)
    firewall_id = 9449049 # int | Firewall ID
    rule_id = 8941182 # int | Firewall Rule ID

    try:
        # Delete firewall rule
        api_response = api_instance.delete_firewall_rule_v1(firewall_id, rule_id)
        print("The response of VPSFirewallApi->delete_firewall_rule_v1:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VPSFirewallApi->delete_firewall_rule_v1: %s\n" % e)

Parameters

Name Type Description Notes
firewall_id int Firewall ID
rule_id int Firewall Rule ID

Return type

CommonSuccessEmptyResource

Authorization

apiToken

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Success empty response -
401 Unauthenticated response -
500 Error response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_firewall_v1

CommonSuccessEmptyResource delete_firewall_v1(firewall_id)

Delete firewall

Delete a specified firewall.

Any virtual machine that has this firewall activated will automatically have it deactivated.

Use this endpoint to remove unused firewall configurations.

Example

  • Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.common_success_empty_resource import CommonSuccessEmptyResource
from hostinger_api.rest import ApiException
from pprint import pprint


# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hostinger_api.VPSFirewallApi(api_client)
    firewall_id = 9449049 # int | Firewall ID

    try:
        # Delete firewall
        api_response = api_instance.delete_firewall_v1(firewall_id)
        print("The response of VPSFirewallApi->delete_firewall_v1:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VPSFirewallApi->delete_firewall_v1: %s\n" % e)

Parameters

Name Type Description Notes
firewall_id int Firewall ID

Return type

CommonSuccessEmptyResource

Authorization

apiToken

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Success empty response -
401 Unauthenticated response -
500 Error response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_firewall_details_v1

VPSV1FirewallFirewallResource get_firewall_details_v1(firewall_id)

Get firewall details

Retrieve firewall by its ID and rules associated with it.

Use this endpoint to view specific firewall configuration and rules.

Example

  • Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_firewall_firewall_resource import VPSV1FirewallFirewallResource
from hostinger_api.rest import ApiException
from pprint import pprint


# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hostinger_api.VPSFirewallApi(api_client)
    firewall_id = 9449049 # int | Firewall ID

    try:
        # Get firewall details
        api_response = api_instance.get_firewall_details_v1(firewall_id)
        print("The response of VPSFirewallApi->get_firewall_details_v1:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VPSFirewallApi->get_firewall_details_v1: %s\n" % e)

Parameters

Name Type Description Notes
firewall_id int Firewall ID

Return type

VPSV1FirewallFirewallResource

Authorization

apiToken

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Success response -
401 Unauthenticated response -
500 Error response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_firewall_list_v1

VPSGetFirewallListV1200Response get_firewall_list_v1(page=page)

Get firewall list

Retrieve all available firewalls.

Use this endpoint to view existing firewall configurations.

Example

  • Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vps_get_firewall_list_v1200_response import VPSGetFirewallListV1200Response
from hostinger_api.rest import ApiException
from pprint import pprint


# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hostinger_api.VPSFirewallApi(api_client)
    page = 1 # int | Page number (optional)

    try:
        # Get firewall list
        api_response = api_instance.get_firewall_list_v1(page=page)
        print("The response of VPSFirewallApi->get_firewall_list_v1:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VPSFirewallApi->get_firewall_list_v1: %s\n" % e)

Parameters

Name Type Description Notes
page int Page number [optional]

Return type

VPSGetFirewallListV1200Response

Authorization

apiToken

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Success response -
401 Unauthenticated response -
500 Error response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

sync_firewall_v1

VPSV1ActionActionResource sync_firewall_v1(firewall_id, virtual_machine_id)

Sync firewall

Sync a firewall for a specified virtual machine.

Firewall can lose sync with virtual machine if the firewall has new rules added, removed or updated.

Use this endpoint to apply updated firewall rules to VPS instances.

Example

  • Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
from hostinger_api.rest import ApiException
from pprint import pprint


# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hostinger_api.VPSFirewallApi(api_client)
    firewall_id = 9449049 # int | Firewall ID
    virtual_machine_id = 1268054 # int | Virtual Machine ID

    try:
        # Sync firewall
        api_response = api_instance.sync_firewall_v1(firewall_id, virtual_machine_id)
        print("The response of VPSFirewallApi->sync_firewall_v1:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VPSFirewallApi->sync_firewall_v1: %s\n" % e)

Parameters

Name Type Description Notes
firewall_id int Firewall ID
virtual_machine_id int Virtual Machine ID

Return type

VPSV1ActionActionResource

Authorization

apiToken

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Success response -
422 Validation error response -
401 Unauthenticated response -
500 Error response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

update_firewall_rule_v1

VPSV1FirewallFirewallRuleResource update_firewall_rule_v1(firewall_id, rule_id, vpsv1_firewall_rules_store_request)

Update firewall rule

Update a specific firewall rule from a specified firewall.

Any virtual machine that has this firewall activated will lose sync with the firewall and will have to be synced again manually.

Use this endpoint to modify existing firewall rules.

Example

  • Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.vpsv1_firewall_firewall_rule_resource import VPSV1FirewallFirewallRuleResource
from hostinger_api.models.vpsv1_firewall_rules_store_request import VPSV1FirewallRulesStoreRequest
from hostinger_api.rest import ApiException
from pprint import pprint


# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hostinger_api.VPSFirewallApi(api_client)
    firewall_id = 9449049 # int | Firewall ID
    rule_id = 8941182 # int | Firewall Rule ID
    vpsv1_firewall_rules_store_request = hostinger_api.VPSV1FirewallRulesStoreRequest() # VPSV1FirewallRulesStoreRequest | 

    try:
        # Update firewall rule
        api_response = api_instance.update_firewall_rule_v1(firewall_id, rule_id, vpsv1_firewall_rules_store_request)
        print("The response of VPSFirewallApi->update_firewall_rule_v1:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling VPSFirewallApi->update_firewall_rule_v1: %s\n" % e)

Parameters

Name Type Description Notes
firewall_id int Firewall ID
rule_id int Firewall Rule ID
vpsv1_firewall_rules_store_request VPSV1FirewallRulesStoreRequest

Return type

VPSV1FirewallFirewallRuleResource

Authorization

apiToken

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Success response -
422 Validation error response -
401 Unauthenticated response -
500 Error response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]