Skip to content

Commit c15107e

Browse files
committed
Update graph API references and comments
1 parent 2fba1e2 commit c15107e

File tree

7 files changed

+76
-8
lines changed

7 files changed

+76
-8
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// github_api_handler.go
2+
package github
3+
4+
import "github.com/deploymenttheory/go-api-http-client/logger"
5+
6+
// GitHubHandler implements the APIHandler interface for the GitHub API.
7+
type GitHubAPIHandler struct {
8+
OverrideBaseDomain string // OverrideBaseDomain is used to override the base domain for URL construction.
9+
InstanceName string // InstanceName is the name of the GitHub instance.
10+
Logger logger.Logger // Logger is the structured logger used for logging.
11+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// github_handler_constants.go
2+
package github
3+
4+
// Endpoint constants represent the URL suffixes used for GitHub token interactions.
5+
const (
6+
APIName = "github" // APIName: represents the name of the API.
7+
DefaultBaseDomain = "api.github.com" // DefaultBaseDomain: represents the base domain for the github instance.
8+
OAuthTokenEndpoint = "github.com/login/oauth/access_token" // OAuthTokenEndpoint: The endpoint to obtain an OAuth token.
9+
BearerTokenEndpoint = "" // BearerTokenEndpoint: The endpoint to obtain a bearer token.
10+
TokenRefreshEndpoint = "github.com/login/oauth/access_token" // TokenRefreshEndpoint: The endpoint to refresh an existing token.
11+
TokenInvalidateEndpoint = "api.github.com/applications/:client_id/token" // TokenInvalidateEndpoint: The endpoint to invalidate an active token.
12+
BearerTokenAuthenticationSupport = false // BearerTokenAuthSuppport: A boolean to indicate if the API supports bearer token authentication.
13+
OAuthAuthenticationSupport = true // OAuthAuthSuppport: A boolean to indicate if the API supports OAuth authentication.
14+
OAuthWithCertAuthenticationSupport = true // OAuthWithCertAuthSuppport: A boolean to indicate if the API supports OAuth with client certificate authentication.
15+
)
16+
17+
// GetDefaultBaseDomain returns the default base domain used for constructing API URLs to the http client.
18+
func (g *GitHubAPIHandler) GetDefaultBaseDomain() string {
19+
return DefaultBaseDomain
20+
}
21+
22+
// GetOAuthTokenEndpoint returns the endpoint for obtaining an OAuth token. Used for constructing API URLs for the http client.
23+
func (g *GitHubAPIHandler) GetOAuthTokenEndpoint() string {
24+
return OAuthTokenEndpoint
25+
}
26+
27+
// GetBearerTokenEndpoint returns the endpoint for obtaining a bearer token. Used for constructing API URLs for the http client.
28+
func (g *GitHubAPIHandler) GetBearerTokenEndpoint() string {
29+
return BearerTokenEndpoint
30+
}
31+
32+
// GetTokenRefreshEndpoint returns the endpoint for refreshing an existing token. Used for constructing API URLs for the http client.
33+
func (g *GitHubAPIHandler) GetTokenRefreshEndpoint() string {
34+
return TokenRefreshEndpoint
35+
}
36+
37+
// GetTokenInvalidateEndpoint returns the endpoint for invalidating an active token. Used for constructing API URLs for the http client.
38+
func (g *GitHubAPIHandler) GetTokenInvalidateEndpoint() string {
39+
return TokenInvalidateEndpoint
40+
}
41+
42+
// GetAPIBearerTokenAuthenticationSupportStatus returns a boolean indicating if bearer token authentication is supported in the api handler.
43+
func (g *GitHubAPIHandler) GetAPIBearerTokenAuthenticationSupportStatus() bool {
44+
return BearerTokenAuthenticationSupport
45+
}
46+
47+
// GetAPIOAuthAuthenticationSupportStatus returns a boolean indicating if OAuth authentication is supported in the api handler.
48+
func (g *GitHubAPIHandler) GetAPIOAuthAuthenticationSupportStatus() bool {
49+
return OAuthAuthenticationSupport
50+
}
51+
52+
// GetAPIOAuthWithCertAuthenticationSupportStatus returns a boolean indicating if OAuth with client certificate authentication is supported in the api handler.
53+
func (g *GitHubAPIHandler) GetAPIOAuthWithCertAuthenticationSupportStatus() bool {
54+
return OAuthWithCertAuthenticationSupport
55+
}

apihandlers/graph/graph_api_exceptions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ func init() {
3434
// Load the default configuration from an embedded resource.
3535
err := loadAPIExceptionsConfiguration()
3636
if err != nil {
37-
log.Fatalf("Error loading Jamf Pro API exceptions configuration: %s", err)
37+
log.Fatalf("Error loading Microsoft Graph API exceptions configuration: %s", err)
3838
}
3939
}
4040

41-
// loadAPIExceptionsConfiguration reads and unmarshals the jamfpro_api_exceptions_configuration JSON data from an embedded file
41+
// loadAPIExceptionsConfiguration reads and unmarshals the graph_api_exceptions_configuration JSON data from an embedded file
4242
// into the configMap variable, which holds the exceptions configuration for endpoint-specific headers.
4343
func loadAPIExceptionsConfiguration() error {
4444
// Unmarshal the embedded default configuration into the global configMap.

apihandlers/graph/graph_api_handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package graph
33

44
import "github.com/deploymenttheory/go-api-http-client/logger"
55

6-
// GraphAPIHandler implements the APIHandler interface for the Jamf Pro API.
6+
// GraphAPIHandler implements the APIHandler interface for the graph Pro API.
77
type GraphAPIHandler struct {
88
OverrideBaseDomain string // OverrideBaseDomain is used to override the base domain for URL construction.
9-
InstanceName string // InstanceName is the name of the Jamf instance.
9+
InstanceName string // InstanceName is the name of the graph instance.
1010
Logger logger.Logger // Logger is the structured logger used for logging.
1111
}

apihandlers/graph/graph_api_handler_constants.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// graph_api_handler_constants.go
22
package graph
33

4-
// Endpoint constants represent the URL suffixes used for Jamf API token interactions.
4+
// Endpoint constants represent the URL suffixes used for graph API token interactions.
55
const (
66
APIName = "microsoft graph" // APIName: represents the name of the API.
7-
DefaultBaseDomain = "graph.microsoft.com" // DefaultBaseDomain: represents the base domain for the jamf instance.
7+
DefaultBaseDomain = "graph.microsoft.com" // DefaultBaseDomain: represents the base domain for the graph instance.
88
OAuthTokenEndpoint = "graph.microsoft.com" // OAuthTokenEndpoint: The endpoint to obtain an OAuth token.
99
BearerTokenEndpoint = "graph.microsoft.com" // BearerTokenEndpoint: The endpoint to obtain a bearer token.
1010
TokenRefreshEndpoint = "graph.microsoft.com" // TokenRefreshEndpoint: The endpoint to refresh an existing token.

apihandlers/graph/graph_api_url.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ func (g *GraphAPIHandler) SetBaseDomain() string {
1717
return DefaultBaseDomain
1818
}
1919

20-
// ConstructAPIResourceEndpoint constructs the full URL for a Jamf API resource endpoint path and logs the URL.
20+
// ConstructAPIResourceEndpoint constructs the full URL for a graph API resource endpoint path and logs the URL.
2121
func (g *GraphAPIHandler) ConstructAPIResourceEndpoint(instanceName string, endpointPath string, log logger.Logger) string {
2222
urlBaseDomain := g.SetBaseDomain()
2323
url := fmt.Sprintf("https://%s%s%s", instanceName, urlBaseDomain, endpointPath)
2424
g.Logger.Debug(fmt.Sprintf("Constructed %s API resource endpoint URL", APIName), zap.String("URL", url))
2525
return url
2626
}
2727

28-
// ConstructAPIAuthEndpoint constructs the full URL for a Jamf API auth endpoint path and logs the URL.
28+
// ConstructAPIAuthEndpoint constructs the full URL for a graph API auth endpoint path and logs the URL.
2929
func (g *GraphAPIHandler) ConstructAPIAuthEndpoint(instanceName string, endpointPath string, log logger.Logger) string {
3030
urlBaseDomain := g.SetBaseDomain()
3131
url := fmt.Sprintf("https://%s%s%s", instanceName, urlBaseDomain, endpointPath)

apihandlers/jamfpro/jamfpro_api_handler.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// jamfpro_api_handler.go
2+
13
package jamfpro
24

35
import "github.com/deploymenttheory/go-api-http-client/logger"

0 commit comments

Comments
 (0)