Documentation
¶
Index ¶
Constants ¶
const ( // Provider Name PROVIDER_NAME = "microsoft365" // Public Cloud PUBLIC_OAUTH_AUTHORITY_URL = "https://login.microsoftonline.com/" PUBLIC_GRAPH_API_SCOPE = "https://graph.microsoft.com/.default" PUBLIC_GRAPH_API_SERVICE_ROOT = "https://graph.microsoft.com/v1.0" PUBLIC_GRAPH_BETA_API_SERVICE_ROOT = "https://graph.microsoft.com/beta" // US Department of Defense (DoD) Cloud USDOD_OAUTH_AUTHORITY_URL = "https://login.microsoftonline.us/" USDOD_GRAPH_API_SCOPE = "https://graph.microsoft.us/.default" USDOD_GRAPH_API_SERVICE_ROOT = "https://dod-graph.microsoft.us/v1.0" USDOD_GRAPH_BETA_API_SERVICE_ROOT = "https://dod-graph.microsoft.us/beta" // US Government Cloud USGOV_OAUTH_AUTHORITY_URL = "https://login.microsoftonline.com/" USGOV_GRAPH_API_SCOPE = "https://graph.microsoft.us/.default" USGOV_GRAPH_API_SERVICE_ROOT = "https://graph.microsoft.us/v1.0" USGOV_GRAPH_BETA_API_SERVICE_ROOT = "https://graph.microsoft.us/beta" // US Government High Cloud USGOVHIGH_OAUTH_AUTHORITY_URL = "https://login.microsoftonline.us/" USGOVHIGH_GRAPH_API_SCOPE = "https://graph.microsoft.us/.default" USGOVHIGH_GRAPH_API_SERVICE_ROOT = "https://graph.microsoft.us/v1.0" USGOVHIGH_GRAPH_BETA_API_SERVICE_ROOT = "https://graph.microsoft.us/beta" // China Cloud (aka mooncake) - https://learn.microsoft.com/en-us/previous-versions/office/office-365-api/api/o365-china-endpoints CHINA_OAUTH_AUTHORITY_URL = "https://login.chinacloudapi.cn/" CHINA_GRAPH_API_SCOPE = "https://microsoftgraph.chinacloudapi.cn/.default" CHINA_GRAPH_API_SERVICE_ROOT = "https://microsoftgraph.chinacloudapi.cn/v1.0" CHINA_GRAPH_BETA_API_SERVICE_ROOT = "https://microsoftgraph.chinacloudapi.cn/beta" // EagleX Cloud EX_OAUTH_AUTHORITY_URL = "https://login.microsoftonline.eaglex.ic.gov/" EX_GRAPH_API_SCOPE = "https://graph.eaglex.ic.gov/.default" EX_GRAPH_API_SERVICE_ROOT = "https://graph.eaglex.ic.gov/v1.0" EX_GRAPH_BETA_API_SERVICE_ROOT = "https://graph.eaglex.ic.gov/beta" // Secure Cloud (RX) RX_OAUTH_AUTHORITY_URL = "https://login.microsoftonline.microsoft.scloud/" RX_GRAPH_API_SCOPE = "https://graph.microsoft.scloud/.default" RX_GRAPH_API_SERVICE_ROOT = "https://graph.microsoft.scloud/v1.0" RX_GRAPH_BETA_API_SERVICE_ROOT = "https://graph.microsoft.scloud/beta" )
const ( // GuidRegex matches a standard GUID/UUID. // Example: "123e4567-e89b-12d3-a456-426614174000" GuidRegex = "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" // GuidOrEmptyValueRegex matches a standard GUID/UUID or an empty string. // Example: "123e4567-e89b-12d3-a456-426614174000" or "" GuidOrEmptyValueRegex = "^(?:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})?$" // UrlValidStringRegex matches a valid URL string (letters, numbers, and URL-safe characters). // Example: "https://example.com/path?query=1" UrlValidStringRegex = "(?i)^[A-Za-z0-9-._~%/:/?=]+$" // ApiIdRegex matches API IDs consisting of alphanumeric characters, slashes, dots, or underscores. // Example: "api/v1/resource_1" ApiIdRegex = "^[0-9a-zA-Z/._]*$" // StringRegex matches any string (including empty). // Example: "any string here" StringRegex = "^.*$" // VersionRegex matches a version string in the format "X.Y.Z.W". // Example: "1.0.0.0" VersionRegex = "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$" // TimeFormatUTCTimeStampRegex matches a UTC timestamp in the format "YYYY-MM-DDTHH:MM:SSZ". // Example: "2023-05-01T13:45:30Z" TimeFormatUTCTimeStampRegex = "^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z)$" // BooleanRegex matches the string "true" or "false". // Example: "true" BooleanRegex = "^(true|false)$" // TimeFormatHMSRegex matches a time string in the format "HH:MM:SS" (24-hour clock). // Example: "14:30:59" TimeFormatHMSRegex = "^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$" // TimeFormatRFC3339Regex is the time format for RFC3339. // Example: "2023-05-01T13:45:30Z" TimeFormatRFC3339Regex = time.RFC3339 // ISO8601DurationRegex matches an ISO 8601 duration format. // Examples: "P1D" (1 day), "PT1H" (1 hour), "P1W" (1 week), "P1Y2M3DT4H5M6S" (1 year, 2 months, 3 days, 4 hours, 5 minutes, 6 seconds) ISO8601DurationRegex = `^P(?:\d+Y)?(?:\d+M)?(?:\d+W)?(?:\d+D)?(?:T(?:\d+H)?(?:\d+M)?(?:\d+S)?)?$` // AzureImageResourceIDRegex matches a valid Azure image resource ID for a custom image. // Example: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.Compute/images/myimage" AzureImageResourceIDRegex = `^/subscriptions/[^/]+/resourceGroups/[^/]+/providers/Microsoft\.Compute/images/[^/]+$` )
Variables ¶
var GraphSDKMutex sync.Mutex
GraphSDKMutex is a global lock used to serialize Microsoft Graph SDK (Kiota) API calls.
Reason: Kiota's middleware (e.g., HeadersInspectionHandler) modifies shared header maps during HTTP request processing. In Go, maps are not concurrency-safe — concurrent writes cause immediate fatal runtime panics ("concurrent map writes").
Terraform executes Read operations across multiple resources in parallel, leading to multiple Graph API calls at the same time. Without locking, simultaneous mutation of the shared headers map causes the plugin to crash.
By acquiring this mutex around Graph API calls (Get, Post, Patch, Delete), we ensure only one request is processed at a time through the Kiota pipeline, preventing concurrency issues and plugin crashes.
You cannot set a mutex as a constant in go.
Functions ¶
This section is empty.
Types ¶
This section is empty.