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

     1  // Copyright (c) Mondoo, Inc.
     2  // SPDX-License-Identifier: BUSL-1.1
     3  
     4  package providers
     5  
     6  import (
     7  	"github.com/cockroachdb/errors"
     8  	"go.mondoo.com/cnquery/providers-sdk/v1/plugin"
     9  )
    10  
    11  const DefaultOsID = "go.mondoo.com/cnquery/providers/os"
    12  
    13  var defaultRuntime *Runtime
    14  
    15  func DefaultRuntime() *Runtime {
    16  	if defaultRuntime == nil {
    17  		defaultRuntime = Coordinator.NewRuntime()
    18  	}
    19  	return defaultRuntime
    20  }
    21  
    22  func SetDefaultRuntime(rt *Runtime) error {
    23  	if rt == nil {
    24  		return errors.New("attempted to set default runtime to null")
    25  	}
    26  	defaultRuntime = rt
    27  	return nil
    28  }
    29  
    30  // DefaultProviders are useful when working in air-gapped environments
    31  // to tell users what providers are used for common connections, when there
    32  // is no other way to find out.
    33  var DefaultProviders Providers = map[string]*Provider{
    34  	"arista": {
    35  		Provider: &plugin.Provider{
    36  			Name:            "arista",
    37  			ConnectionTypes: []string{"arista"},
    38  			Connectors: []plugin.Connector{
    39  				{
    40  					Name:  "arista",
    41  					Short: "Arista EOS",
    42  				},
    43  			},
    44  		},
    45  	},
    46  	"aws": {
    47  		Provider: &plugin.Provider{
    48  			Name:            "aws",
    49  			ConnectionTypes: []string{"aws", "ebs"},
    50  			Connectors: []plugin.Connector{
    51  				{
    52  					Name:  "aws",
    53  					Short: "aws account",
    54  				},
    55  			},
    56  		},
    57  	},
    58  	"azure": {
    59  		Provider: &plugin.Provider{
    60  			Name:            "azure",
    61  			ConnectionTypes: []string{"azure"},
    62  			Connectors: []plugin.Connector{
    63  				{
    64  					Name:  "azure",
    65  					Short: "azure",
    66  				},
    67  			},
    68  		},
    69  	},
    70  	"core": {
    71  		Provider: &plugin.Provider{
    72  			Name:            "core",
    73  			ConnectionTypes: []string(nil),
    74  			Connectors:      []plugin.Connector{},
    75  		},
    76  	},
    77  	"equinix": {
    78  		Provider: &plugin.Provider{
    79  			Name:            "equinix",
    80  			ConnectionTypes: []string{"equinix"},
    81  			Connectors: []plugin.Connector{
    82  				{
    83  					Name:  "equinix",
    84  					Short: "Equinix Metal",
    85  				},
    86  			},
    87  		},
    88  	},
    89  	"gcp": {
    90  		Provider: &plugin.Provider{
    91  			Name:            "gcp",
    92  			ConnectionTypes: []string{"gcp", "gcp-snapshot"},
    93  			Connectors: []plugin.Connector{
    94  				{
    95  					Name:  "gcp",
    96  					Short: "GCP Cloud",
    97  				},
    98  			},
    99  		},
   100  	},
   101  	"github": {
   102  		Provider: &plugin.Provider{
   103  			Name:            "github",
   104  			ConnectionTypes: []string{"github"},
   105  			Connectors: []plugin.Connector{
   106  				{
   107  					Name:  "github",
   108  					Short: "GitHub",
   109  				},
   110  			},
   111  		},
   112  	},
   113  	"gitlab": {
   114  		Provider: &plugin.Provider{
   115  			Name:            "gitlab",
   116  			ConnectionTypes: []string{"gitlab", "gitlab-group", "gitlab-project"},
   117  			Connectors: []plugin.Connector{
   118  				{
   119  					Name:  "gitlab",
   120  					Short: "GitLab",
   121  				},
   122  			},
   123  		},
   124  	},
   125  	"google-workspace": {
   126  		Provider: &plugin.Provider{
   127  			Name:            "google-workspace",
   128  			ConnectionTypes: []string{"google-workspace"},
   129  			Connectors: []plugin.Connector{
   130  				{
   131  					Name:  "google-workspace",
   132  					Short: "Google Workspace",
   133  				},
   134  			},
   135  		},
   136  	},
   137  	"ipmi": {
   138  		Provider: &plugin.Provider{
   139  			Name:            "ipmi",
   140  			ConnectionTypes: []string{"ipmi"},
   141  			Connectors: []plugin.Connector{
   142  				{
   143  					Name:  "ipmi",
   144  					Short: "Ipmi",
   145  				},
   146  			},
   147  		},
   148  	},
   149  	"k8s": {
   150  		Provider: &plugin.Provider{
   151  			Name:            "k8s",
   152  			ConnectionTypes: []string{"k8s"},
   153  			Connectors: []plugin.Connector{
   154  				{
   155  					Name:  "k8s",
   156  					Short: "a Kubernetes cluster or local manifest file(s).",
   157  				},
   158  			},
   159  		},
   160  	},
   161  	"ms365": {
   162  		Provider: &plugin.Provider{
   163  			Name:            "ms365",
   164  			ConnectionTypes: []string{"ms365"},
   165  			Connectors: []plugin.Connector{
   166  				{
   167  					Name:  "ms365",
   168  					Short: "ms365",
   169  				},
   170  			},
   171  		},
   172  	},
   173  	"network": {
   174  		Provider: &plugin.Provider{
   175  			Name:            "network",
   176  			ConnectionTypes: []string{"host"},
   177  			Connectors: []plugin.Connector{
   178  				{
   179  					Name:  "host",
   180  					Short: "a remote host",
   181  				},
   182  			},
   183  		},
   184  	},
   185  	"oci": {
   186  		Provider: &plugin.Provider{
   187  			Name:            "oci",
   188  			ConnectionTypes: []string{"oci"},
   189  			Connectors: []plugin.Connector{
   190  				{
   191  					Name:  "oci",
   192  					Short: "Oracle Cloud Infrastructure",
   193  				},
   194  			},
   195  		},
   196  	},
   197  	"okta": {
   198  		Provider: &plugin.Provider{
   199  			Name:            "okta",
   200  			ConnectionTypes: []string{"okta"},
   201  			Connectors: []plugin.Connector{
   202  				{
   203  					Name:  "okta",
   204  					Short: "Okta",
   205  				},
   206  			},
   207  		},
   208  	},
   209  	"opcua": {
   210  		Provider: &plugin.Provider{
   211  			Name:            "opcua",
   212  			ConnectionTypes: []string{"opcua"},
   213  			Connectors: []plugin.Connector{
   214  				{
   215  					Name:  "opcua",
   216  					Short: "OPC UA",
   217  				},
   218  			},
   219  		},
   220  	},
   221  	"os": {
   222  		Provider: &plugin.Provider{
   223  			Name:            "os",
   224  			ConnectionTypes: []string{"local", "ssh", "tar", "docker-snapshot", "vagrant", "docker-image", "docker-container", "docker-registry", "container-registry", "registry-image", "filesystem"},
   225  			Connectors: []plugin.Connector{
   226  				{
   227  					Name:  "local",
   228  					Short: "your local system",
   229  				},
   230  				{
   231  					Name:  "ssh",
   232  					Short: "a remote system via SSH",
   233  				},
   234  				{
   235  					Name:  "winrm",
   236  					Short: "a remote system via WinRM",
   237  				},
   238  				{
   239  					Name:  "vagrant",
   240  					Short: "a Vagrant host",
   241  				},
   242  				{
   243  					Name:  "container",
   244  					Short: "a running container or container image",
   245  				},
   246  				{
   247  					Name:  "docker",
   248  					Short: "a running docker or docker image",
   249  				},
   250  				{
   251  					Name:  "filesystem",
   252  					Short: "a mounted file system target.",
   253  				},
   254  			},
   255  		},
   256  	},
   257  	"slack": {
   258  		Provider: &plugin.Provider{
   259  			Name:            "slack",
   260  			ConnectionTypes: []string{"slack"},
   261  			Connectors: []plugin.Connector{
   262  				{
   263  					Name:  "slack",
   264  					Short: "slack team",
   265  				},
   266  			},
   267  		},
   268  	},
   269  	"terraform": {
   270  		Provider: &plugin.Provider{
   271  			Name:            "terraform",
   272  			ConnectionTypes: []string{"terraform-state", "terraform-plan", "terraform-hcl", "terraform-hcl-git"},
   273  			Connectors: []plugin.Connector{
   274  				{
   275  					Name:  "terraform",
   276  					Short: "a terraform hcl file or directory.",
   277  				},
   278  			},
   279  		},
   280  	},
   281  	"vcd": {
   282  		Provider: &plugin.Provider{
   283  			Name:            "vcd",
   284  			ConnectionTypes: []string{"vcd"},
   285  			Connectors: []plugin.Connector{
   286  				{
   287  					Name:  "vcd",
   288  					Short: "VMware Cloud Director",
   289  				},
   290  			},
   291  		},
   292  	},
   293  	"vsphere": {
   294  		Provider: &plugin.Provider{
   295  			Name:            "vsphere",
   296  			ConnectionTypes: []string{"vsphere"},
   297  			Connectors: []plugin.Connector{
   298  				{
   299  					Name:  "vsphere",
   300  					Short: "VMware vSphere",
   301  				},
   302  			},
   303  		},
   304  	},
   305  }