Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/golang.org/x/net-0.29.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ykim-akamai authored Sep 23, 2024
2 parents 3ae1c9e + 2710f50 commit 6d9a7e2
Show file tree
Hide file tree
Showing 5 changed files with 396 additions and 236 deletions.
27 changes: 27 additions & 0 deletions account_users.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@ const (
UserTypeDefault UserType = "default"
)

// LastLogin represents a LastLogin object
type LastLogin struct {
LoginDatetime *time.Time `json:"-"`
Status string `json:"status"`
}

// User represents a User object
type User struct {
Username string `json:"username"`
Email string `json:"email"`
LastLogin *LastLogin `json:"last_login"`
UserType UserType `json:"user_type"`
Restricted bool `json:"restricted"`
TFAEnabled bool `json:"tfa_enabled"`
Expand All @@ -42,6 +49,26 @@ type UserUpdateOptions struct {
Restricted *bool `json:"restricted,omitempty"`
}

// UnmarshalJSON implements the json.Unmarshaler interface
func (ll *LastLogin) UnmarshalJSON(b []byte) error {
type Mask LastLogin

p := struct {
*Mask
LoginDatetime *parseabletime.ParseableTime `json:"login_datetime"`
}{
Mask: (*Mask)(ll),
}

if err := json.Unmarshal(b, &p); err != nil {
return err
}

ll.LoginDatetime = (*time.Time)(p.LoginDatetime)

return nil
}

// UnmarshalJSON implements the json.Unmarshaler interface
func (i *User) UnmarshalJSON(b []byte) error {
type Mask User
Expand Down
1 change: 1 addition & 0 deletions images.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ func (c *Client) UpdateImage(ctx context.Context, imageID string, opts ImageUpda
}

// ReplicateImage replicates an image to a given set of regions.
// NOTE: Image replication may not currently be available to all users.
func (c *Client) ReplicateImage(ctx context.Context, imageID string, opts ImageReplicateOptions) (*Image, error) {
return doPOSTRequest[Image](
ctx,
Expand Down
Loading

0 comments on commit 6d9a7e2

Please sign in to comment.