Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions providers/os/resources/date/date.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) Mondoo, Inc.
// SPDX-License-Identifier: BUSL-1.1

package date

import (
"errors"
"time"

"go.mondoo.com/mql/v13/providers-sdk/v1/inventory"
"go.mondoo.com/mql/v13/providers/os/connection/shared"
)

type Result struct {
Time *time.Time
Timezone string
}

type Date interface {
Name() string
Get() (*Result, error)
}

func New(conn shared.Connection) (Date, error) {
pf := conn.Asset().Platform

switch {
case pf.IsFamily(inventory.FAMILY_UNIX):
return &Unix{conn: conn}, nil
case pf.IsFamily(inventory.FAMILY_WINDOWS):
return &Windows{conn: conn}, nil
default:
return nil, errors.New("your platform is not supported by the date resource")
}
}
Loading
Loading