mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 04:40:05 +01:00
feat: sdk migration in progress
This commit is contained in:
24
internal/handlers/dto/auth.go
Normal file
24
internal/handlers/dto/auth.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package dto
|
||||
|
||||
// swagger:model AuthStartResponse
|
||||
type AuthStartResponse struct {
|
||||
AuthURL string `json:"auth_url" example:"https://accounts.google.com/o/oauth2/v2/auth?client_id=..."`
|
||||
}
|
||||
|
||||
// swagger:model TokenPair
|
||||
type TokenPair struct {
|
||||
AccessToken string `json:"access_token" example:"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ij..."`
|
||||
RefreshToken string `json:"refresh_token" example:"m0l9o8rT3t0V8d3eFf...."`
|
||||
TokenType string `json:"token_type" example:"Bearer"`
|
||||
ExpiresIn int64 `json:"expires_in" example:"3600"`
|
||||
}
|
||||
|
||||
// swagger:model RefreshRequest
|
||||
type RefreshRequest struct {
|
||||
RefreshToken string `json:"refresh_token" example:"m0l9o8rT3t0V8d3eFf..."`
|
||||
}
|
||||
|
||||
// swagger:model LogoutRequest
|
||||
type LogoutRequest struct {
|
||||
RefreshToken string `json:"refresh_token" example:"m0l9o8rT3t0V8d3eFf..."`
|
||||
}
|
||||
19
internal/handlers/dto/jwks.go
Normal file
19
internal/handlers/dto/jwks.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package dto
|
||||
|
||||
// JWK represents a single JSON Web Key (public only).
|
||||
// swagger:model JWK
|
||||
type JWK struct {
|
||||
Kty string `json:"kty" example:"RSA" gorm:"-"`
|
||||
Use string `json:"use,omitempty" example:"sig" gorm:"-"`
|
||||
Kid string `json:"kid,omitempty" example:"7c6f1d0a-7a98-4e6a-9dbf-6b1af4b9f345" gorm:"-"`
|
||||
Alg string `json:"alg,omitempty" example:"RS256" gorm:"-"`
|
||||
N string `json:"n,omitempty" gorm:"-"`
|
||||
E string `json:"e,omitempty" example:"AQAB" gorm:"-"`
|
||||
X string `json:"x,omitempty" gorm:"-"`
|
||||
}
|
||||
|
||||
// JWKS is a JSON Web Key Set container.
|
||||
// swagger:model JWKS
|
||||
type JWKS struct {
|
||||
Keys []JWK `json:"keys" gorm:"-"`
|
||||
}
|
||||
37
internal/handlers/dto/servers.go
Normal file
37
internal/handlers/dto/servers.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package dto
|
||||
|
||||
import "github.com/google/uuid"
|
||||
|
||||
type CreateServerRequest struct {
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
PublicIPAddress string `json:"public_ip_address,omitempty"`
|
||||
PrivateIPAddress string `json:"private_ip_address"`
|
||||
SSHUser string `json:"ssh_user"`
|
||||
SshKeyID string `json:"ssh_key_id"`
|
||||
Role string `json:"role" example:"master|worker|bastion"`
|
||||
Status string `json:"status,omitempty" example:"pending|provisioning|ready|failed"`
|
||||
}
|
||||
|
||||
type UpdateServerRequest struct {
|
||||
Hostname *string `json:"hostname,omitempty"`
|
||||
PublicIPAddress *string `json:"public_ip_address,omitempty"`
|
||||
PrivateIPAddress *string `json:"private_ip_address,omitempty"`
|
||||
SSHUser *string `json:"ssh_user,omitempty"`
|
||||
SshKeyID *string `json:"ssh_key_id,omitempty"`
|
||||
Role *string `json:"role,omitempty" example:"master|worker|bastion"`
|
||||
Status *string `json:"status,omitempty" example:"pending|provisioning|ready|failed"`
|
||||
}
|
||||
|
||||
type ServerResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
Hostname string `json:"hostname"`
|
||||
PublicIPAddress *string `json:"public_ip_address,omitempty"`
|
||||
PrivateIPAddress string `json:"private_ip_address"`
|
||||
SSHUser string `json:"ssh_user"`
|
||||
SshKeyID uuid.UUID `json:"ssh_key_id"`
|
||||
Role string `json:"role"`
|
||||
Status string `json:"status"`
|
||||
CreatedAt string `json:"created_at,omitempty"`
|
||||
UpdatedAt string `json:"updated_at,omitempty"`
|
||||
}
|
||||
38
internal/handlers/dto/ssh.go
Normal file
38
internal/handlers/dto/ssh.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package dto
|
||||
|
||||
import "github.com/google/uuid"
|
||||
|
||||
type CreateSSHRequest struct {
|
||||
Name string `json:"name"`
|
||||
Comment string `json:"comment,omitempty" example:"deploy@autoglue"`
|
||||
Bits *int `json:"bits,omitempty"` // Only for RSA
|
||||
Type *string `json:"type,omitempty"` // "rsa" (default) or "ed25519"
|
||||
}
|
||||
|
||||
type SshResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
Name string `json:"name"`
|
||||
PublicKey string `json:"public_key"`
|
||||
Fingerprint string `json:"fingerprint"`
|
||||
CreatedAt string `json:"created_at,omitempty"`
|
||||
UpdatedAt string `json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
type SshRevealResponse struct {
|
||||
SshResponse
|
||||
PrivateKey string `json:"private_key"`
|
||||
}
|
||||
|
||||
type SshMaterialJSON struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Fingerprint string `json:"fingerprint"`
|
||||
// Exactly one of the following will be populated for part=public/private.
|
||||
PublicKey *string `json:"public_key,omitempty"` // OpenSSH authorized_key (string)
|
||||
PrivatePEM *string `json:"private_pem,omitempty"` // PKCS#1/PEM (string)
|
||||
// For part=both with mode=json we'll return a base64 zip
|
||||
ZipBase64 *string `json:"zip_base64,omitempty"` // base64-encoded zip
|
||||
// Suggested filenames (SDKs can save to disk without inferring names)
|
||||
Filenames []string `json:"filenames"`
|
||||
}
|
||||
22
internal/handlers/dto/taints.go
Normal file
22
internal/handlers/dto/taints.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package dto
|
||||
|
||||
import "github.com/google/uuid"
|
||||
|
||||
type TaintResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
Effect string `json:"effect"`
|
||||
}
|
||||
|
||||
type CreateTaintRequest struct {
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
Effect string `json:"effect"`
|
||||
}
|
||||
|
||||
type UpdateTaintRequest struct {
|
||||
Key *string `json:"key,omitempty"`
|
||||
Value *string `json:"value,omitempty"`
|
||||
Effect *string `json:"effect,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user