codegurureviewer

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package codegurureviewer implements the AWS CodeGuru Reviewer service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssociateRepositoryInput

type AssociateRepositoryInput struct {
	Repository *RepositoryInput  `json:"Repository"`
	Tags       map[string]string `json:"Tags,omitempty"`
}

AssociateRepositoryInput represents the request body for AssociateRepository.

type AssociateRepositoryResponse

type AssociateRepositoryResponse struct {
	RepositoryAssociation *RepositoryAssociation `json:"RepositoryAssociation"`
	Tags                  map[string]string      `json:"Tags,omitempty"`
}

AssociateRepositoryResponse represents the response for AssociateRepository.

type CodeCommitRepository

type CodeCommitRepository struct {
	Name string `json:"Name"`
}

CodeCommitRepository represents a CodeCommit repository.

type CodeReview

type CodeReview struct {
	AssociationArn       string  `json:"AssociationArn"`
	CodeReviewArn        string  `json:"CodeReviewArn"`
	CreatedTimeStamp     float64 `json:"CreatedTimeStamp"`
	LastUpdatedTimeStamp float64 `json:"LastUpdatedTimeStamp"`
	Name                 string  `json:"Name"`
	Owner                string  `json:"Owner"`
	ProviderType         string  `json:"ProviderType"`
	RepositoryName       string  `json:"RepositoryName"`
	State                string  `json:"State"`
	StateReason          string  `json:"StateReason,omitempty"`
	Type                 string  `json:"Type"`
}

CodeReview represents a CodeGuru Reviewer code review.

type CodeReviewResponse

type CodeReviewResponse struct {
	CodeReview *CodeReview `json:"CodeReview"`
}

CodeReviewResponse represents the response for CreateCodeReview/DescribeCodeReview.

type CreateCodeReviewInput

type CreateCodeReviewInput struct {
	Name                     string `json:"Name"`
	RepositoryAssociationArn string `json:"RepositoryAssociationArn"`
}

