environments

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const CollectionName = "environments"
View Source
const NeoServiceValue = "NEO"

Variables

View Source
var CreateEnvironmentDef = types.ToolDefinition{
	ValidationPolicy: &types.ToolValidationPolicy{
		ProductionEnvironmentNotApplicable: true,
	},
	McpTool: &mcp.Tool{
		Name:         "create_environment",
		Title:        "Create PingOne Environment",
		Description:  "Create a new sandbox PingOne environment. Only SANDBOX type supported via API (PRODUCTION must be created via admin console). Requires license quota. Environment becomes available immediately but services may take 10-30 seconds to initialize.",
		InputSchema:  schema.MustGenerateSchema[CreateEnvironmentInput](),
		OutputSchema: schema.MustGenerateSchema[CreateEnvironmentOutput](),
		Annotations: &mcp.ToolAnnotations{
			DestructiveHint: func() *bool { b := false; return &b }(),
		},
	},
}
View Source
var GetEnvironmentDef = types.ToolDefinition{
	ValidationPolicy: &types.ToolValidationPolicy{
		AllowProductionEnvironmentRead: true,
	},
	McpTool: &mcp.Tool{
		Name:         "get_environment",
		Title:        "Get PingOne Environment by ID",
		Description:  "Retrieve an environment's full configuration by ID. Use 'list_environments' first if you need to find the environment ID. Call this before 'update_environment' to get current configuration.",
		InputSchema:  schema.MustGenerateSchema[GetEnvironmentInput](),
		OutputSchema: schema.MustGenerateSchema[GetEnvironmentOutput](),
		Annotations: &mcp.ToolAnnotations{
			ReadOnlyHint: true,
		},
	},
}
View Source
var GetEnvironmentServicesDef = types.ToolDefinition{
	ValidationPolicy: &types.ToolValidationPolicy{
		AllowProductionEnvironmentRead: true,
	},
	McpTool: &mcp.Tool{
		Name:         "get_environment_services",
		Title:        "Get PingOne Environment Services by ID",
		Description:  "Retrieve all the services assigned to a specified PingOne environment, by the environment's unique ID.",
		InputSchema:  schema.MustGenerateSchema[GetEnvironmentServicesInput](),
		OutputSchema: schema.MustGenerateSchema[GetEnvironmentServicesOutput](),
		Annotations: &mcp.ToolAnnotations{
			ReadOnlyHint: true,
		},
	},
}
View Source
var ListEnvironmentsDef = types.ToolDefinition{
	ValidationPolicy: &types.ToolValidationPolicy{
		ProductionEnvironmentNotApplicable: true,
	},
	McpTool: &mcp.Tool{
		Name:  "list_environments",
		Title: "List PingOne Environments",
		Description: `Lists all PingOne environments accessible to the authenticated user.

Use to discover environment IDs needed for other operations or to find environments by name/status.

Only filters that 'name' with 'sw' (starts with); 'id', 'organization.id', 'license.id', 'status' with 'eq' (equals); 'and' to combine are valid.

Filter examples:
- name sw "Prod"
- status eq "ACTIVE"
- name sw "Dev" and status eq "ACTIVE"

Returns: Array of environments with ID, name, type, region, license, and metadata.`,
		InputSchema:  schema.MustGenerateSchema[ListEnvironmentsInput](),
		OutputSchema: schema.MustGenerateSchema[ListEnvironmentsOutput](),
		Annotations: &mcp.ToolAnnotations{
			ReadOnlyHint: true,
		},
	},
}
View Source
var UpdateEnvironmentDef = types.ToolDefinition{
	McpTool: &mcp.Tool{
		Name:  "update_environment",
		Title: "Update PingOne Environment by ID",
		Description: `Update environment configuration using full replacement (HTTP PUT).

WORKFLOW - Required to avoid data loss:
1. Call 'get_environment' to fetch current configuration
2. Modify only the fields you want to change
3. Pass the complete merged object to this tool

Omitted optional fields will be cleared. Common updates: name, description, type (SANDBOX→PRODUCTION is permanent). Cannot change: region, ID.`,
		InputSchema:  schema.MustGenerateSchema[UpdateEnvironmentInput](),
		OutputSchema: schema.MustGenerateSchema[UpdateEnvironmentOutput](),
	},
}
View Source
var UpdateEnvironmentServicesDef = types.ToolDefinition{
	McpTool: &mcp.Tool{
		Name:         "update_environment_services",
		Title:        "Update PingOne Environment Services by ID",
		Description:  "Update the services assigned to a PingOne environment (update's the environment's Bill of Materials) by the environment's unique ID. IMPORTANT: when changing the services for an environment, include any optional fields you wish to retain from the existing configuration, as omitting them remove those fields from the configuration.",
		InputSchema:  mustGenerateUpdateEnvironmentServicesInputSchema(),
		OutputSchema: schema.MustGenerateSchema[UpdateEnvironmentServicesOutput](),
	},
}

