-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ref/cli queries update #337
Conversation
Reviewer's Guide by SourceryThis PR adds new GraphQL queries and mutations for managing service bindings and intercepts in the CLI. The changes introduce functionality to list services, create service intercepts, and delete service intercepts. Sequence diagram for CLI service managementsequenceDiagram
actor User
participant CLI
participant GraphQLServer
User->>CLI: Execute listServices
CLI->>GraphQLServer: Core_listServiceBindings
GraphQLServer-->>CLI: Return service bindings
CLI-->>User: Display service list
User->>CLI: Execute createServiceIntercept
CLI->>GraphQLServer: Core_createServiceIntercept
GraphQLServer-->>CLI: Confirm intercept creation
CLI-->>User: Confirm intercept created
User->>CLI: Execute deleteServiceIntercept
CLI->>GraphQLServer: Core_deleteServiceIntercept
GraphQLServer-->>CLI: Confirm intercept deletion
CLI-->>User: Confirm intercept deleted
Class diagram for GraphQL service operationsclassDiagram
class ServiceBinding {
String accountName
String apiVersion
String clusterName
String creationTime
String environmentName
String id
InterceptStatus interceptStatus
String kind
Boolean markedForDeletion
Metadata metadata
String recordVersion
Spec spec
Status status
String updateTime
}
class InterceptStatus {
Boolean intercepted
PortMapping[] portMappings
String toAddr
}
class Metadata {
Map annotations
String creationTimestamp
String deletionTimestamp
Integer generation
Map labels
String name
String namespace
}
class Spec {
String globalIP
String hostname
Port[] ports
String serviceIP
ServiceRef serviceRef
}
class Status {
CheckList[] checkList
Boolean checks
Boolean isReady
Integer lastReadyGeneration
String lastReconcileTime
Message message
Resource[] resources
}
class PortMapping {
Integer containerPort
Integer servicePort
}
class Port {
String appProtocol
String name
Integer nodePort
Integer port
String protocol
TargetPort targetPort
}
class TargetPort {
Integer IntVal
String StrVal
String Type
}
class ServiceRef {
String name
String namespace
}
class CheckList {
Boolean debug
String description
Boolean hide
String name
String title
}
class Message {
String RawMessage
}
class Resource {
String apiVersion
String kind
String name
String namespace
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @nxtCoder19 - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@@ -487,6 +487,144 @@ export const cliQueries = (executor: IExecutor) => ({ | |||
} | |||
), | |||
|
|||
cli_listServices: executor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (complexity): Consider extracting common GraphQL fields into reusable fragments to improve code organization
The GraphQL queries could be simplified by extracting common Kubernetes patterns into reusable fragments. This would reduce duplication while maintaining all functionality. For example:
fragment K8sMetadata on Metadata {
annotations
creationTimestamp
deletionTimestamp
generation
labels
name
namespace
}
fragment PortMapping on PortMapping {
containerPort
servicePort
}
fragment ServiceStatus on Status {
isReady
lastReadyGeneration
lastReconcileTime
message {
RawMessage
}
}
query Core_listServiceBindings(
$envName: String!
$pagination: CursorPaginationIn
) {
core_listServiceBindings(envName: $envName, pagination: $pagination) {
edges {
cursor
node {
metadata { ...K8sMetadata }
interceptStatus {
intercepted
portMappings { ...PortMapping }
toAddr
}
status { ...ServiceStatus }
# ... other fields
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
This approach:
- Reduces duplicate field definitions
- Makes schema changes easier to maintain
- Keeps queries more readable
- Allows reuse across multiple queries
Summary by Sourcery
New Features: