diff --git a/cmd/client/command/common.go b/cmd/client/command/common.go index ad9cce3c6e..b401eaf471 100644 --- a/cmd/client/command/common.go +++ b/cmd/client/command/common.go @@ -48,41 +48,41 @@ const ( statusObjectURL = apiURL + "/status/objects/%s" statusObjectsURL = apiURL + "/status/objects" - // MeshTenantPrefix is the mesh tenant prefix. - MeshTenantPrefix = apiURL + "/mesh/tenants" + // MeshTenantsURL is the mesh tenant prefix. + MeshTenantsURL = apiURL + "/mesh/tenants" - // MeshTenantPath is the mesh tenant path. - MeshTenantPath = apiURL + "/mesh/tenants/%s" + // MeshTenantURL is the mesh tenant path. + MeshTenantURL = apiURL + "/mesh/tenants/%s" - // MeshServicePrefix is mesh service prefix. - MeshServicePrefix = apiURL + "/mesh/services" + // MeshServicesURL is mesh service prefix. + MeshServicesURL = apiURL + "/mesh/services" - // MeshServicePath is the mesh service path. - MeshServicePath = apiURL + "/mesh/services/%s" + // MeshServiceURL is the mesh service path. + MeshServiceURL = apiURL + "/mesh/services/%s" - // MeshServiceCanaryPath is the mesh service canary path. - MeshServiceCanaryPath = apiURL + "/mesh/services/%s/canary" + // MeshServiceCanaryURL is the mesh service canary path. + MeshServiceCanaryURL = apiURL + "/mesh/services/%s/canary" - // MeshServiceResiliencePath is the mesh service resilience path. - MeshServiceResiliencePath = apiURL + "/mesh/services/%s/resilience" + // MeshServiceResilienceURL is the mesh service resilience path. + MeshServiceResilienceURL = apiURL + "/mesh/services/%s/resilience" - // MeshServiceLoadBalancePath is the mesh service load balance path. - MeshServiceLoadBalancePath = apiURL + "/mesh/services/%s/loadbalance" + // MeshServiceLoadBalanceURL is the mesh service load balance path. + MeshServiceLoadBalanceURL = apiURL + "/mesh/services/%s/loadbalance" - // MeshServiceOutputServerPath is the mesh service output server path. - MeshServiceOutputServerPath = apiURL + "/mesh/services/%s/outputserver" + // MeshServiceOutputServerURL is the mesh service output server path. + MeshServiceOutputServerURL = apiURL + "/mesh/services/%s/outputserver" - // MeshServiceTracingsPath is the mesh service tracings path. - MeshServiceTracingsPath = apiURL + "/mesh/services/%s/tracings" + // MeshServiceTracingsURL is the mesh service tracings path. + MeshServiceTracingsURL = apiURL + "/mesh/services/%s/tracings" - // MeshServiceMetricsPath is the mesh service metrics path. - MeshServiceMetricsPath = apiURL + "/mesh/services/%s/metrics" + // MeshServiceMetricsURL is the mesh service metrics path. + MeshServiceMetricsURL = apiURL + "/mesh/services/%s/metrics" - // MeshServiceInstancePrefix is the mesh service prefix. - MeshServiceInstancePrefix = apiURL + "/mesh/serviceinstances" + // MeshServiceInstancesURL is the mesh service prefix. + MeshServiceInstancesURL = apiURL + "/mesh/serviceinstances" - // MeshServiceInstancePath is the mesh service path. - MeshServiceInstancePath = apiURL + "/mesh/serviceinstances/%s/%s" + // MeshServiceInstanceURL is the mesh service path. + MeshServiceInstanceURL = apiURL + "/mesh/serviceinstances/%s/%s" ) func makeURL(urlTemplate string, a ...interface{}) string { diff --git a/cmd/client/command/mesh_service.go b/cmd/client/command/mesh_service.go index 0fe5779a57..d65d13796f 100644 --- a/cmd/client/command/mesh_service.go +++ b/cmd/client/command/mesh_service.go @@ -34,7 +34,7 @@ func createServiceCmd() *cobra.Command { Short: "Create an service from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, _ := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPost, makeURL(MeshServicePath), buff, cmd) + handleRequest(http.MethodPost, makeURL(MeshServicesURL), buff, cmd) }, } @@ -50,7 +50,7 @@ func updateServiceCmd() *cobra.Command { Short: "Update an service from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, name := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPut, makeURL(MeshServicePath, name), buff, cmd) + handleRequest(http.MethodPut, makeURL(MeshServiceURL, name), buff, cmd) }, } @@ -73,7 +73,7 @@ func deleteServiceCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodDelete, makeURL(MeshServicePath, args[0]), nil, cmd) + handleRequest(http.MethodDelete, makeURL(MeshServiceURL, args[0]), nil, cmd) }, } @@ -94,7 +94,7 @@ func getServiceCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodGet, makeURL(MeshServicePath, args[0]), nil, cmd) + handleRequest(http.MethodGet, makeURL(MeshServiceURL, args[0]), nil, cmd) }, } @@ -107,7 +107,7 @@ func listServicesCmd() *cobra.Command { Short: "List all services", Example: "egctl mesh service list", Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodGet, makeURL(MeshServicePrefix), nil, cmd) + handleRequest(http.MethodGet, makeURL(MeshServicesURL), nil, cmd) }, } diff --git a/cmd/client/command/mesh_service_instance.go b/cmd/client/command/mesh_service_instance.go index d89da1ba7e..92d0aa159c 100644 --- a/cmd/client/command/mesh_service_instance.go +++ b/cmd/client/command/mesh_service_instance.go @@ -33,7 +33,7 @@ func deleteServiceInstanceCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodDelete, makeURL(MeshServiceInstancePath, args[0], args[1]), nil, cmd) + handleRequest(http.MethodDelete, makeURL(MeshServiceInstanceURL, args[0], args[1]), nil, cmd) }, } @@ -54,7 +54,7 @@ func getServiceInstanceCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodGet, makeURL(MeshServiceInstancePath, args[0], args[1]), nil, cmd) + handleRequest(http.MethodGet, makeURL(MeshServiceInstanceURL, args[0], args[1]), nil, cmd) }, } @@ -67,7 +67,7 @@ func listServiceInstancesCmd() *cobra.Command { Short: "List all service instances", Example: "egctl mesh service instance list", Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodGet, makeURL(MeshServiceInstancePrefix), nil, cmd) + handleRequest(http.MethodGet, makeURL(MeshServiceInstancesURL), nil, cmd) }, } diff --git a/cmd/client/command/mesh_service_observability.go b/cmd/client/command/mesh_service_observability.go index 27cd3cec1f..4c219c8539 100644 --- a/cmd/client/command/mesh_service_observability.go +++ b/cmd/client/command/mesh_service_observability.go @@ -27,7 +27,7 @@ func createServiceCanaryCmd() *cobra.Command { Short: "Create an service canary from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, _ := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPost, makeURL(MeshServiceCanaryPath), buff, cmd) + handleRequest(http.MethodPost, makeURL(MeshServiceCanaryURL), buff, cmd) }, } @@ -43,7 +43,7 @@ func updateServiceCanaryCmd() *cobra.Command { Short: "Update an service canary from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, name := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPut, makeURL(MeshServiceCanaryPath, name), buff, cmd) + handleRequest(http.MethodPut, makeURL(MeshServiceCanaryURL, name), buff, cmd) }, } @@ -66,7 +66,7 @@ func deleteServiceCanaryCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodDelete, makeURL(MeshServiceCanaryPath, args[0]), nil, cmd) + handleRequest(http.MethodDelete, makeURL(MeshServiceCanaryURL, args[0]), nil, cmd) }, } @@ -87,7 +87,7 @@ func getServiceCanaryCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodGet, makeURL(MeshServiceCanaryPath, args[0]), nil, cmd) + handleRequest(http.MethodGet, makeURL(MeshServiceCanaryURL, args[0]), nil, cmd) }, } @@ -115,7 +115,7 @@ func createServiceResilienceCmd() *cobra.Command { Short: "Create an service resilience from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, _ := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPost, makeURL(MeshServiceResiliencePath), buff, cmd) + handleRequest(http.MethodPost, makeURL(MeshServiceResilienceURL), buff, cmd) }, } @@ -131,7 +131,7 @@ func updateServiceResilienceCmd() *cobra.Command { Short: "Update an service resilience from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, name := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPut, makeURL(MeshServiceResiliencePath, name), buff, cmd) + handleRequest(http.MethodPut, makeURL(MeshServiceResilienceURL, name), buff, cmd) }, } @@ -154,7 +154,7 @@ func deleteServiceResilienceCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodDelete, makeURL(MeshServiceResiliencePath, args[0]), nil, cmd) + handleRequest(http.MethodDelete, makeURL(MeshServiceResilienceURL, args[0]), nil, cmd) }, } @@ -175,7 +175,7 @@ func getServiceResilienceCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodGet, makeURL(MeshServiceResiliencePath, args[0]), nil, cmd) + handleRequest(http.MethodGet, makeURL(MeshServiceResilienceURL, args[0]), nil, cmd) }, } @@ -203,7 +203,7 @@ func createServiceLoadbalanceCmd() *cobra.Command { Short: "Create an service loadbalance from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, _ := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPost, makeURL(MeshServiceLoadBalancePath), buff, cmd) + handleRequest(http.MethodPost, makeURL(MeshServiceLoadBalanceURL), buff, cmd) }, } @@ -219,7 +219,7 @@ func updateServiceLoadbalanceCmd() *cobra.Command { Short: "Update an service loadbalance from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, name := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPut, makeURL(MeshServiceLoadBalancePath, name), buff, cmd) + handleRequest(http.MethodPut, makeURL(MeshServiceLoadBalanceURL, name), buff, cmd) }, } @@ -242,7 +242,7 @@ func deleteServiceLoadbalanceCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodDelete, makeURL(MeshServiceLoadBalancePath, args[0]), nil, cmd) + handleRequest(http.MethodDelete, makeURL(MeshServiceLoadBalanceURL, args[0]), nil, cmd) }, } @@ -263,7 +263,7 @@ func getServiceLoadbalanceCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodGet, makeURL(MeshServiceLoadBalancePath, args[0]), nil, cmd) + handleRequest(http.MethodGet, makeURL(MeshServiceLoadBalanceURL, args[0]), nil, cmd) }, } @@ -291,7 +291,7 @@ func createServiceOutputserverCmd() *cobra.Command { Short: "Create an service outputserver from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, _ := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPost, makeURL(MeshServiceOutputServerPath), buff, cmd) + handleRequest(http.MethodPost, makeURL(MeshServiceOutputServerURL), buff, cmd) }, } @@ -307,7 +307,7 @@ func updateServiceOutputserverCmd() *cobra.Command { Short: "Update an service outputserver from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, name := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPut, makeURL(MeshServiceOutputServerPath, name), buff, cmd) + handleRequest(http.MethodPut, makeURL(MeshServiceOutputServerURL, name), buff, cmd) }, } @@ -330,7 +330,7 @@ func deleteServiceOutputserverCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodDelete, makeURL(MeshServiceOutputServerPath, args[0]), nil, cmd) + handleRequest(http.MethodDelete, makeURL(MeshServiceOutputServerURL, args[0]), nil, cmd) }, } @@ -351,7 +351,7 @@ func getServiceOutputserverCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodGet, makeURL(MeshServiceOutputServerPath, args[0]), nil, cmd) + handleRequest(http.MethodGet, makeURL(MeshServiceOutputServerURL, args[0]), nil, cmd) }, } @@ -379,7 +379,7 @@ func createServiceTracingCmd() *cobra.Command { Short: "Create an service tracings from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, _ := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPost, makeURL(MeshServiceTracingsPath), buff, cmd) + handleRequest(http.MethodPost, makeURL(MeshServiceTracingsURL), buff, cmd) }, } @@ -395,7 +395,7 @@ func updateServiceTracingCmd() *cobra.Command { Short: "Update an service tracings from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, name := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPut, makeURL(MeshServiceTracingsPath, name), buff, cmd) + handleRequest(http.MethodPut, makeURL(MeshServiceTracingsURL, name), buff, cmd) }, } @@ -418,7 +418,7 @@ func deleteServiceTracingCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodDelete, makeURL(MeshServiceTracingsPath, args[0]), nil, cmd) + handleRequest(http.MethodDelete, makeURL(MeshServiceTracingsURL, args[0]), nil, cmd) }, } @@ -439,7 +439,7 @@ func getServiceTracingCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodGet, makeURL(MeshServiceTracingsPath, args[0]), nil, cmd) + handleRequest(http.MethodGet, makeURL(MeshServiceTracingsURL, args[0]), nil, cmd) }, } @@ -467,7 +467,7 @@ func createServiceMetricCmd() *cobra.Command { Short: "Create an service metrics from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, _ := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPost, makeURL(MeshServiceMetricsPath), buff, cmd) + handleRequest(http.MethodPost, makeURL(MeshServiceMetricsURL), buff, cmd) }, } @@ -483,7 +483,7 @@ func updateServiceMetricCmd() *cobra.Command { Short: "Update an service metrics from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, name := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPut, makeURL(MeshServiceMetricsPath, name), buff, cmd) + handleRequest(http.MethodPut, makeURL(MeshServiceMetricsURL, name), buff, cmd) }, } @@ -506,7 +506,7 @@ func deleteServiceMetricCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodDelete, makeURL(MeshServiceMetricsPath, args[0]), nil, cmd) + handleRequest(http.MethodDelete, makeURL(MeshServiceMetricsURL, args[0]), nil, cmd) }, } @@ -527,7 +527,7 @@ func getServiceMetricCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodGet, makeURL(MeshServiceMetricsPath, args[0]), nil, cmd) + handleRequest(http.MethodGet, makeURL(MeshServiceMetricsURL, args[0]), nil, cmd) }, } diff --git a/cmd/client/command/mesh_tenant.go b/cmd/client/command/mesh_tenant.go index f52f030b41..d8cab8f1d4 100644 --- a/cmd/client/command/mesh_tenant.go +++ b/cmd/client/command/mesh_tenant.go @@ -26,7 +26,7 @@ func createTenantCmd() *cobra.Command { Short: "Create an tenant from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, _ := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPost, makeURL(MeshTenantPath), buff, cmd) + handleRequest(http.MethodPost, makeURL(MeshTenantsURL), buff, cmd) }, } @@ -42,7 +42,7 @@ func updateTenantCmd() *cobra.Command { Short: "Update an tenant from a yaml file or stdin", Run: func(cmd *cobra.Command, args []string) { buff, name := readFromFileOrStdin(specFile, cmd) - handleRequest(http.MethodPut, makeURL(MeshTenantPath, name), buff, cmd) + handleRequest(http.MethodPut, makeURL(MeshTenantURL, name), buff, cmd) }, } @@ -65,7 +65,7 @@ func deleteTenantCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodDelete, makeURL(MeshTenantPath, args[0]), nil, cmd) + handleRequest(http.MethodDelete, makeURL(MeshTenantURL, args[0]), nil, cmd) }, } @@ -86,7 +86,7 @@ func getTenantCmd() *cobra.Command { }, Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodGet, makeURL(MeshTenantPath, args[0]), nil, cmd) + handleRequest(http.MethodGet, makeURL(MeshTenantURL, args[0]), nil, cmd) }, } @@ -99,7 +99,7 @@ func listTenantsCmd() *cobra.Command { Short: "List all tenants", Example: "egctl mesh tenant list", Run: func(cmd *cobra.Command, args []string) { - handleRequest(http.MethodGet, makeURL(MeshTenantPrefix), nil, cmd) + handleRequest(http.MethodGet, makeURL(MeshTenantsURL), nil, cmd) }, }