Functions

func CreateEnvironmentHandler

func CreateEnvironmentHandler(environmentsClientFactory EnvironmentsClientFactory, initializeAuthContext initialize.ContextInitializer) func(
	ctx context.Context,
	req *mcp.CallToolRequest,
	input CreateEnvironmentInput,
) (
	*mcp.CallToolResult,
	*CreateEnvironmentOutput,
	error,
)

CreateEnvironmentHandler creates a new PingOne environment using the provided client

func GetEnvironmentHandler

func GetEnvironmentHandler(environmentsClientFactory EnvironmentsClientFactory, initializeAuthContext initialize.ContextInitializer) func(
	ctx context.Context,
	req *mcp.CallToolRequest,
	input GetEnvironmentInput,
) (
	*mcp.CallToolResult,
	*GetEnvironmentOutput,
	error,
)

GetEnvironmentHandler retrieves a PingOne environment by ID using the provided client

func GetEnvironmentServicesHandler

func GetEnvironmentServicesHandler(environmentsClientFactory EnvironmentsClientFactory, initializeAuthContext initialize.ContextInitializer) func(
	ctx context.Context,
	req *mcp.CallToolRequest,
	input GetEnvironmentServicesInput,
) (
	*mcp.CallToolResult,
	*GetEnvironmentServicesOutput,
	error,
)

GetEnvironmentServicesHandler retrieves PingOne environment services by ID using the provided client

func ListEnvironmentsHandler

func ListEnvironmentsHandler(environmentsClientFactory EnvironmentsClientFactory, initializeAuthContext initialize.ContextInitializer) func(
	ctx context.Context,
	req *mcp.CallToolRequest,
	input ListEnvironmentsInput,
) (
	*mcp.CallToolResult,
	*ListEnvironmentsOutput,
	error,
)

ListEnvironmentsHandler lists all PingOne environments using the provided client

func UpdateEnvironmentHandler

func UpdateEnvironmentHandler(environmentsClientFactory EnvironmentsClientFactory, initializeAuthContext initialize.ContextInitializer) func(
	ctx context.Context,
	req *mcp.CallToolRequest,
	input UpdateEnvironmentInput,
) (
	*mcp.CallToolResult,
	*UpdateEnvironmentOutput,
	error,
)

UpdateEnvironmentHandler updates a PingOne environment by ID using the provided client

func UpdateEnvironmentServicesHandler

func UpdateEnvironmentServicesHandler(environmentsClientFactory EnvironmentsClientFactory, initializeAuthContext initialize.ContextInitializer) func(
	ctx context.Context,
	req *mcp.CallToolRequest,
	input UpdateEnvironmentServicesInput,
) (
	*mcp.CallToolResult,
	*UpdateEnvironmentServicesOutput,
	error,
)

UpdateEnvironmentServicesHandler updates PingOne environment services by ID using the provided client

Types

type CreateEnvironmentInput

type CreateEnvironmentInput struct {
	BillOfMaterials *pingone.EnvironmentBillOfMaterials `` /* 310-byte string literal not displayed */
	Description     *string                             `json:"description,omitempty" jsonschema:"OPTIONAL. The description of the environment."`
	Icon            *string                             `` /* 161-byte string literal not displayed */
	License         pingone.EnvironmentLicense          `` /* 159-byte string literal not displayed */
	Name            string                              `json:"name" jsonschema:"REQUIRED. Environment name, must be unique within organization."`
	Region          pingone.EnvironmentRegionCode       `json:"region" jsonschema:"REQUIRED. Region code: NA, CA, EU, AU, SG, or AP. Cannot be changed after creation."`
}

