Categorygithub.com/sander0542/nginxproxymanager-go
repository
0.0.0-20250128203155-da6fa80348b5
Repository: https://github.com/sander0542/nginxproxymanager-go.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

Go API client for nginxproxymanager

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 2.12.2
  • Package version: 1.0.0
  • Generator version: 7.11.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import nginxproxymanager "github.com/sander0542/nginxproxymanager-go"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value nginxproxymanager.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), nginxproxymanager.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value nginxproxymanager.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), nginxproxymanager.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using nginxproxymanager.ContextOperationServerIndices and nginxproxymanager.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), nginxproxymanager.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), nginxproxymanager.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost/api

ClassMethodHTTP requestDescription
AccessListsAPICreateAccessListPost /nginx/access-listsCreate a Access List
AccessListsAPIDeleteAccessListDelete /nginx/access-lists/{listID}Delete a Access List
AccessListsAPIGetAccessListGet /nginx/access-lists/{listID}Get a access List
AccessListsAPIGetAccessListsGet /nginx/access-listsGet all access lists
AccessListsAPIUpdateAccessListPut /nginx/access-lists/{listID}Update a Access List
AuditLogAPIGetAuditLogGet /audit-logGet Audit Log
CertificatesAPICreateCertificatePost /nginx/certificatesCreate a Certificate
CertificatesAPIDeleteCertificateDelete /nginx/certificates/{certID}Delete a Certificate
CertificatesAPIDownloadCertificateGet /nginx/certificates/{certID}/downloadDownloads a Certificate
CertificatesAPIGetCertificateGet /nginx/certificates/{certID}Get a Certificate
CertificatesAPIGetCertificatesGet /nginx/certificatesGet all certificates
CertificatesAPIRenewCertificatePost /nginx/certificates/{certID}/renewRenews a Certificate
CertificatesAPITestHttpReachGet /nginx/certificates/test-httpTest HTTP Reachability
CertificatesAPIUploadCertificatePost /nginx/certificates/{certID}/uploadUploads a custom Certificate
CertificatesAPIValidateCertificatesPost /nginx/certificates/validateValidates given Custom Certificates
Class404HostsAPICreate404HostPost /nginx/dead-hostsCreate a 404 Host
Class404HostsAPIDeleteDeadHostDelete /nginx/dead-hosts/{hostID}Delete a 404 Host
Class404HostsAPIDisableDeadHostPost /nginx/dead-hosts/{hostID}/disableDisable a 404 Host
Class404HostsAPIEnableDeadHostPost /nginx/dead-hosts/{hostID}/enableEnable a 404 Host
Class404HostsAPIGetDeadHostGet /nginx/dead-hosts/{hostID}Get a 404 Host
Class404HostsAPIGetDeadHostsGet /nginx/dead-hostsGet all 404 hosts
Class404HostsAPIUpdateDeadHostPut /nginx/dead-hosts/{hostID}Update a 404 Host
ProxyHostsAPICreateProxyHostPost /nginx/proxy-hostsCreate a Proxy Host
ProxyHostsAPIDeleteProxyHostDelete /nginx/proxy-hosts/{hostID}Delete a Proxy Host
ProxyHostsAPIDisableProxyHostPost /nginx/proxy-hosts/{hostID}/disableDisable a Proxy Host
ProxyHostsAPIEnableProxyHostPost /nginx/proxy-hosts/{hostID}/enableEnable a Proxy Host
ProxyHostsAPIGetProxyHostGet /nginx/proxy-hosts/{hostID}Get a Proxy Host
ProxyHostsAPIGetProxyHostsGet /nginx/proxy-hostsGet all proxy hosts
ProxyHostsAPIUpdateProxyHostPut /nginx/proxy-hosts/{hostID}Update a Proxy Host
PublicAPIHealthGet /Returns the API health status
PublicAPISchemaGet /schemaReturns this swagger API schema
RedirectionHostsAPICreateRedirectionHostPost /nginx/redirection-hostsCreate a Redirection Host
RedirectionHostsAPIDeleteRedirectionHostDelete /nginx/redirection-hosts/{hostID}Delete a Redirection Host
RedirectionHostsAPIDisableRedirectionHostPost /nginx/redirection-hosts/{hostID}/disableDisable a Redirection Host
RedirectionHostsAPIEnableRedirectionHostPost /nginx/redirection-hosts/{hostID}/enableEnable a Redirection Host
RedirectionHostsAPIGetRedirectionHostGet /nginx/redirection-hosts/{hostID}Get a Redirection Host
RedirectionHostsAPIGetRedirectionHostsGet /nginx/redirection-hostsGet all Redirection hosts
RedirectionHostsAPIUpdateRedirectionHostPut /nginx/redirection-hosts/{hostID}Update a Redirection Host
ReportsAPIReportsHostsGet /reports/hostsReport on Host Statistics
SettingsAPIGetSettingGet /settings/{settingID}Get a setting
SettingsAPIGetSettingsGet /settingsGet all settings
SettingsAPIUpdateSettingPut /settings/{settingID}Update a setting
StreamsAPICreateStreamPost /nginx/streamsCreate a Stream
StreamsAPIDeleteStreamDelete /nginx/streams/{streamID}Delete a Stream
StreamsAPIDisableStreamPost /nginx/streams/{streamID}/disableDisable a Stream
StreamsAPIEnableStreamPost /nginx/streams/{streamID}/enableEnable a Stream
StreamsAPIGetStreamGet /nginx/streams/{streamID}Get a Stream
StreamsAPIGetStreamsGet /nginx/streamsGet all streams
StreamsAPIUpdateStreamPut /nginx/streams/{streamID}Update a Stream
TokensAPIRefreshTokenGet /tokensRefresh your access token
TokensAPIRequestTokenPost /tokensRequest a new access token from credentials
UsersAPICreateUserPost /usersCreate a User
UsersAPIDeleteUserDelete /users/{userID}Delete a User
UsersAPIGetUserGet /users/{userID}Get a user
UsersAPIGetUsersGet /usersGet all users
UsersAPILoginAsUserPost /users/{userID}/loginLogin as this user
UsersAPIUpdateUserPut /users/{userID}Update a User
UsersAPIUpdateUserAuthPut /users/{userID}/authUpdate a User's Authentication
UsersAPIUpdateUserPermissionsPut /users/{userID}/permissionsUpdate a User's Permissions

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author