diff --git a/changelog/CHANGELOG.md b/changelog/CHANGELOG.md new file mode 100644 index 0000000000000..2995dc3ec99bf --- /dev/null +++ b/changelog/CHANGELOG.md @@ -0,0 +1,2 @@ +### Features +- fix: rename API query according to Codefresh API update \ No newline at end of file diff --git a/pkg/codefresh/api_graphql_requests.go b/pkg/codefresh/api_graphql_requests.go index 33850e13b7dc7..b7e06ff617bec 100644 --- a/pkg/codefresh/api_graphql_requests.go +++ b/pkg/codefresh/api_graphql_requests.go @@ -11,19 +11,19 @@ type CodefreshGraphQLRequests struct { } type CodefreshGraphQLInterface interface { - GetApplicationConfiguration(app *metav1.ObjectMeta) (*ApplicationConfiguration, error) + GetPromotionTemplate(app *metav1.ObjectMeta) (*PromotionTemplate, error) } -// GetApplicationConfiguration method to get application configuration -func (r *CodefreshGraphQLRequests) GetApplicationConfiguration(app *metav1.ObjectMeta) (*ApplicationConfiguration, error) { +// GetPromotionTemplate method to get application configuration +func (r *CodefreshGraphQLRequests) GetPromotionTemplate(app *metav1.ObjectMeta) (*PromotionTemplate, error) { type ResponseData struct { - ApplicationConfigurationByRuntime ApplicationConfiguration `json:"applicationConfigurationByRuntime"` + PromotionTemplateByRuntime PromotionTemplate `json:"promotionTemplateByRuntime"` } query := GraphQLQuery{ Query: ` query ($applicationMetadata: Object!) { - applicationConfigurationByRuntime(applicationMetadata: $applicationMetadata) { + promotionTemplateByRuntime(applicationMetadata: $applicationMetadata) { versionSource { file jsonPath @@ -46,7 +46,7 @@ func (r *CodefreshGraphQLRequests) GetApplicationConfiguration(app *metav1.Objec return nil, err } - return &responseData.ApplicationConfigurationByRuntime, nil + return &responseData.PromotionTemplateByRuntime, nil } func NewCodefreshGraphQLRequests(client CodefreshClientInterface) CodefreshGraphQLInterface { diff --git a/pkg/codefresh/types.go b/pkg/codefresh/types.go index 513a45f012e3d..cd845ad1a609f 100644 --- a/pkg/codefresh/types.go +++ b/pkg/codefresh/types.go @@ -6,6 +6,6 @@ type VersionSource struct { JsonPath string `json:"jsonPath"` } -type ApplicationConfiguration struct { +type PromotionTemplate struct { VersionSource VersionSource `json:"versionSource"` } diff --git a/pkg/version_config_manager/version_config_manager.go b/pkg/version_config_manager/version_config_manager.go index baef03785d20b..9822123059f61 100644 --- a/pkg/version_config_manager/version_config_manager.go +++ b/pkg/version_config_manager/version_config_manager.go @@ -13,7 +13,7 @@ type VersionConfig struct { } func (v *VersionConfigManager) GetVersionConfig(app *metav1.ObjectMeta) (*VersionConfig, error) { - var appConfig *codefresh.ApplicationConfiguration + var appConfig *codefresh.PromotionTemplate // Get from cache appConfig, err := v.cache.GetCfAppConfig(app.Namespace, app.Name) @@ -31,7 +31,7 @@ func (v *VersionConfigManager) GetVersionConfig(app *metav1.ObjectMeta) (*Versio } // Get from Codefresh API - appConfig, err = v.requests.GetApplicationConfiguration(app) + appConfig, err = v.requests.GetPromotionTemplate(app) if err != nil { log.Infof("Failed to get application config from API: %v", err) return nil, err diff --git a/reposerver/cache/cache.go b/reposerver/cache/cache.go index e98fcb83e4082..0a8598e47dc02 100644 --- a/reposerver/cache/cache.go +++ b/reposerver/cache/cache.go @@ -393,12 +393,12 @@ func CfAppConfigCacheKey(namespace, name string) string { return fmt.Sprintf("cf_app_config:%s:%s", namespace, name) } -func (c *Cache) GetCfAppConfig(namespace, name string) (*codefresh.ApplicationConfiguration, error) { - item := &codefresh.ApplicationConfiguration{} +func (c *Cache) GetCfAppConfig(namespace, name string) (*codefresh.PromotionTemplate, error) { + item := &codefresh.PromotionTemplate{} return item, c.cache.GetItem(CfAppConfigCacheKey(namespace, name), item) } -func (c *Cache) SetCfAppConfig(namespace, name string, item *codefresh.ApplicationConfiguration) error { +func (c *Cache) SetCfAppConfig(namespace, name string, item *codefresh.PromotionTemplate) error { return c.cache.SetItem(CfAppConfigCacheKey(namespace, name), item, c.cfAppConfigCacheExpiration, false) }