### Go API: Installing a Product Version with Installer Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/hc-install/README.md Demonstrates how to use the Installer's Ensure method to find, install, or build a specific product version. This method accepts various Source types to define how the binary should be obtained. ```go import ( "context" "github.com/hashicorp/hc-install" "github.com/hashicorp/hc-install/releases" "github.com/hashicorp/hc-install/src" ) func main() { installer := hcinstall.NewInstaller() ctx := context.Background() // Example: Install the latest version of a product from releases.hashicorp.com _, err := installer.Ensure(ctx, []src.Source{ releases.NewExactVersion("terraform", "1.0.0"), }) if err != nil { panic(err) } } ``` -------------------------------- ### Get User Information - Azure AD Go SDK Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/users/beta/user/README.md Demonstrates how to retrieve detailed information about a specific user from Azure Active Directory using the Go SDK. The example shows context and user ID setup, the call to `GetUser`, and handling the returned user model. ```go ctx := context.TODO() id := user.NewUserID("userId") read, err := client.GetUser(ctx, id, user.DefaultGetUserOperationOptions()) if err != nil { // handle the error } if model := read.Model; model != nil { // do something with the model/response object } ``` -------------------------------- ### Install msgpack library Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/vmihailenco/msgpack/v5/README.md Commands to initialize a Go module and install the msgpack/v5 package. ```shell go mod init github.com/my/repo go get github.com/vmihailenco/msgpack/v5 ``` -------------------------------- ### Example Usage Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/docs/resources/application_permission_scope.md Example of how to configure the `azuread_application_permission_scope` resource. ```APIDOC ```terraform resource "azuread_application_registration" "example" { display_name = "example" } resource "random_uuid" "example_administer" {} resource "azuread_application_permission_scope" "example" { application_id = azuread_application_registration.test.id scope_id = random_uuid.example_administer.id value = "administer" admin_consent_description = "Administer the application" admin_consent_display_name = "Administer" } ``` ``` -------------------------------- ### Install HashiCorp Product via CLI Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/hc-install/README.md Demonstrates the command syntax to install a specific version of a HashiCorp product. The command requires a version flag and the product name. ```shell hc-install install -version 1.3.7 terraform ``` -------------------------------- ### Install go-isatty Package Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/mattn/go-isatty/README.md Command to install the go-isatty library using the Go toolchain. ```bash go get github.com/mattn/go-isatty ``` -------------------------------- ### Install Golang Color Library Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/fatih/color/README.md Instructions to install the color library using the Go package manager. ```go go get github.com/fatih/color ``` -------------------------------- ### Install MessagePack Library Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/vmihailenco/msgpack/README.md Command to install the MessagePack package using the Go toolchain. ```shell go get -u github.com/vmihailenco/msgpack ``` -------------------------------- ### Get User Count - Azure AD Go SDK Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/users/beta/user/README.md Shows how to retrieve the total count of users in Azure Active Directory using the Go SDK. The example includes context setup and the call to `GetsCount`, along with error handling for the operation. ```go ctx := context.TODO() read, err := client.GetsCount(ctx, user.DefaultGetsCountOperationOptions()) if err != nil { // handle the error } if model := read.Model; model != nil { // do something with the model/response object } ``` -------------------------------- ### Install go-colorable Package Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/mattn/go-colorable/README.md This command installs the go-colorable package using the Go build tools. It fetches the package and its dependencies, making it available for use in your Go projects. ```bash go get github.com/mattn/go-colorable ``` -------------------------------- ### CLI Installation Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/hc-install/README.md Instructions for installing the hc-install command-line utility on macOS and Linux systems. ```APIDOC ## CLI Installation ### Description Instructions for installing the `hc-install` command-line utility. ### Installation Methods #### Homebrew (macOS / Linux) ```sh brew install hashicorp/tap/hc-install ``` #### Linux (Debian/Ubuntu & RPM-based) Follow the instructions in the [Official Packaging Guide](https://www.hashicorp.com/official-packaging-guide) to install the `hc-install` package from the official HashiCorp-maintained repositories. ``` -------------------------------- ### Get Member Groups for User - Azure AD Go SDK Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/users/beta/user/README.md Illustrates retrieving the groups a user is a member of using the Azure AD Go SDK. The example covers context setup, user ID, request payload, and the use of `GetMemberGroupsComplete` for batched results. ```go ctx := context.TODO() id := user.NewUserID("userId") payload := user.GetMemberGroupsRequest{ // ... } // alternatively `client.GetMemberGroups(ctx, id, payload, user.DefaultGetMemberGroupsOperationOptions())` can be used to do batched pagination items, err := client.GetMemberGroupsComplete(ctx, id, payload, user.DefaultGetMemberGroupsOperationOptions()) if err != nil { // handle the error } for _, item := range items { // do something } ``` -------------------------------- ### Installer API Methods Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/hc-install/README.md The Installer in hc-install provides high-level methods to manage HashiCorp product versions. These methods can find, install, or build specific versions based on various source types. ```APIDOC ## Installer API ### Description The `Installer` type offers methods to manage HashiCorp binaries. ### Methods - `Ensure(context.Context, []src.Source)`: Finds, installs, or builds a product version. - `Install(context.Context, []src.Installable)`: Installs a product version. ### Sources The `Installer` methods accept various `Source` types, each with different trade-offs: #### `fs.{AnyVersion,ExactVersion,Version}` - **Description**: Finds a binary in `$PATH` or additional specified paths. - **Pros**: Convenient if the product is already installed and managed by the user. - **Cons**: Relies on a single version; user must manage the installation. Not recommended for environments where installation is not controlled (e.g., default GitHub Actions images). #### `releases.{LatestVersion,ExactVersion}` - **Description**: Downloads, verifies, and installs any known product from `releases.hashicorp.com`. - **Pros**: Fast, reliable, and allows installation of enterprise versions. - **Cons**: Consumes bandwidth, disk space, and time. Potentially less stable builds compared to Checkpoint. #### `checkpoint.LatestVersion` - **Description**: Downloads, verifies, and installs any known product available in HashiCorp Checkpoint. - **Pros**: Checkpoint typically contains stable product versions. - **Cons**: Consumes bandwidth, disk space, and time. Does not support old or enterprise versions. #### `build.GitRevision` - **Description**: Clones raw source code and builds the product from it. - **Pros**: Useful for catching bugs early; allows building from source. - **Cons**: Time-consuming and resource-intensive. Build instructions may become outdated. CI builds can be fragile. ``` -------------------------------- ### Get Member Groups using MeClient Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/me/stable/me/README.md Example of retrieving the groups a user is a member of using GetMemberGroupsComplete. This is similar to CheckMemberGroups but might return different details. ```go ctx := context.TODO() payload := me.GetMemberGroupsRequest{ // ... } // alternatively `client.GetMemberGroups(ctx, payload, me.DefaultGetMemberGroupsOperationOptions())` can be used to do batched pagination items, err := client.GetMemberGroupsComplete(ctx, payload, me.DefaultGetMemberGroupsOperationOptions()) if err != nil { // handle the error } for _, item := range items { // do something } ``` -------------------------------- ### CLI: Installing hc-install on Debian/Ubuntu Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/hc-install/README.md Instructions for installing the hc-install command-line utility on Debian and Ubuntu systems using the APT package manager, by adding the official HashiCorp repository. ```sh # Add the official HashiCorp repository and install hc-install # Refer to the Official Packaging Guide for detailed steps. # Example command (may vary based on OS version): # sudo apt-get update && sudo apt-get install hc-install ``` -------------------------------- ### Get Password Single Sign-On Credentials - Azure AD Go SDK Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/users/beta/user/README.md Provides an example of retrieving password single sign-on credentials for a user using the Azure AD Go SDK. It includes setting up the context and user ID, and using `GetPasswordSingleSignOnCredentialsComplete` for batched results. ```go ctx := context.TODO() id := user.NewUserID("userId") // alternatively `client.GetPasswordSingleSignOnCredentials(ctx, id, user.DefaultGetPasswordSingleSignOnCredentialsOperationOptions())` can be used to do batched pagination items, err := client.GetPasswordSingleSignOnCredentialsComplete(ctx, id, user.DefaultGetPasswordSingleSignOnCredentialsOperationOptions()) if err != nil { // handle the error } for _, item := range items { // do something } ``` -------------------------------- ### Install Tag Parser Library Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/vmihailenco/tagparser/v2/README.md Command to install the tagparser package using the Go toolchain. This is required before importing the library into your project. ```shell go get github.com/vmihailenco/tagparser/v2 ``` -------------------------------- ### CLI: Installing hc-install on RHEL/CentOS/Fedora Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/hc-install/README.md Instructions for installing the hc-install command-line utility on RHEL, CentOS, Fedora, and Amazon Linux systems using the RPM package manager, by adding the official HashiCorp repository. ```sh # Add the official HashiCorp repository and install hc-install # Refer to the Official Packaging Guide for detailed steps. # Example command (may vary based on OS version): # sudo yum install hc-install OR sudo dnf install hc-install ``` -------------------------------- ### Perform a Simple GET Request with RetryableHTTP Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-retryablehttp/README.md Demonstrates how to execute a basic HTTP GET request using the retryablehttp package, which handles retries automatically. ```go resp, err := retryablehttp.Get("/foo") if err != nil { panic(err) } ``` -------------------------------- ### GET /applicationTemplates Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/applicationtemplates/stable/applicationtemplate/README.md Lists all available application templates, supporting batched pagination. ```APIDOC ## GET /applicationTemplates ### Description Retrieves a list of all application templates. ### Method GET ### Endpoint /applicationTemplates ### Response #### Success Response (200) - **items** (array) - A list of application template objects. ``` -------------------------------- ### Yamux Client and Server Setup in Go Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/yamux/README.md Demonstrates how to set up both the client and server sides of a Yamux session in Go. It shows establishing a connection, initializing the Yamux session, and opening/accepting streams for communication. This code requires a network connection (e.g., TCP) and the Yamux library. ```go func client() { // Get a TCP connection conn, err := net.Dial("tcp", "localhost:8080") if err != nil { panic(err) } // Setup client side of yamux session, err := yamux.Client(conn, nil) if err != nil { panic(err) } // Open a new stream stream, err := session.Open() if err != nil { panic(err) } // Stream implements net.Conn stream.Write([]byte("ping")) } ``` ```go func server() { listener, err := net.Listen("tcp", ":8080") if err != nil { panic(err) } // Accept a TCP connection conn, err := listener.Accept() if err != nil { panic(err) } // Setup server side of yamux session, err := yamux.Server(conn, nil) if err != nil { panic(err) } // Accept a stream stream, err := session.Accept() if err != nil { panic(err) } // Listen for a message buf := make([]byte, 4) _, err = stream.Read(buf) if err != nil { panic(err) } // Process buf } ``` -------------------------------- ### Initialize Entitlement Management Access Package Client Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/identitygovernance/beta/entitlementmanagementaccesspackage/README.md Demonstrates how to import the package and initialize the client with a base URI and authorizer. ```go import "github.com/hashicorp/go-azure-sdk/microsoft-graph/identitygovernance/beta/entitlementmanagementaccesspackage" client := entitlementmanagementaccesspackage.NewEntitlementManagementAccessPackageClientWithBaseURI("https://graph.microsoft.com") client.Client.Authorizer = authorizer ``` -------------------------------- ### Create Gets User Owned Object Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/serviceprincipals/beta/serviceprincipal/README.md Example for creating a 'Gets User Owned Object' entry. This involves defining a request payload and calling the `CreateGetsUserOwnedObject` method. It includes error handling and processing of the response model. ```go ctx := context.TODO() payload := serviceprincipal.CreateGetsUserOwnedObjectRequest{ // ... } read, err := client.CreateGetsUserOwnedObject(ctx, payload, serviceprincipal.DefaultCreateGetsUserOwnedObjectOperationOptions()) if err != nil { // handle the error } if model := read.Model; model != nil { // do something with the model/response object } ``` -------------------------------- ### Create Gets User Owned Object in Azure AD Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/administrativeunits/beta/administrativeunit/README.md Example for creating a user-owned object within Azure AD. This function returns the created object or an error. ```go ctx := context.TODO() payload := administrativeunit.CreateGetsUserOwnedObjectRequest{ // ... } read, err := client.CreateGetsUserOwnedObject(ctx, payload, administrativeunit.DefaultCreateGetsUserOwnedObjectOperationOptions()) if err != nil { // handle the error } if model := read.Model; model != nil { // do something with the model/response object } ``` -------------------------------- ### Initialize DirectoryRole Client Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/directoryroles/stable/directoryrole/README.md Demonstrates how to import the package and instantiate a new DirectoryRole client with a base URI and authorizer. ```go import "github.com/hashicorp/go-azure-sdk/microsoft-graph/directoryroles/stable/directoryrole" client := directoryrole.NewDirectoryRoleClientWithBaseURI("https://graph.microsoft.com") client.Client.Authorizer = authorizer ``` -------------------------------- ### Get Member Groups in Azure AD Administrative Unit Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/administrativeunits/beta/administrativeunit/README.md Example of retrieving the groups that a member belongs to within an administrative unit. It uses `GetMemberGroupsComplete` for efficient batched pagination. ```go ctx := context.TODO() id := administrativeunit.NewAdministrativeUnitID("administrativeUnitId") payload := administrativeunit.GetMemberGroupsRequest{ // ... } // alternatively `client.GetMemberGroups(ctx, id, payload, administrativeunit.DefaultGetMemberGroupsOperationOptions())` can be used to do batched pagination items, err := client.GetMemberGroupsComplete(ctx, id, payload, administrativeunit.DefaultGetMemberGroupsOperationOptions()) if err != nil { // handle the error } for _, item := range items { // do something } ``` -------------------------------- ### Initialize Microsoft Graph Group Client Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/groups/beta/group/README.md Demonstrates how to import the SDK and initialize a new GroupClient with a base URI and authorizer. ```go import "github.com/hashicorp/go-azure-sdk/microsoft-graph/groups/beta/group" client := group.NewGroupClientWithBaseURI("https://graph.microsoft.com") client.Client.Authorizer = authorizer ``` -------------------------------- ### Initialize SynchronizationJobClient Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/serviceprincipals/stable/synchronizationjob/README.md Demonstrates how to instantiate the SynchronizationJobClient using a base URI and an authorizer. ```go client := synchronizationjob.NewSynchronizationJobClientWithBaseURI("https://graph.microsoft.com") client.Client.Authorizer = authorizer ``` -------------------------------- ### Get Azure AD Application Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/applications/beta/application/README.md Demonstrates how to retrieve details of a specific Azure AD application using its ID. The code shows context setup, ID creation, and response handling. ```go ctx := context.TODO() id := application.NewApplicationID("applicationId") read, err := client.GetApplication(ctx, id, application.DefaultGetApplicationOperationOptions()) if err != nil { // handle the error } if model := read.Model; model != nil { // do something with the model/response object } ``` -------------------------------- ### Get Member Objects using Go Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/groups/beta/group/README.md Provides an example of retrieving all objects that are members of a specified group using `GetMemberObjectsComplete`. This method handles batched pagination and allows processing each member object. ```go ctx := context.TODO() id := group.NewGroupID("groupId") payload := group.GetMemberObjectsRequest{ // ... } // alternatively `client.GetMemberObjects(ctx, id, payload, group.DefaultGetMemberObjectsOperationOptions())` can be used to do batched pagination items, err := client.GetMemberObjectsComplete(ctx, id, payload, group.DefaultGetMemberObjectsOperationOptions()) if err != nil { // handle the error } for _, item := range items { // do something } ``` -------------------------------- ### Initialize Azure AD Administrative Unit Client Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/administrativeunits/beta/administrativeunit/README.md Demonstrates how to initialize the administrative unit client with a base URI and an authorizer. ```go client := administrativeunit.NewAdministrativeUnitClientWithBaseURI("https://graph.microsoft.com") client.Client.Authorizer = authorizer ``` -------------------------------- ### Get Member Objects for User - Azure AD Go SDK Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/users/beta/user/README.md Shows how to retrieve all objects (users, groups, etc.) a user is a member of using the Azure AD Go SDK. The example demonstrates preparing the context, user ID, and payload, then calling `GetMemberObjectsComplete` for batched retrieval. ```go ctx := context.TODO() id := user.NewUserID("userId") payload := user.GetMemberObjectsRequest{ // ... } // alternatively `client.GetMemberObjects(ctx, id, payload, user.DefaultGetMemberObjectsOperationOptions())` can be used to do batched pagination items, err := client.GetMemberObjectsComplete(ctx, id, payload, user.DefaultGetMemberObjectsOperationOptions()) if err != nil { // handle the error } for _, item := range items { // do something } ``` -------------------------------- ### Create Custom Logger with Options in Go Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-hclog/README.md Shows how to create a new logger instance with custom options, including setting the logger's name and log level from a string. ```go appLogger := hclog.New(&hclog.LoggerOptions{ Name: "my-app", Level: hclog.LevelFromString("DEBUG"), }) ``` -------------------------------- ### Initialize MeClient Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/me/stable/me/README.md Demonstrates how to initialize the MeClient for interacting with the Microsoft Graph API. It requires a base URI and an authorizer for authentication. ```go client := me.NewMeClientWithBaseURI("https://graph.microsoft.com") client.Client.Authorizer = authorizer ``` -------------------------------- ### Parse and Compare Versions Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-version/README.md Demonstrates how to instantiate version objects from strings and perform comparison operations such as LessThan. This is useful for determining the relative order of two version identifiers. ```go v1, err := version.NewVersion("1.2") v2, err := version.NewVersion("1.5+metadata") if v1.LessThan(v2) { fmt.Printf("%s is less than %s", v1, v2) } ``` -------------------------------- ### Initialize SynchronizationSecretClient Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/serviceprincipals/stable/synchronizationsecret/README.md Demonstrates how to instantiate the synchronization secret client using a base URI and an authorizer. This is the prerequisite for performing any operations on service principal secrets. ```go client := synchronizationsecret.NewSynchronizationSecretClientWithBaseURI("https://graph.microsoft.com") client.Client.Authorizer = authorizer ``` -------------------------------- ### POST /applicationTemplates/{id}/instantiate Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/applicationtemplates/stable/applicationtemplate/README.md Instantiates an application based on the specified application template. ```APIDOC ## POST /applicationTemplates/{id}/instantiate ### Description Creates an instance of an application from a template. ### Method POST ### Endpoint /applicationTemplates/{id}/instantiate ### Request Body - **payload** (object) - Required - The instantiation request details. ### Response #### Success Response (200) - **model** (object) - The instantiated application object. ``` -------------------------------- ### Start Synchronization Job Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/serviceprincipals/stable/synchronizationjob/README.md Starts a synchronization job for a given service principal or object ID. This operation initiates the synchronization process. ```APIDOC ## POST /api/synchronization/jobs/{jobId}/start ### Description Starts a synchronization job for a given service principal or object ID. ### Method POST ### Endpoint /api/synchronization/jobs/{jobId}/start ### Parameters #### Path Parameters - **jobId** (string) - Required - The ID of the synchronization job. #### Query Parameters - **servicePrincipalId** (string) - Required - The ID of the service principal. #### Request Body This endpoint does not require a request body. ### Request Example ```go ctx := context.TODO() id := synchronizationjob.NewServicePrincipalIdSynchronizationJobID("servicePrincipalId", "synchronizationJobId") read, err := client.StartSynchronizationJob(ctx, id, synchronizationjob.DefaultStartSynchronizationJobOperationOptions()) if err != nil { // handle the error } if model := read.Model; model != nil { // do something with the model/response object } ``` ### Response #### Success Response (200) - **model** (SynchronizationJob) - The updated synchronization job object. #### Response Example ```json { "model": { // ... synchronization job details ... } } ``` ``` -------------------------------- ### CLI: Installing hc-install via Homebrew Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/hc-install/README.md Instructions for installing the hc-install command-line utility using the Homebrew package manager on macOS and Linux systems. ```sh brew install hashicorp/tap/hc-install ``` -------------------------------- ### Instantiate Application Template Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/applicationtemplates/stable/applicationtemplate/README.md Instantiates a new application based on a specified application template. Requires a payload containing instantiation details and handles potential errors. ```go import "github.com/hashicorp/go-azure-sdk/microsoft-graph/applicationtemplates/stable/applicationtemplate" import "context" // ... ctx := context.TODO() id := applicationtemplate.NewApplicationTemplateID("applicationTemplateId") payload := applicationtemplate.InstantiateRequest{ // ... } read, err := client.Instantiate(ctx, id, payload, applicationtemplate.DefaultInstantiateOperationOptions()) if err != nil { // handle the error } if model := read.Model; model != nil { // do something with the model/response object } ``` -------------------------------- ### Using go-testing-interface Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/mitchellh/go-testing-interface/README.md How to define and invoke test helpers that are compatible with both standard Go tests and runtime execution. ```APIDOC ## Library Usage: go-testing-interface ### Description This library exports an interface that `*testing.T` implements, allowing test helpers to be used outside of the standard `testing` package context. ### Implementation Define a function that accepts the `testing.T` interface: ```go import "github.com/mitchellh/go-testing-interface" func TestHelper(t testing.T) { t.Fatal("I failed") } ``` ### Usage in Tests Pass the standard `*testing.T` object to your helper: ```go func TestThing(t *testing.T) { TestHelper(t) } ``` ### Usage at Runtime Use `testing.RuntimeT` to execute helpers outside of a test suite: ```go func main() { TestHelper(&testing.RuntimeT{}) } ``` ``` -------------------------------- ### Create Azure AD Application Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/applications/beta/application/README.md Provides an example of creating a new Azure AD application. It involves setting up the context and defining the application object payload. ```go ctx := context.TODO() payload := application.Application{ // ... } read, err := client.CreateApplication(ctx, payload, application.DefaultCreateApplicationOperationOptions()) if err != nil { // handle the error } if model := read.Model; model != nil { // do something with the model/response object } ``` -------------------------------- ### Initialize Default Logger in Go Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-hclog/README.md Demonstrates how to use the default global logger instance provided by the go-hclog package to emit an informational message. ```go hclog.Default().Info("hello world") ``` -------------------------------- ### Basic GET Request with Retries Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-retryablehttp/README.md Demonstrates how to perform a simple GET request using the retryablehttp package. The request will automatically retry on errors or certain server responses. ```APIDOC ## GET /foo ### Description Performs a GET request to the specified URL with automatic retries. ### Method GET ### Endpoint /foo ### Parameters None ### Request Example ```go resp, err := retryablehttp.Get("/foo") if err != nil { panic(err) } // Process the response ``` ### Response #### Success Response (200) - **resp** (*http.Response) - The HTTP response object. #### Response Example ```go // Example response body (depends on the /foo endpoint) { "message": "Success" } ``` ``` -------------------------------- ### Construct Built-in Terraform Provider Address (Go) Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/terraform-registry-address/README.md Demonstrates how to construct the fully qualified address for the built-in Terraform provider using `NewProvider`. This is the recommended approach when treating the 'terraform' address as the core provider. ```Go pAddr := NewProvider(BuiltInProviderHost, BuiltInProviderNamespace, "terraform") ``` -------------------------------- ### Get Group Count using Go Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/groups/beta/group/README.md Shows how to get the total count of Azure AD groups using the `GetsCount` method. It returns a model containing the count or an error. ```go ctx := context.TODO() read, err := client.GetsCount(ctx, group.DefaultGetsCountOperationOptions()) if err != nil { // handle the error } if model := read.Model; model != nil { // do something with the model/response object } ``` -------------------------------- ### Initialize DirectoryRoleTemplateClient Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/directoryroletemplates/stable/directoryroletemplate/README.md Initializes the client for the directory role template service using a base URI and an authorizer. ```go client := directoryroletemplate.NewDirectoryRoleTemplateClientWithBaseURI("https://graph.microsoft.com") client.Client.Authorizer = authorizer ``` -------------------------------- ### Run System Tests (Go) Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/google.golang.org/appengine/CONTRIBUTING.md This command executes the system tests for the AzureAD provider using Go's testing framework. Ensure the APPENGINE_DEV_APPSERVER environment variable is set correctly before running. ```bash go test -v google.golang.org/appengine/... ``` -------------------------------- ### Create Gets User Owned Object for Azure AD Application Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/applications/beta/application/README.md Demonstrates the creation of a 'Gets User Owned Object' resource within Azure AD. This function requires context and a specific request payload. ```go ctx := context.TODO() payload := application.CreateGetsUserOwnedObjectRequest{ // ... } read, err := client.CreateGetsUserOwnedObject(ctx, payload, application.DefaultCreateGetsUserOwnedObjectOperationOptions()) if err != nil { // handle the error } if model := read.Model; model != nil { // do something with the model/response object } ``` -------------------------------- ### GET /servicePrincipals Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/serviceprincipals/beta/serviceprincipal/README.md Lists all service principals in the directory. ```APIDOC ## GET /servicePrincipals ### Description Retrieves a list of all service principals available in the tenant. ### Method GET ### Endpoint /servicePrincipals ### Response #### Success Response (200) - **items** (array) - A list of service principal objects. ``` -------------------------------- ### List Groups using Go Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/groups/beta/group/README.md Demonstrates how to list all Azure AD groups using the `ListGroupsComplete` method. This method supports batched pagination and iterates through all available groups. ```go ctx := context.TODO() // alternatively `client.ListGroups(ctx, group.DefaultListGroupsOperationOptions())` can be used to do batched pagination items, err := client.ListGroupsComplete(ctx, group.DefaultListGroupsOperationOptions()) if err != nil { // handle the error } for _, item := range items { // do something } ``` -------------------------------- ### Instantiate Provider with Strict Namespace (Go) Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/terraform-registry-address/README.md Illustrates that the `NewProvider` function will panic if provided with an empty, legacy ('-'), or unknown ('?') namespace. This enforces the use of fully qualified provider addresses. ```Go NewProvider(DefaultProviderRegistryHost, "", "aws") // panic NewProvider(DefaultProviderRegistryHost, "-", "aws") // panic NewProvider(DefaultProviderRegistryHost, "?", "aws") // panic ``` -------------------------------- ### GET /policies/authenticationStrengthPolicies Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/policies/stable/authenticationstrengthpolicy/README.md Lists all authentication strength policies. ```APIDOC ## GET /policies/authenticationStrengthPolicies ### Description Retrieves a list of all authentication strength policies. ### Method GET ### Endpoint /policies/authenticationStrengthPolicies ### Response #### Success Response (200) - **items** (Array) - A list of authentication strength policy objects. ``` -------------------------------- ### GET /me Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/me/stable/me/README.md Retrieves the profile information for the current user. ```APIDOC ## GET /me ### Description Fetches the profile details of the authenticated user. ### Method GET ### Endpoint /me ### Response #### Success Response (200) - **Model** (object) - The user profile object #### Response Example { "id": "user-id", "displayName": "User Name" } ``` -------------------------------- ### Basic Azure AD Invitation Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/docs/resources/invitation.md This example demonstrates the basic configuration for creating an invitation for a guest user. It requires the user's email address and a redirect URL. ```terraform resource "azuread_invitation" "example" { user_email_address = "jdoe@hashicorp.com" redirect_url = "https://portal.azure.com" } ``` -------------------------------- ### GET /directoryObjects/count Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/directoryobjects/stable/directoryobject/README.md Retrieves the total count of directory objects. ```APIDOC ## GET /directoryObjects/count ### Description Returns the count of directory objects available in the directory. ### Method GET ### Endpoint /directoryObjects/count ### Response #### Success Response (200) - **count** (integer) - The total number of directory objects. ``` -------------------------------- ### Get Mail Tips using MeClient Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/me/stable/me/README.md Demonstrates how to retrieve mail tips for a user using GetMailTipsComplete. This can be useful for providing information to users before sending an email. ```go ctx := context.TODO() payload := me.GetMailTipsRequest{ // ... } // alternatively `client.GetMailTips(ctx, payload, me.DefaultGetMailTipsOperationOptions())` can be used to do batched pagination items, err := client.GetMailTipsComplete(ctx, payload, me.DefaultGetMailTipsOperationOptions()) if err != nil { // handle the error } for _, item := range items { // do something } ``` -------------------------------- ### Assign License using MeClient Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/me/stable/me/README.md Example of using the AssignLicense method of the MeClient to assign licenses to a user. It involves creating a request payload and handling the response or errors. ```go ctx := context.TODO() payload := me.AssignLicenseRequest{ // ... } read, err := client.AssignLicense(ctx, payload, me.DefaultAssignLicenseOperationOptions()) if err != nil { // handle the error } if model := read.Model; model != nil { // do something with the model/response object } ``` -------------------------------- ### GET /servicePrincipals/{id} Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/serviceprincipals/beta/serviceprincipal/README.md Retrieves the details of a specific service principal. ```APIDOC ## GET /servicePrincipals/{id} ### Description Fetches the properties of an existing service principal. ### Method GET ### Endpoint /servicePrincipals/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the service principal. ### Response #### Success Response (200) - **model** (object) - The service principal object. ``` -------------------------------- ### Navigate to Provider Source Directory (Bash) Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/google.golang.org/appengine/CONTRIBUTING.md After downloading the package, this command changes the current directory to the checked-out source code location, allowing you to work with the provider's files. ```bash cd $GOPATH/src/google.golang.org/appengine ``` -------------------------------- ### GET /directoryRoleTemplates/count Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/directoryroletemplates/stable/directoryroletemplate/README.md Retrieves the total count of directory role templates. ```APIDOC ## GET /directoryRoleTemplates/$count ### Description Returns the total number of directory role templates available in the directory. ### Method GET ### Endpoint /directoryRoleTemplates/$count ### Response #### Success Response (200) - **count** (integer) - The total number of templates. #### Response Example { "count": 50 } ``` -------------------------------- ### Create Azure AD Application from Template Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/docs/resources/application_from_template.md Demonstrates how to use a data source to find a template and instantiate an application using the azuread_application_from_template resource. It also shows how to retrieve the resulting application and service principal objects. ```terraform data "azuread_application_template" "example" { display_name = "Marketo" } resource "azuread_application_from_template" "example" { display_name = "Example Application" template_id = data.azuread_application_template.example.template_id } data "azuread_application" "example" { object_id = azuread_application_from_template.example.application_object_id } data "azuread_service_principal" "example" { object_id = azuread_application_from_template.example.service_principal_object_id } ``` -------------------------------- ### GET /directoryObjects Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/directoryobjects/stable/directoryobject/README.md Lists directory objects with support for batched pagination. ```APIDOC ## GET /directoryObjects ### Description Retrieves a list of directory objects. Supports pagination for large result sets. ### Method GET ### Endpoint /directoryObjects ### Response #### Success Response (200) - **items** (array) - List of directory object models. ``` -------------------------------- ### Create Gets User Owned Object Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/serviceprincipals/beta/serviceprincipal/README.md Creates a user-owned object. ```APIDOC ## POST /users/{id}/ownedObjects ### Description Creates a user-owned object. This endpoint is typically used internally or for specific scenarios. ### Method POST ### Endpoint `/users/{id}/ownedObjects` ### Parameters #### Path Parameters - **id** (string) - Required - The object ID of the user. #### Request Body - **CreateGetsUserOwnedObjectRequest** (object) - Required - The request body containing details for the object to be created. ### Request Example ```json { "createGetsUserOwnedObjectRequest": { // ... object details ... } } ``` ### Response #### Success Response (201 Created) - **model** (object) - The created user-owned object. #### Response Example ```json { "model": { // ... created object details ... } } ``` ``` -------------------------------- ### Get User Count Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/users/stable/user/README.md Retrieves the total count of users available in the directory. ```go ctx := context.TODO() read, err := client.GetsCount(ctx, user.DefaultGetsCountOperationOptions()) if err != nil { // handle the error } if model := read.Model; model != nil { // do something with the model/response object } ``` -------------------------------- ### Get Service Principal Source: https://github.com/hashicorp/terraform-provider-azuread/blob/main/vendor/github.com/hashicorp/go-azure-sdk/microsoft-graph/serviceprincipals/beta/serviceprincipal/README.md Retrieves details for a specific Service Principal by its ID. ```go ctx := context.TODO() id := serviceprincipal.NewServicePrincipalID("servicePrincipalId") read, err := client.GetServicePrincipal(ctx, id, serviceprincipal.DefaultGetServicePrincipalOperationOptions()) if err != nil { // handle the error } if model := read.Model; model != nil { // do something with the model/response object } ```