2018-05-22 21:43:36 +02: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 05:23:26 +01:00
|
|
|
|
|
|
|
package diag
|
|
|
|
|
|
|
|
import (
|
2020-04-14 10:30:25 +02:00
|
|
|
"github.com/pulumi/pulumi/sdk/v2/go/common/resource"
|
2018-02-02 05:23:26 +01:00
|
|
|
)
|
|
|
|
|
2018-06-06 23:10:28 +02:00
|
|
|
// newError registers a new error message underneath the given id.
|
2018-04-10 21:03:11 +02:00
|
|
|
func newError(urn resource.URN, id ID, message string) *Diag {
|
2018-06-06 23:10:28 +02:00
|
|
|
return &Diag{URN: urn, ID: id, Message: message}
|
2018-02-02 05:23:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Plan and apply errors are in the [2000,3000) range.
|
2018-04-10 21:03:11 +02:00
|
|
|
|
2019-07-30 03:51:11 +02:00
|
|
|
func GetResourceOperationFailedError(urn resource.URN) *Diag {
|
2019-11-20 02:17:17 +01:00
|
|
|
return newError(urn, 2000, "%v")
|
2018-04-10 21:03:11 +02: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 {
|
|
|
|
return newError(urn, 2003, "%v resource '%v's property '%v' value %v has a problem: %v")
|
|
|
|
}
|
|
|
|
|
2018-04-14 07:26:01 +02:00
|
|
|
func GetPreviewFailedError(urn resource.URN) *Diag {
|
|
|
|
return newError(urn, 2005, "Preview failed: %v")
|
|
|
|
}
|
2019-03-21 21:23:46 +01: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 08:01:01 +02: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 23:28:42 +02:00
|
|
|
|
2019-09-21 02:50:44 +02:00
|
|
|
func GetTargetCouldNotBeFoundError() *Diag {
|
|
|
|
return newError("", 2010, "Target '%v' could not be found in the stack.")
|
2019-09-18 23:28:42 +02:00
|
|
|
}
|
|
|
|
|
2019-09-21 02:50:44 +02:00
|
|
|
func GetTargetCouldNotBeFoundDidYouForgetError() *Diag {
|
|
|
|
return newError("", 2011, "Target '%v' could not be found in the stack. "+
|
2019-09-20 04:28:14 +02:00
|
|
|
"Did you forget to escape $ in your shell?")
|
|
|
|
}
|
|
|
|
|
2019-10-01 08:41:56 +02:00
|
|
|
func GetCannotDeleteParentResourceWithoutAlsoDeletingChildError(urn resource.URN) *Diag {
|
|
|
|
return newError(urn, 2012, "Cannot delete parent resource '%v' without also deleting child '%v'.")
|
|
|
|
}
|
|
|
|
|
2019-11-19 05:28:25 +01: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 04:28:14 +02:00
|
|
|
}
|