package
0.1.0
Repository: https://github.com/kubeslice/stackpath.git
Documentation: pkg.go.dev

# README

Go API client for waf

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: 1.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientExperimentalCodegen For more information, please visit https://support.stackpath.com/

Installation

Install the following dependencies:

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

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

import sw "./waf"

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 sw.ContextServerIndex of type int.

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

Templated Server URL

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

ctx := context.WithValue(context.Background(), sw.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 identifield by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

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

Documentation for API Endpoints

All URIs are relative to https://gateway.stackpath.com

ClassMethodHTTP requestDescription
ConfigurationApiGetSiteDnsTargetsGet /waf/v1/stacks/{stack_id}/sites/{site_id}/delivery/dns/targetsGet CNAME targets
EventsApiGetEventGet /waf/v1/stacks/{stack_id}/sites/{site_id}/events/{event_id}LEGACY: Get an event
EventsApiGetEventStatisticsGet /waf/v1/stacks/{stack_id}/sites/{site_id}/event_statsLEGACY: Get event statistics
EventsApiSearchEventsGet /waf/v1/stacks/{stack_id}/sites/{site_id}/eventsLEGACY: Get all events
InfrastructureApiGetWAFOrganizationsGet /waf/v1/organizationsGet WHOIS organizations
PoliciesApiDisablePolicyPost /waf/v1/stacks/{stack_id}/sites/{site_id}/policy_groups/{policy_group_id}/policies/{policy_id}/disableDisable a policy
PoliciesApiDisablePolicyGroupPost /waf/v1/stacks/{stack_id}/sites/{site_id}/policy_groups/{policy_group_id}/disableDisable all policies in a group
PoliciesApiEnablePolicyPost /waf/v1/stacks/{stack_id}/sites/{site_id}/policy_groups/{policy_group_id}/policies/{policy_id}/enableEnable a policy
PoliciesApiEnablePolicyGroupPost /waf/v1/stacks/{stack_id}/sites/{site_id}/policy_groups/{policy_group_id}/enableEnable all policies in a group
PoliciesApiGetPoliciesGet /waf/v1/stacks/{stack_id}/sites/{site_id}/policy_groups/{policy_group_id}/policiesGet all policies in a group
PoliciesApiGetPolicyGet /waf/v1/stacks/{stack_id}/sites/{site_id}/policy_groups/{policy_group_id}/policies/{policy_id}Get a policy
PoliciesApiGetPolicyGroupGet /waf/v1/stacks/{stack_id}/sites/{site_id}/policy_groups/{policy_group_id}Get a policy group
PoliciesApiGetPolicyGroupsGet /waf/v1/stacks/{stack_id}/sites/{site_id}/policy_groupsGet all policy groups
PoliciesApiUpdatePolicyGroupsPatch /waf/v1/stacks/{stack_id}/sites/{site_id}/policy_groupsUpdate policy groups
RequestsApiGetRequestGet /waf/v1/stacks/{stack_id}/sites/{site_id}/requests/{request_id}Get a request
RequestsApiGetRequestDetailsGet /waf/v1/stacks/{stack_id}/sites/{site_id}/requests/{request_id}/detailsGet a request's details
RequestsApiGetRequestsGet /waf/v1/stacks/{stack_id}/sites/{site_id}/requestsGet all requests
RulesApiBulkDeleteRulesPost /waf/v1/stacks/{stack_id}/sites/{site_id}/rules/bulk_deleteDelete multiple rules
RulesApiCreateRulePost /waf/v1/stacks/{stack_id}/sites/{site_id}/rulesCreate a rule
RulesApiDeleteRuleDelete /waf/v1/stacks/{stack_id}/sites/{site_id}/rules/{rule_id}Delete a rule
RulesApiDisableRulePost /waf/v1/stacks/{stack_id}/sites/{site_id}/rules/{rule_id}/disableDisable a rule
RulesApiEnableRulePost /waf/v1/stacks/{stack_id}/sites/{site_id}/rules/{rule_id}/enableEnable a rule
RulesApiGetRuleGet /waf/v1/stacks/{stack_id}/sites/{site_id}/rules/{rule_id}Get a rule
RulesApiGetRulesGet /waf/v1/stacks/{stack_id}/sites/{site_id}/rulesGet all rules
RulesApiUpdateRulePatch /waf/v1/stacks/{stack_id}/sites/{site_id}/rules/{rule_id}Update a rule
SSLApiConnectSiteToCertificatePut /waf/v1/stacks/{stack_id}/sites/{site_id}/delivery/certificates/{certificate_id}Update SAN hosts
SSLApiCreateCertificatePost /waf/v1/stacks/{stack_id}/delivery/certificatesAdd a certificate
SSLApiDeleteCertificateDelete /waf/v1/stacks/{stack_id}/delivery/certificates/{certificate_id}Delete a certificate
SSLApiGetCertificateGet /waf/v1/stacks/{stack_id}/delivery/certificates/{certificate_id}Get a certificate
SSLApiGetCertificateVerificationDetailsGet /waf/v1/stacks/{stack_id}/delivery/certificates/{certificate_id}/verification_detailsGet sites associated with a certificate
SSLApiGetCertificatesGet /waf/v1/stacks/{stack_id}/delivery/certificatesGet all certificates
SSLApiGetSiteCertificatesGet /waf/v1/stacks/{stack_id}/sites/{site_id}/delivery/certificatesGet all site certificates
SSLApiRenewCertificatePost /waf/v1/stacks/{stack_id}/delivery/certificates/{certificate_id}/renewRenew a certificate
SSLApiRequestCertificatePost /waf/v1/stacks/{stack_id}/sites/{site_id}/delivery/certificates/requestRequest a free certificate
SSLApiUpdateCertificatePut /waf/v1/stacks/{stack_id}/delivery/certificates/{certificate_id}Update a certificate
TrafficApiGetTrafficGet /waf/v1/stacks/{stack_id}/trafficLEGACY: Get traffic
TrafficApiGetTrafficV2Get /waf/v2/stacks/{stack_id}/trafficGet traffic
WAFFeaturesApiGetDdosSettingsGet /waf/v1/stacks/{stack_id}/sites/{site_id}/ddosGet DDOS settings
WAFFeaturesApiGetTagsGet /waf/v1/tagsGet all tags
WAFFeaturesApiMonitorSitePost /waf/v1/stacks/{stack_id}/sites/{site_id}/monitoringEnable monitoring mode
WAFFeaturesApiUnMonitorSiteDelete /waf/v1/stacks/{stack_id}/sites/{site_id}/monitoringDisable monitoring mode
WAFFeaturesApiUpdateDdosSettingsPatch /waf/v1/stacks/{stack_id}/sites/{site_id}/ddosUpdate DDOS settings
WAFFeaturesApiUpdateSiteApiUrlsPut /waf/v1/stacks/{stack_id}/sites/{site_id}/api_urlsUpdate API URLs

Documentation For Models

Documentation For Authorization

oauth2

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes: N/A

Example

auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)

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