CreateCodeReviewInput represents the request body for CreateCodeReview.

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"Message"`
	Type    string `json:"Type"`
}

ErrorResponse represents an error response.

type ListCodeReviewsResponse

type ListCodeReviewsResponse struct {
	CodeReviewSummaries []CodeReview `json:"CodeReviewSummaries"`
	NextToken           string       `json:"NextToken,omitempty"`
}

ListCodeReviewsResponse represents the response for ListCodeReviews.

type ListRecommendationFeedbackResponse

type ListRecommendationFeedbackResponse struct {
	RecommendationFeedbackSummaries []RecommendationFeedback `json:"RecommendationFeedbackSummaries"`
	NextToken                       string                   `json:"NextToken,omitempty"`
}

ListRecommendationFeedbackResponse represents the response for ListRecommendationFeedback.

type ListRecommendationsResponse

type ListRecommendationsResponse struct {
	RecommendationSummaries []RecommendationSummary `json:"RecommendationSummaries"`
	NextToken               string                  `json:"NextToken,omitempty"`
}

ListRecommendationsResponse represents the response for ListRecommendations.

type ListRepositoryAssociationsResponse

type ListRepositoryAssociationsResponse struct {
	RepositoryAssociationSummaries []RepositoryAssociationSummary `json:"RepositoryAssociationSummaries"`
	NextToken                      string                         `json:"NextToken,omitempty"`
}

ListRepositoryAssociationsResponse represents the response for ListRepositoryAssociations.

type MemoryStorage

type MemoryStorage struct {
	Associations map[string]*RepositoryAssociation             `json:"associations"`
	CodeReviews  map[string]*CodeReview                        `json:"codeReviews"`
	Feedback     map[string]map[string]*RecommendationFeedback `json:"feedback"` // codeReviewArn -> recommendationID -> feedback
	// contains filtered or unexported fields
}

MemoryStorage is an in-memory implementation of Storage.

func NewMemoryStorage

func NewMemoryStorage(opts ...Option) *MemoryStorage

NewMemoryStorage creates a new in-memory storage.

func (*MemoryStorage) AssociateRepository

func (m *MemoryStorage) AssociateRepository(input *AssociateRepositoryInput) *RepositoryAssociation

AssociateRepository creates a new repository association.

func (*MemoryStorage) Close added in v0.6.0

func (m *MemoryStorage) Close() error

Close saves the storage state to disk if persistence is enabled.

func (*MemoryStorage) CreateCodeReview

func (m *MemoryStorage) CreateCodeReview(input *CreateCodeReviewInput) (*CodeReview, error)

CreateCodeReview creates a new code review.

func (*MemoryStorage) DescribeCodeReview

func (m *MemoryStorage) DescribeCodeReview(arn string) (*CodeReview, error)

DescribeCodeReview returns a code review by ARN.

func (*MemoryStorage) DescribeRecommendationFeedback

func (m *MemoryStorage) DescribeRecommendationFeedback(codeReviewArn, recommendationID string) (*RecommendationFeedback, error)

DescribeRecommendationFeedback returns feedback for a recommendation.

func (*MemoryStorage) DescribeRepositoryAssociation

func (m *MemoryStorage) DescribeRepositoryAssociation(arn string) (*RepositoryAssociation, error)

DescribeRepositoryAssociation returns a repository association by ARN.

func (*MemoryStorage) DisassociateRepository

func (m *MemoryStorage) DisassociateRepository(arn string) (*RepositoryAssociation, error)

DisassociateRepository removes a repository association.

func (*MemoryStorage) ListCodeReviews

func (m *MemoryStorage) ListCodeReviews() []CodeReview

ListCodeReviews returns all code reviews.

func (*MemoryStorage) ListRecommendationFeedback

func (m *MemoryStorage) ListRecommendationFeedback(codeReviewArn string) []RecommendationFeedback

ListRecommendationFeedback returns all feedback for a code review.

func (*MemoryStorage) ListRecommendations

func (m *MemoryStorage) ListRecommendations(_ string) []RecommendationSummary

ListRecommendations returns recommendations for a code review.

func (*MemoryStorage) ListRepositoryAssociations

func (m *MemoryStorage) ListRepositoryAssociations() []RepositoryAssociationSummary

ListRepositoryAssociations returns all repository associations.

func (*MemoryStorage) MarshalJSON added in v0.6.0

func (m *MemoryStorage) MarshalJSON() ([]byte, error)

MarshalJSON serializes the storage state to JSON.

func (*MemoryStorage) PutRecommendationFeedback

func (m *MemoryStorage) PutRecommendationFeedback(input *PutRecommendationFeedbackInput) error

PutRecommendationFeedback stores feedback for a recommendation.

func (*MemoryStorage) UnmarshalJSON added in v0.6.0

func (m *MemoryStorage) UnmarshalJSON(data []byte) error

UnmarshalJSON restores the storage state from JSON.

type Option added in v0.6.0

type Option func(*MemoryStorage)

Option is a configuration option for MemoryStorage.

func WithDataDir added in v0.6.0

func WithDataDir(dir string) Option

WithDataDir enables persistent storage in the specified directory.

type PutRecommendationFeedbackInput

type PutRecommendationFeedbackInput struct {
	CodeReviewArn    string   `json:"CodeReviewArn"`
	Reactions        []string `json:"Reactions"`
	RecommendationID string   `json:"RecommendationId"`
}

PutRecommendationFeedbackInput represents the request body for PutRecommendationFeedback.

type RecommendationFeedback

type RecommendationFeedback struct {
	CodeReviewArn        string   `json:"CodeReviewArn"`
	CreatedTimeStamp     float64  `json:"CreatedTimeStamp"`
	LastUpdatedTimeStamp float64  `json:"LastUpdatedTimeStamp"`
	Reactions            []string `json:"Reactions"`
	RecommendationID     string   `json:"RecommendationId"`
	UserID               string   `json:"UserId"`
}

RecommendationFeedback represents feedback on a recommendation.

type RecommendationFeedbackResponse

type RecommendationFeedbackResponse struct {
	RecommendationFeedback *RecommendationFeedback `json:"RecommendationFeedback"`
}

RecommendationFeedbackResponse represents the response for DescribeRecommendationFeedback.

type RecommendationSummary

type RecommendationSummary struct {
	Description            string `json:"Description"`
	EndLine                int    `json:"EndLine"`
	FilePath               string `json:"FilePath"`
	RecommendationID       string `json:"RecommendationId"`
	Severity               string `json:"Severity,omitempty"`
	StartLine              int    `json:"StartLine"`
	RecommendationCategory string `json:"RecommendationCategory,omitempty"`
}

RecommendationSummary represents a recommendation from a code review.

type RepositoryAssociation

type RepositoryAssociation struct {
	AssociationArn       string            `json:"AssociationArn"`
	AssociationID        string            `json:"AssociationId"`
	ConnectionArn        string            `json:"ConnectionArn,omitempty"`
	CreatedTimeStamp     float64           `json:"CreatedTimeStamp"`
	LastUpdatedTimeStamp float64           `json:"LastUpdatedTimeStamp"`
	Name                 string            `json:"Name"`
	Owner                string            `json:"Owner"`
	ProviderType         string            `json:"ProviderType"`
	State                string            `json:"State"`
	StateReason          string            `json:"StateReason,omitempty"`
	Tags                 map[string]string `json:"Tags,omitempty"`
}

RepositoryAssociation represents a CodeGuru Reviewer repository association.

type RepositoryAssociationSummary

type RepositoryAssociationSummary struct {
	AssociationArn       string  `json:"AssociationArn"`
	AssociationID        string  `json:"AssociationId"`
	ConnectionArn        string  `json:"ConnectionArn,omitempty"`
	LastUpdatedTimeStamp float64 `json:"LastUpdatedTimeStamp"`
	Name                 string  `json:"Name"`
	Owner                string  `json:"Owner"`
	ProviderType         string  `json:"ProviderType"`
	State                string  `json:"State"`
}

RepositoryAssociationSummary represents a summary of a repository association.

type RepositoryInput

type RepositoryInput struct {
	CodeCommit             *CodeCommitRepository       `json:"CodeCommit,omitempty"`
	Bitbucket              *ThirdPartySourceRepository `json:"Bitbucket,omitempty"`
	GitHubEnterpriseServer *ThirdPartySourceRepository `json:"GitHubEnterpriseServer,omitempty"`
	S3Bucket               *S3Repository               `json:"S3Bucket,omitempty"`
}

RepositoryInput represents a repository in an associate request.

type S3Repository

type S3Repository struct {
	BucketName string `json:"BucketName"`
	Name       string `json:"Name"`
}

S3Repository represents an S3 repository.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service implements the AWS CodeGuru Reviewer service.

func New

func New(storage Storage) *Service

New creates a new CodeGuru Reviewer service.

func (*Service) AssociateRepository

func (s *Service) AssociateRepository(w http.ResponseWriter, r *http.Request)

AssociateRepository handles POST /associations.

func (*Service) Close added in v0.6.0

func (s *Service) Close() error

Close saves the storage state if persistence is enabled.

func (*Service) CreateCodeReview

func (s *Service) CreateCodeReview(w http.ResponseWriter, r *http.Request)

CreateCodeReview handles POST /codereviews.

func (*Service) DescribeCodeReview

func (s *Service) DescribeCodeReview(w http.ResponseWriter, r *http.Request)

DescribeCodeReview handles GET /codereviews/{CodeReviewArn}.

func (*Service) DescribeRecommendationFeedback

func (s *Service) DescribeRecommendationFeedback(w http.ResponseWriter, r *http.Request)

DescribeRecommendationFeedback handles GET /feedback/{CodeReviewArn}.

func (*Service) DescribeRepositoryAssociation

func (s *Service) DescribeRepositoryAssociation(w http.ResponseWriter, r *http.Request)

DescribeRepositoryAssociation handles GET /associations/{AssociationArn}.

func (*Service) DisassociateRepository

func (s *Service) DisassociateRepository(w http.ResponseWriter, r *http.Request)

DisassociateRepository handles DELETE /associations/{AssociationArn}.

func (*Service) ListCodeReviews

func (s *Service) ListCodeReviews(w http.ResponseWriter, _ *http.Request)

ListCodeReviews handles GET /codereviews.

func (*Service) ListRecommendationFeedback

func (s *Service) ListRecommendationFeedback(w http.ResponseWriter, r *http.Request)

ListRecommendationFeedback handles GET /feedback/{CodeReviewArn}/RecommendationFeedback.

func (*Service) ListRecommendations

func (s *Service) ListRecommendations(w http.ResponseWriter, r *http.Request)

ListRecommendations handles GET /codereviews/{CodeReviewArn}/Recommendations.

func (*Service) ListRepositoryAssociations

func (s *Service) ListRepositoryAssociations(w http.ResponseWriter, _ *http.Request)

ListRepositoryAssociations handles GET /associations.

func (*Service) Name

func (s *Service) Name() string

Name returns the service name.

func (*Service) Prefix

func (s *Service) Prefix() string

Prefix returns the URL prefix for CodeGuru Reviewer.

func (*Service) PutRecommendationFeedback

func (s *Service) PutRecommendationFeedback(w http.ResponseWriter, r *http.Request)

PutRecommendationFeedback handles PUT /feedback.

func (*Service) RegisterRoutes

func (s *Service) RegisterRoutes(r service.Router)

RegisterRoutes registers routes with the router.

type Storage

type Storage interface {
	AssociateRepository(input *AssociateRepositoryInput) *RepositoryAssociation
	DescribeRepositoryAssociation(arn string) (*RepositoryAssociation, error)
	DisassociateRepository(arn string) (*RepositoryAssociation, error)
	ListRepositoryAssociations() []RepositoryAssociationSummary

	CreateCodeReview(input *CreateCodeReviewInput) (*CodeReview, error)
	DescribeCodeReview(arn string) (*CodeReview, error)
	ListCodeReviews() []CodeReview

	ListRecommendations(codeReviewArn string) []RecommendationSummary

	PutRecommendationFeedback(input *PutRecommendationFeedbackInput) error
	DescribeRecommendationFeedback(codeReviewArn, recommendationID string) (*RecommendationFeedback, error)
	ListRecommendationFeedback(codeReviewArn string) []RecommendationFeedback
}

Storage defines the interface for CodeGuru Reviewer storage operations.

type ThirdPartySourceRepository

type ThirdPartySourceRepository struct {
	ConnectionArn string `json:"ConnectionArn"`
	Name          string `json:"Name"`
	Owner         string `json:"Owner"`
}

ThirdPartySourceRepository represents a third-party repository.

Jump to

Keyboard shortcuts

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