mirror of
https://github.com/1Password/onepassword-operator.git
synced 2025-10-22 15:38:06 +00:00

These internal models are introduced to reduce decoupling. The idea is to operate internal model within the project boundaries and convert to appropriate Connect or SDK models in the places where it's necessary.
24 lines
467 B
Go
24 lines
467 B
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
connect "github.com/1Password/connect-sdk-go/onepassword"
|
|
sdk "github.com/1password/onepassword-sdk-go"
|
|
)
|
|
|
|
type Vault struct {
|
|
ID string
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
func (v *Vault) FromConnectVault(vault *connect.Vault) {
|
|
v.ID = vault.ID
|
|
v.CreatedAt = vault.CreatedAt
|
|
}
|
|
|
|
func (v *Vault) FromSDKVault(vault *sdk.VaultOverview) {
|
|
v.ID = vault.ID
|
|
v.CreatedAt = time.Now() // TODO: add to SDK and use it instead of time.Now()
|
|
}
|