|
| 1 | +# Azure Communitytraining Module for Go |
| 2 | + |
| 3 | +[](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communitytraining/armcommunitytraining) |
| 4 | + |
| 5 | +The `armcommunitytraining` module provides operations for working with Azure Communitytraining. |
| 6 | + |
| 7 | +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/communitytraining/armcommunitytraining) |
| 8 | + |
| 9 | +# Getting started |
| 10 | + |
| 11 | +## Prerequisites |
| 12 | + |
| 13 | +- an [Azure subscription](https://azure.microsoft.com/free/) |
| 14 | +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) |
| 15 | + |
| 16 | +## Install the package |
| 17 | + |
| 18 | +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. |
| 19 | + |
| 20 | +Install the Azure Communitytraining module: |
| 21 | + |
| 22 | +```sh |
| 23 | +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communitytraining/armcommunitytraining |
| 24 | +``` |
| 25 | + |
| 26 | +## Authorization |
| 27 | + |
| 28 | +When creating a client, you will need to provide a credential for authenticating with Azure Communitytraining. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. |
| 29 | + |
| 30 | +```go |
| 31 | +cred, err := azidentity.NewDefaultAzureCredential(nil) |
| 32 | +``` |
| 33 | + |
| 34 | +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). |
| 35 | + |
| 36 | +## Client Factory |
| 37 | + |
| 38 | +Azure Communitytraining module consists of one or more clients. We provide a client factory which could be used to create any client in this module. |
| 39 | + |
| 40 | +```go |
| 41 | +clientFactory, err := armcommunitytraining.NewClientFactory(<subscription ID>, cred, nil) |
| 42 | +``` |
| 43 | + |
| 44 | +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). |
| 45 | + |
| 46 | +```go |
| 47 | +options := arm.ClientOptions { |
| 48 | + ClientOptions: azcore.ClientOptions { |
| 49 | + Cloud: cloud.AzureChina, |
| 50 | + }, |
| 51 | +} |
| 52 | +clientFactory, err := armcommunitytraining.NewClientFactory(<subscription ID>, cred, &options) |
| 53 | +``` |
| 54 | + |
| 55 | +## Clients |
| 56 | + |
| 57 | +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. |
| 58 | + |
| 59 | +```go |
| 60 | +client := clientFactory.NewCommunityTrainingsClient() |
| 61 | +``` |
| 62 | + |
| 63 | +## Fakes |
| 64 | + |
| 65 | +The fake package contains types used for constructing in-memory fake servers used in unit tests. |
| 66 | +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. |
| 67 | + |
| 68 | +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. |
| 69 | + |
| 70 | +## Provide Feedback |
| 71 | + |
| 72 | +If you encounter bugs or have suggestions, please |
| 73 | +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Communitytraining` label. |
| 74 | + |
| 75 | +# Contributing |
| 76 | + |
| 77 | +This project welcomes contributions and suggestions. Most contributions require |
| 78 | +you to agree to a Contributor License Agreement (CLA) declaring that you have |
| 79 | +the right to, and actually do, grant us the rights to use your contribution. |
| 80 | +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). |
| 81 | + |
| 82 | +When you submit a pull request, a CLA-bot will automatically determine whether |
| 83 | +you need to provide a CLA and decorate the PR appropriately (e.g., label, |
| 84 | +comment). Simply follow the instructions provided by the bot. You will only |
| 85 | +need to do this once across all repos using our CLA. |
| 86 | + |
| 87 | +This project has adopted the |
| 88 | +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). |
| 89 | +For more information, see the |
| 90 | +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) |
| 91 | + |
| 92 | +additional questions or comments. |
0 commit comments