Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/storage zone improvements #1

Commits on Jun 15, 2022

  1. storagezone: fix: creation fails

    Creating a storagezone failed with the immutable attribute errors:
    	* 'name' is immutable and cannot be changed from '' to 'tf-test-20220615075051824800000019'.[..]
    	* 'region' is immutable and cannot be changed from '' to 'DE'. [..]
    
    Fix it by always allowing changes in validateImmutableStringProperty if the old
    value was an empty string.
    fho committed Jun 15, 2022
    Configuration menu
    Copy the full SHA
    89bda18 View commit details
    Browse the repository at this point in the history
  2. storagezone: improve error message for immutable fields

    - add newlines to make the message easier to read,
    - make the message vars constants,
    fho committed Jun 15, 2022
    Configuration menu
    Copy the full SHA
    0ebb31b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    103e042 View commit details
    Browse the repository at this point in the history
  4. storagezone: remove setting state to current values on failed update

    It is not needed.
    d.Get() only returns the proposed state, if updating fails it is not stored as
    current state.
    fho committed Jun 15, 2022
    Configuration menu
    Copy the full SHA
    932b9e2 View commit details
    Browse the repository at this point in the history
  5. simplify storageZoneFromResource

    storageZoneFromResource was only setting fields in
    *bunny.StorageZoneUpdateOptions that changed in the resource.
    Change it to set always all fields to the current values.
    This is consistent with how other *FromResource functions are behaving.
    
    The update message sent to the bunny API will contain all settings also the
    current ones instead of only the changed ones.
    Depending on how the bunny.net endpoint handles missing fields in JSON payloads
    for update messages this could be better or worse. :-)
    If it always interprets missing fields as no change is done, it causes only
    unnecessary network traffic.
    If it interprets missing fields as the setting should be unset/disabled, it's
    better to include the whole configuration.
    
    The bunny.net API distinguishes between missing and empty string values
    for the OriginURL and Custom404FilePath fields. When submitting empty strings
    for those it resulted in an error, that those fields set to invalid
    values.
    
    To handle it the helper function getOkStrPtr() is introduced. It returns nil if
    the value is unset instead of an empty string.
    
    Replacing all get<TYPE>Ptr() calls with getOk<TYPE>Ptr() might make sense and
    should be investigated in a follow-up.
    fho committed Jun 15, 2022
    Configuration menu
    Copy the full SHA
    773b9be View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    cc62818 View commit details
    Browse the repository at this point in the history
  7. tests: add testcase for immutable storagezone fields

    Add a testcase that ensures changing an immutable storagezone field fails
    fho committed Jun 15, 2022
    Configuration menu
    Copy the full SHA
    0764bd1 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    a4ca606 View commit details
    Browse the repository at this point in the history
  9. tests: replace randPullZoneName(), randStorageZoneName() with 1 function

    replace the randPullZoneName() and randStorageZoneName() functions that were
    doing the same with a function called randResourceName()
    fho committed Jun 15, 2022
    Configuration menu
    Copy the full SHA
    ab02902 View commit details
    Browse the repository at this point in the history