github.com/aws-cloudformation/cloudformation-cli-go-plugin@v1.2.0/python/rpdk/go/version.py (about)

     1  """
     2  The version package contains warning messages that should be displayed
     3  to a Go plugin user when upgrading from an older version of the plugin
     4  """
     5  
     6  import semver
     7  from typing import List
     8  
     9  # pylint: disable=pointless-string-statement
    10  """
    11  If there are breaking changes that need to be communicated to a user,
    12  add them to this dict. For readability, an opening and closing newline
    13  is recommended for each warning message
    14  """
    15  WARNINGS = {
    16      # FIXME: Version number to be finalised
    17      semver.VersionInfo(
    18          0, 1, 3
    19      ): """
    20  Generated models no longer use the types exported in the encoding package.
    21  Your model's fields have been regenerated using standard pointer types
    22  (*string, *int, etc) as used in the AWS Go SDK.
    23  The AWS SDK has helper functions that you can use to get and set your model's values.
    24  
    25  Make the following changes to your handler code as needed:
    26  
    27  * Replace `encoding.New{Type}` with `aws.{Type}`
    28  * Replace `model.{field}.Value()` with `aws.{Type}Value(model.{field})`
    29  
    30  Where {Type} is either String, Bool, Int, or Float64 and {field} is any field within
    31  your generated model.
    32  """
    33  }
    34  
    35  
    36  def check_version(current_version: str) -> List[str]:
    37      """
    38      check_version compares the user's current plugin version with each
    39      version in WARNINGS and returns any appropriate messages
    40      """
    41  
    42      if current_version is not None:
    43          current_version = semver.VersionInfo.parse(current_version)
    44  
    45      return [
    46          f"Change message for Go plugin v{version}:" + WARNINGS[version]
    47          for version in sorted(WARNINGS.keys())
    48          if current_version is None or current_version < version
    49      ]