-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_v1_teleport_addresses.go
156 lines (127 loc) · 10.3 KB
/
model_v1_teleport_addresses.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
/*
Subspace Product API
# Introduction The Subspace API is based on REST, has resource-oriented URLs, returns JSON-encoded responses, and returns standard HTTP response codes. The base URL for the API is: `https://api.subspace.com/` # Naming Convention * Version name currently in use is: *v1* * Example: `https://api.subspace.com/v1` # Authentication ## API Tokens Subspace authenticates your API requests using JWT Bearer tokens. To use any Subspace API, you must pass a Bearer token with each request. If you do not include your Bearer token when making an API request, or use one that is incorrect or disabled, Subspace returns an error. Bearer tokens are granted by requesting one (as noted below) and presenting your publishable (client_id) and secret (client_secret) tokens. Subspace provides two types of API tokens: publishable (client_id) and secret (client_secret). These are available in the Subspace console. * **Publishable** API tokens (client_id) are meant solely to identify your account with Subspace, they aren’t secret. They can be published in places like your website JavaScript code, or in an iPhone or Android app. * **Secret** API tokens (client_secret) should be kept confidential and only stored on your own servers. Your account’s secret API token will allow you to acquire a valid JWT token authorized to perform any API request to Subspace. ## Getting a JWT Bearer Token Subspace uses auth0 for JWT token management. You can acquire a JWT token by utilizing `https://id.subspace.com` and following the instructions in the curl example below. ## Protecting Your API Tokens * **JWT tokens have a expiration time of 24 hours.** Once expired, you will have to use your Subspace private API and public token to request a new one. * The Subspace private token can be rotated from within the Subspace console. * **Keep your secret token safe.** Your secret token can make any API call on behalf of your account, including changes that may impact billing such as enabling pay-as-you-go charges. Do not store your secret token in your version control system. Do not use your secret token outside your web server, such as a browser, mobile app, or distributed file. * **You may use the Subspace console to acquire an API token.** * **You may use the Subspace console to disable pay-as-you-go.** This may prevent unexpected charges due to unauthorized or abnormal usage. * **Do not embed API keys directly in code.** Instead of directly embedding API keys in your application’s code, put them in environment variables, or within include files that are stored separately from the bulk of your code—outside the source repository of your application. Then, if you share your code, the API keys will not be included in the shared files. * **Do not store API tokens inside your application’s source control.** If you store API tokens in files, keep the files outside your application’s source control system. This is particularly important if you use a public source code management system such as GitHub. * **Limit access with restricted tokens.** The Subspace console will allow you to specify the IP addresses or referrer URLs associated with each token, reducing the impact of a compromised API token. * **Use independent API tokens for different apps.** This limits the scope of each token. If an API token is compromised, you can rotate the impacted token without impacting other API tokens. # Error Codes Subspace uses HTTP response codes to indicate the success or failure of an API request. General HTML status codes: * 2xx Success. * 4xx Errors based on information provided in the request. * 5xx Errors on Subspace servers. # Security We provide a valid, signed certificate for our API methods. Be sure your connection library supports HTTPS with the SNI extension. # REST How-To Making your first REST API call is easy and can be done from your browser. You will need: * Your **secret** token and public client token, both found in the Console. * The URL for the type of data you would like to request. First, acquire a JWT Bearer Token. Command line example: curl --request POST \\ --url \"https://id.subspace.com/oauth/token\" \\ --header 'content-type: application/json' \\ --data '{ \"client_id\": \"YOURCLIENTID\", \"client_secret\": \"YOURCLIENTSECRET\", \"audience\": \"https://api.subspace.com/\", \"grant_type\": \"client_credentials\" }' REST calls are made up of: * Base url: Example: `https://api.subspace.com` * Version: Example: `v1` * The API Endpoint and any parameters: `accelerator/acc_NDA3MUI5QzUtOTY4MC00Nz` where `acc_NDA3MUI5QzUtOTY4MC00Nz` is a valid accelerator ID * Accelerator ids are always of the format `acc_NDA3MUI5QzUtOTY4MC00Nz`, with a \"acc_\" prefix followed by 22 characters. * Token header: All REST requests require a valid JWT Bearer token which should be added as an “Authorization” header to the request: `Authorization: Bearer YOUR_TOKEN_HERE` ## Authorization header example If your API token was “my_api_token”, you would add... Authorization: Bearer my_api_token ...to the header. ## Command line examples To list your current open packet_accelerators using the token “my_api_token”: curl -H “Authorization: Bearer my_api_token” https://api.subspace.com/v1/accelerator Alternately, to get the details of a specific accelerator whose id is 'abcd-ef01-2345': curl -H “Authorization: Bearer my_api_token” https://api.subspace.com/v1/accelerator/abcd-ef01-2345 # API Versioning Subspace will release new versions when we make backwards-incompatible changes to the API. We will give advance notice before releasing a new version or retiring an old version. Backwards compatible changes: * Adding new response attributes * Adding new endpoints * Adding new methods to an existing endpoint * Adding new query string parameters * Adding new path parameters * Adding new webhook events * Adding new streaming endpoints * Changing the order of existing response attributes Versions are added to the base url, for example: * `https://api.subspace.com/v1` Current Version is **v1:** `https://api.subspace.com/v1`
API version: 1.0
Contact: [email protected]
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package subspace_openapi_client
import (
"encoding/json"
)
// V1TeleportAddresses struct for V1TeleportAddresses
type V1TeleportAddresses struct {
Address *string `json:"address,omitempty"`
TransportType *V1TransportType `json:"transport_type,omitempty"`
}
// NewV1TeleportAddresses instantiates a new V1TeleportAddresses object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewV1TeleportAddresses() *V1TeleportAddresses {
this := V1TeleportAddresses{}
var transportType V1TransportType = UDP_TCP
this.TransportType = &transportType
return &this
}
// NewV1TeleportAddressesWithDefaults instantiates a new V1TeleportAddresses object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewV1TeleportAddressesWithDefaults() *V1TeleportAddresses {
this := V1TeleportAddresses{}
var transportType V1TransportType = UDP_TCP
this.TransportType = &transportType
return &this
}
// GetAddress returns the Address field value if set, zero value otherwise.
func (o *V1TeleportAddresses) GetAddress() string {
if o == nil || o.Address == nil {
var ret string
return ret
}
return *o.Address
}
// GetAddressOk returns a tuple with the Address field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *V1TeleportAddresses) GetAddressOk() (*string, bool) {
if o == nil || o.Address == nil {
return nil, false
}
return o.Address, true
}
// HasAddress returns a boolean if a field has been set.
func (o *V1TeleportAddresses) HasAddress() bool {
if o != nil && o.Address != nil {
return true
}
return false
}
// SetAddress gets a reference to the given string and assigns it to the Address field.
func (o *V1TeleportAddresses) SetAddress(v string) {
o.Address = &v
}
// GetTransportType returns the TransportType field value if set, zero value otherwise.
func (o *V1TeleportAddresses) GetTransportType() V1TransportType {
if o == nil || o.TransportType == nil {
var ret V1TransportType
return ret
}
return *o.TransportType
}
// GetTransportTypeOk returns a tuple with the TransportType field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *V1TeleportAddresses) GetTransportTypeOk() (*V1TransportType, bool) {
if o == nil || o.TransportType == nil {
return nil, false
}
return o.TransportType, true
}
// HasTransportType returns a boolean if a field has been set.
func (o *V1TeleportAddresses) HasTransportType() bool {
if o != nil && o.TransportType != nil {
return true
}
return false
}
// SetTransportType gets a reference to the given V1TransportType and assigns it to the TransportType field.
func (o *V1TeleportAddresses) SetTransportType(v V1TransportType) {
o.TransportType = &v
}
func (o V1TeleportAddresses) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Address != nil {
toSerialize["address"] = o.Address
}
if o.TransportType != nil {
toSerialize["transport_type"] = o.TransportType
}
return json.Marshal(toSerialize)
}
type NullableV1TeleportAddresses struct {
value *V1TeleportAddresses
isSet bool
}
func (v NullableV1TeleportAddresses) Get() *V1TeleportAddresses {
return v.value
}
func (v *NullableV1TeleportAddresses) Set(val *V1TeleportAddresses) {
v.value = val
v.isSet = true
}
func (v NullableV1TeleportAddresses) IsSet() bool {
return v.isSet
}
func (v *NullableV1TeleportAddresses) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableV1TeleportAddresses(val *V1TeleportAddresses) *NullableV1TeleportAddresses {
return &NullableV1TeleportAddresses{value: val, isSet: true}
}
func (v NullableV1TeleportAddresses) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableV1TeleportAddresses) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}