Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pluralsh/console-client-go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.0.81
Choose a base ref
...
head repository: pluralsh/console-client-go
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.0.82
Choose a head ref
  • 2 commits
  • 4 files changed
  • 2 contributors

Commits on Jan 30, 2024

  1. change main

    zreigz committed Jan 30, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f9ea08c View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8e95088 View commit details
Showing with 476 additions and 6 deletions.
  1. +378 −0 client.go
  2. +5 −5 example/main.go
  3. +70 −0 graph/git.graphql
  4. +23 −1 graph/models.graphql
378 changes: 378 additions & 0 deletions client.go
10 changes: 5 additions & 5 deletions example/main.go
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ type authedTransport struct {
}

func (t *authedTransport) RoundTrip(req *http.Request) (*http.Response, error) {
req.Header.Set("Authorization", "Token "+t.key)
req.Header.Set("Authorization", "Bearer "+t.key)
return t.wrapped.RoundTrip(req)
}

@@ -28,19 +28,19 @@ func main() {
}
}()

key := "deploy-h89xne0p2efknbud7n26nzc2rym9anhwppj3mifwrc2bzyiafe"
key := "PASTE YOUR KEY HERE FROM https://app.plural.sh/profile/tokens"

httpClient := http.Client{
Transport: &authedTransport{
key: key,
wrapped: http.DefaultTransport,
},
}
graphqlClient := gqlclient.NewClient(&httpClient, "https://console.cdaws.onplural.sh/gql/ext")
meResp, err := graphqlClient.ListClusterRestore(context.Background(), "daa2b5f7-a0e7-4e11-896a-6e5389b3d8aa")
graphqlClient := gqlclient.NewClient(&httpClient, "https://app.plural.sh/gql")
meResp, err := graphqlClient.MyCluster(context.Background())
if err != nil {
return
}
fmt.Println("my cluster", meResp)
fmt.Println("my cluster", meResp.MyCluster.Name)

}
70 changes: 70 additions & 0 deletions graph/git.graphql
Original file line number Diff line number Diff line change
@@ -29,3 +29,73 @@ query GetGitRepository($id: ID, $url: String) {
...GitRepositoryFragment
}
}

query GetScmConnection($id: ID, $name: String) {
scmConnection(id: $id, name: $name) {
...ScmConnectionFragment
}
}

query ListScmConnections($cursor: String, $before: String, $last: Int) {
scmConnections(after: $cursor, first: 100, before: $before, last: $last) {
edges {
node {
...ScmConnectionFragment
}
cursor
}
}
}

mutation CreateScmConnection($attributes: ScmConnectionAttributes!) {
createScmConnection(attributes: $attributes) {
...ScmConnectionFragment
}
}

mutation UpdateScmConnection($id: ID!, $attributes: ScmConnectionAttributes!) {
updateScmConnection(id: $id, attributes: $attributes) {
...ScmConnectionFragment
}
}

mutation DeleteScmConnection($id: ID!) {
deleteScmConnection(id: $id) {
...ScmConnectionFragment
}
}

query GetPrAutomation($id: ID, $name: String) {
prAutomation(id: $id, name: $name) {
...PrAutomationFragment
}
}

query ListPrAutomations($cursor: String, $before: String, $last: Int) {
prAutomations(after: $cursor, first: 100, before: $before, last: $last) {
edges {
node {
...PrAutomationFragment
}
cursor
}
}
}

mutation CreatePrAutomation($attributes: PrAutomationAttributes!) {
createPrAutomation(attributes: $attributes) {
...PrAutomationFragment
}
}

mutation UpdatePrAutomation($id: ID!, $attributes: PrAutomationAttributes!) {
updatePrAutomation(id: $id, attributes: $attributes) {
...PrAutomationFragment
}
}

mutation DeletePrAutomation($id: ID!) {
deletePrAutomation(id: $id) {
...PrAutomationFragment
}
}
24 changes: 23 additions & 1 deletion graph/models.graphql
Original file line number Diff line number Diff line change
@@ -322,4 +322,26 @@ fragment ClusterRestoreFragment on ClusterRestore {
id
status
backup { ... ClusterBackupFragment}
}
}

fragment ScmConnectionFragment on ScmConnection {
id
name
apiUrl
baseUrl
type
username
insertedAt
updatedAt
}

fragment PrAutomationFragment on PrAutomation {
id
name
title
addon
message
identifier
insertedAt
updatedAt
}