github.com/polarismesh/polaris@v1.17.8/service/api_v1.go (about) 1 /** 2 * Tencent is pleased to support the open source community by making Polaris available. 3 * 4 * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 5 * 6 * Licensed under the BSD 3-Clause License (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * https://opensource.org/licenses/BSD-3-Clause 11 * 12 * Unless required by applicable law or agreed to in writing, software distributed 13 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 14 * CONDITIONS OF ANY KIND, either express or implied. See the License for the 15 * specific language governing permissions and limitations under the License. 16 */ 17 18 package service 19 20 import ( 21 "context" 22 23 apifault "github.com/polarismesh/specification/source/go/api/v1/fault_tolerance" 24 apiservice "github.com/polarismesh/specification/source/go/api/v1/service_manage" 25 apitraffic "github.com/polarismesh/specification/source/go/api/v1/traffic_manage" 26 27 "github.com/polarismesh/polaris/common/api/l5" 28 "github.com/polarismesh/polaris/common/model" 29 ) 30 31 // CircuitBreakerOperateServer Melting rule related treatment 32 type CircuitBreakerOperateServer interface { 33 34 // CreateCircuitBreakers Create a CircuitBreaker rule 35 // Deprecated: not support from 1.14.x 36 CreateCircuitBreakers(ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse 37 38 // CreateCircuitBreakerVersions Create a melt rule version 39 // Deprecated: not support from 1.14.x 40 CreateCircuitBreakerVersions(ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse 41 42 // DeleteCircuitBreakers Delete CircuitBreaker rules 43 // Deprecated: not support from 1.14.x 44 DeleteCircuitBreakers(ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse 45 46 // UpdateCircuitBreakers Modify the CircuitBreaker rule 47 // Deprecated: not support from 1.14.x 48 UpdateCircuitBreakers(ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse 49 50 // ReleaseCircuitBreakers Release CircuitBreaker rule 51 // Deprecated: not support from 1.14.x 52 ReleaseCircuitBreakers(ctx context.Context, req []*apiservice.ConfigRelease) *apiservice.BatchWriteResponse 53 54 // UnBindCircuitBreakers Solution CircuitBreaker rule 55 // Deprecated: not support from 1.14.x 56 UnBindCircuitBreakers(ctx context.Context, req []*apiservice.ConfigRelease) *apiservice.BatchWriteResponse 57 58 // GetCircuitBreaker Get CircuitBreaker regular according to ID and VERSION 59 // Deprecated: not support from 1.14.x 60 GetCircuitBreaker(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse 61 62 // GetCircuitBreakerVersions Query all versions of the CircuitBreaker rule 63 // Deprecated: not support from 1.14.x 64 GetCircuitBreakerVersions(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse 65 66 // GetMasterCircuitBreakers Query Master CircuitBreaker rules 67 // Deprecated: not support from 1.14.x 68 GetMasterCircuitBreakers(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse 69 70 // GetReleaseCircuitBreakers Query the released CircuitBreaker rule according to the rule ID 71 // Deprecated: not support from 1.14.x 72 GetReleaseCircuitBreakers(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse 73 74 // GetCircuitBreakerByService Binding CircuitBreaker rule based on service query 75 // Deprecated: not support from 1.14.x 76 GetCircuitBreakerByService(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse 77 78 // GetCircuitBreakerToken Get CircuitBreaker rules token 79 // Deprecated: not support from 1.14.x 80 GetCircuitBreakerToken(ctx context.Context, req *apifault.CircuitBreaker) *apiservice.Response 81 82 // CreateCircuitBreakerRules Create a CircuitBreaker rule 83 CreateCircuitBreakerRules(ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse 84 85 // DeleteCircuitBreakerRules Delete current CircuitBreaker rules 86 DeleteCircuitBreakerRules(ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse 87 88 // EnableCircuitBreakerRules Enable the CircuitBreaker rule 89 EnableCircuitBreakerRules(ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse 90 91 // UpdateCircuitBreakerRules Modify the CircuitBreaker rule 92 UpdateCircuitBreakerRules(ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse 93 94 // GetCircuitBreakerRules Query CircuitBreaker rules 95 GetCircuitBreakerRules(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse 96 } 97 98 // RateLimitOperateServer Lamflow rule related operation 99 type RateLimitOperateServer interface { 100 101 // CreateRateLimits Create a RateLimit rule 102 CreateRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse 103 104 // DeleteRateLimits Delete current RateLimit rules 105 DeleteRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse 106 107 // EnableRateLimits Enable the RateLimit rule 108 EnableRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse 109 110 // UpdateRateLimits Modify the RateLimit rule 111 UpdateRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse 112 113 // GetRateLimits Query RateLimit rules 114 GetRateLimits(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse 115 } 116 117 // RouteRuleOperateServer Routing rules related operations 118 type RouteRuleOperateServer interface { 119 // CreateRoutingConfigs Batch creation routing configuration 120 CreateRoutingConfigs(ctx context.Context, req []*apitraffic.Routing) *apiservice.BatchWriteResponse 121 122 // DeleteRoutingConfigs Batch delete routing configuration 123 DeleteRoutingConfigs(ctx context.Context, req []*apitraffic.Routing) *apiservice.BatchWriteResponse 124 125 // UpdateRoutingConfigs Batch update routing configuration 126 UpdateRoutingConfigs(ctx context.Context, req []*apitraffic.Routing) *apiservice.BatchWriteResponse 127 128 // GetRoutingConfigs Inquiry route configuration to OSS 129 GetRoutingConfigs(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse 130 } 131 132 // ServiceOperateServer Service related operations 133 type ServiceOperateServer interface { 134 135 // CreateServices Batch creation service 136 CreateServices(ctx context.Context, req []*apiservice.Service) *apiservice.BatchWriteResponse 137 138 // DeleteServices Batch delete service 139 DeleteServices(ctx context.Context, req []*apiservice.Service) *apiservice.BatchWriteResponse 140 141 // UpdateServices Batch update service 142 UpdateServices(ctx context.Context, req []*apiservice.Service) *apiservice.BatchWriteResponse 143 144 // UpdateServiceToken Update service token 145 UpdateServiceToken(ctx context.Context, req *apiservice.Service) *apiservice.Response 146 147 // GetServices Get a list of service 148 GetServices(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse 149 150 // GetAllServices Get all service list 151 GetAllServices(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse 152 153 // GetServicesCount Total number of services 154 GetServicesCount(ctx context.Context) *apiservice.BatchQueryResponse 155 156 // GetServiceToken Get service token 157 GetServiceToken(ctx context.Context, req *apiservice.Service) *apiservice.Response 158 159 // GetServiceOwner Owner for obtaining service 160 GetServiceOwner(ctx context.Context, req []*apiservice.Service) *apiservice.BatchQueryResponse 161 } 162 163 // ServiceAliasOperateServer Service alias related operations 164 type ServiceAliasOperateServer interface { 165 166 // CreateServiceAlias Create a service alias 167 CreateServiceAlias(ctx context.Context, req *apiservice.ServiceAlias) *apiservice.Response 168 169 // DeleteServiceAliases Batch delete service alias 170 DeleteServiceAliases(ctx context.Context, req []*apiservice.ServiceAlias) *apiservice.BatchWriteResponse 171 172 // UpdateServiceAlias Update service alias 173 UpdateServiceAlias(ctx context.Context, req *apiservice.ServiceAlias) *apiservice.Response 174 175 // GetServiceAliases Get a list of service alias 176 GetServiceAliases(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse 177 } 178 179 // InstanceOperateServer Example related operations 180 type InstanceOperateServer interface { 181 182 // CreateInstances Batch creation instance 183 CreateInstances(ctx context.Context, reqs []*apiservice.Instance) *apiservice.BatchWriteResponse 184 185 // DeleteInstances Batch delete instance 186 DeleteInstances(ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse 187 188 // DeleteInstancesByHost Delete instance according to HOST information batch 189 DeleteInstancesByHost(ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse 190 191 // UpdateInstances Batch update instance 192 UpdateInstances(ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse 193 194 // UpdateInstancesIsolate Batch update instance isolation state 195 UpdateInstancesIsolate(ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse 196 197 // GetInstances Get an instance list 198 GetInstances(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse 199 200 // GetInstancesCount Get an instance quantity 201 GetInstancesCount(ctx context.Context) *apiservice.BatchQueryResponse 202 203 // GetInstanceLabels Get an instance tag under a service 204 GetInstanceLabels(ctx context.Context, query map[string]string) *apiservice.Response 205 } 206 207 // ClientServer Client related operation Client operation interface definition 208 type ClientServer interface { 209 210 // RegisterInstance create one instance by client 211 RegisterInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response 212 213 // DeregisterInstance delete onr instance by client 214 DeregisterInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response 215 216 // ReportClient Client gets geographic location information 217 ReportClient(ctx context.Context, req *apiservice.Client) *apiservice.Response 218 219 // GetPrometheusTargets Used to obtain the ReportClient information and serve as the SD result of Prometheus 220 GetPrometheusTargets(ctx context.Context, query map[string]string) *model.PrometheusDiscoveryResponse 221 222 // GetServiceWithCache Used for client acquisition service information 223 GetServiceWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse 224 225 // ServiceInstancesCache Used for client acquisition service instance information 226 ServiceInstancesCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse 227 228 // GetRoutingConfigWithCache User Client Get Service Routing Configuration Information 229 GetRoutingConfigWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse 230 231 // GetRateLimitWithCache User Client Get Service Limit Configuration Information 232 GetRateLimitWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse 233 234 // GetCircuitBreakerWithCache Fuse configuration information for obtaining services for clients 235 GetCircuitBreakerWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse 236 237 // GetFaultDetectWithCache User Client Get FaultDetect Rule Information 238 GetFaultDetectWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse 239 240 // UpdateInstance update one instance by client 241 UpdateInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response 242 } 243 244 // L5OperateServer L5 related operations 245 type L5OperateServer interface { 246 247 // SyncByAgentCmd Get routing information according to SID list 248 SyncByAgentCmd(ctx context.Context, sbac *l5.Cl5SyncByAgentCmd) (*l5.Cl5SyncByAgentAckCmd, error) 249 250 // RegisterByNameCmd Look for the corresponding SID list according to the list of service names 251 RegisterByNameCmd(rbnc *l5.Cl5RegisterByNameCmd) (*l5.Cl5RegisterByNameAckCmd, error) 252 } 253 254 // ReportClientOperateServer Report information operation interface on the client 255 type ReportClientOperateServer interface { 256 // GetReportClients Query the client information reported 257 GetReportClients(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse 258 } 259 260 // RouterRuleOperateServer Routing rules related operations 261 type RouterRuleOperateServer interface { 262 // CreateRoutingConfigsV2 Batch creation routing configuration 263 CreateRoutingConfigsV2(ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse 264 // DeleteRoutingConfigsV2 Batch delete routing configuration 265 DeleteRoutingConfigsV2(ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse 266 // UpdateRoutingConfigsV2 Batch update routing configuration 267 UpdateRoutingConfigsV2(ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse 268 // QueryRoutingConfigsV2 Inquiry route configuration to OSS 269 QueryRoutingConfigsV2(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse 270 // EnableRoutings batch enable routing rules 271 EnableRoutings(ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse 272 } 273 274 // FaultDetectRuleOperateServer Fault detect rules related operations 275 type FaultDetectRuleOperateServer interface { 276 // CreateFaultDetectRules create the fault detect rule by request 277 CreateFaultDetectRules(ctx context.Context, request []*apifault.FaultDetectRule) *apiservice.BatchWriteResponse 278 // DeleteFaultDetectRules delete the fault detect rule by request 279 DeleteFaultDetectRules(ctx context.Context, request []*apifault.FaultDetectRule) *apiservice.BatchWriteResponse 280 // UpdateFaultDetectRules update the fault detect rule by request 281 UpdateFaultDetectRules(ctx context.Context, request []*apifault.FaultDetectRule) *apiservice.BatchWriteResponse 282 // GetFaultDetectRules get the fault detect rule by request 283 GetFaultDetectRules(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse 284 } 285 286 type DiscoverServerV1 interface { 287 // CircuitBreakerOperateServer Fuse rule operation interface definition 288 CircuitBreakerOperateServer 289 // RateLimitOperateServer Lamflow rule operation interface definition 290 RateLimitOperateServer 291 // RouteRuleOperateServer Routing rules operation interface definition 292 RouteRuleOperateServer 293 // RouterRuleOperateServer Routing rules operation interface definition 294 RouterRuleOperateServer 295 // FaultDetectRuleOperateServer fault detect rules operation interface definition 296 FaultDetectRuleOperateServer 297 }