Coder Social home page Coder Social logo

krist00fer / azure-sdk-for-go-samples Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azure-samples/azure-sdk-for-go-samples

0.0 1.0 0.0 277 KB

Examples of how to utilize Azure services from Go.

License: MIT License

Smarty 0.07% Go 99.22% Shell 0.71%

azure-sdk-for-go-samples's Introduction

Azure SDK for Go - Samples

azure-sdk-for-go-samples provides easy-to-understand, continuously-tested samples for using Azure services via Azure/azure-sdk-for-go. These are currently targeting Go SDK For Azure v14.0.0.

Build Status

The goal of this project is to provide a library of code snippets for common and not-so-common operations in Azure via the Go SDK. Code is organized by services as well as snippet type. The repo will continue to be testable to ensure our samples reflect current recommendations and best practices!

Read the main SDK README for more help getting started with the Go SDK.

To run tests

  1. Set the following environment variables (those marked * are required). Use the following instructions to find or create these values if necessary.

    • AZ_SUBSCRIPTION_ID*
    • AZ_TENANT_ID*
    • AZ_CLIENT_ID*
    • AZ_CLIENT_SECRET*
    • AZ_SP_OBJECT_ID
    • AZ_LOCATION
    • AZ_RESOURCE_GROUP_PREFIX
    • AZ_KEEP_SAMPLE_RESOURCES

    Using the Azure CLI, you can get your subscription ID by running az account list. You can check your tenant ID and get a client ID and secret by running az ad sp create-for-rbac -n "<yourAppName>".

    If AZ_RESOURCE_GROUP_PREFIX isn't specified, azure-samples-go will be used.

    If AZ_LOCATION isn't specified westus2 will be used.

    If AZ_KEEP_SAMPLE_RESOURCES is set to 1 tests won't clean up resources they create when done. This can be helpful if you want to further experiment with those resources.

    AZ_SP_OBJECT_ID represents a service principal ObjectID. It is needed to run the Create VM with encrypted managed disks sample.

    NOTE: the environment variables are listed in .env.tpl so you can copy that to .env (e.g. cp .env.tpl .env) and update for convenience. The samples pick up environment variables from .env files automatically.

  2. Run dep ensure to get dependencies.

  3. Run tests with go test as follows:

    1. To run individual samples, refer to that folder, e.g. go test ./storage/, go test ./network/.
      • If you use a .env file, copy it into the folder first, e.g. cp .env ./network/.
    2. If you're feeling lucky and want to test all the samples, try go test ./...
      • This only requires the root .env file.

Resources

License

This code is provided under the MIT license. See LICENSE for details.

Contribute

We welcome your contributions! For instructions and our code of conduct see CONTRIBUTING.md. And thank you!

azure-sdk-for-go-samples's People

Contributors

mcardosos avatar joshgav avatar lawrencegripper avatar marstr avatar radu-matei avatar sozercan avatar sptramer avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.