insight

package
v0.0.0-...-071abd4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assets

type Assets struct {
	Name          string `json:"name,omitempty" yaml:"name,omitempty"`
	DownloadCount int    `json:"download_count,omitempty" yaml:"download_count,omitempty"`
}

Assets holds download count information of a specific release of GitHub.

type Attributes

type Attributes struct {
	Month int `json:"month,omitempty" yaml:"month,omitempty"`
	Total int `json:"total,omitempty" yaml:"total,omitempty"`
	Week  int `json:"week,omitempty" yaml:"week,omitempty"`
	Year  int `json:"year,omitempty" yaml:"year,omitempty"`
}

Attributes holds the download attributes of a Terraform provider.

type Auth

type Auth struct {
	UserName    string `json:"username,omitempty" yaml:"username,omitempty"`
	Password    string `json:"password,omitempty" yaml:"password,omitempty"`
	BearerToken string `json:"bearer_token,omitempty" yaml:"bearer_token,omitempty"`
}

Auth holds the authorization information of selected platforms.

func (*Auth) SetAuth

func (auth *Auth) SetAuth(httpClient *resty.Client)

SetAuth sets authorization for the http client if passed.

type Config

type Config struct {
	Sources  []Source `json:"sources,omitempty" yaml:"sources,omitempty"`
	LogLevel string   `json:"log_level,omitempty" yaml:"log_level,omitempty"`
	// contains filtered or unexported fields
}

Config holds the configuration of multiple projects for which metrics need to be collected.

func GetConfig

func GetConfig(conf Config, path string) (*Config, error)

GetConfig returns the new instance of Config.

func (*Config) GetInsight

func (cfg *Config) GetInsight() []Insight

GetInsight gets insight into the downloads of all specified projects.

func (*Config) SetLogger

func (cfg *Config) SetLogger(logger *logrus.Logger)

type Data

type Data struct {
	Type       string     `json:"type,omitempty" yaml:"type,omitempty"`
	ID         string     `json:"id,omitempty" yaml:"id,omitempty"`
	Attributes Attributes `json:"attributes,omitempty" yaml:"attributes,omitempty"`
}

Data holds the download data of a Terraform provider.

type GitRelease

type GitRelease struct {
	TagName string   `json:"tag_name,omitempty" yaml:"tag_name,omitempty"`
	Name    string   `json:"name,omitempty" yaml:"name,omitempty"`
	Assets  []Assets `json:"assets,omitempty" yaml:"assets,omitempty"`
}

GitRelease holds information of the releases downloaded metrics of GitHub.

type Insight

type Insight struct {
	Platform string `json:"platform,omitempty" yaml:"platform,omitempty"`
	ID       string `json:"id,omitempty" yaml:"id,omitempty"`
	Summary  any    `json:"summary,omitempty" yaml:"summary,omitempty"`
}

Insight holds the download metrics for a particular project.

type OpensourceID

type OpensourceID struct {
	ID    string `json:"id,omitempty" yaml:"id,omitempty"`
	Name  string `json:"name,omitempty" yaml:"name,omitempty"`
	Alias string `json:"alias,omitempty" yaml:"alias,omitempty"`
}

OpensourceID holds information about the ID of the project for which metrics are to be pulled.

func (OpensourceID) GetID

func (id OpensourceID) GetID() string

GetID gets ID of the project by validating the alias if set.

type ProviderDownloadSummary

type ProviderDownloadSummary struct {
	Data Data `json:"data,omitempty" yaml:"data,omitempty"`
}

ProviderDownloadSummary holds the information of the download metrics of a Terraform provider.

type ProviderVersion

type ProviderVersion struct {
	ID        string   `json:"id,omitempty" yaml:"id,omitempty"`
	Versions  []string `json:"versions,omitempty" yaml:"versions,omitempty"`
	Source    string   `json:"source,omitempty" yaml:"source,omitempty"`
	Owner     string   `json:"owner,omitempty" yaml:"owner,omitempty"`
	NameSpace string   `json:"namespace,omitempty" yaml:"namespace,omitempty"`
}

ProviderVersion Holds the information of all available versions of a provider.

type Source

type Source struct {
	Platform    string         `json:"platform,omitempty" yaml:"platform,omitempty"`
	BaseURL     string         `json:"base_url,omitempty" yaml:"base_url,omitempty"`
	ResourceIDs []OpensourceID `json:"resource_ids,omitempty" yaml:"resource_ids,omitempty"`
	CaFilePath  string         `json:"ca_file_path,omitempty" yaml:"ca_file_path,omitempty"`
	Auth        Auth           `json:"auth,omitempty" yaml:"auth,omitempty"`
	// contains filtered or unexported fields
}

Source holds the information about the project for which metrics are to be pulled.

func (*Source) GetPlatform

func (s *Source) GetPlatform() (string, error)

GetPlatform returns the platform by identifying it from the URL of the project passed.

func (*Source) GitHubMetrics

func (s *Source) GitHubMetrics(sourceID string, httpClient *resty.Client) (any, error)

GitHubMetrics is responsible for making https calls to pull the metrics for the appropriate project.

func (*Source) NewClient

func (s *Source) NewClient(caContent []byte) *resty.Client

NewClient returns new instance of httpClient when invoked.

func (*Source) SetLogger

func (s *Source) SetLogger(log *logrus.Logger)

SetLogger sets logger to the opensource insight.

func (*Source) TerraformMetrics

func (s *Source) TerraformMetrics(name, sourceID string, httpClient *resty.Client) (any, error)

TerraformMetrics is responsible for making https calls to pull the metrics for the appropriate project from terraform.

type Version

type Version struct {
	Version string `json:"version,omitempty" yaml:"version,omitempty"`
}

Version Holds the version of a provider.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL