58a75cbbf4
If a resource's options bag does not specify `protect` or `provider`, pull a default value from the resource's parent. In order to allow a parent resource to specify providers for multiple resource types, component resources now accept an optional map from package name to provider instance. When a custom resource needs a default provider from its parent, it checks its parent provider bag for an entry under its package. If a component resource does not have a provider bag, its pulls a default from its parent. These changes also add a `parent` field to `InvokeOptions` s.t. calls to invoke can use the same behavior as resource creation w.r.t. providers. Fixes #1735, #1736.
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
// Copyright 2016-2018, Pulumi Corporation.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
import { ProviderResource, Resource } from "./resource";
|
|
|
|
/*
|
|
* InvokeOptions is a bag of options that control the behavior of a call to runtime.invoke.
|
|
*/
|
|
export interface InvokeOptions {
|
|
/**
|
|
* An optional parent to use for default options for this invoke (e.g. the default provider to use).
|
|
*/
|
|
parent?: Resource;
|
|
|
|
/**
|
|
* An optional provider to use for this invocation. If no provider is supplied, the default provider for the
|
|
* invoked function's package will be used.
|
|
*/
|
|
provider?: ProviderResource;
|
|
}
|