github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/internal/fs/ddl/cache/agent/choria_util.ddl (about)

     1  --  Copyright (c) 2024, R.I. Pienaar and the Choria Project contributors
     2  --
     3  --  SPDX-License-Identifier: Apache-2.0
     4  
     5  metadata :name        => "choria_util",
     6           :description => "Choria Utilities",
     7           :author      => "R.I.Pienaar <rip@devco.net>",
     8           :license     => "Apache-2.0",
     9           :version     => "0.28.0",
    10           :url         => "https://choria.io",
    11           :timeout     => 2
    12  
    13  
    14  action "info", :description => "Choria related information from the running Daemon and Middleware" do
    15    display :failed
    16  
    17  
    18  
    19    output :choria_version,
    20           :description => "Choria version",
    21           :type        => "string",
    22           :display_as  => "Choria Version"
    23  
    24    output :client_flavour,
    25           :description => "Middleware client library flavour",
    26           :type        => "string",
    27           :display_as  => "Middleware Client Flavour"
    28  
    29    output :client_options,
    30           :description => "Active Middleware client options",
    31           :type        => "hash",
    32           :display_as  => "Middleware Client Options"
    33  
    34    output :client_stats,
    35           :description => "Middleware client statistics",
    36           :type        => "hash",
    37           :display_as  => "Middleware Client Stats"
    38  
    39    output :client_version,
    40           :description => "Middleware client library version",
    41           :type        => "string",
    42           :display_as  => "Middleware Client Library Version"
    43  
    44    output :connected_server,
    45           :description => "Connected middleware server",
    46           :type        => "string",
    47           :display_as  => "Connected Broker"
    48  
    49    output :connector,
    50           :description => "Connector plugin",
    51           :type        => "string",
    52           :display_as  => "Connector"
    53  
    54    output :connector_tls,
    55           :description => "If the connector is running with TLS security enabled",
    56           :type        => "boolean",
    57           :display_as  => "Connector TLS"
    58  
    59    output :facter_command,
    60           :description => "Command used for Facter",
    61           :type        => "string",
    62           :display_as  => "Facter"
    63  
    64    output :facter_domain,
    65           :description => "Facter domain",
    66           :type        => "string",
    67           :display_as  => "Facter Domain"
    68  
    69    output :middleware_servers,
    70           :description => "Middleware Servers configured or discovered",
    71           :type        => "array",
    72           :display_as  => "Middleware"
    73  
    74    output :path,
    75           :description => "Active OS PATH",
    76           :type        => "string",
    77           :display_as  => "Path"
    78  
    79    output :secure_protocol,
    80           :description => "If the protocol is running with PKI security enabled",
    81           :type        => "boolean",
    82           :display_as  => "Protocol Secure"
    83  
    84    output :security,
    85           :description => "Security Provider plugin",
    86           :type        => "string",
    87           :display_as  => "Security Provider"
    88  
    89    output :srv_domain,
    90           :description => "Configured SRV domain",
    91           :type        => "string",
    92           :display_as  => "SRV Domain"
    93  
    94    output :using_srv,
    95           :description => "Indicates if SRV records are considered",
    96           :type        => "boolean",
    97           :display_as  => "SRV Used"
    98  
    99    summarize do
   100      aggregate summary(:choria_version)
   101      aggregate summary(:client_version)
   102      aggregate summary(:client_flavour)
   103      aggregate summary(:connected_server)
   104      aggregate summary(:srv_domain)
   105      aggregate summary(:using_srv)
   106      aggregate summary(:secure_protocol)
   107      aggregate summary(:connector_tls)
   108    end
   109  end
   110  
   111  action "machine_state", :description => "Retrieves the current state of a specific Choria Autonomous Agent" do
   112    display :ok
   113  
   114    input :instance,
   115          :prompt      => "Instance ID",
   116          :description => "Machine Instance ID",
   117          :type        => :string,
   118          :validation  => '^.+-.+-.+-.+-.+$',
   119          :maxlength   => 36,
   120          :optional    => true
   121  
   122  
   123    input :name,
   124          :prompt      => "Name",
   125          :description => "Machine Name",
   126          :type        => :string,
   127          :validation  => '^[a-zA-Z][a-zA-Z0-9_-]+',
   128          :maxlength   => 128,
   129          :optional    => true
   130  
   131  
   132    input :path,
   133          :prompt      => "Path",
   134          :description => "Machine Path",
   135          :type        => :string,
   136          :validation  => '.+',
   137          :maxlength   => 512,
   138          :optional    => true
   139  
   140  
   141  
   142  
   143    output :available_transitions,
   144           :description => "The list of available transitions this autonomous agent can make",
   145           :type        => "array",
   146           :display_as  => "Available Transitions"
   147  
   148    output :current_state,
   149           :description => "The Choria Scout specific state for Scout checks",
   150           :display_as  => "Scout State"
   151  
   152    output :id,
   153           :description => "The unique running ID of the autonomous agent",
   154           :type        => "string",
   155           :display_as  => "ID"
   156  
   157    output :name,
   158           :description => "The name of the autonomous agent",
   159           :type        => "string",
   160           :display_as  => "Name"
   161  
   162    output :path,
   163           :description => "The location on disk where the autonomous agent is stored",
   164           :type        => "string",
   165           :display_as  => "Path"
   166  
   167    output :scout,
   168           :description => "True when this autonomous agent represents a Choria Scout Check",
   169           :type        => "boolean",
   170           :display_as  => "Scout Check"
   171  
   172    output :start_time,
   173           :description => "The time the autonomous agent was started in unix seconds",
   174           :type        => "string",
   175           :display_as  => "Started"
   176  
   177    output :state,
   178           :description => "The current state the agent is in",
   179           :type        => "string",
   180           :display_as  => "State"
   181  
   182    output :version,
   183           :description => "The version of the autonomous agent",
   184           :type        => "string",
   185           :display_as  => "Version"
   186  
   187    summarize do
   188      aggregate summary(:state)
   189      aggregate summary(:name)
   190      aggregate summary(:version)
   191    end
   192  end
   193  
   194  action "machine_states", :description => "States of the hosted Choria Autonomous Agents" do
   195    display :always
   196  
   197  
   198  
   199    output :machine_ids,
   200           :description => "List of running machine IDs",
   201           :type        => "array",
   202           :display_as  => "Machine IDs"
   203  
   204    output :machine_names,
   205           :description => "List of running machine names",
   206           :type        => "array",
   207           :display_as  => "Machine Names"
   208  
   209    output :states,
   210           :description => "Hash map of machine statusses indexed by machine ID",
   211           :type        => "hash",
   212           :display_as  => "Machine States"
   213  
   214    summarize do
   215      aggregate summary(:machine_names)
   216    end
   217  end
   218  
   219  action "machine_transition", :description => "Attempts to force a transition in a hosted Choria Autonomous Agent" do
   220    display :failed
   221  
   222    input :instance,
   223          :prompt      => "Instance ID",
   224          :description => "Machine Instance ID",
   225          :type        => :string,
   226          :validation  => '^.+-.+-.+-.+-.+$',
   227          :maxlength   => 36,
   228          :optional    => true
   229  
   230  
   231    input :name,
   232          :prompt      => "Name",
   233          :description => "Machine Name",
   234          :type        => :string,
   235          :validation  => '^[a-zA-Z][a-zA-Z0-9_-]+',
   236          :maxlength   => 128,
   237          :optional    => true
   238  
   239  
   240    input :path,
   241          :prompt      => "Path",
   242          :description => "Machine Path",
   243          :type        => :string,
   244          :validation  => '.+',
   245          :maxlength   => 512,
   246          :optional    => true
   247  
   248  
   249    input :transition,
   250          :prompt      => "Transition Name",
   251          :description => "The transition event to send to the machine",
   252          :type        => :string,
   253          :validation  => '^[a-zA-Z][a-zA-Z0-9_-]+$',
   254          :maxlength   => 128,
   255          :optional    => false
   256  
   257  
   258    input :version,
   259          :prompt      => "Version",
   260          :description => "Machine Version",
   261          :type        => :string,
   262          :validation  => '^\d+\.\d+\.\d+$',
   263          :maxlength   => 20,
   264          :optional    => true
   265  
   266  
   267  
   268  
   269    output :success,
   270           :description => "Indicates if the transition was successfully accepted",
   271           :type        => "boolean",
   272           :display_as  => "Accepted"
   273  
   274  end
   275