3228 lines
96 KiB
Go
3228 lines
96 KiB
Go
/*
|
|
* HyperOne API
|
|
*
|
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
*
|
|
* API version: 0.0.2
|
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
|
*/
|
|
|
|
package openapi
|
|
|
|
import (
|
|
"context"
|
|
"io/ioutil"
|
|
"net/http"
|
|
"net/url"
|
|
"strings"
|
|
"fmt"
|
|
"github.com/antihax/optional"
|
|
)
|
|
|
|
// Linger please
|
|
var (
|
|
_ context.Context
|
|
)
|
|
|
|
type FirewallApiService service
|
|
|
|
/*
|
|
FirewallApiService /actions/attach
|
|
Action attach
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
* @param firewallActionAttach
|
|
@return Firewall
|
|
*/
|
|
func (a *FirewallApiService) FirewallActionAttach(ctx context.Context, firewallId string, firewallActionAttach FirewallActionAttach) (Firewall, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Post")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue Firewall
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/actions/attach"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = &firewallActionAttach
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 202 {
|
|
var v Firewall
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /actions/detach
|
|
Action detach
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
@return Firewall
|
|
*/
|
|
func (a *FirewallApiService) FirewallActionDetach(ctx context.Context, firewallId string) (Firewall, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Post")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue Firewall
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/actions/detach"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 202 {
|
|
var v Firewall
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /actions/transfer
|
|
Action transfer
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
* @param firewallActionTransfer
|
|
@return Firewall
|
|
*/
|
|
func (a *FirewallApiService) FirewallActionTransfer(ctx context.Context, firewallId string, firewallActionTransfer FirewallActionTransfer) (Firewall, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Post")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue Firewall
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/actions/transfer"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = &firewallActionTransfer
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 202 {
|
|
var v Firewall
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService Create
|
|
Create firewall
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallCreate
|
|
@return Firewall
|
|
*/
|
|
func (a *FirewallApiService) FirewallCreate(ctx context.Context, firewallCreate FirewallCreate) (Firewall, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Post")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue Firewall
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = &firewallCreate
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 202 {
|
|
var v Firewall
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService Delete
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
*/
|
|
func (a *FirewallApiService) FirewallDelete(ctx context.Context, firewallId string) (*http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Delete")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
return localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /accessrights/:identity
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
* @param identity identity
|
|
@return Firewall
|
|
*/
|
|
func (a *FirewallApiService) FirewallDeleteAccessrightsIdentity(ctx context.Context, firewallId string, identity string) (Firewall, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Delete")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue Firewall
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/accessrights/{identity}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"identity"+"}", fmt.Sprintf("%v", identity), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v Firewall
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
if localVarHttpResponse.StatusCode == 202 {
|
|
var v Firewall
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /egress/:ruleId
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
* @param ruleId ruleId
|
|
@return InlineResponse2001
|
|
*/
|
|
func (a *FirewallApiService) FirewallDeleteEgressRuleId(ctx context.Context, firewallId string, ruleId string) (InlineResponse2001, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Delete")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue InlineResponse2001
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/egress/{ruleId}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", fmt.Sprintf("%v", ruleId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v InlineResponse2001
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /ingress/:ruleId
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
* @param ruleId ruleId
|
|
@return InlineResponse2001
|
|
*/
|
|
func (a *FirewallApiService) FirewallDeleteIngressRuleId(ctx context.Context, firewallId string, ruleId string) (InlineResponse2001, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Delete")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue InlineResponse2001
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/ingress/{ruleId}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", fmt.Sprintf("%v", ruleId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v InlineResponse2001
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /tag/:key
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
* @param key key
|
|
@return map[string]interface{}
|
|
*/
|
|
func (a *FirewallApiService) FirewallDeleteTagKey(ctx context.Context, firewallId string, key string) (map[string]interface{}, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Delete")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue map[string]interface{}
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/tag/{key}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", fmt.Sprintf("%v", key), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v map[string]interface{}
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /egress/:ruleId
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
* @param ruleId ruleId
|
|
@return InlineResponse2001
|
|
*/
|
|
func (a *FirewallApiService) FirewallGetEgressRuleId(ctx context.Context, firewallId string, ruleId string) (InlineResponse2001, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue InlineResponse2001
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/egress/{ruleId}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", fmt.Sprintf("%v", ruleId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v InlineResponse2001
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /ingress/:ruleId
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
* @param ruleId ruleId
|
|
@return InlineResponse2001
|
|
*/
|
|
func (a *FirewallApiService) FirewallGetIngressRuleId(ctx context.Context, firewallId string, ruleId string) (InlineResponse2001, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue InlineResponse2001
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/ingress/{ruleId}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", fmt.Sprintf("%v", ruleId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v InlineResponse2001
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /services/:serviceId
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
* @param serviceId serviceId
|
|
@return FirewallServices
|
|
*/
|
|
func (a *FirewallApiService) FirewallGetServicesServiceId(ctx context.Context, firewallId string, serviceId string) (FirewallServices, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue FirewallServices
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/services/{serviceId}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"serviceId"+"}", fmt.Sprintf("%v", serviceId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v FirewallServices
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /tag
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
@return map[string]interface{}
|
|
*/
|
|
func (a *FirewallApiService) FirewallGetTag(ctx context.Context, firewallId string) (map[string]interface{}, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue map[string]interface{}
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/tag"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v map[string]interface{}
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService List
|
|
List firewall
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param optional nil or *FirewallListOpts - Optional Parameters:
|
|
* @param "Name" (optional.String) - Filter by name
|
|
@return []Firewall
|
|
*/
|
|
|
|
type FirewallListOpts struct {
|
|
Name optional.String
|
|
}
|
|
|
|
func (a *FirewallApiService) FirewallList(ctx context.Context, localVarOptionals *FirewallListOpts) ([]Firewall, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue []Firewall
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if localVarOptionals != nil && localVarOptionals.Name.IsSet() {
|
|
localVarQueryParams.Add("name", parameterToString(localVarOptionals.Name.Value(), ""))
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v []Firewall
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /accessrights
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
@return []string
|
|
*/
|
|
func (a *FirewallApiService) FirewallListAccessrights(ctx context.Context, firewallId string) ([]string, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue []string
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/accessrights"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v []string
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /egress
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
@return []InlineResponse2001
|
|
*/
|
|
func (a *FirewallApiService) FirewallListEgress(ctx context.Context, firewallId string) ([]InlineResponse2001, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue []InlineResponse2001
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/egress"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v []InlineResponse2001
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /ingress
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
@return []InlineResponse2001
|
|
*/
|
|
func (a *FirewallApiService) FirewallListIngress(ctx context.Context, firewallId string) ([]InlineResponse2001, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue []InlineResponse2001
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/ingress"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v []InlineResponse2001
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /queue
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
@return []Event
|
|
*/
|
|
func (a *FirewallApiService) FirewallListQueue(ctx context.Context, firewallId string) ([]Event, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue []Event
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/queue"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v []Event
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /services
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
@return []FirewallServices
|
|
*/
|
|
func (a *FirewallApiService) FirewallListServices(ctx context.Context, firewallId string) ([]FirewallServices, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue []FirewallServices
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/services"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v []FirewallServices
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /tag
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
* @param body
|
|
@return map[string]interface{}
|
|
*/
|
|
func (a *FirewallApiService) FirewallPatchTag(ctx context.Context, firewallId string, body map[string]interface{}) (map[string]interface{}, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Patch")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue map[string]interface{}
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/tag"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = &body
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v map[string]interface{}
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /accessrights
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
* @param firewallPostAccessrights
|
|
@return Firewall
|
|
*/
|
|
func (a *FirewallApiService) FirewallPostAccessrights(ctx context.Context, firewallId string, firewallPostAccessrights FirewallPostAccessrights) (Firewall, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Post")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue Firewall
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/accessrights"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = &firewallPostAccessrights
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v Firewall
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
if localVarHttpResponse.StatusCode == 202 {
|
|
var v Firewall
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /egress
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
* @param firewallPostEgress
|
|
@return InlineResponse2001
|
|
*/
|
|
func (a *FirewallApiService) FirewallPostEgress(ctx context.Context, firewallId string, firewallPostEgress FirewallPostEgress) (InlineResponse2001, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Post")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue InlineResponse2001
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/egress"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = &firewallPostEgress
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v InlineResponse2001
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService /ingress
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
* @param firewallPostIngress
|
|
@return InlineResponse2001
|
|
*/
|
|
func (a *FirewallApiService) FirewallPostIngress(ctx context.Context, firewallId string, firewallPostIngress FirewallPostIngress) (InlineResponse2001, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Post")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue InlineResponse2001
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}/ingress"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = &firewallPostIngress
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v InlineResponse2001
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService Get
|
|
Returns a single firewall
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
@return Firewall
|
|
*/
|
|
func (a *FirewallApiService) FirewallShow(ctx context.Context, firewallId string) (Firewall, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue Firewall
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v Firewall
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|
|
|
|
/*
|
|
FirewallApiService Update
|
|
Returns modified firewall
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param firewallId ID of firewall
|
|
* @param firewallUpdate
|
|
@return Firewall
|
|
*/
|
|
func (a *FirewallApiService) FirewallUpdate(ctx context.Context, firewallId string, firewallUpdate FirewallUpdate) (Firewall, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Patch")
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue Firewall
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/firewall/{firewallId}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"firewallId"+"}", fmt.Sprintf("%v", firewallId), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
if localVarHttpContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHttpHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = &firewallUpdate
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-project"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["x-auth-token"] = key
|
|
}
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
if err != nil || localVarHttpResponse == nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
localVarHttpResponse.Body.Close()
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHttpResponse.Status,
|
|
}
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
var v Firewall
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
}
|