iam

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 7 Imported by: 0

README

awsutils/iam

The iam package is a collection of utility functions designed to simplify common iam tasks.


Table of contents


Functions

AWSService.GetAWSIdentity()
GetAWSIdentity() *AWSIdentity, error

GetAWSIdentity retrieves the AWS identity of the caller.

Returns:

*AWSIdentity: A pointer to the AWSIdentity of the caller. error: An error if any issue occurs while trying to get the AWS identity.


AWSService.GetInstanceProfile(string)
GetInstanceProfile(string) *types.InstanceProfile, error

GetInstanceProfile retrieves the instance profile for a given profile name.

Parameters:

profileName: The name of the profile to retrieve.

Returns:

*types.InstanceProfile: A pointer to the InstanceProfile. error: An error if any issue occurs while trying to get the instance profile.


NewAWSService()
NewAWSService() *AWSService, error

NewAWSService creates a new AWSService with the default AWS configuration.

Returns:

*AWSService: A pointer to the newly created AWSService. error: An error if any issue occurs while trying to create the AWSService.


Installation

To use the awsutils/iam package, you first need to install it. Follow the steps below to install via go get.

go get github.com/l50/awsutils/iam

Usage

After installation, you can import the package in your Go project using the following import statement:

import "github.com/l50/awsutils/iam"

Tests

To ensure the package is working correctly, run the following command to execute the tests for awsutils/iam:

go test -v

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.


License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSIdentity added in v1.1.7

type AWSIdentity struct {
	Account string
	ARN     string
	UserID  string
}

AWSIdentity represents the identity of an AWS account.

**Attributes:**

Account: AWS account ID. ARN: AWS ARN associated with the account. UserID: AWS user ID associated with the account.

type AWSService added in v1.1.7

type AWSService struct {
	STSClient STSClientAPI
	IAMClient IdentityClientAPI
}

AWSService represents the AWS services needed for the application.

**Attributes:**

STSClient: Client to make calls to the AWS STS service. IAMClient: Client to make calls to the AWS IAM service.

func NewAWSService added in v1.1.7

func NewAWSService() (*AWSService, error)

NewAWSService creates a new AWSService with the default AWS configuration.

**Returns:**

*AWSService: A pointer to the newly created AWSService. error: An error if any issue occurs while trying to create the AWSService.

func (*AWSService) GetAWSIdentity added in v1.1.7

func (s *AWSService) GetAWSIdentity() (*AWSIdentity, error)

GetAWSIdentity retrieves the AWS identity of the caller.

**Returns:**

*AWSIdentity: A pointer to the AWSIdentity of the caller. error: An error if any issue occurs while trying to get the AWS identity.

func (*AWSService) GetInstanceProfile added in v1.1.7

func (s *AWSService) GetInstanceProfile(profileName string) (*types.InstanceProfile, error)

GetInstanceProfile retrieves the instance profile for a given profile name.

**Parameters:**

profileName: The name of the profile to retrieve.

**Returns:**

*types.InstanceProfile: A pointer to the InstanceProfile. error: An error if any issue occurs while trying to get the instance profile.

type IdentityClientAPI added in v1.1.7

type IdentityClientAPI interface {
	GetInstanceProfile(ctx context.Context, params *iam.GetInstanceProfileInput, optFns ...func(*iam.Options)) (*iam.GetInstanceProfileOutput, error)
}

IdentityClientAPI represents the interface needed to make calls to the AWS IAM service.

**Attributes:**

GetInstanceProfile: Function to get the instance profile.

type STSClientAPI added in v1.1.7

type STSClientAPI interface {
	GetCallerIdentity(ctx context.Context, params *sts.GetCallerIdentityInput, optFns ...func(*sts.Options)) (*sts.GetCallerIdentityOutput, error)
}

STSClientAPI represents the interface needed to make calls to the AWS STS service.

**Attributes:**

GetCallerIdentity: Function to get the caller identity.

Jump to

Keyboard shortcuts

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