current

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package current contains all logic and data structures relevant to the current state of the AWS instance. It is primarily leveraged by the `methodaws current` subcommand.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSResource

type AWSResource struct {
	IdentityDocument imds.InstanceIdentityDocument `json:"identityDocument" yaml:"identityDocument"`
	Hostname         string                        `json:"hostname" yaml:"hostname"`
	PublicIP         string                        `json:"publicIp" yaml:"publicIp"`
	PublicHostname   string                        `json:"publicHostname" yaml:"publicHostname"`
}

AWSResource contains the instance identity document, hostname, public IP, and public hostname of the current AWS instance. It is used to represent the current state of the instance.

type AWSResourceReport

type AWSResourceReport struct {
	Resource AWSResource `json:"resource" yaml:"resource"`
	Errors   []string    `json:"errors" yaml:"errors"`
}

AWSResourceReport contains the AWSResource and any errors that occurred during the execution of the `methodaws current instance` subcommand.

func InstanceDetails

func InstanceDetails(ctx context.Context, cfg aws.Config) (AWSResourceReport, error)

InstanceDetails is responsible for gathering the instance identity document, hostname, public IP, and public hostname of the current AWS instance. It returns an AWSResourceReport struct that contains any non-fatal errors that occurred during the execution of the subcommand.

type IamResourceReport

type IamResourceReport struct {
	InlinePolicies   []*iam.GetRolePolicyOutput `json:"inlinePolicies" yaml:"inlinePolicies"`
	AttachedPolicies []identity.PolicyResource  `json:"attachedPolicies" yaml:"attachedPolicies"`
	Role             *types.Role                `json:"role" yaml:"role"`
	Errors           []string                   `json:"errors" yaml:"errors"`
}

IamResourceReport represents the output of the `methodaws current iam` subcommand. It contains the inline policies, attached policies, and role details of the current IAM role. It also contains any errors that occurred during the execution of the subcommand.

func IamDetails

func IamDetails(ctx context.Context, cfg aws.Config) (IamResourceReport, error)

IamDetails is responsible for gathering the IAM role details, inline policies, and attached policies for any IAM roles that are associated with the current AWS instance. It returns an IamResourceReport struct that contains any non-fatal errors that occurred during the execution of the subcommand. If the caller ARN cannot be retrieved, it will return an error because execution cannot proceed.

Jump to

Keyboard shortcuts

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