Add organizational agent-cluster-mapping mutations
Issue: GraphQL API Layer to support management of orga... (#513368 - closed)
What does this MR do and why?
This MR exposes the domain logic for users to manage organization cluster agent mappings via graphQL endpoints.
References
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
How to set up and validate locally
prereq: Have workspaces setup on your machine with GDK.
Create mutation
In the GDK query explorer, run the following query to create an organizational mapping:
mutation($clusterid:ClustersAgentID! ,$orgid: OrganizationsOrganizationID!){
organizationCreateClusterAgentMapping(input:{clusterAgentId:$clusterid,organizationId:$orgid}){
errors
}
}
# where clusterid and orgid are the cluster-agent and organizationIDs respectively
It should return a response with no error, triggering the mutation a second time should yield the error Organization cluster agent mapping already exists
In the rails console, looking up the mapping created for that agent like so : RemoteDevelopment::OrganizationClusterAgentMapping.for_agents(agent_id)
should provide a valid mapping
Delete mutation
In the GDK query explorer, run the following query to delete an organizational mapping:
mutation($clusterid:ClustersAgentID! ,$orgid: OrganizationsOrganizationID!){
organizationDeleteClusterAgentMapping(input:{clusterAgentId:$clusterid,organizationId:$orgid}){
errors
}
}
# where clusterid and orgid are the cluster-agent and organizationIDs respectively
It should return a response with no error, triggering the mutation a second time should yield the error Organization cluster agent mapping not found
In the rails console, looking up the mapping created for that agent like so: RemoteDevelopment::OrganizationClusterAgentMapping.for_agents(agent_id)
should provide no result