github.com/Axway/agent-sdk@v1.1.101/pkg/apic/definitions.go (about) 1 package apic 2 3 import ( 4 "sync" 5 6 cache2 "github.com/Axway/agent-sdk/pkg/agent/cache" 7 "github.com/Axway/agent-sdk/pkg/util/log" 8 9 coreapi "github.com/Axway/agent-sdk/pkg/api" 10 "github.com/Axway/agent-sdk/pkg/apic/auth" 11 "github.com/Axway/agent-sdk/pkg/cache" 12 corecfg "github.com/Axway/agent-sdk/pkg/config" 13 ) 14 15 // Various consts for use 16 const ( 17 API = "API" 18 Wsdl = "wsdl" 19 SwaggerV2 = "swaggerv2" 20 Oas2 = "oas2" 21 Oas3 = "oas3" 22 Protobuf = "protobuf" 23 AsyncAPI = "asyncapi" 24 Unstructured = "unstructured" 25 Specification = "specification" 26 Swagger = "swagger" 27 GraphQL = "graphql-sdl" 28 Raml = "RAML" 29 30 SubscriptionSchemaNameSuffix = ".authsubscription" 31 DefaultSubscriptionWebhookName = "subscriptionwebhook" 32 DefaultSubscriptionWebhookAuthKey = "webhookAuthKey" 33 34 FieldsKey = "fields" 35 QueryKey = "query" 36 37 CreateTimestampQueryKey = "metadata.audit.createTimestamp" 38 39 DefaultTeamKey = "DefaultTeam" 40 ) 41 42 // consts for dataplane type 43 type DataplaneType string 44 45 const ( 46 // Discovery only 47 GitHub DataplaneType = "GitHub" 48 GitLab DataplaneType = "GitLab" 49 SwaggerHub DataplaneType = "SwaggerHub" 50 Backstage DataplaneType = "Backstage" 51 52 // Discovery and Traceability 53 APIConnect DataplaneType = "APIConnect" 54 Apigee DataplaneType = "Apigee" 55 APIM DataplaneType = "APIM" 56 AWS DataplaneType = "AWS" 57 Azure DataplaneType = "Azure" 58 Istio DataplaneType = "Istio" // Reports as APIMG 59 Kafka DataplaneType = "Kafka" 60 WebMethods DataplaneType = "WebMethods" 61 62 // AgentSDK Metrics 63 Kong DataplaneType = "Kong" 64 Mulesoft DataplaneType = "Mulesoft" 65 66 // Compliance 67 Graylog DataplaneType = "Graylog" 68 Traceable DataplaneType = "Traceable" 69 70 // Other 71 Unclassified DataplaneType = "Unclassified" 72 Unidentified DataplaneType = "Unidentified" 73 ) 74 75 func (t DataplaneType) String() string { 76 return string(t) 77 } 78 79 // consts for state 80 const ( 81 UnpublishedState = "UNPUBLISHED" 82 PublishedState = "PUBLISHED" 83 ApprovalPendingState = "PENDING" 84 ) 85 86 // consts for status 87 const ( 88 DeprecatedStatus = "DEPRECATED" 89 PublishedStatus = "PUBLISHED" 90 UnpublishedStatus = "UNPUBLISHED" 91 UnidentifiedInboundPolicy = "UNIDENTIFIED INBOUND POLICY" 92 ) 93 94 // consts for update serverity 95 const ( 96 MajorChange = "MAJOR" 97 MinorChange = "MINOR" 98 ) 99 100 // consts for RAML versions 101 const ( 102 Raml08 = "RAML 0.8" 103 Raml10 = "RAML 1.0" 104 ) 105 106 type serviceContext struct { 107 serviceName string 108 serviceID string 109 serviceAction actionType 110 revisionName string 111 revisionCount int 112 instanceName string 113 updateServiceSource bool 114 updateInstanceSource bool 115 } 116 117 // EndpointDefinition - holds the service endpoint definition 118 type EndpointDefinition struct { 119 Host string 120 Port int32 121 Protocol string 122 BasePath string 123 Details map[string]interface{} 124 } 125 126 // APIError - api response error 127 type APIError struct { 128 Status int `json:"status,omitempty"` 129 Title string `json:"title,omitempty"` 130 Detail string `json:"detail,omitempty"` 131 } 132 133 // ResponseError - api response errors 134 type ResponseError struct { 135 Errors []APIError `json:"errors,omitempty"` 136 } 137 138 // UnstructuredProperties - 139 type UnstructuredProperties struct { 140 AssetType string 141 ContentType string 142 Label string 143 Filename string 144 } 145 146 // ServiceClient - 147 type ServiceClient struct { 148 tokenRequester auth.TokenGetter 149 cfg corecfg.CentralConfig 150 apiClient coreapi.Client 151 caches cache2.Manager 152 subscriptionSchemaCache cache.Cache 153 DefaultSubscriptionApprovalWebhook corecfg.WebhookConfig 154 subscriptionRegistrationLock sync.Mutex 155 logger log.FieldLogger 156 pageSizes map[string]int 157 pageSizeMutex *sync.Mutex 158 } 159 160 // APIServerInfoProperty - 161 type APIServerInfoProperty struct { 162 Name string `json:"name,omitempty"` 163 ID string `json:"id,omitempty"` 164 } 165 166 // APIServerInfo - 167 type APIServerInfo struct { 168 Environment APIServerInfoProperty `json:"environment,omitempty"` 169 }