CreateEnvironmentInput defines the input parameters for creating an environment

type CreateEnvironmentOutput

type CreateEnvironmentOutput struct {
	Environment pingone.EnvironmentResponse `json:"environment" jsonschema:"The created environment details including ID, name, type, region, and metadata"`
}

CreateEnvironmentOutput represents the result of creating an environment

type EnvironmentServiceInput

type EnvironmentServiceInput struct {
	Type      string                                              `` /* 145-byte string literal not displayed */
	Bookmarks []pingone.EnvironmentBillOfMaterialsProductBookmark `json:"bookmarks,omitempty" jsonschema:"OPTIONAL. Custom bookmarks. Up to five can be specified per product."`
	Console   *pingone.EnvironmentBillOfMaterialsProductConsole   `` /* 282-byte string literal not displayed */
	Tags      []string                                            `` /* 299-byte string literal not displayed */
}

type EnvironmentSummary

type EnvironmentSummary struct {
	Id        uuid.UUID                       `json:"id" jsonschema:"The unique identifier of the environment"`
	Name      string                          `json:"name" jsonschema:"The name of the environment"`
	CreatedAt time.Time                       `json:"createdAt" jsonschema:"The timestamp when the environment was created"`
	Type      pingone.EnvironmentTypeValue    `json:"type" jsonschema:"The type of the environment (e.g., PRODUCTION, SANDBOX)"`
	Status    *pingone.EnvironmentStatusValue `json:"status,omitempty" jsonschema:"OPTIONAL. The status of the environment (e.g., ACTIVE, DELETE_PENDING)"`
}

EnvironmentSummary contains the essential fields of an environment

type EnvironmentsClient

type EnvironmentsClient interface {
	GetEnvironments(ctx context.Context, filter *string) (pingone.PagedIterator[pingone.EnvironmentsCollectionResponse], error)
	CreateEnvironment(ctx context.Context, request *pingone.EnvironmentCreateRequest) (*pingone.EnvironmentResponse, *http.Response, error)
	GetEnvironment(ctx context.Context, environmentId uuid.UUID) (*pingone.EnvironmentResponse, *http.Response, error)
	UpdateEnvironment(ctx context.Context, environmentId uuid.UUID, request *pingone.EnvironmentReplaceRequest) (*pingone.EnvironmentResponse, *http.Response, error)
	GetEnvironmentServices(ctx context.Context, environmentId uuid.UUID) (*pingone.EnvironmentBillOfMaterialsResponse, *http.Response, error)
	UpdateEnvironmentServices(ctx context.Context, environmentId uuid.UUID, request *pingone.EnvironmentBillOfMaterialsReplaceRequest) (*pingone.EnvironmentBillOfMaterialsResponse, *http.Response, error)
}

type EnvironmentsClientFactory

type EnvironmentsClientFactory interface {
	GetAuthenticatedClient(ctx context.Context) (EnvironmentsClient, error)
}

type EnvironmentsCollection

type EnvironmentsCollection struct{}

func (*EnvironmentsCollection) ListTools

func (c *EnvironmentsCollection) ListTools() []types.ToolDefinition

func (*EnvironmentsCollection) Name

func (c *EnvironmentsCollection) Name() string

func (*EnvironmentsCollection) RegisterTools

func (c *EnvironmentsCollection) RegisterTools(ctx context.Context, server *mcp.Server, clientFactory sdk.ClientFactory, authClientFactory client.AuthClientFactory, tokenStore tokenstore.TokenStore, toolFilter *filter.Filter, grantType auth.GrantType) error

type GetEnvironmentInput

type GetEnvironmentInput struct {
	EnvironmentId uuid.UUID `json:"environmentId" jsonschema:"REQUIRED. UUID format (e.g., '123e4567-e89b-12d3-a456-426614174000')."`
}

GetEnvironmentInput defines the input parameters for retrieving an environment by ID

type GetEnvironmentOutput

type GetEnvironmentOutput struct {
	Environment pingone.EnvironmentResponse `json:"environment" jsonschema:"The environment details including ID, name, type, region, and metadata"`
}

GetEnvironmentOutput represents the result of retrieving an environment

type GetEnvironmentServicesInput

type GetEnvironmentServicesInput struct {
	EnvironmentId uuid.UUID `json:"environmentId" jsonschema:"REQUIRED. The unique identifier (UUID) string of the PingOne environment"`
}

GetEnvironmentServicesInput defines the input parameters for retrieving environment services by ID

type GetEnvironmentServicesOutput

type GetEnvironmentServicesOutput struct {
	Services pingone.EnvironmentBillOfMaterialsResponse `json:"services" jsonschema:"The bill of materials for the environment, including products and solution type"`
}

GetEnvironmentServicesOutput represents the result of retrieving environment services

type ListEnvironmentsInput

type ListEnvironmentsInput struct {
	Filter *string `` /* 205-byte string literal not displayed */
}

ListEnvironmentsInput defines the input parameters for listing environments

type ListEnvironmentsOutput

type ListEnvironmentsOutput struct {
	Environments []EnvironmentSummary `json:"environments" jsonschema:"List of environments with their basic details"`
}

ListEnvironmentsOutput represents the result of listing environments

type PingOneClientEnvironmentsWrapper

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

func NewPingOneClientEnvironmentsWrapper

func NewPingOneClientEnvironmentsWrapper(client *pingone.APIClient) *PingOneClientEnvironmentsWrapper

func (*PingOneClientEnvironmentsWrapper) CreateEnvironment

func (*PingOneClientEnvironmentsWrapper) GetEnvironment

func (*PingOneClientEnvironmentsWrapper) GetEnvironmentServices

func (*PingOneClientEnvironmentsWrapper) GetEnvironments

func (*PingOneClientEnvironmentsWrapper) UpdateEnvironment

func (*PingOneClientEnvironmentsWrapper) UpdateEnvironmentServices

type PingOneClientEnvironmentsWrapperFactory

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

func NewPingOneClientEnvironmentsWrapperFactory

func NewPingOneClientEnvironmentsWrapperFactory(clientFactory sdk.ClientFactory, tokenStore tokenstore.TokenStore) *PingOneClientEnvironmentsWrapperFactory

func (*PingOneClientEnvironmentsWrapperFactory) GetAuthenticatedClient

type UpdateEnvironmentInput

type UpdateEnvironmentInput struct {
	BillOfMaterials *pingone.EnvironmentBillOfMaterialsReplaceRequest `` /* 203-byte string literal not displayed */
	Description     *string                                           `json:"description,omitempty" jsonschema:"OPTIONAL. The description of the environment."`
	EnvironmentId   uuid.UUID                                         `json:"environmentId" jsonschema:"REQUIRED. The unique identifier (UUID) string of the PingOne environment to update."`
	Icon            *string                                           `` /* 161-byte string literal not displayed */
	License         *pingone.EnvironmentLicense                       `` /* 169-byte string literal not displayed */
	Name            string                                            `json:"name" jsonschema:"REQUIRED. Environment name, must be unique within organization."`
	Region          pingone.EnvironmentRegionCode                     `json:"region" jsonschema:"REQUIRED. Region code (NA/CA/EU/AU/SG/AP). Set at creation, immutable."`
	Status          *pingone.EnvironmentStatusValue                   `` /* 149-byte string literal not displayed */
	Type            pingone.EnvironmentTypeValue                      `json:"type" jsonschema:"REQUIRED. PRODUCTION or SANDBOX. SANDBOX can be promoted to PRODUCTION (permanent, cannot revert)."`
}

UpdateEnvironmentInput defines the input parameters for updating an environment

type UpdateEnvironmentOutput

type UpdateEnvironmentOutput struct {
	Environment pingone.EnvironmentResponse `json:"environment" jsonschema:"The updated environment details including ID, name, type, region, and metadata"`
}

UpdateEnvironmentOutput represents the result of updating an environment

type UpdateEnvironmentServicesInput

type UpdateEnvironmentServicesInput struct {
	EnvironmentId uuid.UUID                 `json:"environmentId" jsonschema:"REQUIRED. The unique identifier (UUID) string of the PingOne environment"`
	Services      []EnvironmentServiceInput `` /* 167-byte string literal not displayed */
}

type UpdateEnvironmentServicesOutput

type UpdateEnvironmentServicesOutput struct {
	Services pingone.EnvironmentBillOfMaterialsResponse `json:"services" jsonschema:"The updated bill of materials for the environment, including products and solution type"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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