packer-cn/vendor/github.com/hyperonecom/h1-client-go/api_network.go

2410 lines
79 KiB
Go
Raw Normal View History

2019-02-08 05:15:45 -05:00
/*
* 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 "context"
2019-02-08 05:15:45 -05:00
"fmt"
"github.com/antihax/optional"
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
"strings"
2019-02-08 05:15:45 -05:00
)
// Linger please
var (
_ _context.Context
2019-02-08 05:15:45 -05:00
)
// NetworkApiService NetworkApi service
2019-02-08 05:15:45 -05:00
type NetworkApiService service
/*
NetworkActionFirewallAdd /actions/firewall_add
Action firewall_add
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param networkId ID of network
* @param networkActionFirewallAdd
2019-02-08 05:15:45 -05:00
@return Network
*/
func (a *NetworkApiService) NetworkActionFirewallAdd(ctx _context.Context, networkId string, networkActionFirewallAdd NetworkActionFirewallAdd) (Network, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodPost
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Network
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/actions/firewall_add"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
// body params
localVarPostBody = &networkActionFirewallAdd
2019-02-08 05:15:45 -05:00
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
2019-02-08 05:15:45 -05:00
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 Network
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 202 {
var v Network
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 == 400 {
var v InlineResponse400
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(),
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
}
/*
NetworkActionFirewallRemove /actions/firewall_remove
Action firewall_remove
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param networkId ID of network
@return Network
*/
func (a *NetworkApiService) NetworkActionFirewallRemove(ctx _context.Context, networkId string) (Network, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Network
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/actions/firewall_remove"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.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
}
2019-02-08 05:15:45 -05:00
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
2019-02-08 05:15:45 -05:00
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 200 {
var v Network
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
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 202 {
2019-02-08 05:15:45 -05:00
var v Network
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 == 400 {
var v InlineResponse400
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}
/*
NetworkCreate Create
Create network
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param networkCreate
@return Network
2019-02-08 05:15:45 -05:00
*/
func (a *NetworkApiService) NetworkCreate(ctx _context.Context, networkCreate NetworkCreate) (Network, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodPost
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Network
2019-02-08 05:15:45 -05:00
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network"
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
// body params
localVarPostBody = &networkCreate
2019-02-08 05:15:45 -05:00
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
2019-02-08 05:15:45 -05:00
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 Network
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 202 {
var v Network
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 == 400 {
var v InlineResponse400
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
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
}
/*
NetworkDelete Delete
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param networkId ID of network
*/
func (a *NetworkApiService) NetworkDelete(ctx _context.Context, networkId string) (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodDelete
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.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
}
2019-02-08 05:15:45 -05:00
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
2019-02-08 05:15:45 -05:00
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 400 {
var v InlineResponse400
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarHTTPResponse, newErr
}
newErr.model = v
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}
/*
NetworkDeleteAccessrightsIdentity /accessrights/:identity
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param networkId ID of network
* @param identity identity
@return Network
*/
func (a *NetworkApiService) NetworkDeleteAccessrightsIdentity(ctx _context.Context, networkId string, identity string) (Network, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodDelete
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Network
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/accessrights/{identity}"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
localVarPath = strings.Replace(localVarPath, "{"+"identity"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", identity)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 200 {
2019-02-08 05:15:45 -05:00
var v Network
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 202 {
2019-02-08 05:15:45 -05:00
var v Network
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 == 400 {
var v InlineResponse400
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}
/*
NetworkDeleteIpIpId /ip/:ipId
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param networkId ID of network
* @param ipId ipId
@return Ip
*/
func (a *NetworkApiService) NetworkDeleteIpIpId(ctx _context.Context, networkId string, ipId string) (Ip, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodDelete
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Ip
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/ip/{ipId}"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
localVarPath = strings.Replace(localVarPath, "{"+"ipId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", ipId)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 200 {
2019-02-08 05:15:45 -05:00
var v Ip
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 400 {
var v InlineResponse400
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
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}
/*
NetworkDeleteTagKey /tag/:key
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param networkId ID of network
* @param key key
@return map[string]string
2019-02-08 05:15:45 -05:00
*/
func (a *NetworkApiService) NetworkDeleteTagKey(ctx _context.Context, networkId string, key string) (map[string]string, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodDelete
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue map[string]string
2019-02-08 05:15:45 -05:00
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/tag/{key}"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", key)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 200 {
var v map[string]string
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 400 {
var v InlineResponse400
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
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}
/*
NetworkGetIpIpId /ip/:ipId
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param networkId ID of network
* @param ipId ipId
@return Ip
*/
func (a *NetworkApiService) NetworkGetIpIpId(ctx _context.Context, networkId string, ipId string) (Ip, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodGet
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Ip
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/ip/{ipId}"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
localVarPath = strings.Replace(localVarPath, "{"+"ipId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", ipId)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 200 {
2019-02-08 05:15:45 -05:00
var v Ip
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 == 400 {
var v InlineResponse400
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}
/*
NetworkGetServicesServiceId /services/:serviceId
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param networkId ID of network
* @param serviceId serviceId
@return NetworkServices
*/
func (a *NetworkApiService) NetworkGetServicesServiceId(ctx _context.Context, networkId string, serviceId string) (NetworkServices, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodGet
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue NetworkServices
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/services/{serviceId}"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
localVarPath = strings.Replace(localVarPath, "{"+"serviceId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", serviceId)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 200 {
2019-02-08 05:15:45 -05:00
var v NetworkServices
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 == 400 {
var v InlineResponse400
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}
/*
NetworkGetTag /tag
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param networkId ID of network
@return map[string]string
2019-02-08 05:15:45 -05:00
*/
func (a *NetworkApiService) NetworkGetTag(ctx _context.Context, networkId string) (map[string]string, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodGet
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue map[string]string
2019-02-08 05:15:45 -05:00
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/tag"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 200 {
var v map[string]string
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 400 {
var v InlineResponse400
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
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
}
// NetworkListOpts Optional parameters for the method 'NetworkList'
type NetworkListOpts struct {
Name optional.String
Tag optional.Interface
2019-02-08 05:15:45 -05:00
}
/*
NetworkList List
2019-02-08 05:15:45 -05:00
List network
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param optional nil or *NetworkListOpts - Optional Parameters:
* @param "Name" (optional.String) - Filter by name
* @param "Tag" (optional.Interface of map[string]string) - Filter by tag
2019-02-08 05:15:45 -05:00
@return []Network
*/
func (a *NetworkApiService) NetworkList(ctx _context.Context, localVarOptionals *NetworkListOpts) ([]Network, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodGet
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []Network
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
if localVarOptionals != nil && localVarOptionals.Name.IsSet() {
localVarQueryParams.Add("name", parameterToString(localVarOptionals.Name.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Tag.IsSet() {
localVarQueryParams.Add("tag", parameterToString(localVarOptionals.Tag.Value(), ""))
}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 200 {
2019-02-08 05:15:45 -05:00
var v []Network
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 == 400 {
var v InlineResponse400
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}
/*
NetworkListAccessrights /accessrights
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param networkId ID of network
@return []string
*/
func (a *NetworkApiService) NetworkListAccessrights(ctx _context.Context, networkId string) ([]string, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodGet
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []string
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/accessrights"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 200 {
2019-02-08 05:15:45 -05:00
var v []string
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 400 {
var v InlineResponse400
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
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}
/*
NetworkListIp /ip
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param networkId ID of network
@return []Ip
*/
func (a *NetworkApiService) NetworkListIp(ctx _context.Context, networkId string) ([]Ip, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodGet
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []Ip
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/ip"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 200 {
var v []Ip
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
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 400 {
var v InlineResponse400
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
}
// NetworkListQueueOpts Optional parameters for the method 'NetworkListQueue'
type NetworkListQueueOpts struct {
Limit optional.Float32
Skip optional.Float32
2019-02-08 05:15:45 -05:00
}
/*
NetworkListQueue /queue
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param networkId ID of network
* @param optional nil or *NetworkListQueueOpts - Optional Parameters:
* @param "Limit" (optional.Float32) - $limit
* @param "Skip" (optional.Float32) - $skip
2019-02-08 05:15:45 -05:00
@return []Event
*/
func (a *NetworkApiService) NetworkListQueue(ctx _context.Context, networkId string, localVarOptionals *NetworkListQueueOpts) ([]Event, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodGet
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []Event
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/queue"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
if localVarOptionals != nil && localVarOptionals.Limit.IsSet() {
localVarQueryParams.Add("$limit", parameterToString(localVarOptionals.Limit.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Skip.IsSet() {
localVarQueryParams.Add("$skip", parameterToString(localVarOptionals.Skip.Value(), ""))
}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 200 {
2019-02-08 05:15:45 -05:00
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
}
if localVarHTTPResponse.StatusCode == 400 {
var v InlineResponse400
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}
/*
NetworkListServices /services
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param networkId ID of network
@return []NetworkServices
*/
func (a *NetworkApiService) NetworkListServices(ctx _context.Context, networkId string) ([]NetworkServices, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodGet
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []NetworkServices
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/services"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 200 {
2019-02-08 05:15:45 -05:00
var v []NetworkServices
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 == 400 {
var v InlineResponse400
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}
/*
NetworkPatchTag /tag
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param networkId ID of network
* @param requestBody
@return map[string]string
2019-02-08 05:15:45 -05:00
*/
func (a *NetworkApiService) NetworkPatchTag(ctx _context.Context, networkId string, requestBody map[string]string) (map[string]string, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodPatch
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue map[string]string
2019-02-08 05:15:45 -05:00
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/tag"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
// body params
localVarPostBody = &requestBody
2019-02-08 05:15:45 -05:00
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 200 {
var v map[string]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
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 400 {
var v InlineResponse400
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}
/*
NetworkPostAccessrights /accessrights
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param networkId ID of network
* @param networkPostAccessrights
@return Network
*/
func (a *NetworkApiService) NetworkPostAccessrights(ctx _context.Context, networkId string, networkPostAccessrights NetworkPostAccessrights) (Network, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodPost
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Network
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/accessrights"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
// body params
localVarPostBody = &networkPostAccessrights
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 200 {
2019-02-08 05:15:45 -05:00
var v Network
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 202 {
2019-02-08 05:15:45 -05:00
var v Network
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 == 400 {
var v InlineResponse400
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}
/*
NetworkPostIp /ip
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param networkId ID of network
* @param networkPostIp
@return Ip
*/
func (a *NetworkApiService) NetworkPostIp(ctx _context.Context, networkId string, networkPostIp NetworkPostIp) (Ip, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodPost
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Ip
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/ip"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
// body params
localVarPostBody = &networkPostIp
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
2019-02-08 05:15:45 -05:00
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 Ip
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 == 400 {
var v InlineResponse400
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
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(),
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
/*
NetworkPutTag /tag
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param networkId ID of network
* @param requestBody
@return map[string]string
*/
func (a *NetworkApiService) NetworkPutTag(ctx _context.Context, networkId string, requestBody map[string]string) (map[string]string, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue map[string]string
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}/tag"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &requestBody
2019-02-08 05:15:45 -05:00
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
2019-02-08 05:15:45 -05:00
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 200 {
var v map[string]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
}
if localVarHTTPResponse.StatusCode == 400 {
var v InlineResponse400
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}
/*
NetworkShow Get
2019-02-08 05:15:45 -05:00
Returns a single network
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param networkId ID of network
@return Network
*/
func (a *NetworkApiService) NetworkShow(ctx _context.Context, networkId string) (Network, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodGet
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Network
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 200 {
2019-02-08 05:15:45 -05:00
var v Network
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 == 400 {
var v InlineResponse400
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}
/*
NetworkUpdate Update
2019-02-08 05:15:45 -05:00
Returns modified network
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2019-02-08 05:15:45 -05:00
* @param networkId ID of network
* @param networkUpdate
@return Network
*/
func (a *NetworkApiService) NetworkUpdate(ctx _context.Context, networkId string, networkUpdate NetworkUpdate) (Network, *_nethttp.Response, error) {
2019-02-08 05:15:45 -05:00
var (
localVarHTTPMethod = _nethttp.MethodPatch
2019-02-08 05:15:45 -05:00
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Network
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/network/{networkId}"
localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", networkId)), -1)
2019-02-08 05:15:45 -05:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
2019-02-08 05:15:45 -05:00
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2019-02-08 05:15:45 -05:00
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
2019-02-08 05:15:45 -05:00
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2019-02-08 05:15:45 -05:00
}
// body params
localVarPostBody = &networkUpdate
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
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
2019-02-08 05:15:45 -05:00
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode >= 300 {
2019-02-08 05:15:45 -05:00
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
2019-02-08 05:15:45 -05:00
}
if localVarHTTPResponse.StatusCode == 200 {
2019-02-08 05:15:45 -05:00
var v Network
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 == 400 {
var v InlineResponse400
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2019-02-08 05:15:45 -05:00
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
2019-02-08 05:15:45 -05:00
}
return localVarReturnValue, localVarHTTPResponse, nil
2019-02-08 05:15:45 -05:00
}