New returns a new Client using the provided config and Options. By default, the client surfaces warnings returned by the server. To suppress warnings, set config.WarningHandlerWithContext = rest.NoWarnings{}. To define custom behavior, implement the rest.WarningHandlerWithContext interface. See [si
(config *rest.Config, options Options)
| 114 | // case of unstructured types, the group, version, and kind will be extracted |
| 115 | // from the corresponding fields on the object. |
| 116 | func New(config *rest.Config, options Options) (c Client, err error) { |
| 117 | c, err = newClient(config, options) |
| 118 | if err == nil && options.DryRun != nil && *options.DryRun { |
| 119 | c = NewDryRunClient(c) |
| 120 | } |
| 121 | if fo := options.FieldOwner; fo != "" { |
| 122 | c = WithFieldOwner(c, fo) |
| 123 | } |
| 124 | if fv := options.FieldValidation; fv != "" { |
| 125 | c = WithFieldValidation(c, FieldValidation(fv)) |
| 126 | } |
| 127 | |
| 128 | return c, err |
| 129 | } |
| 130 | |
| 131 | func newClient(config *rest.Config, options Options) (*client, error) { |
| 132 | if config == nil { |