Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmingoia committed Dec 22, 2023
1 parent 1897348 commit 92bafc6
Show file tree
Hide file tree
Showing 19 changed files with 1,766 additions and 0 deletions.
67 changes: 67 additions & 0 deletions providers/rootly/cause.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

// Generated by generators/rootly/rootly.js

package rootly

import (

"github.com/GoogleCloudPlatform/terraformer/terraformutils"
"github.com/rootlyhq/terraform-provider-rootly/client"
rootlygo "github.com/rootlyhq/terraform-provider-rootly/schema"
)

type CauseGenerator struct {
RootlyService
}

func (g* CauseGenerator) InitResources() error {
page_size := 50
page_num := 1

client, err := g.RootlyClient()
if err != nil {
return err
}

for {
resources, err := func(page_size, page_num int) ([]interface{}, error) {
params := new(rootlygo.ListCausesParams)
params.PageSize = &page_size
params.PageNumber = &page_num
return client.ListCauses(params)
}(page_size, page_num)

if err != nil {
return err
}

if len(resources) == 0 {
break
}

for _, resource := range resources {
tf_resource := g.createCauseResource(resource)
g.Resources = append(g.Resources, tf_resource)

}

page_num += 1
}

return nil
}

func (g *CauseGenerator) createCauseResource(provider_resource interface{}) terraformutils.Resource {
x, _ := provider_resource.(*client.Cause)
return terraformutils.NewSimpleResource(
x.ID,
x.Slug,
"rootly_cause",
g.ProviderName,
[]string{},
)
}




67 changes: 67 additions & 0 deletions providers/rootly/dashboard.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

// Generated by generators/rootly/rootly.js

package rootly

import (

"github.com/GoogleCloudPlatform/terraformer/terraformutils"
"github.com/rootlyhq/terraform-provider-rootly/client"
rootlygo "github.com/rootlyhq/terraform-provider-rootly/schema"
)

type DashboardGenerator struct {
RootlyService
}

func (g* DashboardGenerator) InitResources() error {
page_size := 50
page_num := 1

client, err := g.RootlyClient()
if err != nil {
return err
}

for {
resources, err := func(page_size, page_num int) ([]interface{}, error) {
params := new(rootlygo.ListDashboardsParams)
params.PageSize = &page_size
params.PageNumber = &page_num
return client.ListDashboards(params)
}(page_size, page_num)

if err != nil {
return err
}

if len(resources) == 0 {
break
}

for _, resource := range resources {
tf_resource := g.createDashboardResource(resource)
g.Resources = append(g.Resources, tf_resource)

}

page_num += 1
}

return nil
}

func (g *DashboardGenerator) createDashboardResource(provider_resource interface{}) terraformutils.Resource {
x, _ := provider_resource.(*client.Dashboard)
return terraformutils.NewSimpleResource(
x.ID,
x.Name,
"rootly_dashboard",
g.ProviderName,
[]string{},
)
}




67 changes: 67 additions & 0 deletions providers/rootly/environment.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

// Generated by generators/rootly/rootly.js

package rootly

import (

"github.com/GoogleCloudPlatform/terraformer/terraformutils"
"github.com/rootlyhq/terraform-provider-rootly/client"
rootlygo "github.com/rootlyhq/terraform-provider-rootly/schema"
)

type EnvironmentGenerator struct {
RootlyService
}

func (g* EnvironmentGenerator) InitResources() error {
page_size := 50
page_num := 1

client, err := g.RootlyClient()
if err != nil {
return err
}

for {
resources, err := func(page_size, page_num int) ([]interface{}, error) {
params := new(rootlygo.ListEnvironmentsParams)
params.PageSize = &page_size
params.PageNumber = &page_num
return client.ListEnvironments(params)
}(page_size, page_num)

if err != nil {
return err
}

if len(resources) == 0 {
break
}

for _, resource := range resources {
tf_resource := g.createEnvironmentResource(resource)
g.Resources = append(g.Resources, tf_resource)

}

page_num += 1
}

return nil
}

func (g *EnvironmentGenerator) createEnvironmentResource(provider_resource interface{}) terraformutils.Resource {
x, _ := provider_resource.(*client.Environment)
return terraformutils.NewSimpleResource(
x.ID,
x.Slug,
"rootly_environment",
g.ProviderName,
[]string{},
)
}




Loading

0 comments on commit 92bafc6

Please sign in to comment.