// Code generated by smithy-go-codegen DO NOT EDIT.

package bedrockagentcorecontrol

import (
	"context"
	"github.com/aws/aws-sdk-go-v2/service/bedrockagentcorecontrol/types"
	"github.com/aws/smithy-go/middleware"
	smithyhttp "github.com/aws/smithy-go/transport/http"
	"time"
)

// Retrieves detailed information about a specific gateway rule.
func (c *Client) GetGatewayRule(ctx context.Context, params *GetGatewayRuleInput, optFns ...func(*Options)) (*GetGatewayRuleOutput, error) {
	if params == nil {
		params = &GetGatewayRuleInput{}
	}

	result, metadata, err := c.invokeOperation(ctx, "GetGatewayRule", params, optFns, c.addOperationGetGatewayRuleMiddlewares)
	if err != nil {
		return nil, err
	}

	out := result.(*GetGatewayRuleOutput)
	out.ResultMetadata = metadata
	return out, nil
}

type GetGatewayRuleInput struct {

	// The identifier of the gateway containing the rule.
	//
	// This member is required.
	GatewayIdentifier *string

	// The unique identifier of the rule to retrieve.
	//
	// This member is required.
	RuleId *string

	noSmithyDocumentSerde
}

// Create response excludes updatedAt (redundant on create). Get/Update responses
// include it via their own output structures.
type GetGatewayRuleOutput struct {

	// The actions to take when the rule conditions are met.
	//
	// This member is required.
	Actions []types.Action

	// The timestamp when the rule was created.
	//
	// This member is required.
	CreatedAt *time.Time

	// The Amazon Resource Name (ARN) of the gateway that the rule belongs to.
	//
	// This member is required.
	GatewayArn *string

	// The priority of the rule. Rules are evaluated in order of priority, with lower
	// numbers evaluated first.
	//
	// This member is required.
	Priority *int32

	// The unique identifier of the gateway rule.
	//
	// This member is required.
	RuleId *string

	// The current status of the rule.
	//
	// This member is required.
	Status types.GatewayRuleStatus

	// The conditions that must be met for the rule to apply.
	Conditions []types.Condition

	// The description of the gateway rule.
	Description *string

	// System-managed metadata for rules created by automated processes.
	System *types.SystemManagedBlock

	// The timestamp when the rule was last updated.
	UpdatedAt *time.Time

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

func (c *Client) addOperationGetGatewayRuleMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsRestjson1_serializeOpGetGatewayRule{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetGatewayRule{}, middleware.After)
	if err != nil {
		return err
	}

	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
		return err
	}
	if err = addComputeContentLength(stack); err != nil {
		return err
	}
	if err = addResolveEndpointMiddleware(stack, options); err != nil {
		return err
	}
	if err = addComputePayloadSHA256(stack); err != nil {
		return err
	}
	if err = addRecordResponseTiming(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = addOpGetGatewayRuleValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "GetGatewayRule"), middleware.Before); err != nil {
		return err
	}
	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
		return err
	}
	if err = addResponseErrorMiddleware(stack); err != nil {
		return err
	}
	if err = addRequestResponseLogging(stack, options); err != nil {
		return err
	}
	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
		return err
	}
	if err = addInterceptors(stack, options); err != nil {
		return err
	}
	return nil
}
