Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var IAMPolicySchema = map[string]interface{}{ "name": "IAMPolicy", "schema": map[string]interface{}{ "type": "object", "properties": map[string]interface{}{ "Version": map[string]interface{}{ "type": "string", "enum": []string{"2012-10-17"}, }, "Id": map[string]interface{}{ "type": "string", }, "Statement": map[string]interface{}{ "type": "array", "items": map[string]interface{}{ "type": "object", "properties": map[string]interface{}{ "Sid": map[string]interface{}{ "type": "string", }, "Effect": map[string]interface{}{ "type": "string", "enum": []string{"Allow", "Deny"}, }, "Action": map[string]interface{}{ "oneOf": []interface{}{ map[string]interface{}{ "type": "string", "enum": []string{"*"}, }, map[string]interface{}{ "type": "array", "items": map[string]interface{}{"type": "string"}, }, }, }, "Resource": map[string]interface{}{ "oneOf": []interface{}{ map[string]interface{}{ "type": "string", "enum": []string{"*"}, }, map[string]interface{}{ "type": "array", "items": map[string]interface{}{"type": "string"}, }, }, }, }, "required": []string{"Effect"}, }, }, }, "required": []string{"Version", "Statement"}, }, }
View Source
var UserPromptSchema = map[string]interface{}{ "name": "iam_request", "schema": map[string]interface{}{ "type": "object", "properties": map[string]interface{}{ "action": map[string]interface{}{ "type": []string{"string", "null"}, "description": "The action type. If undetermined, return null.", "enum": []string{ "attach_policy", "detach_policy", "add_to_group", "remove_from_group", "attach_custom_policy", }, }, "error": map[string]interface{}{ "type": "boolean", "description": "Indicates if the command cannot be managed by the specified actions.", }, "principal": map[string]interface{}{ "type": "object", "description": "The target entity to which the policy will be attached.", "properties": map[string]interface{}{ "type": map[string]interface{}{ "type": []string{"string", "null"}, "enum": []string{"users", "groups", "roles"}, }, "name": map[string]interface{}{ "type": []string{"string", "null"}, "description": "The name of the target entity.", }, }, "required": []string{"type", "name"}, "additionalProperties": false, }, "requested_resource_type": map[string]interface{}{ "type": []string{"string", "null"}, "description": "The type of aws resource user wants access for. AWS::S3::Bucket, AWS::RDS::DBCluster, AWS::RDS::DBInstance, AWS::EC2::Instance etc", }, "requested_resource": map[string]interface{}{ "type": []string{"string", "null"}, "description": "The name of the resource user wants access for.", }, "is_managed_policy": map[string]interface{}{ "type": "boolean", "description": "Indicates if the provided policy is an exact AWS managed policy.", }, "policy": map[string]interface{}{ "type": []string{"string", "null"}, "description": "The name of the policy. If it's too vague, return null. If the user input does not provide any meaningful context, the model must not guess a policy. For Managed policies, use the arn foe example: arn:aws:iam::aws:policy/AdministratorAccess.", }, "confidence": map[string]interface{}{ "type": "integer", "description": "Confidence level from 1 to 10 about the policy name.", }, }, "required": []string{ "error", }, "additionalProperties": false, }, }
Functions ¶
func GenerateCLICommand ¶
func GenerateCLICommand(response GPTResponse) string
Types ¶
type GPTResponse ¶
type GPTResponse struct {
Action string `json:"action"`
Principal map[string]string `json:"principal"`
RequestedResourceType string `json:"requested_resource_type"`
RequestedResource string `json:"requested_resource"`
IsManagedPolicy bool `json:"is_managed_policy"`
Policy string `json:"policy"`
Error bool `json:"error"`
Confidence int `json:"confidence"`
}
func UserPrompt ¶
func UserPrompt(apiKey, prompt string) (GPTResponse, error)
type IAMActionResource ¶
func (IAMActionResource) MarshalJSON ¶
func (ar IAMActionResource) MarshalJSON() ([]byte, error)
func (*IAMActionResource) UnmarshalJSON ¶
func (ar *IAMActionResource) UnmarshalJSON(data []byte) error
type IAMPolicy ¶
type IAMPolicy struct {
Version string `json:"Version"`
Id string `json:"Id,omitempty"`
Statement []IAMStatement `json:"Statement"`
}
type IAMPrincipal ¶
type IAMPrincipal struct {
Star bool
AWS []string
Federated []string
Service []string
CanonicalUser []string
}
func (IAMPrincipal) MarshalJSON ¶
func (p IAMPrincipal) MarshalJSON() ([]byte, error)
func (*IAMPrincipal) UnmarshalJSON ¶
func (p *IAMPrincipal) UnmarshalJSON(data []byte) error
type IAMStatement ¶
type IAMStatement struct {
Sid string `json:"Sid,omitempty"`
Effect string `json:"Effect"`
Principal *IAMPrincipal `json:"Principal,omitempty"`
NotPrincipal *IAMPrincipal `json:"NotPrincipal,omitempty"`
Action *IAMActionResource `json:"Action,omitempty"`
NotAction *IAMActionResource `json:"NotAction,omitempty"`
Resource *IAMActionResource `json:"Resource,omitempty"`
NotResource *IAMActionResource `json:"NotResource,omitempty"`
Condition map[string]interface{} `json:"Condition,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.