2018-05-22 19:43:36 +00:00
|
|
|
// 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.
|
2018-02-02 04:23:26 +00:00
|
|
|
|
|
|
|
package diag
|
|
|
|
|
|
|
|
import (
|
2021-03-17 13:20:05 +00:00
|
|
|
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
|
2018-02-02 04:23:26 +00:00
|
|
|
)
|
|
|
|
|
2018-06-06 21:10:28 +00:00
|
|
|
// newError registers a new error message underneath the given id.
|
2018-04-10 19:03:11 +00:00
|
|
|
func newError(urn resource.URN, id ID, message string) *Diag {
|
2018-06-06 21:10:28 +00:00
|
|
|
return &Diag{URN: urn, ID: id, Message: message}
|
2018-02-02 04:23:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Plan and apply errors are in the [2000,3000) range.
|
2018-04-10 19:03:11 +00:00
|
|
|
|
2019-07-30 01:51:11 +00:00
|
|
|
func GetResourceOperationFailedError(urn resource.URN) *Diag {
|
2019-11-20 01:17:17 +00:00
|
|
|
return newError(urn, 2000, "%v")
|
2018-04-10 19:03:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func GetDuplicateResourceURNError(urn resource.URN) *Diag {
|
|
|
|
return newError(urn, 2001, "Duplicate resource URN '%v'; try giving it a unique name")
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetResourceInvalidError(urn resource.URN) *Diag {
|
|
|
|
return newError(urn, 2002, "%v resource '%v' has a problem: %v")
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetResourcePropertyInvalidValueError(urn resource.URN) *Diag {
|
2021-10-26 20:55:25 +00:00
|
|
|
return newError(urn, 2003, "%v resource '%v': property %v value %v has a problem: %v")
|
2018-04-10 19:03:11 +00:00
|
|
|
}
|
|
|
|
|
2018-04-14 05:26:01 +00:00
|
|
|
func GetPreviewFailedError(urn resource.URN) *Diag {
|
|
|
|
return newError(urn, 2005, "Preview failed: %v")
|
|
|
|
}
|
2019-03-21 20:23:46 +00:00
|
|
|
|
|
|
|
func GetBadProviderError(urn resource.URN) *Diag {
|
|
|
|
return newError(urn, 2006, "bad provider reference '%v' for resource '%v': %v")
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetUnknownProviderError(urn resource.URN) *Diag {
|
|
|
|
return newError(urn, 2007, "unknown provider '%v' for resource '%v'")
|
|
|
|
}
|
2019-06-01 06:01:01 +00:00
|
|
|
|
|
|
|
func GetDuplicateResourceAliasError(urn resource.URN) *Diag {
|
|
|
|
return newError(urn, 2008,
|
|
|
|
"Duplicate resource alias '%v' applied to resource with URN '%v' conflicting with resource with URN '%v'",
|
|
|
|
)
|
|
|
|
}
|
2019-09-18 21:28:42 +00:00
|
|
|
|
2019-09-21 00:50:44 +00:00
|
|
|
func GetTargetCouldNotBeFoundError() *Diag {
|
|
|
|
return newError("", 2010, "Target '%v' could not be found in the stack.")
|
2019-09-18 21:28:42 +00:00
|
|
|
}
|
|
|
|
|
2019-09-21 00:50:44 +00:00
|
|
|
func GetTargetCouldNotBeFoundDidYouForgetError() *Diag {
|
|
|
|
return newError("", 2011, "Target '%v' could not be found in the stack. "+
|
2019-09-20 02:28:14 +00:00
|
|
|
"Did you forget to escape $ in your shell?")
|
|
|
|
}
|
|
|
|
|
2019-10-01 06:41:56 +00:00
|
|
|
func GetCannotDeleteParentResourceWithoutAlsoDeletingChildError(urn resource.URN) *Diag {
|
|
|
|
return newError(urn, 2012, "Cannot delete parent resource '%v' without also deleting child '%v'.")
|
|
|
|
}
|
|
|
|
|
2019-11-19 04:28:25 +00:00
|
|
|
func GetResourceWillBeCreatedButWasNotSpecifiedInTargetList(urn resource.URN) *Diag {
|
|
|
|
return newError(urn, 2013, `Resource '%v' depends on '%v' which was was not specified in --target list.`)
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetResourceWillBeDestroyedButWasNotSpecifiedInTargetList(urn resource.URN) *Diag {
|
|
|
|
return newError(urn, 2014, `Resource '%v' will be destroyed but was not specified in --target list.
|
|
|
|
Either include resource in --target list or pass --target-dependents to proceed.`)
|
2019-09-20 02:28:14 +00:00
|
|
|
}
|
2022-01-26 17:08:36 +00:00
|
|
|
|
|
|
|
func GetDefaultProviderDenied(urn resource.URN) *Diag {
|
|
|
|
return newError(urn, 2015, `Default provider for '%v' disabled. '%v' must use an explicit provider.`)
|
|
|
|
}
|
2022-10-31 18:33:42 +00:00
|
|
|
|
|
|
|
func GetDuplicateResourceAliasedError(urn resource.URN) *Diag {
|
|
|
|
return newError(urn, 2016,
|
|
|
|
"Duplicate resource URN '%v' conflicting with alias on resource with URN '%v'",
|
|
|
|
)
|
|
|
|
}
|