ProvisionGraphWithAgent returns provision responses that will mock a fake "aws_instance" resource with an agent that has the given auth token.
(authToken string, muts ...func(g *proto.GraphComplete))
| 47 | // ProvisionGraphWithAgent returns provision responses that will mock a fake |
| 48 | // "aws_instance" resource with an agent that has the given auth token. |
| 49 | func ProvisionGraphWithAgent(authToken string, muts ...func(g *proto.GraphComplete)) []*proto.Response { |
| 50 | gc := &proto.GraphComplete{ |
| 51 | Resources: []*proto.Resource{{ |
| 52 | Name: "example", |
| 53 | Type: "aws_instance", |
| 54 | Agents: []*proto.Agent{{ |
| 55 | Id: uuid.NewString(), |
| 56 | Name: "example", |
| 57 | Auth: &proto.Agent_Token{ |
| 58 | Token: authToken, |
| 59 | }, |
| 60 | }}, |
| 61 | }}, |
| 62 | } |
| 63 | for _, mut := range muts { |
| 64 | mut(gc) |
| 65 | } |
| 66 | |
| 67 | return []*proto.Response{{ |
| 68 | Type: &proto.Response_Graph{ |
| 69 | Graph: gc, |
| 70 | }, |
| 71 | }} |
| 72 | } |
| 73 | |
| 74 | var ( |
| 75 | // ParseComplete is a helper to indicate an empty parse completion. |
no outgoing calls