Skip to content

Commit

Permalink
Merge pull request #316 from aziontech/feat-cache-settings-delete
Browse files Browse the repository at this point in the history
Feat: cache settings command delete
  • Loading branch information
maxwelbm authored Mar 2, 2023
2 parents 0fd3313 + e3f47db commit 778726d
Show file tree
Hide file tree
Showing 7 changed files with 399 additions and 285 deletions.
33 changes: 18 additions & 15 deletions messages/cache_settings/errors.go
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
package cache_settings

import (
"errors"
"errors"
)

var (
ErrorGetCaches = errors.New("Failed to list your cache settings. Check your settings and try again. If the error persists, contact Azion support.")
ErrorGetCaches = errors.New("Failed to list your cache settings. Check your settings and try again. If the error persists, contact Azion support.")
ErrorGetCache = errors.New("Failed to get cache settings: %s. Check your settings and try again. If the error persists, contact Azion support.")
ErrorMandatoryListFlags = errors.New("Required flags are missing. You must provide application-id, name, addresses and host-header flags when the --application-id flag are not provided. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorMandatoryListFlags = errors.New("Required flags are missing. You must provide application-id, name, addresses and host-header flags when the --application-id flag are not provided. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")

ErrorMandatoryCreateFlags = errors.New("Required flags are missing. You must provide the application-id and name flags when --in flag is not provided. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorMandatoryCreateFlagsIn = errors.New("Required flags are missing. You must provide the application-id flag when the --in flag is provided. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorCachingForOptionsFlag = errors.New("Invalid --enable-caching-for-options flag provided. The flag must have 'true' or 'false' values. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorCachingForPostFlag = errors.New("Invalid --enable-caching-for-post flag provided. The flag must have 'true' or 'false' values. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorCachingStringSortFlag = errors.New("Invalid --enable-caching-string-sort flag provided. The flag must have 'true' or 'false' values. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorSliceConfigurationFlag = errors.New("Invalid --slice-configuration-enable flag provided. The flag must have 'true' or 'false' values. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorSliceL2CachingFlag = errors.New("Invalid --slice-l2-caching-enabled flag provided. The flag must have 'true' or 'false' values. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorL2CachingEnabledFlag = errors.New("Invalid --l2-caching-enabled flag provided. The flag must have 'true' or 'false' values. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorMandatoryCreateFlags = errors.New("Required flags are missing. You must provide the application-id and name flags when --in flag is not provided. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorMandatoryCreateFlagsIn = errors.New("Required flags are missing. You must provide the application-id flag when the --in flag is provided. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorCachingForOptionsFlag = errors.New("Invalid --enable-caching-for-options flag provided. The flag must have 'true' or 'false' values. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorCachingForPostFlag = errors.New("Invalid --enable-caching-for-post flag provided. The flag must have 'true' or 'false' values. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorCachingStringSortFlag = errors.New("Invalid --enable-caching-string-sort flag provided. The flag must have 'true' or 'false' values. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorSliceConfigurationFlag = errors.New("Invalid --slice-configuration-enable flag provided. The flag must have 'true' or 'false' values. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorSliceL2CachingFlag = errors.New("Invalid --slice-l2-caching-enabled flag provided. The flag must have 'true' or 'false' values. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorL2CachingEnabledFlag = errors.New("Invalid --l2-caching-enabled flag provided. The flag must have 'true' or 'false' values. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")

ErrorCreateCacheSettings = errors.New("Failed to create the Cache Setting: %s. Check your settings and try again. If the error persists, contact Azion support.")
ErrorBrowserMaximumTtlNotSent = errors.New("When browser cache settings is 'override' you must send the --browser-cache-settings-maximum-ttl flag")
ErrorApplicationAccelerationNotEnabled = errors.New("When --enable-caching-string-sort, --enable-caching-for-post or --enable-caching-for-options is sent, application acceleration must be enabled")
ErrorCreateCacheSettings = errors.New("Failed to create the Cache Setting: %s. Check your settings and try again. If the error persists, contact Azion support.")
ErrorBrowserMaximumTtlNotSent = errors.New("When browser cache settings is 'override' you must send the --browser-cache-settings-maximum-ttl flag")
ErrorApplicationAccelerationNotEnabled = errors.New("When --enable-caching-string-sort, --enable-caching-for-post or --enable-caching-for-options is sent, application acceleration must be enabled")

ErrorMissingArguments = errors.New("Required flags are missing. You must supply application-id and cache-settings-id as arguments. Run 'azioncli <command> <subcommand> --help' command to display more information and try again")

ErrorFailToDelete = errors.New("Failed to delete the Cache settings: %s. Check your settings and try again. If the error persists, contact Azion support.")

ErrorMandatoryUpdateFlags = errors.New("Required flags are missing. You must provide the application-id and cache-settings-id flags when --in flag is not provided. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorMandatoryUpdateInFlags = errors.New("Required flags are missing. You must provide the application-id flag when --in flag is not provided. Run the command 'azioncli <command> <subcommand> --help' to display more information and try again.")
ErrorMissingArguments = errors.New("Required flags are missing. You must supply application-id and cache-settings-id as arguments. Run 'azioncli <command> <subcommand> --help' command to display more information and try again")
)
113 changes: 60 additions & 53 deletions messages/cache_settings/messages.go
Original file line number Diff line number Diff line change
@@ -1,63 +1,70 @@
package cache_settings

var (
// [ cache_settings ]
CacheSettingsUsage = "cache_settings"
CacheSettingsShortDescription = "Cache Settings lets you check, remove or update existing settings, besides creating new ones"
CacheSettingsLongDescription = "Cache Settings lets you check, remove or update existing settings, besides creating new ones"
CacheSettingsFlagHelp = "Displays more information about the cache_settings command"
CacheSettingsId = "Unique identifier for a cache setting"
// [ cache_settings ]
CacheSettingsUsage = "cache_settings"
CacheSettingsShortDescription = "Cache Settings lets you check, remove or update existing settings, besides creating new ones"
CacheSettingsLongDescription = "Cache Settings lets you check, remove or update existing settings, besides creating new ones"
CacheSettingsFlagHelp = "Displays more information about the cache_settings command"
CacheSettingsId = "Unique identifier for a cache setting"

// [ list ]
CacheSettingsListUsage = "list [flags]"
CacheSettingsListShortDescription = "Displays yours cache settings"
CacheSettingsListLongDescription = "Displays all cache settings"
CacheSettingsListHelpFlag = "Displays more information about the list subcommand"
// [ list ]
CacheSettingsListUsage = "list [flags]"
CacheSettingsListShortDescription = "Displays yours cache settings"
CacheSettingsListLongDescription = "Displays all cache settings"
CacheSettingsListHelpFlag = "Displays more information about the list subcommand"

// [ create ]
CacheSettingsCreateUsage = "create [flags]"
CacheSettingsCreateShortDescription = "Creates a new Cache Setting"
CacheSettingsCreateLongDescription = "Creates a Cache Setting based on given attributes to be used in edge applications"
CacheSettingsCreateFlagEdgeApplicationId = "Unique identifier for an edge application"
CacheSettingsCreateFlagName = "The Cache Settings' name"
CacheSettingsCreateFlagIn = "Path to a JSON file containing the attributes of the Cache Setting that will be created; you can use - for reading from stdin"
CacheSettingsCreateOutputSuccess = "Created cache setting with ID %d\n"
CacheSettingsCreateHelpFlag = "Displays more information about the create subcommand"
CacheSettingsCreateFlagBrowserCacheSettings = "Browser Cache Settings"
CacheSettingsCreateFlagQueryStringFields = "Cache Settings' query string fields"
CacheSettingsCreateFlagCookieNames = "Cache Settings' cookie names"
CacheSettingsCreateFlagCacheByCookies = "Whether cache by cookies is active or not"
CacheSettingsCreateFlagCacheByQueryString = "Cache Settings' cache by query string"
CacheSettingsCreateFlagCdnCacheSettings = "CDN cache settings"
CacheSettingsCreateFlagCachingForOptions = "Whether caching for options is active or not"
CacheSettingsCreateFlagCachingStringSort = "Whether caching string sort is active or not"
CacheSettingsCreateFlagCachingForPost = "Whether caching for post is active or not"
CacheSettingsCreateFlagSliceConfigurationEnabled = "Whether slice configuration is active or not"
CacheSettingsCreateFlagSliceL2CachingEnabled = "Whether slice L2 caching is active or not"
CacheSettingsCreateFlagSliceEdgeCachingEnabled = "Whether slice edge caching is active or not"
CacheSettingsCreateFlagL2CachingEnabled = "Whether slice edge caching is active or not"
CacheSettingsCreateFlagSliceConfigurationRange = "Cache Settings' slice configuration range"
CacheSettingsCreateFlagCdnCacheSettingsMaxTtl = "CDN cache settings' maximum TTL"
CacheSettingsCreateFlagBrowserCacheSettingsMaxTtl = "Browser cache settings' maximum TTL"
CacheSettingsCreateFlagAdaptiveDeliveryAction = "Cache Settings' adaptive delivery action"
// [ create ]
CacheSettingsCreateUsage = "create [flags]"
CacheSettingsCreateShortDescription = "Creates a new Cache Setting"
CacheSettingsCreateLongDescription = "Creates a Cache Setting based on given attributes to be used in edge applications"
CacheSettingsCreateFlagEdgeApplicationId = "Unique identifier for an edge application"
CacheSettingsCreateFlagName = "The Cache Settings' name"
CacheSettingsCreateFlagIn = "Path to a JSON file containing the attributes of the Cache Setting that will be created; you can use - for reading from stdin"
CacheSettingsCreateOutputSuccess = "Created cache setting with ID %d\n"
CacheSettingsCreateHelpFlag = "Displays more information about the create subcommand"
CacheSettingsCreateFlagBrowserCacheSettings = "Browser Cache Settings"
CacheSettingsCreateFlagQueryStringFields = "Cache Settings' query string fields"
CacheSettingsCreateFlagCookieNames = "Cache Settings' cookie names"
CacheSettingsCreateFlagCacheByCookies = "Whether cache by cookies is active or not"
CacheSettingsCreateFlagCacheByQueryString = "Cache Settings' cache by query string"
CacheSettingsCreateFlagCdnCacheSettings = "CDN cache settings"
CacheSettingsCreateFlagCachingForOptions = "Whether caching for options is active or not"
CacheSettingsCreateFlagCachingStringSort = "Whether caching string sort is active or not"
CacheSettingsCreateFlagCachingForPost = "Whether caching for post is active or not"
CacheSettingsCreateFlagSliceConfigurationEnabled = "Whether slice configuration is active or not"
CacheSettingsCreateFlagSliceL2CachingEnabled = "Whether slice L2 caching is active or not"
CacheSettingsCreateFlagSliceEdgeCachingEnabled = "Whether slice edge caching is active or not"
CacheSettingsCreateFlagL2CachingEnabled = "Whether slice edge caching is active or not"
CacheSettingsCreateFlagSliceConfigurationRange = "Cache Settings' slice configuration range"
CacheSettingsCreateFlagCdnCacheSettingsMaxTtl = "CDN cache settings' maximum TTL"
CacheSettingsCreateFlagBrowserCacheSettingsMaxTtl = "Browser cache settings' maximum TTL"
CacheSettingsCreateFlagAdaptiveDeliveryAction = "Cache Settings' adaptive delivery action"

// [ update ]
CacheSettingsUpdateUsage = "update [flags]"
CacheSettingsUpdateShortDescription = "Modifies a Cache Setting"
CacheSettingsUpdateLongDescription = "Modifies a Cache Setting based on given attributes to be used in edge applications"
CacheSettingsUpdateOutputSuccess = "Updated cache setting with ID %d\n"

// [ update ]
CacheSettingsUpdateUsage = "update [flags]"
CacheSettingsUpdateShortDescription = "Modifies a Cache Setting"
CacheSettingsUpdateLongDescription = "Modifies a Cache Setting based on given attributes to be used in edge applications"
CacheSettingsUpdateOutputSuccess = "Updated cache setting with ID %d\n"
// [ describe ]
CacheSettingsDescribeUsage = "describe --application-id <application_id> --cache-settings-id <cache-settings-id> [flags]"
CacheSettingsDescribeShortDescription = "Returns information about a specific cache settings"
CacheSettingsDescribeLongDescription = "Returns information about a specific cache settings, based on a given ID, in details"
CacheSettingsDescribeFlagApplicationID = "Unique identifier for an edge application. The '--application-id' flag is mandatory"
CacheSettingsDescribeFlagCacheSettingsID = "Unique identifier for an origin. The '--cache-settings-id' flag is mandatory"
CacheSettingsDescribeFlagOut = "Exports the output to the given <file_path/file_name.ext>"
CacheSettingsDescribeFlagFormat = "Changes the output format passing the json value to the flag"
CacheSettingsDescribeHelpFlag = "Displays more information about the describe subcommand"

// [ describe ]
CacheSettingsDescribeUsage = "describe --application-id <application_id> --cache-settings-id <cache-settings-id> [flags]"
CacheSettingsDescribeShortDescription = "Returns information about a specific cache settings"
CacheSettingsDescribeLongDescription = "Returns information about a specific cache settings, based on a given ID, in details"
CacheSettingsDescribeFlagApplicationID = "Unique identifier for an edge application. The '--application-id' flag is mandatory"
CacheSettingsDescribeFlagCacheSettingsID = "Unique identifier for an origin. The '--cache-settings-id' flag is mandatory"
CacheSettingsDescribeFlagOut = "Exports the output to the given <file_path/file_name.ext>"
CacheSettingsDescribeFlagFormat = "Changes the output format passing the json value to the flag"
CacheSettingsDescribeHelpFlag = "Displays more information about the describe subcommand"

CacheSettingsFileWritten = "File successfully written to: %s\n"
// [ delete ]
CacheSettingsDeleteUsage = "delete [flags]"
CacheSettingsDeleteShortDescription = "Deletes an Cache Settings"
CacheSettingsDeleteLongDescription = "Deletes an Caches Settings from the Edge Applications library based on its given ID"
CacheSettingsDeleteOutputSuccess = "Caches settings %d was successfully deleted\n"
CacheSettingsDeleteFlagApplicationID = "Unique identifier for an edge application"
CacheSettingsDeleteFlagCacheSettingsID = "The Cache Settings key unique identifier"
CacheSettingsDeleteHelpFlag = "Displays more information about the delete subcommand"

CacheSettingsFileWritten = "File successfully written to: %s\n"
)
Loading

0 comments on commit 778726d

Please sign in to comment.