github.com/digitalocean/go-netbox@v0.0.2/netbox/client/plugins/plugins_client.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // Copyright 2020 The go-netbox Authors. 4 // 5 // Licensed under the Apache License, Version 2.0 (the "License"); 6 // you may not use this file except in compliance with the License. 7 // You may obtain a copy of the License at 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, software 12 // distributed under the License is distributed on an "AS IS" BASIS, 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 // See the License for the specific language governing permissions and 15 // limitations under the License. 16 // 17 18 package plugins 19 20 // This file was generated by the swagger tool. 21 // Editing this file might prove futile when you re-run the swagger generate command 22 23 import ( 24 "fmt" 25 26 "github.com/go-openapi/runtime" 27 "github.com/go-openapi/strfmt" 28 ) 29 30 // New creates a new plugins API client. 31 func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { 32 return &Client{transport: transport, formats: formats} 33 } 34 35 /* 36 Client for plugins API 37 */ 38 type Client struct { 39 transport runtime.ClientTransport 40 formats strfmt.Registry 41 } 42 43 // ClientOption is the option for Client methods 44 type ClientOption func(*runtime.ClientOperation) 45 46 // ClientService is the interface for Client methods 47 type ClientService interface { 48 PluginsIPReservationsRelatedIPV6Read(params *PluginsIPReservationsRelatedIPV6ReadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PluginsIPReservationsRelatedIPV6ReadOK, error) 49 50 SetTransport(transport runtime.ClientTransport) 51 } 52 53 /* 54 PluginsIPReservationsRelatedIPV6Read plugins ip reservations related ipv6 read API 55 */ 56 func (a *Client) PluginsIPReservationsRelatedIPV6Read(params *PluginsIPReservationsRelatedIPV6ReadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PluginsIPReservationsRelatedIPV6ReadOK, error) { 57 // TODO: Validate the params before sending 58 if params == nil { 59 params = NewPluginsIPReservationsRelatedIPV6ReadParams() 60 } 61 op := &runtime.ClientOperation{ 62 ID: "plugins_ip-reservations_related-ipv6_read", 63 Method: "GET", 64 PathPattern: "/plugins/ip-reservations/related-ipv6/{id}/", 65 ProducesMediaTypes: []string{"application/json"}, 66 ConsumesMediaTypes: []string{"application/json"}, 67 Schemes: []string{"http"}, 68 Params: params, 69 Reader: &PluginsIPReservationsRelatedIPV6ReadReader{formats: a.formats}, 70 AuthInfo: authInfo, 71 Context: params.Context, 72 Client: params.HTTPClient, 73 } 74 for _, opt := range opts { 75 opt(op) 76 } 77 78 result, err := a.transport.Submit(op) 79 if err != nil { 80 return nil, err 81 } 82 success, ok := result.(*PluginsIPReservationsRelatedIPV6ReadOK) 83 if ok { 84 return success, nil 85 } 86 // unexpected success response 87 // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue 88 msg := fmt.Sprintf("unexpected success response for plugins_ip-reservations_related-ipv6_read: API contract not enforced by server. Client expected to get an error, but got: %T", result) 89 panic(msg) 90 } 91 92 // SetTransport changes the transport on the client 93 func (a *Client) SetTransport(transport runtime.ClientTransport) { 94 a.transport = transport 95 }