11//
22// DISCLAIMER
33//
4- // Copyright 2020-2021 ArangoDB GmbH, Cologne, Germany
4+ // Copyright 2020-2023 ArangoDB GmbH, Cologne, Germany
55//
66// Licensed under the Apache License, Version 2.0 (the "License");
77// you may not use this file except in compliance with the License.
1717//
1818// Copyright holder is ArangoDB GmbH, Cologne, Germany
1919//
20- // Author Joerg Schad
21- // Author Gergely Brautigam
22- // Author Robert Stam
23- //
2420
2521package provider
2622
@@ -33,11 +29,12 @@ import (
3329 "google.golang.org/grpc/credentials"
3430
3531 "github.com/arangodb-managed/apis/common/auth"
32+ commonGrpc "github.com/arangodb-managed/apis/common/v1/grpc"
3633 iam "github.com/arangodb-managed/apis/iam/v1"
3734 lh "github.com/arangodb-managed/log-helper"
3835)
3936
40- // Client is responsible for connecting to the Oasis API
37+ // Client is responsible for connecting to the Arango Graph API
4138type Client struct {
4239 ApiKeyID string
4340 ApiKeySecret string
@@ -50,7 +47,7 @@ type Client struct {
5047 log zerolog.Logger
5148}
5249
53- // Connect connects to oasis api
50+ // Connect connects to Arango Graph API
5451func (c * Client ) Connect () error {
5552 ctx := context .Background ()
5653 c .log = lh .MustNew (lh .DefaultConfig ())
@@ -66,18 +63,21 @@ func (c *Client) Connect() error {
6663 c .log .Error ().Err (err ).Msg ("Could not get Auth Token" )
6764 return err
6865 }
69-
70- c .ctxWithToken = auth .WithAccessToken (ctx , token )
66+ // Add Access Token
67+ ctxWithToken := auth .WithAccessToken (ctx , token )
68+ // Add the User Agent as well
69+ ua := commonGrpc .CreateUserAgent ("terraform-provider-oasis" , currentVersion )
70+ c .ctxWithToken = commonGrpc .WithUserAgent (ctxWithToken , ua )
7171 return nil
7272}
7373
74- // mustDialAPI dials the ArangoDB Oasis API
74+ // mustDialAPI dials the Arango Graph API
7575func (c * Client ) mustDialAPI () (* grpc.ClientConn , error ) {
7676 // Set up a connection to the server.
7777 tc := credentials .NewTLS (& tls.Config {})
7878 conn , err := grpc .Dial (c .ApiEndpoint + c .ApiPortSuffix , grpc .WithTransportCredentials (tc ))
7979 if err != nil {
80- c .log .Error ().Err (err ).Msg ("Failed to connect to ArangoDB Oasis API" )
80+ c .log .Error ().Err (err ).Msg ("Failed to connect to Arango Graph API" )
8181 return nil , err
8282 }
8383 return conn , nil
0 commit comments