-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontracts_api.go
240 lines (198 loc) · 9.3 KB
/
contracts_api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/*
* Telstra Programmable Network API
*
* Telstra Programmable Network is a self-provisioning platform that allows its users to create on-demand connectivity services between multiple end-points and add various network functions to those services. Programmable Network enables to connectivity to a global ecosystem of networking services as well as public and private cloud services. Once you are connected to the platform on one or more POPs (points of presence), you can start creating those services based on the use case that you want to accomplish. The Programmable Network API is available to all customers who have registered to use the Programmable Network. To register, please contact your account representative.
*
* API version: 2.1.3
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package TelstraTPN
import (
"io/ioutil"
"net/url"
"net/http"
"strings"
"golang.org/x/net/context"
"encoding/json"
"fmt"
)
// Linger please
var (
_ context.Context
)
type ContractsApiService service
/* ContractsApiService Get active Contract by ContractID
Get active Contract by ContractID
* @param ctx context.Context for authentication, logging, tracing, etc.
@param linkid Unique identifier representing a specific link
@param contractid Unique identifier representing a specific contract
@return InventoryLinksContractResponse*/
func (a *ContractsApiService) InventoryLinksContractByLinkidAndContractidGet(ctx context.Context, linkid string, contractid string) (InventoryLinksContractResponse, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
successPayload InventoryLinksContractResponse
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/1.0.0/inventory/links/{linkid}/contract/{contractid}"
localVarPath = strings.Replace(localVarPath, "{"+"linkid"+"}", fmt.Sprintf("%v", linkid), -1)
localVarPath = strings.Replace(localVarPath, "{"+"contractid"+"}", fmt.Sprintf("%v", contractid), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{ "application/json", }
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"application/json",
}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return successPayload, localVarHttpResponse, err
}
defer localVarHttpResponse.Body.Close()
if localVarHttpResponse.StatusCode >= 300 {
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
}
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
return successPayload, localVarHttpResponse, err
}
return successPayload, localVarHttpResponse, err
}
/* ContractsApiService Update active Contract by ContractID
Update active Contract by ContractID
* @param ctx context.Context for authentication, logging, tracing, etc.
@param linkid Unique identifier representing a specific link
@param contractid Unique identifier representing a specific contract
@param optional (nil or map[string]interface{}) with one or more of:
@param "body" (InventoryLinksContractRequest)
@return InventoryLinksContractResponse33*/
func (a *ContractsApiService) InventoryLinksContractByLinkidAndContractidPut(ctx context.Context, linkid string, contractid string, localVarOptionals map[string]interface{}) (InventoryLinksContractResponse33, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Put")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
successPayload InventoryLinksContractResponse33
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/1.0.0/inventory/links/{linkid}/contract/{contractid}"
localVarPath = strings.Replace(localVarPath, "{"+"linkid"+"}", fmt.Sprintf("%v", linkid), -1)
localVarPath = strings.Replace(localVarPath, "{"+"contractid"+"}", fmt.Sprintf("%v", contractid), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{ "application/json", }
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"application/json",
}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
// body params
if localVarTempParam, localVarOk := localVarOptionals["body"].(InventoryLinksContractRequest); localVarOk {
localVarPostBody = &localVarTempParam
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return successPayload, localVarHttpResponse, err
}
defer localVarHttpResponse.Body.Close()
if localVarHttpResponse.StatusCode >= 300 {
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
}
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
return successPayload, localVarHttpResponse, err
}
return successPayload, localVarHttpResponse, err
}
/* ContractsApiService Create new Contract on specified link
Create new Contract on specified link
* @param ctx context.Context for authentication, logging, tracing, etc.
@param linkid Unique identifier representing a specific link
@param optional (nil or map[string]interface{}) with one or more of:
@param "body" (InventoryLinksContractRequest37)
@return []InventoryLinksContractResponse38*/
func (a *ContractsApiService) InventoryLinksContractByLinkidPost(ctx context.Context, linkid string, localVarOptionals map[string]interface{}) ([]InventoryLinksContractResponse38, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
successPayload []InventoryLinksContractResponse38
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/1.0.0/inventory/links/{linkid}/contract"
localVarPath = strings.Replace(localVarPath, "{"+"linkid"+"}", fmt.Sprintf("%v", linkid), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{ "application/json", }
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"application/json",
}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
// body params
if localVarTempParam, localVarOk := localVarOptionals["body"].(InventoryLinksContractRequest37); localVarOk {
localVarPostBody = &localVarTempParam
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return successPayload, localVarHttpResponse, err
}
defer localVarHttpResponse.Body.Close()
if localVarHttpResponse.StatusCode >= 300 {
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
}
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
return successPayload, localVarHttpResponse, err
}
return successPayload, localVarHttpResponse, err
}