go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers-sdk/v1/resources/resource_info.go (about) 1 // Copyright (c) Mondoo, Inc. 2 // SPDX-License-Identifier: BUSL-1.1 3 4 package resources 5 6 // HasEmptyInit is true if the init call has non-optional arguments 7 // or if the resource has mandatory fields. In either case it 8 // cannot be called without arguments. 9 func (r *ResourceInfo) HasEmptyInit() bool { 10 if r.Init != nil { 11 for i := range r.Init.Args { 12 if !r.Init.Args[i].Optional { 13 return false 14 } 15 } 16 } 17 18 for _, v := range r.Fields { 19 if v.IsMandatory { 20 return false 21 } 22 } 23 24 return true 25 }