Skip to content

Instantly share code, notes, and snippets.

View lfmundim's full-sized avatar

Lucas Fonseca Mundim lfmundim

View GitHub Profile
2020/08/04 09:21:38 [INFO] Terraform version: 0.12.28
2020/08/04 09:21:38 [INFO] Go runtime version: go1.12.13
2020/08/04 09:21:38 [INFO] CLI args: []string{"C:\\Program Files\\dotnet\\terraform.exe", "apply"}
2020/08/04 09:21:38 [DEBUG] Attempting to open CLI config file: C:\Users\lucasm\AppData\Roaming\terraform.rc
2020/08/04 09:21:38 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/08/04 09:21:38 Loading CLI configuration from C:\Users\lucasm\AppData\Roaming\terraform.d\credentials.tfrc.json
2020/08/04 09:21:38 [INFO] CLI command args: []string{"apply"}
2020/08/04 09:21:38 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2020/08/04 09:21:38 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2020/08/04 09:21:38 [DEBUG] New state was assigned lineage "e3ba7cfe-0fed-1ded-5bba-15de9b87218b"
Error: rpc error: code = Unavailable desc = transport is closing
panic: runtime error: invalid memory address or nil pointer dereference
2020-06-24T10:34:44.827-0300 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4.exe: [signal 0xc0000005 code=0x0 addr=0x8 pc=0xe050ab]
2020-06-24T10:34:44.827-0300 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4.exe:
2020-06-24T10:34:44.827-0300 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4.exe: goroutine 52 [running]:
2020-06-24T10:34:44.827-0300 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4.exe: github.com/terraform-providers/terraform-provider-azuredevops/azuredevops/internal/service/git.resourceGitRepositoryCreate(0xc0002fea10, 0xef9ea0, 0xc0003ec240, 0x2, 0x1b3c480)
2020-06-24T10:34:44.827-0300 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4.exe: /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azuredevops/azuredevops/internal/service/git/resource_git_repository.go:173 +0x44b
2020/06/24 10:34:35 [INFO] Terraform version: 0.12.26
2020/06/24 10:34:35 [INFO] Go runtime version: go1.12.13
2020/06/24 10:34:35 [INFO] CLI args: []string{"C:\\Program Files\\dotnet\\terraform.exe", "apply"}
2020/06/24 10:34:35 [DEBUG] Attempting to open CLI config file: C:\Users\lucasm\AppData\Roaming\terraform.rc
2020/06/24 10:34:35 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/06/24 10:34:35 Loading CLI configuration from C:\Users\lucasm\AppData\Roaming\terraform.d\credentials.tfrc.json
2020/06/24 10:34:35 [INFO] CLI command args: []string{"apply"}
2020/06/24 10:34:35 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2020/06/24 10:34:35 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2020/06/24 10:34:35 [DEBUG] New state was assigned lineage "458ef9ea-5fa1-2935-b21a-2bd371004179"
// Ran on C# Interactive via VisualStudio
> public abstract class Bird
. {
.     public abstract double GetSpeed();
. }
> public class AfricanBird : Bird
. {
.     public override double GetSpeed()
. {
public class AfricanBird : Bird
{
    public override double GetSpeed()
    {
        // logic for African birds
    }
}

public class AmericanBird : Bird
public abstract class Bird
{
    public abstract double GetSpeed();
}
public enum BirdType
{
    African,
    American,
    European,
    Asian // new type
}
public class Bird
{
    // whatever properties do birds have
    public BirdType Type { get; set; }

    public double GetSpeed()
    {
        switch(Type)
 {
@lfmundim
lfmundim / BirdStub.md
Last active April 27, 2020 22:49
To be used in medium
public class Bird
{
    // whatever properties do birds have
    public BirdType Type { get; set; }
}

public enum BirdType
{
 African,

Usage

After installing the package, you'll need to tell your API to use this scheme in the Startup.cs file. The simplest way is using the extension method provided with the package:

public void ConfigureServices(IServiceCollection services)
{
    // ...
    // If only a single bot is authorized
    services.UseBotAuthentication("bot authorization key");
    // If multiple bots
 services.UseBotAuthentication(authorizationKeyEnumerable); // pass any enumerable containing your keys