github.com/opentofu/opentofu@v1.7.1/internal/tfdiags/simple_warning.go (about)

     1  // Copyright (c) The OpenTofu Authors
     2  // SPDX-License-Identifier: MPL-2.0
     3  // Copyright (c) 2023 HashiCorp, Inc.
     4  // SPDX-License-Identifier: MPL-2.0
     5  
     6  package tfdiags
     7  
     8  type simpleWarning string
     9  
    10  var _ Diagnostic = simpleWarning("")
    11  
    12  // SimpleWarning constructs a simple (summary-only) warning diagnostic.
    13  func SimpleWarning(msg string) Diagnostic {
    14  	return simpleWarning(msg)
    15  }
    16  
    17  func (e simpleWarning) Severity() Severity {
    18  	return Warning
    19  }
    20  
    21  func (e simpleWarning) Description() Description {
    22  	return Description{
    23  		Summary: string(e),
    24  	}
    25  }
    26  
    27  func (e simpleWarning) Source() Source {
    28  	// No source information available for a simple warning
    29  	return Source{}
    30  }
    31  
    32  func (e simpleWarning) FromExpr() *FromExpr {
    33  	// Simple warnings are not expression-related
    34  	return nil
    35  }
    36  
    37  func (e simpleWarning) ExtraInfo() interface{} {
    38  	// Simple warnings cannot carry extra information.
    39  	return nil
    40  }