// Package clientv2 provides primitives to interact with the openapi HTTP API. // // Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT. package clientv2 import ( "bytes" "context" "encoding/json" "fmt" "io" "net/http" "net/url" "strings" "time" "github.com/oapi-codegen/runtime" openapi_types "github.com/oapi-codegen/runtime/types" ) // CreateKeyRequest defines model for CreateKeyRequest. type CreateKeyRequest struct { Capabilities *KeyCapabilities `json:"capabilities,omitempty"` Description *string `json:"description,omitempty"` // ExpirySeconds Lifetime in seconds; defaults to 90 days. Auth keys only. ExpirySeconds *int64 `json:"expirySeconds,omitempty"` // KeyType Key kind: "auth" (default) or "client" (OAuth client). KeyType *string `json:"keyType,omitempty"` // Scopes OAuth scopes granted to the client. keyType=client only. Scopes *[]string `json:"scopes,omitempty"` // Tags Tags the client may assign. keyType=client only. Tags *[]string `json:"tags,omitempty"` } // DeleteKeyOutputBody defines model for DeleteKeyOutputBody. type DeleteKeyOutputBody = map[string]interface{} // Device defines model for Device. type Device struct { Addresses []string `json:"addresses"` AdvertisedRoutes *[]string `json:"advertisedRoutes,omitempty"` Authorized bool `json:"authorized"` ClientVersion string `json:"clientVersion"` Created time.Time `json:"created"` EnabledRoutes *[]string `json:"enabledRoutes,omitempty"` Expires *time.Time `json:"expires,omitempty"` Hostname string `json:"hostname"` Id string `json:"id"` IsEphemeral bool `json:"isEphemeral"` KeyExpiryDisabled bool `json:"keyExpiryDisabled"` LastSeen *time.Time `json:"lastSeen,omitempty"` MachineKey string `json:"machineKey"` Name string `json:"name"` NodeId string `json:"nodeId"` NodeKey string `json:"nodeKey"` Os string `json:"os"` Tags []string `json:"tags"` UpdateAvailable bool `json:"updateAvailable"` User string `json:"user"` } // DeviceRoutes defines model for DeviceRoutes. type DeviceRoutes struct { AdvertisedRoutes []string `json:"advertisedRoutes"` EnabledRoutes []string `json:"enabledRoutes"` } // EmptyOutputBody defines model for EmptyOutputBody. type EmptyOutputBody = map[string]interface{} // ErrorDetail defines model for ErrorDetail. type ErrorDetail struct { // Location Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id' Location *string `json:"location,omitempty"` // Message Error message text Message *string `json:"message,omitempty"` // Value The value at the given location Value interface{} `json:"value,omitempty"` } // ErrorModel defines model for ErrorModel. type ErrorModel struct { // Detail A human-readable explanation specific to this occurrence of the problem. // // Example: Property foo is required but is missing. Detail *string `json:"detail,omitempty"` // Errors Optional list of individual error details Errors *[]ErrorDetail `json:"errors,omitempty"` // Instance A URI reference that identifies the specific occurrence of the problem. // // Example: https://example.com/error-log/abc123 Instance *string `json:"instance,omitempty"` // Status HTTP status code // // Example: 400 Status *int64 `json:"status,omitempty"` // Title A short, human-readable summary of the problem type. This value should not change between occurrences of the error. // // Example: Bad Request Title *string `json:"title,omitempty"` // Type A URI reference to human-readable documentation for the error. // // Example: https://example.com/errors/example Type *string `json:"type,omitempty"` } // Key defines model for Key. type Key struct { Capabilities KeyCapabilities `json:"capabilities"` Created time.Time `json:"created"` Description *string `json:"description,omitempty"` Expires *time.Time `json:"expires,omitempty"` ExpirySeconds *int64 `json:"expirySeconds,omitempty"` Id string `json:"id"` Invalid bool `json:"invalid"` Key *string `json:"key,omitempty"` KeyType string `json:"keyType"` Revoked *time.Time `json:"revoked,omitempty"` Scopes *[]string `json:"scopes,omitempty"` Tags *[]string `json:"tags,omitempty"` UserId *string `json:"userId,omitempty"` } // KeyCapabilities defines model for KeyCapabilities. type KeyCapabilities struct { Devices KeyDeviceCapabilities `json:"devices"` } // KeyDeviceCapabilities defines model for KeyDeviceCapabilities. type KeyDeviceCapabilities struct { Create KeyDeviceCreateCapabilities `json:"create"` } // KeyDeviceCreateCapabilities defines model for KeyDeviceCreateCapabilities. type KeyDeviceCreateCapabilities struct { Ephemeral bool `json:"ephemeral"` Preauthorized bool `json:"preauthorized"` Reusable bool `json:"reusable"` Tags *[]string `json:"tags"` } // ListDevicesOutputBody defines model for ListDevicesOutputBody. type ListDevicesOutputBody struct { Devices []Device `json:"devices"` } // ListKeysOutputBody defines model for ListKeysOutputBody. type ListKeysOutputBody struct { Keys []Key `json:"keys"` } // ListUsersOutputBody defines model for ListUsersOutputBody. type ListUsersOutputBody struct { Users []User `json:"users"` } // SetAuthorizedRequest defines model for SetAuthorizedRequest. type SetAuthorizedRequest struct { Authorized bool `json:"authorized"` } // SetKeyRequest defines model for SetKeyRequest. type SetKeyRequest struct { KeyExpiryDisabled bool `json:"keyExpiryDisabled"` } // SetNameRequest defines model for SetNameRequest. type SetNameRequest struct { Name string `json:"name"` } // SetSubnetRoutesRequest defines model for SetSubnetRoutesRequest. type SetSubnetRoutesRequest struct { Routes []string `json:"routes"` } // SetTagsRequest defines model for SetTagsRequest. type SetTagsRequest struct { Tags *[]string `json:"tags"` } // TailnetSettings defines model for TailnetSettings. type TailnetSettings struct { AclsExternalLink string `json:"aclsExternalLink"` AclsExternallyManagedOn bool `json:"aclsExternallyManagedOn"` DevicesApprovalOn bool `json:"devicesApprovalOn"` DevicesAutoUpdatesOn bool `json:"devicesAutoUpdatesOn"` DevicesKeyDurationDays int64 `json:"devicesKeyDurationDays"` HttpsEnabled bool `json:"httpsEnabled"` NetworkFlowLoggingOn bool `json:"networkFlowLoggingOn"` PostureIdentityCollectionOn bool `json:"postureIdentityCollectionOn"` RegionalRoutingOn bool `json:"regionalRoutingOn"` UsersApprovalOn bool `json:"usersApprovalOn"` UsersRoleAllowedToJoinExternalTailnets string `json:"usersRoleAllowedToJoinExternalTailnets"` } // User defines model for User. type User struct { Created time.Time `json:"created"` CurrentlyConnected bool `json:"currentlyConnected"` DeviceCount int64 `json:"deviceCount"` DisplayName string `json:"displayName"` Id string `json:"id"` LastSeen time.Time `json:"lastSeen"` LoginName string `json:"loginName"` ProfilePicUrl string `json:"profilePicUrl"` Role string `json:"role"` Status string `json:"status"` TailnetId string `json:"tailnetId"` Type string `json:"type"` } // DeleteDeviceParams defines parameters for DeleteDevice. type DeleteDeviceParams struct { // Fields Set to "all" for route fields. Fields *string `form:"fields,omitempty" json:"fields,omitempty"` } // GetDeviceParams defines parameters for GetDevice. type GetDeviceParams struct { // Fields Set to "all" for route fields. Fields *string `form:"fields,omitempty" json:"fields,omitempty"` } // GetDeviceRoutesParams defines parameters for GetDeviceRoutes. type GetDeviceRoutesParams struct { // Fields Set to "all" for route fields. Fields *string `form:"fields,omitempty" json:"fields,omitempty"` } // GetACLParams defines parameters for GetACL. type GetACLParams struct { // Details Accepted for compatibility; ignored. Details *bool `form:"details,omitempty" json:"details,omitempty"` Accept *string `json:"Accept,omitempty"` } // SetACLJSONBody defines parameters for SetACL. type SetACLJSONBody = openapi_types.File // SetACLParams defines parameters for SetACL. type SetACLParams struct { IfMatch *string `json:"If-Match,omitempty"` Accept *string `json:"Accept,omitempty"` } // ListDevicesParams defines parameters for ListDevices. type ListDevicesParams struct { Fields *string `form:"fields,omitempty" json:"fields,omitempty"` } // ListKeysParams defines parameters for ListKeys. type ListKeysParams struct { // All Accepted for compatibility; Headscale returns all keys. All *bool `form:"all,omitempty" json:"all,omitempty"` } // UpdateTailnetSettingsJSONBody defines parameters for UpdateTailnetSettings. type UpdateTailnetSettingsJSONBody = interface{} // ListUsersParams defines parameters for ListUsers. type ListUsersParams struct { // Type Filter by user type; Headscale users are all "member". Type *string `form:"type,omitempty" json:"type,omitempty"` // Role Filter by user role; Headscale users are all "member". Role *string `form:"role,omitempty" json:"role,omitempty"` } // AuthorizeDeviceJSONRequestBody defines body for AuthorizeDevice for application/json ContentType. type AuthorizeDeviceJSONRequestBody = SetAuthorizedRequest // SetDeviceKeyJSONRequestBody defines body for SetDeviceKey for application/json ContentType. type SetDeviceKeyJSONRequestBody = SetKeyRequest // SetDeviceNameJSONRequestBody defines body for SetDeviceName for application/json ContentType. type SetDeviceNameJSONRequestBody = SetNameRequest // SetDeviceRoutesJSONRequestBody defines body for SetDeviceRoutes for application/json ContentType. type SetDeviceRoutesJSONRequestBody = SetSubnetRoutesRequest // SetDeviceTagsJSONRequestBody defines body for SetDeviceTags for application/json ContentType. type SetDeviceTagsJSONRequestBody = SetTagsRequest // SetACLJSONRequestBody defines body for SetACL for application/json ContentType. type SetACLJSONRequestBody = SetACLJSONBody // CreateKeyJSONRequestBody defines body for CreateKey for application/json ContentType. type CreateKeyJSONRequestBody = CreateKeyRequest // UpdateTailnetSettingsJSONRequestBody defines body for UpdateTailnetSettings for application/json ContentType. type UpdateTailnetSettingsJSONRequestBody = UpdateTailnetSettingsJSONBody // RequestEditorFn is the function signature for the RequestEditor callback function type RequestEditorFn func(ctx context.Context, req *http.Request) error // Doer performs HTTP requests. // // The standard http.Client implements this interface. type HttpRequestDoer interface { Do(req *http.Request) (*http.Response, error) } // Client which conforms to the OpenAPI3 specification for this service. type Client struct { // The endpoint of the server conforming to this interface, with scheme, // https://api.deepmap.com for example. This can contain a path relative // to the server, such as https://api.deepmap.com/dev-test, and all the // paths in the swagger spec will be appended to the server. Server string // Doer for performing requests, typically a *http.Client with any // customized settings, such as certificate chains. Client HttpRequestDoer // A list of callbacks for modifying requests which are generated before sending over // the network. RequestEditors []RequestEditorFn } // ClientOption allows setting custom parameters during construction type ClientOption func(*Client) error // Creates a new Client, with reasonable defaults func NewClient(server string, opts ...ClientOption) (*Client, error) { // create a client with sane default values client := Client{ Server: server, } // mutate client and add all optional params for _, o := range opts { if err := o(&client); err != nil { return nil, err } } // ensure the server URL always has a trailing slash if !strings.HasSuffix(client.Server, "/") { client.Server += "/" } // create httpClient, if not already present if client.Client == nil { client.Client = &http.Client{} } return &client, nil } // WithHTTPClient allows overriding the default Doer, which is // automatically created using http.Client. This is useful for tests. func WithHTTPClient(doer HttpRequestDoer) ClientOption { return func(c *Client) error { c.Client = doer return nil } } // WithRequestEditorFn allows setting up a callback function, which will be // called right before sending the request. This can be used to mutate the request. func WithRequestEditorFn(fn RequestEditorFn) ClientOption { return func(c *Client) error { c.RequestEditors = append(c.RequestEditors, fn) return nil } } // The interface specification for the client above. type ClientInterface interface { // DeleteDevice Delete a device // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Corresponds with DELETE /api/v2/device/{id} (the `DeleteDevice` operationId). DeleteDevice(ctx context.Context, id string, params *DeleteDeviceParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetDevice Get a device // // Requires the `devices:core:read` OAuth scope (an admin API key is all-access). // // Corresponds with GET /api/v2/device/{id} (the `GetDevice` operationId). GetDevice(ctx context.Context, id string, params *GetDeviceParams, reqEditors ...RequestEditorFn) (*http.Response, error) // AuthorizeDeviceWithBody Authorize a device // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with POST /api/v2/device/{id}/authorized (the `AuthorizeDevice` operationId). AuthorizeDeviceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) // AuthorizeDevice Authorize a device // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with POST /api/v2/device/{id}/authorized (the `AuthorizeDevice` operationId). AuthorizeDevice(ctx context.Context, id string, body AuthorizeDeviceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // SetDeviceKeyWithBody Set a device's key settings // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with POST /api/v2/device/{id}/key (the `SetDeviceKey` operationId). SetDeviceKeyWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) // SetDeviceKey Set a device's key settings // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with POST /api/v2/device/{id}/key (the `SetDeviceKey` operationId). SetDeviceKey(ctx context.Context, id string, body SetDeviceKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // SetDeviceNameWithBody Set a device's name // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with POST /api/v2/device/{id}/name (the `SetDeviceName` operationId). SetDeviceNameWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) // SetDeviceName Set a device's name // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with POST /api/v2/device/{id}/name (the `SetDeviceName` operationId). SetDeviceName(ctx context.Context, id string, body SetDeviceNameJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetDeviceRoutes Get a device's subnet routes // // Requires the `devices:routes:read` OAuth scope (an admin API key is all-access). // // Corresponds with GET /api/v2/device/{id}/routes (the `GetDeviceRoutes` operationId). GetDeviceRoutes(ctx context.Context, id string, params *GetDeviceRoutesParams, reqEditors ...RequestEditorFn) (*http.Response, error) // SetDeviceRoutesWithBody Set a device's enabled subnet routes // // Requires the `devices:routes` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with POST /api/v2/device/{id}/routes (the `SetDeviceRoutes` operationId). SetDeviceRoutesWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) // SetDeviceRoutes Set a device's enabled subnet routes // // Requires the `devices:routes` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with POST /api/v2/device/{id}/routes (the `SetDeviceRoutes` operationId). SetDeviceRoutes(ctx context.Context, id string, body SetDeviceRoutesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // SetDeviceTagsWithBody Set a device's tags // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with POST /api/v2/device/{id}/tags (the `SetDeviceTags` operationId). SetDeviceTagsWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) // SetDeviceTags Set a device's tags // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with POST /api/v2/device/{id}/tags (the `SetDeviceTags` operationId). SetDeviceTags(ctx context.Context, id string, body SetDeviceTagsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetACL Get the policy file // // Requires the `policy_file:read` OAuth scope (an admin API key is all-access). // // Corresponds with GET /api/v2/tailnet/{tailnet}/acl (the `GetACL` operationId). GetACL(ctx context.Context, tailnet string, params *GetACLParams, reqEditors ...RequestEditorFn) (*http.Response, error) // SetACLWithBody Set the policy file // // Requires the `policy_file` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with POST /api/v2/tailnet/{tailnet}/acl (the `SetACL` operationId). SetACLWithBody(ctx context.Context, tailnet string, params *SetACLParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) // SetACL Set the policy file // // Requires the `policy_file` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with POST /api/v2/tailnet/{tailnet}/acl (the `SetACL` operationId). SetACL(ctx context.Context, tailnet string, params *SetACLParams, body SetACLJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // ListDevices List devices // // Requires the `devices:core:read` OAuth scope (an admin API key is all-access). // // Corresponds with GET /api/v2/tailnet/{tailnet}/devices (the `ListDevices` operationId). ListDevices(ctx context.Context, tailnet string, params *ListDevicesParams, reqEditors ...RequestEditorFn) (*http.Response, error) // ListKeys List auth keys and OAuth clients // // A token sees the kinds it can read: `auth_keys:read` for auth keys, `oauth_keys:read` for OAuth clients (an admin API key sees all). // // Corresponds with GET /api/v2/tailnet/{tailnet}/keys (the `ListKeys` operationId). ListKeys(ctx context.Context, tailnet string, params *ListKeysParams, reqEditors ...RequestEditorFn) (*http.Response, error) // CreateKeyWithBody Create an auth key or OAuth client // // Requires the `auth_keys` scope for an auth key, or `oauth_keys` for an OAuth client (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with POST /api/v2/tailnet/{tailnet}/keys (the `CreateKey` operationId). CreateKeyWithBody(ctx context.Context, tailnet string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) // CreateKey Create an auth key or OAuth client // // Requires the `auth_keys` scope for an auth key, or `oauth_keys` for an OAuth client (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with POST /api/v2/tailnet/{tailnet}/keys (the `CreateKey` operationId). CreateKey(ctx context.Context, tailnet string, body CreateKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // DeleteKey Delete an auth key or OAuth client // // Requires the `auth_keys` scope for an auth key, or `oauth_keys` for an OAuth client (an admin API key is all-access). // // Corresponds with DELETE /api/v2/tailnet/{tailnet}/keys/{keyId} (the `DeleteKey` operationId). DeleteKey(ctx context.Context, tailnet string, keyId string, reqEditors ...RequestEditorFn) (*http.Response, error) // GetKey Get an auth key or OAuth client // // Requires `auth_keys:read` for an auth key, or `oauth_keys:read` for an OAuth client (an admin API key is all-access). // // Corresponds with GET /api/v2/tailnet/{tailnet}/keys/{keyId} (the `GetKey` operationId). GetKey(ctx context.Context, tailnet string, keyId string, reqEditors ...RequestEditorFn) (*http.Response, error) // GetTailnetSettings Get tailnet settings // // Requires the `feature_settings:read` OAuth scope (an admin API key is all-access). // // Corresponds with GET /api/v2/tailnet/{tailnet}/settings (the `GetTailnetSettings` operationId). GetTailnetSettings(ctx context.Context, tailnet string, reqEditors ...RequestEditorFn) (*http.Response, error) // UpdateTailnetSettingsWithBody Update tailnet settings // // Requires the `feature_settings` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with PATCH /api/v2/tailnet/{tailnet}/settings (the `UpdateTailnetSettings` operationId). UpdateTailnetSettingsWithBody(ctx context.Context, tailnet string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) // UpdateTailnetSettings Update tailnet settings // // Requires the `feature_settings` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with PATCH /api/v2/tailnet/{tailnet}/settings (the `UpdateTailnetSettings` operationId). UpdateTailnetSettings(ctx context.Context, tailnet string, body UpdateTailnetSettingsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // ListUsers List users // // Requires the `users:read` OAuth scope (an admin API key is all-access). // // Corresponds with GET /api/v2/tailnet/{tailnet}/users (the `ListUsers` operationId). ListUsers(ctx context.Context, tailnet string, params *ListUsersParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetUser Get a user // // Requires the `users:read` OAuth scope (an admin API key is all-access). // // Corresponds with GET /api/v2/users/{id} (the `GetUser` operationId). GetUser(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) } // DeleteDevice Delete a device // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Corresponds with DELETE /api/v2/device/{id} (the `DeleteDevice` operationId). func (c *Client) DeleteDevice(ctx context.Context, id string, params *DeleteDeviceParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewDeleteDeviceRequest(c.Server, id, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // GetDevice Get a device // // Requires the `devices:core:read` OAuth scope (an admin API key is all-access). // // Corresponds with GET /api/v2/device/{id} (the `GetDevice` operationId). func (c *Client) GetDevice(ctx context.Context, id string, params *GetDeviceParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetDeviceRequest(c.Server, id, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // AuthorizeDeviceWithBody Authorize a device // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with POST /api/v2/device/{id}/authorized (the `AuthorizeDevice` operationId). func (c *Client) AuthorizeDeviceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewAuthorizeDeviceRequestWithBody(c.Server, id, contentType, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // AuthorizeDevice Authorize a device // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with POST /api/v2/device/{id}/authorized (the `AuthorizeDevice` operationId). func (c *Client) AuthorizeDevice(ctx context.Context, id string, body AuthorizeDeviceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewAuthorizeDeviceRequest(c.Server, id, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // SetDeviceKeyWithBody Set a device's key settings // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with POST /api/v2/device/{id}/key (the `SetDeviceKey` operationId). func (c *Client) SetDeviceKeyWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewSetDeviceKeyRequestWithBody(c.Server, id, contentType, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // SetDeviceKey Set a device's key settings // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with POST /api/v2/device/{id}/key (the `SetDeviceKey` operationId). func (c *Client) SetDeviceKey(ctx context.Context, id string, body SetDeviceKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewSetDeviceKeyRequest(c.Server, id, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // SetDeviceNameWithBody Set a device's name // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with POST /api/v2/device/{id}/name (the `SetDeviceName` operationId). func (c *Client) SetDeviceNameWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewSetDeviceNameRequestWithBody(c.Server, id, contentType, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // SetDeviceName Set a device's name // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with POST /api/v2/device/{id}/name (the `SetDeviceName` operationId). func (c *Client) SetDeviceName(ctx context.Context, id string, body SetDeviceNameJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewSetDeviceNameRequest(c.Server, id, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // GetDeviceRoutes Get a device's subnet routes // // Requires the `devices:routes:read` OAuth scope (an admin API key is all-access). // // Corresponds with GET /api/v2/device/{id}/routes (the `GetDeviceRoutes` operationId). func (c *Client) GetDeviceRoutes(ctx context.Context, id string, params *GetDeviceRoutesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetDeviceRoutesRequest(c.Server, id, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // SetDeviceRoutesWithBody Set a device's enabled subnet routes // // Requires the `devices:routes` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with POST /api/v2/device/{id}/routes (the `SetDeviceRoutes` operationId). func (c *Client) SetDeviceRoutesWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewSetDeviceRoutesRequestWithBody(c.Server, id, contentType, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // SetDeviceRoutes Set a device's enabled subnet routes // // Requires the `devices:routes` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with POST /api/v2/device/{id}/routes (the `SetDeviceRoutes` operationId). func (c *Client) SetDeviceRoutes(ctx context.Context, id string, body SetDeviceRoutesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewSetDeviceRoutesRequest(c.Server, id, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // SetDeviceTagsWithBody Set a device's tags // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with POST /api/v2/device/{id}/tags (the `SetDeviceTags` operationId). func (c *Client) SetDeviceTagsWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewSetDeviceTagsRequestWithBody(c.Server, id, contentType, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // SetDeviceTags Set a device's tags // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with POST /api/v2/device/{id}/tags (the `SetDeviceTags` operationId). func (c *Client) SetDeviceTags(ctx context.Context, id string, body SetDeviceTagsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewSetDeviceTagsRequest(c.Server, id, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // GetACL Get the policy file // // Requires the `policy_file:read` OAuth scope (an admin API key is all-access). // // Corresponds with GET /api/v2/tailnet/{tailnet}/acl (the `GetACL` operationId). func (c *Client) GetACL(ctx context.Context, tailnet string, params *GetACLParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetACLRequest(c.Server, tailnet, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // SetACLWithBody Set the policy file // // Requires the `policy_file` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with POST /api/v2/tailnet/{tailnet}/acl (the `SetACL` operationId). func (c *Client) SetACLWithBody(ctx context.Context, tailnet string, params *SetACLParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewSetACLRequestWithBody(c.Server, tailnet, params, contentType, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // SetACL Set the policy file // // Requires the `policy_file` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with POST /api/v2/tailnet/{tailnet}/acl (the `SetACL` operationId). func (c *Client) SetACL(ctx context.Context, tailnet string, params *SetACLParams, body SetACLJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewSetACLRequest(c.Server, tailnet, params, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // ListDevices List devices // // Requires the `devices:core:read` OAuth scope (an admin API key is all-access). // // Corresponds with GET /api/v2/tailnet/{tailnet}/devices (the `ListDevices` operationId). func (c *Client) ListDevices(ctx context.Context, tailnet string, params *ListDevicesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewListDevicesRequest(c.Server, tailnet, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // ListKeys List auth keys and OAuth clients // // A token sees the kinds it can read: `auth_keys:read` for auth keys, `oauth_keys:read` for OAuth clients (an admin API key sees all). // // Corresponds with GET /api/v2/tailnet/{tailnet}/keys (the `ListKeys` operationId). func (c *Client) ListKeys(ctx context.Context, tailnet string, params *ListKeysParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewListKeysRequest(c.Server, tailnet, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // CreateKeyWithBody Create an auth key or OAuth client // // Requires the `auth_keys` scope for an auth key, or `oauth_keys` for an OAuth client (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with POST /api/v2/tailnet/{tailnet}/keys (the `CreateKey` operationId). func (c *Client) CreateKeyWithBody(ctx context.Context, tailnet string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewCreateKeyRequestWithBody(c.Server, tailnet, contentType, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // CreateKey Create an auth key or OAuth client // // Requires the `auth_keys` scope for an auth key, or `oauth_keys` for an OAuth client (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with POST /api/v2/tailnet/{tailnet}/keys (the `CreateKey` operationId). func (c *Client) CreateKey(ctx context.Context, tailnet string, body CreateKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewCreateKeyRequest(c.Server, tailnet, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // DeleteKey Delete an auth key or OAuth client // // Requires the `auth_keys` scope for an auth key, or `oauth_keys` for an OAuth client (an admin API key is all-access). // // Corresponds with DELETE /api/v2/tailnet/{tailnet}/keys/{keyId} (the `DeleteKey` operationId). func (c *Client) DeleteKey(ctx context.Context, tailnet string, keyId string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewDeleteKeyRequest(c.Server, tailnet, keyId) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // GetKey Get an auth key or OAuth client // // Requires `auth_keys:read` for an auth key, or `oauth_keys:read` for an OAuth client (an admin API key is all-access). // // Corresponds with GET /api/v2/tailnet/{tailnet}/keys/{keyId} (the `GetKey` operationId). func (c *Client) GetKey(ctx context.Context, tailnet string, keyId string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetKeyRequest(c.Server, tailnet, keyId) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // GetTailnetSettings Get tailnet settings // // Requires the `feature_settings:read` OAuth scope (an admin API key is all-access). // // Corresponds with GET /api/v2/tailnet/{tailnet}/settings (the `GetTailnetSettings` operationId). func (c *Client) GetTailnetSettings(ctx context.Context, tailnet string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetTailnetSettingsRequest(c.Server, tailnet) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // UpdateTailnetSettingsWithBody Update tailnet settings // // Requires the `feature_settings` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type. // // Corresponds with PATCH /api/v2/tailnet/{tailnet}/settings (the `UpdateTailnetSettings` operationId). func (c *Client) UpdateTailnetSettingsWithBody(ctx context.Context, tailnet string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewUpdateTailnetSettingsRequestWithBody(c.Server, tailnet, contentType, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // UpdateTailnetSettings Update tailnet settings // // Requires the `feature_settings` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type. // // Corresponds with PATCH /api/v2/tailnet/{tailnet}/settings (the `UpdateTailnetSettings` operationId). func (c *Client) UpdateTailnetSettings(ctx context.Context, tailnet string, body UpdateTailnetSettingsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewUpdateTailnetSettingsRequest(c.Server, tailnet, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // ListUsers List users // // Requires the `users:read` OAuth scope (an admin API key is all-access). // // Corresponds with GET /api/v2/tailnet/{tailnet}/users (the `ListUsers` operationId). func (c *Client) ListUsers(ctx context.Context, tailnet string, params *ListUsersParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewListUsersRequest(c.Server, tailnet, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // GetUser Get a user // // Requires the `users:read` OAuth scope (an admin API key is all-access). // // Corresponds with GET /api/v2/users/{id} (the `GetUser` operationId). func (c *Client) GetUser(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetUserRequest(c.Server, id) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // NewDeleteDeviceRequest constructs an http.Request for the DeleteDevice method func NewDeleteDeviceRequest(server string, id string, params *DeleteDeviceParams) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/device/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { // queryValues collects non-styled parameters (passthrough, JSON) // that are safe to round-trip through url.Values.Encode(). queryValues := queryURL.Query() // rawQueryFragments collects pre-encoded query fragments from // styled parameters, preserving literal commas as delimiters // per the OpenAPI spec (e.g. "color=blue,black,brown"). var rawQueryFragments []string if params.Fields != nil { if queryFrag, err := runtime.StyleParamWithOptions("form", false, "fields", *params.Fields, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { return nil, err } else { for _, qp := range strings.Split(queryFrag, "&") { rawQueryFragments = append(rawQueryFragments, qp) } } } if encoded := queryValues.Encode(); encoded != "" { rawQueryFragments = append(rawQueryFragments, encoded) } queryURL.RawQuery = strings.Join(rawQueryFragments, "&") } req, err := http.NewRequest(http.MethodDelete, queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewGetDeviceRequest constructs an http.Request for the GetDevice method func NewGetDeviceRequest(server string, id string, params *GetDeviceParams) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/device/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { // queryValues collects non-styled parameters (passthrough, JSON) // that are safe to round-trip through url.Values.Encode(). queryValues := queryURL.Query() // rawQueryFragments collects pre-encoded query fragments from // styled parameters, preserving literal commas as delimiters // per the OpenAPI spec (e.g. "color=blue,black,brown"). var rawQueryFragments []string if params.Fields != nil { if queryFrag, err := runtime.StyleParamWithOptions("form", false, "fields", *params.Fields, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { return nil, err } else { for _, qp := range strings.Split(queryFrag, "&") { rawQueryFragments = append(rawQueryFragments, qp) } } } if encoded := queryValues.Encode(); encoded != "" { rawQueryFragments = append(rawQueryFragments, encoded) } queryURL.RawQuery = strings.Join(rawQueryFragments, "&") } req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewAuthorizeDeviceRequest calls the generic AuthorizeDevice builder with application/json body func NewAuthorizeDeviceRequest(server string, id string, body AuthorizeDeviceJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewAuthorizeDeviceRequestWithBody(server, id, "application/json", bodyReader) } // NewAuthorizeDeviceRequestWithBody constructs an http.Request for the AuthorizeDevice method, with any body, and a specified content type func NewAuthorizeDeviceRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/device/%s/authorized", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewSetDeviceKeyRequest calls the generic SetDeviceKey builder with application/json body func NewSetDeviceKeyRequest(server string, id string, body SetDeviceKeyJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewSetDeviceKeyRequestWithBody(server, id, "application/json", bodyReader) } // NewSetDeviceKeyRequestWithBody constructs an http.Request for the SetDeviceKey method, with any body, and a specified content type func NewSetDeviceKeyRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/device/%s/key", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewSetDeviceNameRequest calls the generic SetDeviceName builder with application/json body func NewSetDeviceNameRequest(server string, id string, body SetDeviceNameJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewSetDeviceNameRequestWithBody(server, id, "application/json", bodyReader) } // NewSetDeviceNameRequestWithBody constructs an http.Request for the SetDeviceName method, with any body, and a specified content type func NewSetDeviceNameRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/device/%s/name", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewGetDeviceRoutesRequest constructs an http.Request for the GetDeviceRoutes method func NewGetDeviceRoutesRequest(server string, id string, params *GetDeviceRoutesParams) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/device/%s/routes", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { // queryValues collects non-styled parameters (passthrough, JSON) // that are safe to round-trip through url.Values.Encode(). queryValues := queryURL.Query() // rawQueryFragments collects pre-encoded query fragments from // styled parameters, preserving literal commas as delimiters // per the OpenAPI spec (e.g. "color=blue,black,brown"). var rawQueryFragments []string if params.Fields != nil { if queryFrag, err := runtime.StyleParamWithOptions("form", false, "fields", *params.Fields, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { return nil, err } else { for _, qp := range strings.Split(queryFrag, "&") { rawQueryFragments = append(rawQueryFragments, qp) } } } if encoded := queryValues.Encode(); encoded != "" { rawQueryFragments = append(rawQueryFragments, encoded) } queryURL.RawQuery = strings.Join(rawQueryFragments, "&") } req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewSetDeviceRoutesRequest calls the generic SetDeviceRoutes builder with application/json body func NewSetDeviceRoutesRequest(server string, id string, body SetDeviceRoutesJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewSetDeviceRoutesRequestWithBody(server, id, "application/json", bodyReader) } // NewSetDeviceRoutesRequestWithBody constructs an http.Request for the SetDeviceRoutes method, with any body, and a specified content type func NewSetDeviceRoutesRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/device/%s/routes", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewSetDeviceTagsRequest calls the generic SetDeviceTags builder with application/json body func NewSetDeviceTagsRequest(server string, id string, body SetDeviceTagsJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewSetDeviceTagsRequestWithBody(server, id, "application/json", bodyReader) } // NewSetDeviceTagsRequestWithBody constructs an http.Request for the SetDeviceTags method, with any body, and a specified content type func NewSetDeviceTagsRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/device/%s/tags", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewGetACLRequest constructs an http.Request for the GetACL method func NewGetACLRequest(server string, tailnet string, params *GetACLParams) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "tailnet", tailnet, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/tailnet/%s/acl", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { // queryValues collects non-styled parameters (passthrough, JSON) // that are safe to round-trip through url.Values.Encode(). queryValues := queryURL.Query() // rawQueryFragments collects pre-encoded query fragments from // styled parameters, preserving literal commas as delimiters // per the OpenAPI spec (e.g. "color=blue,black,brown"). var rawQueryFragments []string if params.Details != nil { if queryFrag, err := runtime.StyleParamWithOptions("form", false, "details", *params.Details, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "boolean", Format: ""}); err != nil { return nil, err } else { for _, qp := range strings.Split(queryFrag, "&") { rawQueryFragments = append(rawQueryFragments, qp) } } } if encoded := queryValues.Encode(); encoded != "" { rawQueryFragments = append(rawQueryFragments, encoded) } queryURL.RawQuery = strings.Join(rawQueryFragments, "&") } req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } if params != nil { if params.Accept != nil { var headerParam0 string headerParam0, err = runtime.StyleParamWithOptions("simple", false, "Accept", *params.Accept, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) if err != nil { return nil, err } req.Header.Set("Accept", headerParam0) } } return req, nil } // NewSetACLRequest calls the generic SetACL builder with application/json body func NewSetACLRequest(server string, tailnet string, params *SetACLParams, body SetACLJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewSetACLRequestWithBody(server, tailnet, params, "application/json", bodyReader) } // NewSetACLRequestWithBody constructs an http.Request for the SetACL method, with any body, and a specified content type func NewSetACLRequestWithBody(server string, tailnet string, params *SetACLParams, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "tailnet", tailnet, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/tailnet/%s/acl", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) if params != nil { if params.IfMatch != nil { var headerParam0 string headerParam0, err = runtime.StyleParamWithOptions("simple", false, "If-Match", *params.IfMatch, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) if err != nil { return nil, err } req.Header.Set("If-Match", headerParam0) } if params.Accept != nil { var headerParam1 string headerParam1, err = runtime.StyleParamWithOptions("simple", false, "Accept", *params.Accept, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) if err != nil { return nil, err } req.Header.Set("Accept", headerParam1) } } return req, nil } // NewListDevicesRequest constructs an http.Request for the ListDevices method func NewListDevicesRequest(server string, tailnet string, params *ListDevicesParams) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "tailnet", tailnet, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/tailnet/%s/devices", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { // queryValues collects non-styled parameters (passthrough, JSON) // that are safe to round-trip through url.Values.Encode(). queryValues := queryURL.Query() // rawQueryFragments collects pre-encoded query fragments from // styled parameters, preserving literal commas as delimiters // per the OpenAPI spec (e.g. "color=blue,black,brown"). var rawQueryFragments []string if params.Fields != nil { if queryFrag, err := runtime.StyleParamWithOptions("form", false, "fields", *params.Fields, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { return nil, err } else { for _, qp := range strings.Split(queryFrag, "&") { rawQueryFragments = append(rawQueryFragments, qp) } } } if encoded := queryValues.Encode(); encoded != "" { rawQueryFragments = append(rawQueryFragments, encoded) } queryURL.RawQuery = strings.Join(rawQueryFragments, "&") } req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewListKeysRequest constructs an http.Request for the ListKeys method func NewListKeysRequest(server string, tailnet string, params *ListKeysParams) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "tailnet", tailnet, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/tailnet/%s/keys", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { // queryValues collects non-styled parameters (passthrough, JSON) // that are safe to round-trip through url.Values.Encode(). queryValues := queryURL.Query() // rawQueryFragments collects pre-encoded query fragments from // styled parameters, preserving literal commas as delimiters // per the OpenAPI spec (e.g. "color=blue,black,brown"). var rawQueryFragments []string if params.All != nil { if queryFrag, err := runtime.StyleParamWithOptions("form", false, "all", *params.All, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "boolean", Format: ""}); err != nil { return nil, err } else { for _, qp := range strings.Split(queryFrag, "&") { rawQueryFragments = append(rawQueryFragments, qp) } } } if encoded := queryValues.Encode(); encoded != "" { rawQueryFragments = append(rawQueryFragments, encoded) } queryURL.RawQuery = strings.Join(rawQueryFragments, "&") } req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewCreateKeyRequest calls the generic CreateKey builder with application/json body func NewCreateKeyRequest(server string, tailnet string, body CreateKeyJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewCreateKeyRequestWithBody(server, tailnet, "application/json", bodyReader) } // NewCreateKeyRequestWithBody constructs an http.Request for the CreateKey method, with any body, and a specified content type func NewCreateKeyRequestWithBody(server string, tailnet string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "tailnet", tailnet, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/tailnet/%s/keys", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewDeleteKeyRequest constructs an http.Request for the DeleteKey method func NewDeleteKeyRequest(server string, tailnet string, keyId string) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "tailnet", tailnet, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } var pathParam1 string pathParam1, err = runtime.StyleParamWithOptions("simple", false, "keyId", keyId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/tailnet/%s/keys/%s", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest(http.MethodDelete, queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewGetKeyRequest constructs an http.Request for the GetKey method func NewGetKeyRequest(server string, tailnet string, keyId string) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "tailnet", tailnet, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } var pathParam1 string pathParam1, err = runtime.StyleParamWithOptions("simple", false, "keyId", keyId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/tailnet/%s/keys/%s", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewGetTailnetSettingsRequest constructs an http.Request for the GetTailnetSettings method func NewGetTailnetSettingsRequest(server string, tailnet string) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "tailnet", tailnet, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/tailnet/%s/settings", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewUpdateTailnetSettingsRequest calls the generic UpdateTailnetSettings builder with application/json body func NewUpdateTailnetSettingsRequest(server string, tailnet string, body UpdateTailnetSettingsJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewUpdateTailnetSettingsRequestWithBody(server, tailnet, "application/json", bodyReader) } // NewUpdateTailnetSettingsRequestWithBody constructs an http.Request for the UpdateTailnetSettings method, with any body, and a specified content type func NewUpdateTailnetSettingsRequestWithBody(server string, tailnet string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "tailnet", tailnet, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/tailnet/%s/settings", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest(http.MethodPatch, queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewListUsersRequest constructs an http.Request for the ListUsers method func NewListUsersRequest(server string, tailnet string, params *ListUsersParams) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "tailnet", tailnet, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/tailnet/%s/users", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { // queryValues collects non-styled parameters (passthrough, JSON) // that are safe to round-trip through url.Values.Encode(). queryValues := queryURL.Query() // rawQueryFragments collects pre-encoded query fragments from // styled parameters, preserving literal commas as delimiters // per the OpenAPI spec (e.g. "color=blue,black,brown"). var rawQueryFragments []string if params.Type != nil { if queryFrag, err := runtime.StyleParamWithOptions("form", false, "type", *params.Type, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { return nil, err } else { for _, qp := range strings.Split(queryFrag, "&") { rawQueryFragments = append(rawQueryFragments, qp) } } } if params.Role != nil { if queryFrag, err := runtime.StyleParamWithOptions("form", false, "role", *params.Role, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { return nil, err } else { for _, qp := range strings.Split(queryFrag, "&") { rawQueryFragments = append(rawQueryFragments, qp) } } } if encoded := queryValues.Encode(); encoded != "" { rawQueryFragments = append(rawQueryFragments, encoded) } queryURL.RawQuery = strings.Join(rawQueryFragments, "&") } req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewGetUserRequest constructs an http.Request for the GetUser method func NewGetUserRequest(server string, id string) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v2/users/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) if err != nil { return nil, err } return req, nil } func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { for _, r := range c.RequestEditors { if err := r(ctx, req); err != nil { return err } } for _, r := range additionalEditors { if err := r(ctx, req); err != nil { return err } } return nil } // ClientWithResponses builds on ClientInterface to offer response payloads type ClientWithResponses struct { ClientInterface } // NewClientWithResponses creates a new ClientWithResponses, which wraps // Client with return type handling func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) { client, err := NewClient(server, opts...) if err != nil { return nil, err } return &ClientWithResponses{client}, nil } // WithBaseURL overrides the baseURL. func WithBaseURL(baseURL string) ClientOption { return func(c *Client) error { newBaseURL, err := url.Parse(baseURL) if err != nil { return err } c.Server = newBaseURL.String() return nil } } // ClientWithResponsesInterface is the interface specification for the client with responses above. type ClientWithResponsesInterface interface { // DeleteDeviceWithResponse Delete a device // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with DELETE /api/v2/device/{id} (the `DeleteDevice` operationId). DeleteDeviceWithResponse(ctx context.Context, id string, params *DeleteDeviceParams, reqEditors ...RequestEditorFn) (*DeleteDeviceResponse, error) // GetDeviceWithResponse Get a device // // Requires the `devices:core:read` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/device/{id} (the `GetDevice` operationId). GetDeviceWithResponse(ctx context.Context, id string, params *GetDeviceParams, reqEditors ...RequestEditorFn) (*GetDeviceResponse, error) // AuthorizeDeviceWithBodyWithResponse Authorize a device // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/authorized (the `AuthorizeDevice` operationId). AuthorizeDeviceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthorizeDeviceResponse, error) // AuthorizeDeviceWithResponse Authorize a device // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/authorized (the `AuthorizeDevice` operationId). AuthorizeDeviceWithResponse(ctx context.Context, id string, body AuthorizeDeviceJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthorizeDeviceResponse, error) // SetDeviceKeyWithBodyWithResponse Set a device's key settings // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/key (the `SetDeviceKey` operationId). SetDeviceKeyWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetDeviceKeyResponse, error) // SetDeviceKeyWithResponse Set a device's key settings // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/key (the `SetDeviceKey` operationId). SetDeviceKeyWithResponse(ctx context.Context, id string, body SetDeviceKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*SetDeviceKeyResponse, error) // SetDeviceNameWithBodyWithResponse Set a device's name // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/name (the `SetDeviceName` operationId). SetDeviceNameWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetDeviceNameResponse, error) // SetDeviceNameWithResponse Set a device's name // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/name (the `SetDeviceName` operationId). SetDeviceNameWithResponse(ctx context.Context, id string, body SetDeviceNameJSONRequestBody, reqEditors ...RequestEditorFn) (*SetDeviceNameResponse, error) // GetDeviceRoutesWithResponse Get a device's subnet routes // // Requires the `devices:routes:read` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/device/{id}/routes (the `GetDeviceRoutes` operationId). GetDeviceRoutesWithResponse(ctx context.Context, id string, params *GetDeviceRoutesParams, reqEditors ...RequestEditorFn) (*GetDeviceRoutesResponse, error) // SetDeviceRoutesWithBodyWithResponse Set a device's enabled subnet routes // // Requires the `devices:routes` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/routes (the `SetDeviceRoutes` operationId). SetDeviceRoutesWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetDeviceRoutesResponse, error) // SetDeviceRoutesWithResponse Set a device's enabled subnet routes // // Requires the `devices:routes` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/routes (the `SetDeviceRoutes` operationId). SetDeviceRoutesWithResponse(ctx context.Context, id string, body SetDeviceRoutesJSONRequestBody, reqEditors ...RequestEditorFn) (*SetDeviceRoutesResponse, error) // SetDeviceTagsWithBodyWithResponse Set a device's tags // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/tags (the `SetDeviceTags` operationId). SetDeviceTagsWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetDeviceTagsResponse, error) // SetDeviceTagsWithResponse Set a device's tags // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/tags (the `SetDeviceTags` operationId). SetDeviceTagsWithResponse(ctx context.Context, id string, body SetDeviceTagsJSONRequestBody, reqEditors ...RequestEditorFn) (*SetDeviceTagsResponse, error) // GetACLWithResponse Get the policy file // // Requires the `policy_file:read` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/tailnet/{tailnet}/acl (the `GetACL` operationId). GetACLWithResponse(ctx context.Context, tailnet string, params *GetACLParams, reqEditors ...RequestEditorFn) (*GetACLResponse, error) // SetACLWithBodyWithResponse Set the policy file // // Requires the `policy_file` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/tailnet/{tailnet}/acl (the `SetACL` operationId). SetACLWithBodyWithResponse(ctx context.Context, tailnet string, params *SetACLParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetACLResponse, error) // SetACLWithResponse Set the policy file // // Requires the `policy_file` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/tailnet/{tailnet}/acl (the `SetACL` operationId). SetACLWithResponse(ctx context.Context, tailnet string, params *SetACLParams, body SetACLJSONRequestBody, reqEditors ...RequestEditorFn) (*SetACLResponse, error) // ListDevicesWithResponse List devices // // Requires the `devices:core:read` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/tailnet/{tailnet}/devices (the `ListDevices` operationId). ListDevicesWithResponse(ctx context.Context, tailnet string, params *ListDevicesParams, reqEditors ...RequestEditorFn) (*ListDevicesResponse, error) // ListKeysWithResponse List auth keys and OAuth clients // // A token sees the kinds it can read: `auth_keys:read` for auth keys, `oauth_keys:read` for OAuth clients (an admin API key sees all). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/tailnet/{tailnet}/keys (the `ListKeys` operationId). ListKeysWithResponse(ctx context.Context, tailnet string, params *ListKeysParams, reqEditors ...RequestEditorFn) (*ListKeysResponse, error) // CreateKeyWithBodyWithResponse Create an auth key or OAuth client // // Requires the `auth_keys` scope for an auth key, or `oauth_keys` for an OAuth client (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/tailnet/{tailnet}/keys (the `CreateKey` operationId). CreateKeyWithBodyWithResponse(ctx context.Context, tailnet string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateKeyResponse, error) // CreateKeyWithResponse Create an auth key or OAuth client // // Requires the `auth_keys` scope for an auth key, or `oauth_keys` for an OAuth client (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/tailnet/{tailnet}/keys (the `CreateKey` operationId). CreateKeyWithResponse(ctx context.Context, tailnet string, body CreateKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateKeyResponse, error) // DeleteKeyWithResponse Delete an auth key or OAuth client // // Requires the `auth_keys` scope for an auth key, or `oauth_keys` for an OAuth client (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with DELETE /api/v2/tailnet/{tailnet}/keys/{keyId} (the `DeleteKey` operationId). DeleteKeyWithResponse(ctx context.Context, tailnet string, keyId string, reqEditors ...RequestEditorFn) (*DeleteKeyResponse, error) // GetKeyWithResponse Get an auth key or OAuth client // // Requires `auth_keys:read` for an auth key, or `oauth_keys:read` for an OAuth client (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/tailnet/{tailnet}/keys/{keyId} (the `GetKey` operationId). GetKeyWithResponse(ctx context.Context, tailnet string, keyId string, reqEditors ...RequestEditorFn) (*GetKeyResponse, error) // GetTailnetSettingsWithResponse Get tailnet settings // // Requires the `feature_settings:read` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/tailnet/{tailnet}/settings (the `GetTailnetSettings` operationId). GetTailnetSettingsWithResponse(ctx context.Context, tailnet string, reqEditors ...RequestEditorFn) (*GetTailnetSettingsResponse, error) // UpdateTailnetSettingsWithBodyWithResponse Update tailnet settings // // Requires the `feature_settings` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with PATCH /api/v2/tailnet/{tailnet}/settings (the `UpdateTailnetSettings` operationId). UpdateTailnetSettingsWithBodyWithResponse(ctx context.Context, tailnet string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateTailnetSettingsResponse, error) // UpdateTailnetSettingsWithResponse Update tailnet settings // // Requires the `feature_settings` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with PATCH /api/v2/tailnet/{tailnet}/settings (the `UpdateTailnetSettings` operationId). UpdateTailnetSettingsWithResponse(ctx context.Context, tailnet string, body UpdateTailnetSettingsJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateTailnetSettingsResponse, error) // ListUsersWithResponse List users // // Requires the `users:read` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/tailnet/{tailnet}/users (the `ListUsers` operationId). ListUsersWithResponse(ctx context.Context, tailnet string, params *ListUsersParams, reqEditors ...RequestEditorFn) (*ListUsersResponse, error) // GetUserWithResponse Get a user // // Requires the `users:read` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/users/{id} (the `GetUser` operationId). GetUserWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetUserResponse, error) } type DeleteDeviceResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *EmptyOutputBody // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r DeleteDeviceResponse) GetJSON200() *EmptyOutputBody { return r.JSON200 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r DeleteDeviceResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r DeleteDeviceResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r DeleteDeviceResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r DeleteDeviceResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r DeleteDeviceResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r DeleteDeviceResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r DeleteDeviceResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r DeleteDeviceResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r DeleteDeviceResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type GetDeviceResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *Device // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r GetDeviceResponse) GetJSON200() *Device { return r.JSON200 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r GetDeviceResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r GetDeviceResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r GetDeviceResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r GetDeviceResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r GetDeviceResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r GetDeviceResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r GetDeviceResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetDeviceResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r GetDeviceResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type AuthorizeDeviceResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *EmptyOutputBody // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response ApplicationproblemJSON400 *ErrorModel // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r AuthorizeDeviceResponse) GetJSON200() *EmptyOutputBody { return r.JSON200 } // GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response func (r AuthorizeDeviceResponse) GetApplicationproblemJSON400() *ErrorModel { return r.ApplicationproblemJSON400 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r AuthorizeDeviceResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r AuthorizeDeviceResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r AuthorizeDeviceResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r AuthorizeDeviceResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r AuthorizeDeviceResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r AuthorizeDeviceResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r AuthorizeDeviceResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r AuthorizeDeviceResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r AuthorizeDeviceResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type SetDeviceKeyResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *EmptyOutputBody // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response ApplicationproblemJSON400 *ErrorModel // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r SetDeviceKeyResponse) GetJSON200() *EmptyOutputBody { return r.JSON200 } // GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response func (r SetDeviceKeyResponse) GetApplicationproblemJSON400() *ErrorModel { return r.ApplicationproblemJSON400 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r SetDeviceKeyResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r SetDeviceKeyResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r SetDeviceKeyResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r SetDeviceKeyResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r SetDeviceKeyResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r SetDeviceKeyResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r SetDeviceKeyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r SetDeviceKeyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r SetDeviceKeyResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type SetDeviceNameResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *EmptyOutputBody // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response ApplicationproblemJSON400 *ErrorModel // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r SetDeviceNameResponse) GetJSON200() *EmptyOutputBody { return r.JSON200 } // GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response func (r SetDeviceNameResponse) GetApplicationproblemJSON400() *ErrorModel { return r.ApplicationproblemJSON400 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r SetDeviceNameResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r SetDeviceNameResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r SetDeviceNameResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r SetDeviceNameResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r SetDeviceNameResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r SetDeviceNameResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r SetDeviceNameResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r SetDeviceNameResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r SetDeviceNameResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type GetDeviceRoutesResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *DeviceRoutes // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r GetDeviceRoutesResponse) GetJSON200() *DeviceRoutes { return r.JSON200 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r GetDeviceRoutesResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r GetDeviceRoutesResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r GetDeviceRoutesResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r GetDeviceRoutesResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r GetDeviceRoutesResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r GetDeviceRoutesResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r GetDeviceRoutesResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetDeviceRoutesResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r GetDeviceRoutesResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type SetDeviceRoutesResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *DeviceRoutes // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response ApplicationproblemJSON400 *ErrorModel // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r SetDeviceRoutesResponse) GetJSON200() *DeviceRoutes { return r.JSON200 } // GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response func (r SetDeviceRoutesResponse) GetApplicationproblemJSON400() *ErrorModel { return r.ApplicationproblemJSON400 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r SetDeviceRoutesResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r SetDeviceRoutesResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r SetDeviceRoutesResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r SetDeviceRoutesResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r SetDeviceRoutesResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r SetDeviceRoutesResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r SetDeviceRoutesResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r SetDeviceRoutesResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r SetDeviceRoutesResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type SetDeviceTagsResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *EmptyOutputBody // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response ApplicationproblemJSON400 *ErrorModel // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r SetDeviceTagsResponse) GetJSON200() *EmptyOutputBody { return r.JSON200 } // GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response func (r SetDeviceTagsResponse) GetApplicationproblemJSON400() *ErrorModel { return r.ApplicationproblemJSON400 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r SetDeviceTagsResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r SetDeviceTagsResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r SetDeviceTagsResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r SetDeviceTagsResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r SetDeviceTagsResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r SetDeviceTagsResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r SetDeviceTagsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r SetDeviceTagsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r SetDeviceTagsResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type GetACLResponse struct { Body []byte HTTPResponse *http.Response // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r GetACLResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r GetACLResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r GetACLResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r GetACLResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r GetACLResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r GetACLResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r GetACLResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetACLResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r GetACLResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type SetACLResponse struct { Body []byte HTTPResponse *http.Response // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response ApplicationproblemJSON400 *ErrorModel // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON412 the response for an HTTP 412 `application/problem+json` response ApplicationproblemJSON412 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response func (r SetACLResponse) GetApplicationproblemJSON400() *ErrorModel { return r.ApplicationproblemJSON400 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r SetACLResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r SetACLResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r SetACLResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON412 returns the response for an HTTP 412 `application/problem+json` response func (r SetACLResponse) GetApplicationproblemJSON412() *ErrorModel { return r.ApplicationproblemJSON412 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r SetACLResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r SetACLResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r SetACLResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r SetACLResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r SetACLResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r SetACLResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type ListDevicesResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *ListDevicesOutputBody // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r ListDevicesResponse) GetJSON200() *ListDevicesOutputBody { return r.JSON200 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r ListDevicesResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r ListDevicesResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r ListDevicesResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r ListDevicesResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r ListDevicesResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r ListDevicesResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r ListDevicesResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r ListDevicesResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r ListDevicesResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type ListKeysResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *ListKeysOutputBody // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r ListKeysResponse) GetJSON200() *ListKeysOutputBody { return r.JSON200 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r ListKeysResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r ListKeysResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r ListKeysResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r ListKeysResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r ListKeysResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r ListKeysResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r ListKeysResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r ListKeysResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r ListKeysResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type CreateKeyResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *Key // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response ApplicationproblemJSON400 *ErrorModel // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r CreateKeyResponse) GetJSON200() *Key { return r.JSON200 } // GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response func (r CreateKeyResponse) GetApplicationproblemJSON400() *ErrorModel { return r.ApplicationproblemJSON400 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r CreateKeyResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r CreateKeyResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r CreateKeyResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r CreateKeyResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r CreateKeyResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r CreateKeyResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r CreateKeyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r CreateKeyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r CreateKeyResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type DeleteKeyResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *DeleteKeyOutputBody // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r DeleteKeyResponse) GetJSON200() *DeleteKeyOutputBody { return r.JSON200 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r DeleteKeyResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r DeleteKeyResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r DeleteKeyResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r DeleteKeyResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r DeleteKeyResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r DeleteKeyResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r DeleteKeyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r DeleteKeyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r DeleteKeyResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type GetKeyResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *Key // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r GetKeyResponse) GetJSON200() *Key { return r.JSON200 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r GetKeyResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r GetKeyResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r GetKeyResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r GetKeyResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r GetKeyResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r GetKeyResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r GetKeyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetKeyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r GetKeyResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type GetTailnetSettingsResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *TailnetSettings // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r GetTailnetSettingsResponse) GetJSON200() *TailnetSettings { return r.JSON200 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r GetTailnetSettingsResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r GetTailnetSettingsResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r GetTailnetSettingsResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r GetTailnetSettingsResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r GetTailnetSettingsResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r GetTailnetSettingsResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r GetTailnetSettingsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetTailnetSettingsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r GetTailnetSettingsResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type UpdateTailnetSettingsResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *TailnetSettings // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel // ApplicationproblemJSON501 the response for an HTTP 501 `application/problem+json` response ApplicationproblemJSON501 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r UpdateTailnetSettingsResponse) GetJSON200() *TailnetSettings { return r.JSON200 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r UpdateTailnetSettingsResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r UpdateTailnetSettingsResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r UpdateTailnetSettingsResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r UpdateTailnetSettingsResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r UpdateTailnetSettingsResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetApplicationproblemJSON501 returns the response for an HTTP 501 `application/problem+json` response func (r UpdateTailnetSettingsResponse) GetApplicationproblemJSON501() *ErrorModel { return r.ApplicationproblemJSON501 } // GetBody returns the raw response body bytes func (r UpdateTailnetSettingsResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r UpdateTailnetSettingsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r UpdateTailnetSettingsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r UpdateTailnetSettingsResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type ListUsersResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *ListUsersOutputBody // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r ListUsersResponse) GetJSON200() *ListUsersOutputBody { return r.JSON200 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r ListUsersResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r ListUsersResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r ListUsersResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r ListUsersResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r ListUsersResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r ListUsersResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r ListUsersResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r ListUsersResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r ListUsersResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } type GetUserResponse struct { Body []byte HTTPResponse *http.Response // JSON200 the response for an HTTP 200 `application/json` response JSON200 *User // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response ApplicationproblemJSON401 *ErrorModel // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response ApplicationproblemJSON403 *ErrorModel // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response ApplicationproblemJSON404 *ErrorModel // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response ApplicationproblemJSON422 *ErrorModel // ApplicationproblemJSON500 the response for an HTTP 500 `application/problem+json` response ApplicationproblemJSON500 *ErrorModel } // GetJSON200 returns the response for an HTTP 200 `application/json` response func (r GetUserResponse) GetJSON200() *User { return r.JSON200 } // GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response func (r GetUserResponse) GetApplicationproblemJSON401() *ErrorModel { return r.ApplicationproblemJSON401 } // GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response func (r GetUserResponse) GetApplicationproblemJSON403() *ErrorModel { return r.ApplicationproblemJSON403 } // GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response func (r GetUserResponse) GetApplicationproblemJSON404() *ErrorModel { return r.ApplicationproblemJSON404 } // GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response func (r GetUserResponse) GetApplicationproblemJSON422() *ErrorModel { return r.ApplicationproblemJSON422 } // GetApplicationproblemJSON500 returns the response for an HTTP 500 `application/problem+json` response func (r GetUserResponse) GetApplicationproblemJSON500() *ErrorModel { return r.ApplicationproblemJSON500 } // GetBody returns the raw response body bytes func (r GetUserResponse) GetBody() []byte { return r.Body } // Status returns HTTPResponse.Status func (r GetUserResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetUserResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers func (r GetUserResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } // DeleteDeviceWithResponse Delete a device // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with DELETE /api/v2/device/{id} (the `DeleteDevice` operationId). func (c *ClientWithResponses) DeleteDeviceWithResponse(ctx context.Context, id string, params *DeleteDeviceParams, reqEditors ...RequestEditorFn) (*DeleteDeviceResponse, error) { rsp, err := c.DeleteDevice(ctx, id, params, reqEditors...) if err != nil { return nil, err } return ParseDeleteDeviceResponse(rsp) } // GetDeviceWithResponse Get a device // // Requires the `devices:core:read` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/device/{id} (the `GetDevice` operationId). func (c *ClientWithResponses) GetDeviceWithResponse(ctx context.Context, id string, params *GetDeviceParams, reqEditors ...RequestEditorFn) (*GetDeviceResponse, error) { rsp, err := c.GetDevice(ctx, id, params, reqEditors...) if err != nil { return nil, err } return ParseGetDeviceResponse(rsp) } // AuthorizeDeviceWithBodyWithResponse Authorize a device // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/authorized (the `AuthorizeDevice` operationId). func (c *ClientWithResponses) AuthorizeDeviceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthorizeDeviceResponse, error) { rsp, err := c.AuthorizeDeviceWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseAuthorizeDeviceResponse(rsp) } // AuthorizeDeviceWithResponse Authorize a device // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/authorized (the `AuthorizeDevice` operationId). func (c *ClientWithResponses) AuthorizeDeviceWithResponse(ctx context.Context, id string, body AuthorizeDeviceJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthorizeDeviceResponse, error) { rsp, err := c.AuthorizeDevice(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParseAuthorizeDeviceResponse(rsp) } // SetDeviceKeyWithBodyWithResponse Set a device's key settings // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/key (the `SetDeviceKey` operationId). func (c *ClientWithResponses) SetDeviceKeyWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetDeviceKeyResponse, error) { rsp, err := c.SetDeviceKeyWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseSetDeviceKeyResponse(rsp) } // SetDeviceKeyWithResponse Set a device's key settings // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/key (the `SetDeviceKey` operationId). func (c *ClientWithResponses) SetDeviceKeyWithResponse(ctx context.Context, id string, body SetDeviceKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*SetDeviceKeyResponse, error) { rsp, err := c.SetDeviceKey(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParseSetDeviceKeyResponse(rsp) } // SetDeviceNameWithBodyWithResponse Set a device's name // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/name (the `SetDeviceName` operationId). func (c *ClientWithResponses) SetDeviceNameWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetDeviceNameResponse, error) { rsp, err := c.SetDeviceNameWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseSetDeviceNameResponse(rsp) } // SetDeviceNameWithResponse Set a device's name // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/name (the `SetDeviceName` operationId). func (c *ClientWithResponses) SetDeviceNameWithResponse(ctx context.Context, id string, body SetDeviceNameJSONRequestBody, reqEditors ...RequestEditorFn) (*SetDeviceNameResponse, error) { rsp, err := c.SetDeviceName(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParseSetDeviceNameResponse(rsp) } // GetDeviceRoutesWithResponse Get a device's subnet routes // // Requires the `devices:routes:read` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/device/{id}/routes (the `GetDeviceRoutes` operationId). func (c *ClientWithResponses) GetDeviceRoutesWithResponse(ctx context.Context, id string, params *GetDeviceRoutesParams, reqEditors ...RequestEditorFn) (*GetDeviceRoutesResponse, error) { rsp, err := c.GetDeviceRoutes(ctx, id, params, reqEditors...) if err != nil { return nil, err } return ParseGetDeviceRoutesResponse(rsp) } // SetDeviceRoutesWithBodyWithResponse Set a device's enabled subnet routes // // Requires the `devices:routes` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/routes (the `SetDeviceRoutes` operationId). func (c *ClientWithResponses) SetDeviceRoutesWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetDeviceRoutesResponse, error) { rsp, err := c.SetDeviceRoutesWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseSetDeviceRoutesResponse(rsp) } // SetDeviceRoutesWithResponse Set a device's enabled subnet routes // // Requires the `devices:routes` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/routes (the `SetDeviceRoutes` operationId). func (c *ClientWithResponses) SetDeviceRoutesWithResponse(ctx context.Context, id string, body SetDeviceRoutesJSONRequestBody, reqEditors ...RequestEditorFn) (*SetDeviceRoutesResponse, error) { rsp, err := c.SetDeviceRoutes(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParseSetDeviceRoutesResponse(rsp) } // SetDeviceTagsWithBodyWithResponse Set a device's tags // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/tags (the `SetDeviceTags` operationId). func (c *ClientWithResponses) SetDeviceTagsWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetDeviceTagsResponse, error) { rsp, err := c.SetDeviceTagsWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseSetDeviceTagsResponse(rsp) } // SetDeviceTagsWithResponse Set a device's tags // // Requires the `devices:core` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/device/{id}/tags (the `SetDeviceTags` operationId). func (c *ClientWithResponses) SetDeviceTagsWithResponse(ctx context.Context, id string, body SetDeviceTagsJSONRequestBody, reqEditors ...RequestEditorFn) (*SetDeviceTagsResponse, error) { rsp, err := c.SetDeviceTags(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParseSetDeviceTagsResponse(rsp) } // GetACLWithResponse Get the policy file // // Requires the `policy_file:read` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/tailnet/{tailnet}/acl (the `GetACL` operationId). func (c *ClientWithResponses) GetACLWithResponse(ctx context.Context, tailnet string, params *GetACLParams, reqEditors ...RequestEditorFn) (*GetACLResponse, error) { rsp, err := c.GetACL(ctx, tailnet, params, reqEditors...) if err != nil { return nil, err } return ParseGetACLResponse(rsp) } // SetACLWithBodyWithResponse Set the policy file // // Requires the `policy_file` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/tailnet/{tailnet}/acl (the `SetACL` operationId). func (c *ClientWithResponses) SetACLWithBodyWithResponse(ctx context.Context, tailnet string, params *SetACLParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetACLResponse, error) { rsp, err := c.SetACLWithBody(ctx, tailnet, params, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseSetACLResponse(rsp) } // SetACLWithResponse Set the policy file // // Requires the `policy_file` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/tailnet/{tailnet}/acl (the `SetACL` operationId). func (c *ClientWithResponses) SetACLWithResponse(ctx context.Context, tailnet string, params *SetACLParams, body SetACLJSONRequestBody, reqEditors ...RequestEditorFn) (*SetACLResponse, error) { rsp, err := c.SetACL(ctx, tailnet, params, body, reqEditors...) if err != nil { return nil, err } return ParseSetACLResponse(rsp) } // ListDevicesWithResponse List devices // // Requires the `devices:core:read` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/tailnet/{tailnet}/devices (the `ListDevices` operationId). func (c *ClientWithResponses) ListDevicesWithResponse(ctx context.Context, tailnet string, params *ListDevicesParams, reqEditors ...RequestEditorFn) (*ListDevicesResponse, error) { rsp, err := c.ListDevices(ctx, tailnet, params, reqEditors...) if err != nil { return nil, err } return ParseListDevicesResponse(rsp) } // ListKeysWithResponse List auth keys and OAuth clients // // A token sees the kinds it can read: `auth_keys:read` for auth keys, `oauth_keys:read` for OAuth clients (an admin API key sees all). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/tailnet/{tailnet}/keys (the `ListKeys` operationId). func (c *ClientWithResponses) ListKeysWithResponse(ctx context.Context, tailnet string, params *ListKeysParams, reqEditors ...RequestEditorFn) (*ListKeysResponse, error) { rsp, err := c.ListKeys(ctx, tailnet, params, reqEditors...) if err != nil { return nil, err } return ParseListKeysResponse(rsp) } // CreateKeyWithBodyWithResponse Create an auth key or OAuth client // // Requires the `auth_keys` scope for an auth key, or `oauth_keys` for an OAuth client (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/tailnet/{tailnet}/keys (the `CreateKey` operationId). func (c *ClientWithResponses) CreateKeyWithBodyWithResponse(ctx context.Context, tailnet string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateKeyResponse, error) { rsp, err := c.CreateKeyWithBody(ctx, tailnet, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseCreateKeyResponse(rsp) } // CreateKeyWithResponse Create an auth key or OAuth client // // Requires the `auth_keys` scope for an auth key, or `oauth_keys` for an OAuth client (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with POST /api/v2/tailnet/{tailnet}/keys (the `CreateKey` operationId). func (c *ClientWithResponses) CreateKeyWithResponse(ctx context.Context, tailnet string, body CreateKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateKeyResponse, error) { rsp, err := c.CreateKey(ctx, tailnet, body, reqEditors...) if err != nil { return nil, err } return ParseCreateKeyResponse(rsp) } // DeleteKeyWithResponse Delete an auth key or OAuth client // // Requires the `auth_keys` scope for an auth key, or `oauth_keys` for an OAuth client (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with DELETE /api/v2/tailnet/{tailnet}/keys/{keyId} (the `DeleteKey` operationId). func (c *ClientWithResponses) DeleteKeyWithResponse(ctx context.Context, tailnet string, keyId string, reqEditors ...RequestEditorFn) (*DeleteKeyResponse, error) { rsp, err := c.DeleteKey(ctx, tailnet, keyId, reqEditors...) if err != nil { return nil, err } return ParseDeleteKeyResponse(rsp) } // GetKeyWithResponse Get an auth key or OAuth client // // Requires `auth_keys:read` for an auth key, or `oauth_keys:read` for an OAuth client (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/tailnet/{tailnet}/keys/{keyId} (the `GetKey` operationId). func (c *ClientWithResponses) GetKeyWithResponse(ctx context.Context, tailnet string, keyId string, reqEditors ...RequestEditorFn) (*GetKeyResponse, error) { rsp, err := c.GetKey(ctx, tailnet, keyId, reqEditors...) if err != nil { return nil, err } return ParseGetKeyResponse(rsp) } // GetTailnetSettingsWithResponse Get tailnet settings // // Requires the `feature_settings:read` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/tailnet/{tailnet}/settings (the `GetTailnetSettings` operationId). func (c *ClientWithResponses) GetTailnetSettingsWithResponse(ctx context.Context, tailnet string, reqEditors ...RequestEditorFn) (*GetTailnetSettingsResponse, error) { rsp, err := c.GetTailnetSettings(ctx, tailnet, reqEditors...) if err != nil { return nil, err } return ParseGetTailnetSettingsResponse(rsp) } // UpdateTailnetSettingsWithBodyWithResponse Update tailnet settings // // Requires the `feature_settings` OAuth scope (an admin API key is all-access). // // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). // // Corresponds with PATCH /api/v2/tailnet/{tailnet}/settings (the `UpdateTailnetSettings` operationId). func (c *ClientWithResponses) UpdateTailnetSettingsWithBodyWithResponse(ctx context.Context, tailnet string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateTailnetSettingsResponse, error) { rsp, err := c.UpdateTailnetSettingsWithBody(ctx, tailnet, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseUpdateTailnetSettingsResponse(rsp) } // UpdateTailnetSettingsWithResponse Update tailnet settings // // Requires the `feature_settings` OAuth scope (an admin API key is all-access). // // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). // // Corresponds with PATCH /api/v2/tailnet/{tailnet}/settings (the `UpdateTailnetSettings` operationId). func (c *ClientWithResponses) UpdateTailnetSettingsWithResponse(ctx context.Context, tailnet string, body UpdateTailnetSettingsJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateTailnetSettingsResponse, error) { rsp, err := c.UpdateTailnetSettings(ctx, tailnet, body, reqEditors...) if err != nil { return nil, err } return ParseUpdateTailnetSettingsResponse(rsp) } // ListUsersWithResponse List users // // Requires the `users:read` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/tailnet/{tailnet}/users (the `ListUsers` operationId). func (c *ClientWithResponses) ListUsersWithResponse(ctx context.Context, tailnet string, params *ListUsersParams, reqEditors ...RequestEditorFn) (*ListUsersResponse, error) { rsp, err := c.ListUsers(ctx, tailnet, params, reqEditors...) if err != nil { return nil, err } return ParseListUsersResponse(rsp) } // GetUserWithResponse Get a user // // Requires the `users:read` OAuth scope (an admin API key is all-access). // // Returns a wrapper object for the known response body format(s). // // Corresponds with GET /api/v2/users/{id} (the `GetUser` operationId). func (c *ClientWithResponses) GetUserWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetUserResponse, error) { rsp, err := c.GetUser(ctx, id, reqEditors...) if err != nil { return nil, err } return ParseGetUserResponse(rsp) } // ParseDeleteDeviceResponse parses an HTTP response from a DeleteDeviceWithResponse call func ParseDeleteDeviceResponse(rsp *http.Response) (*DeleteDeviceResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &DeleteDeviceResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest EmptyOutputBody if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseGetDeviceResponse parses an HTTP response from a GetDeviceWithResponse call func ParseGetDeviceResponse(rsp *http.Response) (*GetDeviceResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetDeviceResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest Device if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseAuthorizeDeviceResponse parses an HTTP response from a AuthorizeDeviceWithResponse call func ParseAuthorizeDeviceResponse(rsp *http.Response) (*AuthorizeDeviceResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &AuthorizeDeviceResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest EmptyOutputBody if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseSetDeviceKeyResponse parses an HTTP response from a SetDeviceKeyWithResponse call func ParseSetDeviceKeyResponse(rsp *http.Response) (*SetDeviceKeyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &SetDeviceKeyResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest EmptyOutputBody if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseSetDeviceNameResponse parses an HTTP response from a SetDeviceNameWithResponse call func ParseSetDeviceNameResponse(rsp *http.Response) (*SetDeviceNameResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &SetDeviceNameResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest EmptyOutputBody if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseGetDeviceRoutesResponse parses an HTTP response from a GetDeviceRoutesWithResponse call func ParseGetDeviceRoutesResponse(rsp *http.Response) (*GetDeviceRoutesResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetDeviceRoutesResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest DeviceRoutes if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseSetDeviceRoutesResponse parses an HTTP response from a SetDeviceRoutesWithResponse call func ParseSetDeviceRoutesResponse(rsp *http.Response) (*SetDeviceRoutesResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &SetDeviceRoutesResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest DeviceRoutes if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseSetDeviceTagsResponse parses an HTTP response from a SetDeviceTagsWithResponse call func ParseSetDeviceTagsResponse(rsp *http.Response) (*SetDeviceTagsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &SetDeviceTagsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest EmptyOutputBody if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseGetACLResponse parses an HTTP response from a GetACLWithResponse call func ParseGetACLResponse(rsp *http.Response) (*GetACLResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetACLResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case rsp.StatusCode == 200: break // No content-type case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseSetACLResponse parses an HTTP response from a SetACLWithResponse call func ParseSetACLResponse(rsp *http.Response) (*SetACLResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &SetACLResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case rsp.StatusCode == 200: break // No content-type case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 412: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON412 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseListDevicesResponse parses an HTTP response from a ListDevicesWithResponse call func ParseListDevicesResponse(rsp *http.Response) (*ListDevicesResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &ListDevicesResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest ListDevicesOutputBody if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseListKeysResponse parses an HTTP response from a ListKeysWithResponse call func ParseListKeysResponse(rsp *http.Response) (*ListKeysResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &ListKeysResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest ListKeysOutputBody if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseCreateKeyResponse parses an HTTP response from a CreateKeyWithResponse call func ParseCreateKeyResponse(rsp *http.Response) (*CreateKeyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &CreateKeyResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest Key if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseDeleteKeyResponse parses an HTTP response from a DeleteKeyWithResponse call func ParseDeleteKeyResponse(rsp *http.Response) (*DeleteKeyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &DeleteKeyResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest DeleteKeyOutputBody if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseGetKeyResponse parses an HTTP response from a GetKeyWithResponse call func ParseGetKeyResponse(rsp *http.Response) (*GetKeyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetKeyResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest Key if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseGetTailnetSettingsResponse parses an HTTP response from a GetTailnetSettingsWithResponse call func ParseGetTailnetSettingsResponse(rsp *http.Response) (*GetTailnetSettingsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetTailnetSettingsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest TailnetSettings if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseUpdateTailnetSettingsResponse parses an HTTP response from a UpdateTailnetSettingsWithResponse call func ParseUpdateTailnetSettingsResponse(rsp *http.Response) (*UpdateTailnetSettingsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &UpdateTailnetSettingsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest TailnetSettings if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 501: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON501 = &dest } return response, nil } // ParseListUsersResponse parses an HTTP response from a ListUsersWithResponse call func ParseListUsersResponse(rsp *http.Response) (*ListUsersResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &ListUsersResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest ListUsersOutputBody if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil } // ParseGetUserResponse parses an HTTP response from a GetUserWithResponse call func ParseGetUserResponse(rsp *http.Response) (*GetUserResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetUserResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest User if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON422 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorModel if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.ApplicationproblemJSON500 = &dest } return response, nil }