go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers/core/resources/core.lr (about)

     1  // Copyright (c) Mondoo, Inc.
     2  // SPDX-License-Identifier: BUSL-1.1
     3  
     4  option provider = "go.mondoo.com/cnquery/providers/core"
     5  option go_package = "go.mondoo.com/cnquery/providers/core/resources"
     6  
     7  // Provide contextual information about MQL runtime and environment
     8  mondoo @defaults("version") {
     9    // Version of the client running on the asset
    10    version() string
    11    // The build of the client (e.g. production, development)
    12    build() string
    13    // The architecture of this client (e.g. linux-amd64)
    14    arch() string
    15    // Returns the agent execution environment
    16    jobEnvironment() dict
    17    // Connection capabilities
    18    capabilities() []string
    19  }
    20  
    21  // General asset information
    22  asset @defaults("name platform version") {
    23    // Human readable name of the asset
    24    name string
    25    // All identifiers for this asset
    26    ids []string
    27    // Platform for this asset (redhat, windows, k8s-pod)
    28    platform string
    29    // Kind of platform, for example:
    30    // api, baremetal, vm, vm-image, container, container-image, network, ...
    31    kind string
    32    // Runtime is the specific kind of the platform. Examples include:
    33    // docker-container, podman-container, aws-ec2-instance, ...
    34    runtime string
    35    // Version of the platform
    36    version string
    37    // Architecture this OS is running on
    38    arch string
    39    // Human-readable title of the platform (e.g. "Red Hat 8, Container")
    40    title string
    41    // List of platform families that this platform belongs to
    42    family []string
    43    // Fully qualified domain name (optional)
    44    fqdn string
    45    // Build version of the platform (optional)
    46    build string
    47    // Optional platform information
    48    labels map[string]string
    49  }
    50  
    51  // Date and time functions
    52  time {
    53    // The current time on the local system
    54    now() time
    55    // One second, used for durations
    56    second() time
    57    // One minute, used for durations
    58    minute() time
    59    // One hour, used for durations
    60    hour() time
    61    // One day, used for durations
    62    day() time
    63    // The current day starting at midnight
    64    today() time
    65    // The next day starting at midnight
    66    tomorrow() time
    67  }
    68  
    69  // Builtin regular expression functions
    70  regex {
    71    // Matches IPv4 addresses
    72    ipv4() regex
    73    // Matches IPv6 addresses
    74    ipv6() regex
    75    // Matches URL addresses (HTTP/HTTPS)
    76    url() regex
    77    // Matches email addresses
    78    email() regex
    79    // Matches MAC addresses
    80    mac() regex
    81    // Matches hyphen-deliminated UUIDs
    82    uuid() regex
    83    // Matches emojis
    84    emoji() regex
    85    // Matches semantic version numbers
    86    semver() regex
    87    // Matches credit card numbers
    88    creditCard() regex
    89  }
    90  
    91  // Parse provides common parsers (json, ini, certs, etc)
    92  parse {
    93    // Builtin functions:
    94    // date(value, format) time
    95  }
    96  
    97  // UUIDs based on RFC 4122 and DCE 1.1
    98  uuid @defaults("value") {
    99    init(value string)
   100    // Canonical string representation xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
   101    value string
   102    // URN returns the RFC 2141 URN form of uuid
   103    urn() string
   104    // Version of uuid
   105    version() int
   106    // Variant encoded in uuid
   107    variant() string
   108  }