Add inserts a new provider.
(ctx context.Context, input ProviderInput)
| 165 | |
| 166 | // Add inserts a new provider. |
| 167 | func (api ProviderAPI) Add(ctx context.Context, input ProviderInput) (Provider, error) { |
| 168 | if err := api.prepareProviderOperation(); err != nil { |
| 169 | return Provider{}, err |
| 170 | } |
| 171 | endpoint := endpointFromInput(input) |
| 172 | if err := api.store().AddProvider(ctx, input.Name, endpoint); err != nil { |
| 173 | return Provider{}, err |
| 174 | } |
| 175 | return providerFromEndpoint(input.Name, endpoint, api.getenv()), nil |
| 176 | } |
| 177 | |
| 178 | // Update applies a sparse provider patch. |
| 179 | func (api ProviderAPI) Update(ctx context.Context, name string, patch ProviderPatch) (Provider, error) { |