diff --git a/plugin/build.properties b/plugin/build.properties index 5eba3e21..802f2d61 100644 --- a/plugin/build.properties +++ b/plugin/build.properties @@ -6,5 +6,6 @@ bin.includes = plugin.xml,\ target/classes/,\ webview/build/,\ target/dependency/,\ - auth/ + auth/,\ + codegen-resources/ jre.compilation.profile = JavaSE-17 diff --git a/plugin/codegen-resources/definitions/commonDefinitions.json b/plugin/codegen-resources/definitions/commonDefinitions.json new file mode 100644 index 00000000..b2ecc424 --- /dev/null +++ b/plugin/codegen-resources/definitions/commonDefinitions.json @@ -0,0 +1,7143 @@ +{ + "types": [ + { + "name": "action", + "type": "string", + "description": "Name of an action that was taken, displayed, etc." + }, + { + "name": "amazonqCodeGenerationResult", + "type": "string", + "description": "Captures if code generation result is Complete, Failed, etc." + }, + { + "name": "amazonqConversationId", + "type": "string", + "description": "Uniquely identifies a message with which the user interacts." + }, + { + "name": "amazonqEndOfTheConversationLatency", + "type": "double", + "description": "Total time from start to end" + }, + { + "name": "amazonqGenerateApproachIteration", + "type": "double", + "description": "Order of approach iteration. For initial code changes it is 0" + }, + { + "name": "amazonqGenerateApproachLatency", + "type": "double", + "description": "The time it takes to generate approach response" + }, + { + "name": "amazonqGenerateCodeIteration", + "type": "double", + "description": "Order of code generation iteration. For initial code changes it is 0" + }, + { + "name": "amazonqGenerateCodeResponseLatency", + "type": "double", + "description": "The time it takes to generate code generation response" + }, + { + "name": "amazonqNumberOfFilesAccepted", + "type": "double", + "description": "Captures the number of accepted files as a part of code generation iteration" + }, + { + "name": "amazonqNumberOfFilesGenerated", + "type": "double", + "description": "Captures the number of files generated as a part of code generation iteration" + }, + { + "name": "amazonqNumberOfReferences", + "type": "double", + "description": "Captures the number of references" + }, + { + "name": "amazonqRepositorySize", + "type": "double", + "description": "Captures the size of the source code" + }, + { + "name": "amazonqUploadIntent", + "type": "string", + "description": "The intent of the upload", + "allowedValues": [ + "TRANSFORMATION", + "TASK_ASSIST_PLANNING" + ] + }, + { + "name": "appRunnerServiceSource", + "type": "string", + "allowedValues": [ + "ecr", + "ecrPublic", + "repository" + ], + "description": "The source artifact of an App Runner service" + }, + { + "name": "appRunnerServiceStatus", + "type": "string", + "allowedValues": [ + "CREATE_FAILED", + "RUNNING", + "DELETED", + "DELETE_FAILED", + "PAUSED", + "OPERATION_IN_PROGRESS" + ], + "description": "The current state of the App Runner service" + }, + { + "name": "artifactsUploadDuration", + "type": "int", + "description": "Time taken to fetch the upload URL and upload the artifacts in milliseconds" + }, + { + "name": "attempts", + "type": "int", + "description": "A generic number of attempts" + }, + { + "name": "authConnectionsCount", + "type": "int", + "description": "Current number of authentication connections the user has" + }, + { + "name": "authEnabledConnections", + "type": "string", + "description": "Comma-delimited list of enabled auths." + }, + { + "name": "authEnabledFeatures", + "type": "string", + "description": "Comma delimited list of enabled features for the authenticated user" + }, + { + "name": "authScopes", + "type": "string", + "description": "Comma-delimited list of scopes that users has" + }, + { + "name": "authStatus", + "type": "string", + "allowedValues": [ + "connected", + "notConnected", + "expired" + ], + "description": "Status of the an auth connection." + }, + { + "name": "awsAccount", + "type": "string", + "description": "AWS account ID associated with a metric.\n- \"n/a\" if credentials are not available.\n- \"not-set\" if credentials are not selected.\n- \"invalid\" if account ID cannot be obtained." + }, + { + "name": "awsFiletype", + "type": "string", + "allowedValues": [ + "awsCredentials", + "cloudformation", + "cloudformationSam", + "codebuildBuildspec", + "ecsTask", + "eventbridgeSchema", + "iamPolicy", + "samconfig", + "serverless", + "stepfunctionsAsl", + "smithyModel", + "ssmDocument", + "other" + ], + "description": "AWS filetype kind" + }, + { + "name": "awsRegion", + "type": "string", + "description": "AWS Region associated with a metric\n- \"n/a\" if not associated with a region.\n- \"not-set\" if metric is associated with a region, but region is unknown." + }, + { + "name": "buildDuration", + "type": "int", + "description": "The amount of time required for the build to complete (in seconds)." + }, + { + "name": "buildSystemVersion", + "type": "string", + "description": "The build system version on the user's machine" + }, + { + "name": "causedBy", + "type": "string", + "allowedValues": [ + "user", + "service", + "client", + "unknown" + ], + "description": "High level categorization indicating the cause of the error" + }, + { + "name": "cfnParameterFileUsed", + "type": "boolean", + "description": "Boolean value of whether or not a Cfn parameter file is provided." + }, + { + "name": "checkType", + "type": "string", + "allowedValues": [ + "CheckNoNewAccess", + "CheckAccessNotGranted", + "CheckNoPublicAccess" + ], + "description": "User inputted check type to denote which custom check to run." + }, + { + "name": "cloudWatchLogsPresentation", + "type": "string", + "allowedValues": [ + "ui", + "text" + ], + "description": "Presentation mode used in a CloudWatch Logs operation" + }, + { + "name": "cloudWatchResourceType", + "type": "string", + "allowedValues": [ + "logGroup", + "logGroupList", + "logStream" + ], + "description": "CloudWatch Logs entity" + }, + { + "name": "codecatalyst_createDevEnvironmentRepoType", + "type": "string", + "description": "Type of Git repository provided to the Amazon CodeCatalyst dev environment create wizard", + "allowedValues": [ + "linked", + "unlinked", + "none" + ] + }, + { + "name": "codecatalyst_devEnvironmentWorkflowError", + "type": "string", + "description": "Workflow error name" + }, + { + "name": "codecatalyst_devEnvironmentWorkflowStep", + "type": "string", + "description": "Workflow step name" + }, + { + "name": "codecatalyst_updateDevEnvironmentLocationType", + "type": "string", + "description": "Locality of the Amazon CodeCatalyst update dev environment request (i.e., from the thin client or the local IDE instance)", + "allowedValues": [ + "remote", + "local" + ] + }, + { + "name": "codeScanServiceInvocationsDuration", + "type": "int", + "description": "Time taken to invoke code scan service APIs in milliseconds" + }, + { + "name": "codeTransformApiNames", + "type": "string", + "description": "Deprecated (Names of allowed API calls)", + "allowedValues": [ + "ResumeTransformation", + "StartTransformation", + "StopTransformation", + "GetTransformation", + "GetTransformationPlan", + "UploadZip", + "CreateUploadUrl", + "ExportResultArchive" + ] + }, + { + "name": "codeTransformArtifactType", + "type": "string", + "description": "Type of transform artifact", + "allowedValues": [ + "ClientInstructions", + "Logs" + ] + }, + { + "name": "codeTransformBuildCommand", + "type": "string", + "description": "Type of build command", + "allowedValues": [ + "mvnw.cmd", + "mvnw", + "mvn", + "IDEBundledMaven", + "gradlew.bat", + "gradlew", + "gradle", + "IDEBundledGradle" + ] + }, + { + "name": "codeTransformBuildSystem", + "type": "string", + "description": "Type of build system", + "allowedValues": [ + "Maven", + "Gradle" + ] + }, + { + "name": "codeTransformCancelSrcComponents", + "type": "string", + "description": "Names of components that can cancel a transformation", + "allowedValues": [ + "apiError", + "loadingPanelStopButton", + "devToolsStopButton", + "bottomPanelSideNavButton" + ] + }, + { + "name": "codeTransformDependenciesCopied", + "type": "boolean", + "description": "If dependencies are copied into upload artifact." + }, + { + "name": "codeTransformJavaSourceVersionsAllowed", + "type": "string", + "description": "Allowed Java versions to transform from", + "allowedValues": [ + "JDK_1_8", + "JDK_11", + "Other" + ] + }, + { + "name": "codeTransformJavaTargetVersionsAllowed", + "type": "string", + "description": "Allowed Java versions to transform to", + "allowedValues": [ + "JDK_17" + ] + }, + { + "name": "codeTransformJobId", + "type": "string", + "description": "The ID of the job currently running" + }, + { + "name": "codeTransformLocalJavaVersion", + "type": "string", + "description": "The Java version on the user's machine" + }, + { + "name": "codeTransformLocalMavenVersion", + "type": "string", + "description": "Deprecated - use buildSystemVersion (The build system version on the user's machine)" + }, + { + "name": "codeTransformMavenBuildCommand", + "type": "string", + "description": "Deprecated - use codeTransformBuildCommand (Type of maven command)", + "allowedValues": [ + "mvnw.cmd", + "mvnw", + "mvn", + "IDEBundledMaven" + ] + }, + { + "name": "codeTransformMetadata", + "type": "string", + "description": "A general field for logging metadata associated to Amazon Q transform metrics." + }, + { + "name": "codeTransformNumberOfProjects", + "type": "int", + "description": "The number of projects selected for transformation" + }, + { + "name": "codeTransformNumberOfTransformedFiles", + "type": "int", + "description": "The number of files that were transformed during a transformation job" + }, + { + "name": "codeTransformNumberOfTransformedFilesAccepted", + "type": "int", + "description": "The number of transformed files that have been accepted by the user" + }, + { + "name": "codeTransformNumberOfTransformedUnitsAccepted", + "type": "int", + "description": "The number of transformed buildable units that have been accepted by the user" + }, + { + "name": "codeTransformPatchViewerCancelSrcComponents", + "type": "string", + "description": "Names of components that can cancel the diff viewer", + "allowedValues": [ + "apiError", + "cancelButton" + ] + }, + { + "name": "codeTransformPlanReceivedCount", + "type": "int", + "description": "The number of times the transformation plan was received during transformation" + }, + { + "name": "codeTransformPreValidationError", + "type": "string", + "description": "Names of the pre-validation errors that can occur", + "allowedValues": [ + "NoPom", + "NoJavaProject", + "MixedLanguages", + "UnsupportedJavaVersion", + "ProjectJDKDiffersFromBuildSystemJDK", + "UnsupportedBuildSystem", + "EmptyProject", + "NonSsoLogin", + "RemoteRunProject" + ] + }, + { + "name": "codeTransformPreviousStatus", + "type": "string", + "description": "The current transformation job's previous status" + }, + { + "name": "codeTransformProjectId", + "type": "string", + "description": "A hash identifying the projects chosen top level build file that is to be transformed." + }, + { + "name": "codeTransformRequestId", + "type": "string", + "description": "The API request ID" + }, + { + "name": "codeTransformResultStatusMessage", + "type": "string", + "description": "The outcome of the transformation" + }, + { + "name": "codeTransformRuntimeError", + "type": "string", + "description": "Any runtime errors" + }, + { + "name": "codeTransformRunTimeLatency", + "type": "int", + "description": "A millisecond value of the total run time" + }, + { + "name": "codeTransformSessionId", + "type": "string", + "description": "Represents the IDE session from which users start the transformation process" + }, + { + "name": "codeTransformStartSrcComponents", + "type": "string", + "description": "Names of components that can start a transformation", + "allowedValues": [ + "devToolsStartButton", + "bottomPanelSideNavButton", + "chatPrompt" + ] + }, + { + "name": "codeTransformStatus", + "type": "string", + "description": "The current transformation job's status" + }, + { + "name": "codeTransformTarget", + "type": "string", + "description": "The target solution or project(s) selected for transformation" + }, + { + "name": "codeTransformTotalByteSize", + "type": "int", + "description": "The byte size of the upload or download." + }, + { + "name": "codeTransformUploadId", + "type": "string", + "description": "A unique upload ID for S3" + }, + { + "name": "codeTransformVCSViewerSrcComponents", + "type": "string", + "description": "Names of components that can initiate the diff viewer", + "allowedValues": [ + "chat", + "toastNotification", + "treeView", + "treeViewHeader" + ] + }, + { + "name": "codewhispererAcceptedTokens", + "type": "int", + "description": "The number of tokens that are accepted and not modified by the user" + }, + { + "name": "codewhispererAllCompletionsLatency", + "type": "double", + "description": "The time it takes for the last GenerateCompletions response to be received after plugin makes a first call to GenerateCompletions API." + }, + { + "name": "codewhispererAutomatedTriggerType", + "type": "string", + "description": "The type of the Automated trigger to send request to CodeWhisperer service", + "allowedValues": [ + "KeyStrokeCount", + "SpecialCharacters", + "Enter", + "IntelliSenseAcceptance", + "IdleTime", + "Classifier" + ] + }, + { + "name": "codewhispererCharactersAccepted", + "type": "int", + "description": "The number of characters user has accepted through inline completion service" + }, + { + "name": "codewhispererCharactersModified", + "type": "int", + "description": "number of characters modified by users within the accepted inline suggestion" + }, + { + "name": "codewhispererCharactersRecommended", + "type": "int", + "description": "The number of characters originally recommended to the user in partial acceptance scenario." + }, + { + "name": "codewhispererClassifierResult", + "type": "double", + "description": "The result from Classifier trigger." + }, + { + "name": "codewhispererClassifierThreshold", + "type": "double", + "description": "The threshold of Classifier trigger." + }, + { + "name": "codewhispererCodeScanBuildPayloadBytes", + "type": "int", + "description": "The uncompressed payload size in bytes of the build files in customer project context sent for security scan" + }, + { + "name": "codewhispererCodeScanBuildZipFileBytes", + "type": "int", + "description": "The compressed payload size of built jars in bytes of customer project context sent for security scan. This is only applicable for Java project" + }, + { + "name": "codewhispererCodeScanIssuesWithFixes", + "type": "int", + "description": "The number of security issues detected with suggested fixes" + }, + { + "name": "codewhispererCodeScanJobId", + "type": "string", + "description": "The ID of the security scan job" + }, + { + "name": "codewhispererCodeScanLines", + "type": "int", + "description": "How many lines of code being sent for security scan" + }, + { + "name": "codewhispererCodeScanProjectBytes", + "type": "double", + "description": "The total size in bytes of customer project to perform security scan on" + }, + { + "name": "codewhispererCodeScanScope", + "type": "string", + "description": "The scope of the security scan being performed", + "allowedValues": [ + "FILE", + "PROJECT" + ] + }, + { + "name": "codewhispererCodeScanSrcPayloadBytes", + "type": "int", + "description": "The uncompressed payload size in bytes of the source files in customer project context sent for security scan" + }, + { + "name": "codewhispererCodeScanSrcZipFileBytes", + "type": "int", + "description": "The compressed payload size of source files in bytes of customer project context sent for security scan" + }, + { + "name": "codewhispererCodeScanTotalIssues", + "type": "int", + "description": "The number of security issues been detected" + }, + { + "name": "codewhispererCompletionType", + "type": "string", + "description": "Completion Type of the inference results returned from CodeWhisperer model layer", + "allowedValues": [ + "Line", + "Block" + ] + }, + { + "name": "codewhispererCredentialFetchingLatency", + "type": "double", + "description": "The time it takes to get the Sono/SSO credential for the invocation." + }, + { + "name": "codewhispererCursorOffset", + "type": "int", + "description": "cursor location offset in the editor when invoking CodeWhisperer for recommendation" + }, + { + "name": "codewhispererCustomizationArn", + "type": "string", + "description": "The currently selected customization arn(None if using the base model)" + }, + { + "name": "codewhispererEndToEndLatency", + "type": "double", + "description": "The time it takes for the first completion to be shown in the IDE after the user performs the CW trigger action." + }, + { + "name": "codewhispererFeatureEvaluations", + "type": "string", + "description": "Feature assignments for a particular user" + }, + { + "name": "codewhispererFirstCompletionLatency", + "type": "double", + "description": "The time it takes for the response to be received after the plugin makes a first GenerateCompletions API call." + }, + { + "name": "codewhispererFirstRequestId", + "type": "string", + "description": "The request id of the first request in a paginated session." + }, + { + "name": "codewhispererGettingStartedTask", + "type": "string", + "description": "The task type selected by the user in getting started page", + "allowedValues": [ + "autoTrigger", + "manualTrigger", + "commentAsPrompt", + "unitTest", + "navigation" + ] + }, + { + "name": "codewhispererImportRecommendationEnabled", + "type": "boolean", + "description": "Whether Import Recommendation is enabled." + }, + { + "name": "codewhispererIsPartialAcceptance", + "type": "boolean", + "description": "If user has accepted only part of the recommendation or not." + }, + { + "name": "codewhispererLanguage", + "type": "string", + "description": "Programming language of the CodeWhisperer recommendation", + "allowedValues": [ + "java", + "python", + "javascript", + "plaintext", + "jsx", + "typescript", + "tsx", + "csharp", + "c", + "cpp", + "go", + "kotlin", + "php", + "ruby", + "rust", + "scala", + "shell", + "sql", + "json", + "jsonc", + "yaml", + "yml", + "hcl", + "tf" + ] + }, + { + "name": "codewhispererLastSuggestionIndex", + "type": "int", + "description": "The last index of recommendation from a particular response" + }, + { + "name": "codewhispererLineNumber", + "type": "int", + "description": "The line number of the cursor when the event happens" + }, + { + "name": "codewhispererModificationPercentage", + "type": "double", + "description": "The percentage of user modifications on the suggested code" + }, + { + "name": "codewhispererPaginationProgress", + "type": "int", + "description": "The number of recommendations received so far when user makes a decision" + }, + { + "name": "codewhispererPartialAcceptanceCount", + "type": "int", + "description": "The number of times the user accept part of the recommendations." + }, + { + "name": "codewhispererPercentage", + "type": "int", + "description": "The percentage of acceptance on suggested CodeWhisperer code on the overall code" + }, + { + "name": "codewhispererPostprocessingLatency", + "type": "double", + "description": "The time it takes for the first completions to be displayed in the IDE after the plugin receives the initial Completions object." + }, + { + "name": "codewhispererPreprocessingLatency", + "type": "double", + "description": "The time it takes for the plugin to make the first GenerateCompletions API call after the user performs the CW trigger action." + }, + { + "name": "codewhispererPreviousSuggestionState", + "type": "string", + "description": "The aggregated user decision from previous trigger. ", + "allowedValues": [ + "Accept", + "Reject", + "Discard", + "Empty" + ] + }, + { + "name": "codewhispererRequestId", + "type": "string", + "description": "The ID of the request to CodeWhisperer service" + }, + { + "name": "codewhispererRuntime", + "type": "string", + "allowedValues": [ + "java8", + "java11", + "java16", + "python2", + "python3", + "javascript", + "unknown" + ], + "description": "the pre-defined set of values for runtime version of the language of CodeWhisperer recommendation" + }, + { + "name": "codewhispererRuntimeSource", + "type": "string", + "description": "the original (free-text) of the runtime version of the language of CodeWhisperer recommendation" + }, + { + "name": "codewhispererSessionId", + "type": "string", + "description": "The unique identifier for a CodeWhisperer session(which can contain multiple requests)" + }, + { + "name": "codewhispererSuggestedTokens", + "type": "int", + "description": "The number of tokens in the original code suggestions" + }, + { + "name": "codewhispererSuggestionCount", + "type": "int", + "description": "The total number of code suggestions in a paginated session." + }, + { + "name": "codewhispererSuggestionImportCount", + "type": "int", + "description": "The number of import statements included with recommendation." + }, + { + "name": "codewhispererSuggestionIndex", + "type": "int", + "description": "The index for each suggestion, respectively, in the list of suggestions returned from service invocation" + }, + { + "name": "codewhispererSuggestionReferenceCount", + "type": "int", + "description": "Number of references the particular suggestion is referenced with." + }, + { + "name": "codewhispererSuggestionReferences", + "type": "string", + "description": "The list of unique license names for a particular suggestion" + }, + { + "name": "codewhispererSuggestionState", + "type": "string", + "description": "User decision of each of the suggestion returned from CodeWhisperer", + "allowedValues": [ + "Accept", + "Reject", + "Discard", + "Ignore", + "Filter", + "Unseen", + "Empty" + ] + }, + { + "name": "codewhispererSupplementalContextIsUtg", + "type": "boolean", + "description": "If the supplemental context is for test file(UTG) or src file" + }, + { + "name": "codewhispererSupplementalContextLatency", + "type": "double", + "description": "Latency to obtain supplemental context" + }, + { + "name": "codewhispererSupplementalContextLength", + "type": "int", + "description": "Length of codewhisperer supplemental context extracted from files" + }, + { + "name": "codewhispererSupplementalContextStrategyId", + "type": "string", + "description": "Name tag or identifier for supplemental context fetching strategy being used for us to easier analyze corresponding acceptance rate" + }, + { + "name": "codewhispererSupplementalContextTimeout", + "type": "boolean", + "description": "If the supplemental context fetching timeout or not" + }, + { + "name": "codewhispererTimeSinceLastDocumentChange", + "type": "double", + "description": "The time from last document change to the current document change. " + }, + { + "name": "codewhispererTimeSinceLastUserDecision", + "type": "double", + "description": "The time from last user decision to current invocation. " + }, + { + "name": "codewhispererTimeToFirstRecommendation", + "type": "double", + "description": "The time from user trigger to the first recommendation is received. " + }, + { + "name": "codewhispererTotalShownTime", + "type": "double", + "description": "The time that recommendations are shown to the user in a paginated session." + }, + { + "name": "codewhispererTotalTokens", + "type": "int", + "description": "The metrics generated by the user and acceptance of suggested CodeWhisperer code in the language CodeWhisperer supports." + }, + { + "name": "codewhispererTriggerCharacter", + "type": "string", + "description": "The character that triggered recommendation for special characters trigger." + }, + { + "name": "codewhispererTriggerType", + "type": "string", + "description": "The type of the user trigger to send request to CodeWhisperer service", + "allowedValues": [ + "OnDemand", + "AutoTrigger" + ] + }, + { + "name": "codewhispererTypeaheadLength", + "type": "int", + "description": "The length of additional characters inputted by the user since the invocation. " + }, + { + "name": "codewhispererUserGroup", + "type": "string", + "description": "The user group identifier we assign to the customer and it should be unique identifier across different IDE platforms, i.e. Classifier, CrossFile etc." + }, + { + "name": "component", + "type": "string", + "allowedValues": [ + "editor", + "viewer", + "filesystem", + "explorer", + "infobar", + "hover", + "webview", + "quickfix" + ], + "description": "The IDE or OS component used for the action. (Examples: S3 download to filesystem, S3 upload from editor, ...). See also `featureId` for specific feature names, `module` for low-level modules, and `resourceType`." + }, + { + "name": "contextTruncationDuration", + "type": "int", + "description": "Time taken for context truncation in milliseconds" + }, + { + "name": "count", + "type": "int", + "description": "Number of occurrences a metric, or some other metric-defined count." + }, + { + "name": "credentialModification", + "type": "string", + "allowedValues": [ + "Add", + "Edit", + "Delete" + ], + "description": "The type of modification performed on the credentials" + }, + { + "name": "credentialSourceId", + "type": "string", + "description": "Where credentials are stored or retrieved from", + "allowedValues": [ + "sharedCredentials", + "sdkStore", + "ec2", + "ecs", + "envVars", + "awsId", + "iamIdentityCenter", + "memory", + "other" + ] + }, + { + "name": "credentialStartUrl", + "type": "string", + "description": "The start URL of current SSO connection" + }, + { + "name": "credentialType", + "type": "string", + "description": "The type of credential that was selected", + "allowedValues": [ + "staticProfile", + "staticSessionProfile", + "credentialProcessProfile", + "assumeRoleProfile", + "assumeMfaRoleProfile", + "assumeSamlRoleProfile", + "ssoProfile", + "ecsMetatdata", + "ec2Metadata", + "bearerToken", + "other" + ] + }, + { + "name": "cwsprChatAcceptedCharactersLength", + "type": "int", + "description": "Count of code characters copied to the editor" + }, + { + "name": "cwsprChatAcceptedNumberOfLines", + "type": "int", + "description": "Count of lines of code copied to the editor" + }, + { + "name": "cwsprChatCodeBlockIndex", + "type": "int", + "description": "Index of the code block inside a message in the conversation." + }, + { + "name": "cwsprChatConversationId", + "type": "string", + "description": "Uniquely identifies a message with which the user interacts." + }, + { + "name": "cwsprChatHasReference", + "type": "boolean", + "description": "True if the code snippet that user interacts with has a reference." + }, + { + "name": "cwsprChatInteractionTarget", + "type": "string", + "description": "Identifies the entity within the message that user interacts with." + }, + { + "name": "cwsprChatInteractionType", + "allowedValues": [ + "insertAtCursor", + "copySnippet", + "copy", + "clickLink", + "clickFollowUp", + "hoverReference", + "upvote", + "downvote", + "clickBodyLink" + ], + "type": "string", + "description": "Indicates the specific interaction type with a message in a conversation" + }, + { + "name": "cwsprChatMessageId", + "type": "string", + "description": "Unique identifier for each message in an conversation" + }, + { + "name": "cwsprChatTotalCodeBlocks", + "type": "int", + "description": "Total number of code blocks inside a message in the conversation." + }, + { + "name": "databaseCredentials", + "type": "string", + "allowedValues": [ + "IAM", + "SecretsManager" + ], + "description": "How the database credentials are being retrieved" + }, + { + "name": "databaseEngine", + "type": "string", + "description": "The database engine used (mysql/postgres/redshift)" + }, + { + "name": "debug", + "type": "boolean", + "description": "If the action was run in debug mode or not" + }, + { + "name": "destFacetType", + "type": "string", + "description": "Resource subtype of connection end" + }, + { + "name": "destResourceType", + "type": "string", + "description": "CloudFormation resource type of connection end" + }, + { + "name": "detectorId", + "type": "string", + "description": "The id of the detector which produced the code scan issue" + }, + { + "name": "didSave", + "type": "boolean", + "description": "Whether the user saved" + }, + { + "name": "documentType", + "type": "string", + "allowedValues": [ + "CloudFormation", + "Terraform Plan", + "JSON Policy Language" + ], + "description": "Document type of the edited file in IAM Policy Checks" + }, + { + "name": "duration", + "type": "double", + "description": "The duration of the operation in milliseconds" + }, + { + "name": "dynamicResourceOperation", + "type": "string", + "allowedValues": [ + "Create", + "Update", + "Delete" + ], + "description": "The dynamic resource operation being executed" + }, + { + "name": "dynamoDbFetchType", + "type": "string", + "allowedValues": [ + "scan", + "query" + ], + "description": "The type of fetch being performed" + }, + { + "name": "dynamoDbIndexType", + "type": "string", + "allowedValues": [ + "primary", + "localSecondary", + "globalSecondary" + ], + "description": "The type of index being hit for the query/scan operation" + }, + { + "name": "dynamoDbTarget", + "type": "string", + "allowedValues": [ + "table", + "tableProperties", + "tableStream" + ], + "description": "The type of DynamoDB entity referenced by a metric or operation" + }, + { + "name": "ec2ConnectionType", + "type": "string", + "allowedValues": [ + "remoteDesktop", + "ssh", + "scp", + "ssm" + ], + "description": "Ways to connect to an EC2 Instance" + }, + { + "name": "ec2InstanceState", + "type": "string", + "allowedValues": [ + "start", + "stop", + "reboot", + "terminate" + ], + "description": "Actions that can affect an EC2 Instance state" + }, + { + "name": "ecrDeploySource", + "type": "string", + "allowedValues": [ + "dockerfile", + "tag" + ], + "description": "The source content specified in the ECR deployment request" + }, + { + "name": "ecsExecuteCommandType", + "type": "string", + "allowedValues": [ + "command", + "shell" + ], + "description": "Type of execution selected while running the execute command" + }, + { + "name": "ecsLaunchType", + "type": "string", + "allowedValues": [ + "ec2", + "fargate" + ], + "description": "Infrastructure type used by ECS tasks and services" + }, + { + "name": "elementId", + "type": "string", + "description": "An identifier associated with a UI element" + }, + { + "name": "enabled", + "type": "boolean", + "description": "True if turned on, false if turned off" + }, + { + "name": "enabledAuthConnections", + "type": "string", + "description": "Comma delimited list of enabled auth connections" + }, + { + "name": "enhancedHealthEnabled", + "type": "boolean", + "description": "Whether or not Elastic Beanstalk enhanced health reporting and monitoring is being used" + }, + { + "name": "errorCode", + "type": "string", + "description": "User-friendly error codes describing a failed operation" + }, + { + "name": "eventBridgeSchema", + "type": "string", + "description": "The name of the EventBridge Schema used in the operation" + }, + { + "name": "experimentId", + "type": "string", + "description": "The id of the experiment being activated or deactivated" + }, + { + "name": "experimentState", + "type": "string", + "allowedValues": [ + "activated", + "deactivated" + ], + "description": "The experiment action taken action taken" + }, + { + "name": "failedCount", + "type": "int", + "description": "The number of failed operations" + }, + { + "name": "featureId", + "type": "string", + "description": "The id of the feature the user is interacting in. See also: `component`, `featureId`, `module`, `resourceType`.", + "allowedValues": [ + "amazonQ", + "awsExplorer", + "awsToolkit", + "codewhisperer", + "codecatalyst" + ] + }, + { + "name": "featureValue", + "type": "string", + "description": "Additional Data Value for AB Testing" + }, + { + "name": "featureVariation", + "type": "string", + "description": "Feature Variant for AB Testing" + }, + { + "name": "filenameExt", + "type": "string", + "description": "Filename extension (examples: .txt, .yml, .yaml, .asl.yaml, ...), or empty string if the filename does not contain dot (.) between two chars." + }, + { + "name": "findingId", + "type": "string", + "description": "The id of a security finding from a code scan" + }, + { + "name": "findingsCount", + "type": "int", + "description": "Number of findings discovered after executing IAM Policy Checks" + }, + { + "name": "fps", + "type": "int", + "description": "Average frames per second" + }, + { + "name": "framework", + "type": "string", + "description": "Application framework being used" + }, + { + "name": "generateFailure", + "type": "string", + "allowedValues": [ + "Parse" + ], + "description": "Type of generation failure" + }, + { + "name": "hasChatAuth", + "type": "boolean", + "description": "Whether the user has access to CodeWhisperer Chat" + }, + { + "name": "hasTextFilter", + "type": "boolean", + "description": "A text based filter was used" + }, + { + "name": "hasTimeFilter", + "type": "boolean", + "description": "A time based filter was used" + }, + { + "name": "httpMethod", + "type": "string", + "description": "Any valid HTTP method (GET/HEAD/etc)" + }, + { + "name": "httpStatusCode", + "type": "string", + "description": "HTTP status code for the request (if any) associated with a metric." + }, + { + "name": "iamResourceType", + "type": "string", + "allowedValues": [ + "group", + "role", + "user" + ], + "description": "The type of IAM resource referenced by a metric or operation" + }, + { + "name": "id", + "type": "string", + "description": "Metric-defined identifier" + }, + { + "name": "includesFix", + "type": "boolean", + "description": "Whether the security issue includes a suggested fix" + }, + { + "name": "initialDeploy", + "type": "boolean", + "description": "Whether or not the deploy targets a new destination (true) or an existing destination (false)" + }, + { + "name": "initializeTime", + "type": "int", + "description": "Time from starting the feature until ready-to-use." + }, + { + "name": "inputPolicyType", + "type": "string", + "allowedValues": [ + "Identity", + "Resource", + "None" + ], + "description": "User inputted policy type of the edited file. Applicable to only JSON Policy Language." + }, + { + "name": "insightsDialogOpenSource", + "type": "string", + "allowedValues": [ + "explorer", + "resultsWindow", + "logGroup" + ], + "description": "Dialog open trigger source location" + }, + { + "name": "insightsQueryStringType", + "type": "string", + "allowedValues": [ + "insights", + "searchTerm" + ], + "description": "User-specified search string type while starting an insights query" + }, + { + "name": "insightsQueryTimeType", + "type": "string", + "allowedValues": [ + "relative", + "absolute" + ], + "description": "User-selected time range type while starting an insights query" + }, + { + "name": "invalidInputFields", + "type": "string", + "description": "Comma delimited list of input fields that user has invalid inputs typed. e.g. 'profileName,accessKey,startUrl'" + }, + { + "name": "isAggregated", + "type": "boolean", + "description": "Whether this was an individual point or an aggregation of points." + }, + { + "name": "isReAuth", + "type": "boolean", + "description": "If this was performed as part of the reauthentication flow." + }, + { + "name": "isRetry", + "type": "boolean", + "description": "Whether or not the operation was a retry" + }, + { + "name": "lambdaArchitecture", + "type": "string", + "allowedValues": [ + "x86_64", + "arm64" + ], + "description": "Lambda architecture identifier" + }, + { + "name": "lambdaPackageType", + "type": "string", + "allowedValues": [ + "Zip", + "Image" + ], + "description": "The Lambda Package type of the function" + }, + { + "name": "language", + "type": "string", + "description": "Language used for the project." + }, + { + "name": "loadFileTime", + "type": "int", + "description": "Time from opening Composer to loading the file" + }, + { + "name": "locale", + "type": "string", + "description": "User locale. Examples: en-US, en-GB, etc." + }, + { + "name": "module", + "type": "string", + "description": "Free-form module name for both high-level features such as \"PublishToAWS\", and lower-level modules such as \"ToolkitContextProvider\". Use `component` for UI components, or `featureId` for specific feature names. See also `resourceType`." + }, + { + "name": "name", + "type": "string", + "description": "A generic name metadata" + }, + { + "name": "newAuthConnectionsCount", + "type": "int", + "description": "Number of new authentication connections the user has" + }, + { + "name": "newEnabledAuthConnections", + "type": "string", + "description": "Comma delimited list of NEW enabled auth connections" + }, + { + "name": "numAttempts", + "type": "int", + "description": "Number of generations before the user accepted or rejected" + }, + { + "name": "oldVersion", + "type": "string", + "description": "The old version of something. Useful when updating dependent resources." + }, + { + "name": "partitionId", + "type": "string", + "description": "The ID of the partition that was selected" + }, + { + "name": "pathsScrubbed", + "type": "int", + "description": "Number of generation paths modified" + }, + { + "name": "platform", + "type": "string", + "description": "Language-specific identification. Examples: v4.6.1, netcoreapp3.1, nodejs12.x. Not AWS Lambda specific. Allows for additional details when other fields are opaque, such as the Lambda runtime value 'provided'." + }, + { + "name": "presigned", + "type": "boolean", + "description": "Whether or not it was a presigned request" + }, + { + "name": "reason", + "type": "string", + "description": "Reason code or name for an event (when result=Succeeded) or error (when result=Failed). Unlike the `reasonDesc` field, this should be a stable/predictable name for a class of events or errors (typically the exception name, e.g. FileIOException)." + }, + { + "name": "reasonDesc", + "type": "string", + "description": "Error message detail. May contain arbitrary message details (unlike the `reason` field), but should be truncated (recommendation: 200 chars)." + }, + { + "name": "reAuthReason", + "type": "string", + "description": "Why was the connection/session put in to a state where it needs to be reauthenticated?" + }, + { + "name": "referencePolicyType", + "type": "string", + "allowedValues": [ + "Identity", + "Resource", + "None" + ], + "description": "User-provided policy type of the reference file. Applicable to only CheckNoNewAccess check type." + }, + { + "name": "requestId", + "type": "string", + "description": "Request ID (if any) associated with a metric. For example, an event with `requestServiceType: s3` means that the request ID is associated with an S3 API call. Events that cover multiple API calls should use the request ID of the most recent call." + }, + { + "name": "requestServiceType", + "type": "string", + "description": "Per-request service identifier. Unlike `serviceType` (which describes the originator of the request), this describes the request itself." + }, + { + "name": "resourceCounts", + "type": "string", + "description": "Per-resource count of each resource in a container" + }, + { + "name": "resourceType", + "type": "string", + "description": "The dynamic resource type being interacted with. See also `component` for UI components, `featureId` for specific feature names, or `module` for low-level modules." + }, + { + "name": "result", + "type": "string", + "allowedValues": [ + "Succeeded", + "Failed", + "Cancelled" + ], + "description": "The result of the operation" + }, + { + "name": "ruleId", + "type": "string", + "description": "The id of the rule which produced the code scan issue" + }, + { + "name": "runtime", + "type": "string", + "allowedValues": [ + "dotnetcore3.1", + "dotnetcore2.1", + "dotnet5.0", + "dotnet6", + "dotnet7", + "dotnet8", + "nodejs20.x", + "nodejs18.x", + "nodejs16.x", + "nodejs14.x", + "nodejs12.x", + "nodejs10.x", + "nodejs8.10", + "ruby2.5", + "java8", + "java8.al2", + "java11", + "java17", + "java21", + "go1.x", + "python3.12", + "python3.11", + "python3.10", + "python3.9", + "python3.8", + "python3.7", + "python3.6", + "python2.7" + ], + "description": "The lambda runtime" + }, + { + "name": "runtimeString", + "type": "string", + "description": "A free-text field to record runtimes that may be separate from Lambda runtimes" + }, + { + "name": "saveFileTime", + "type": "int", + "description": "Time from opening the feature until file saved." + }, + { + "name": "saveType", + "type": "string", + "allowedValues": [ + "MANUAL_SAVE", + "AUTO_SAVE" + ], + "description": "Type of save executed" + }, + { + "name": "schemaLanguage", + "type": "string", + "allowedValues": [ + "Java8", + "Python36", + "TypeScript3" + ], + "description": "Languages targeted by the schemas service" + }, + { + "name": "serviceType", + "type": "string", + "description": "The name of the AWS service acted on. These values come from the AWS SDK. To find them in the JAVA SDK search for SERVICE_NAME in each service client, or look for serviceId in metadata in the service2.json" + }, + { + "name": "sessionDuration", + "type": "int", + "description": "Length of time, in milliseconds, that an authentication session has lived for. Useful for determining how frequently a user has to reauthenticate." + }, + { + "name": "settingId", + "type": "string", + "description": "The id of the setting being changed. Consistent namespace should be used for the id, e.g. codewhisperer_autoSuggestionActivation" + }, + { + "name": "settingState", + "type": "string", + "description": "The state of the setting being changed to. This should not be recorded for free-form settings like file-system paths. Instead, stick to things like flags, numbers, and enums." + }, + { + "name": "source", + "type": "string", + "description": "The source of the operation" + }, + { + "name": "sourceFacetType", + "type": "string", + "description": "Resource subtype of connection start" + }, + { + "name": "sourceResourceType", + "type": "string", + "description": "CloudFormation resource type of connection start" + }, + { + "name": "sqsQueueType", + "type": "string", + "allowedValues": [ + "standard", + "fifo" + ], + "description": "The type of an SQS Queue" + }, + { + "name": "ssoRegistrationClientId", + "type": "string", + "description": "The client ID of an SSO registration." + }, + { + "name": "ssoRegistrationExpiresAt", + "type": "string", + "description": "Date/time that an SSO client registration expires." + }, + { + "name": "successCount", + "type": "int", + "description": "The number of successful operations" + }, + { + "name": "syncedResources", + "type": "string", + "description": "Describes which parts of an application (that we know of) were synced to the cloud. \"Code\" resources follow the SAM spec: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-sync.html", + "allowedValues": [ + "AllResources", + "CodeOnly" + ] + }, + { + "name": "templateName", + "type": "string", + "description": "Generic name of a template" + }, + { + "name": "toolId", + "type": "string", + "description": "The tool being installed", + "allowedValues": [ + "session-manager-plugin", + "dotnet-lambda-deploy", + "dotnet-deploy-cli", + "aws-cli", + "sam-cli", + "docker" + ] + }, + { + "name": "totalResourceCount", + "type": "int", + "description": "Total count of all resources in a container" + }, + { + "name": "update", + "type": "boolean", + "description": "If the operation was an update or not" + }, + { + "name": "url", + "type": "string", + "description": "The url associated with a metric" + }, + { + "name": "userChoice", + "type": "string", + "description": "User selection from a predefined menu (not user-provided input)" + }, + { + "name": "userId", + "type": "string", + "description": "Opaque AWS Builder ID identifier" + }, + { + "name": "variant", + "type": "string", + "description": "A generic variant metadata" + }, + { + "name": "version", + "type": "string", + "description": "A generic version metadata" + }, + { + "name": "workflowToken", + "type": "string", + "description": "A token used for flow metrics to link calls together" + }, + { + "name": "xrayEnabled", + "type": "boolean", + "description": "Whether or not AWS X-Ray is enabled" + } + ], + "metrics": [ + { + "name": "accessanalyzer_iamPolicyChecksCustomChecks", + "description": "Execution of Custom Policy Checks in IAM Policy Checks", + "metadata": [ + { + "type": "cfnParameterFileUsed" + }, + { + "type": "checkType" + }, + { + "type": "documentType" + }, + { + "type": "findingsCount" + }, + { + "type": "inputPolicyType" + }, + { + "type": "reason", + "required": false + }, + { + "type": "referencePolicyType" + }, + { + "type": "result" + } + ] + }, + { + "name": "accessanalyzer_iamPolicyChecksValidatePolicy", + "description": "Execution of Validate Policy in IAM Policy Checks", + "metadata": [ + { + "type": "cfnParameterFileUsed" + }, + { + "type": "documentType" + }, + { + "type": "findingsCount" + }, + { + "type": "inputPolicyType" + }, + { + "type": "reason", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "amazonq_approachInvoke", + "description": "Captures Approach generation process", + "metadata": [ + { + "type": "amazonqConversationId" + }, + { + "type": "amazonqGenerateApproachIteration" + }, + { + "type": "amazonqGenerateApproachLatency" + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "duration", + "required": false + }, + { + "type": "reason", + "required": false + }, + { + "type": "requestId", + "required": false + }, + { + "type": "requestServiceType", + "required": false + }, + { + "type": "result", + "required": false + } + ] + }, + { + "name": "amazonq_approachThumbsDown", + "description": "User clicked on the thumbs down button to say that they are unsatisfied", + "unit": "Count", + "metadata": [ + { + "type": "amazonqConversationId" + }, + { + "type": "credentialStartUrl", + "required": false + } + ] + }, + { + "name": "amazonq_approachThumbsUp", + "description": "User clicked on the thumbs up button, to mention that they are satisfied", + "unit": "Count", + "metadata": [ + { + "type": "amazonqConversationId" + }, + { + "type": "credentialStartUrl", + "required": false + } + ] + }, + { + "name": "amazonq_bundleExtensionIgnored", + "description": "File extension was ignored 'count' many times during bundling process", + "metadata": [ + { + "type": "count" + }, + { + "type": "filenameExt" + } + ] + }, + { + "name": "amazonq_codeGenerationInvoke", + "description": "Captures Code Generation generation process", + "metadata": [ + { + "type": "amazonqCodeGenerationResult" + }, + { + "type": "amazonqConversationId" + }, + { + "type": "amazonqGenerateCodeIteration" + }, + { + "type": "amazonqGenerateCodeResponseLatency" + }, + { + "type": "amazonqNumberOfFilesGenerated", + "required": false + }, + { + "type": "amazonqNumberOfReferences", + "required": false + }, + { + "type": "amazonqRepositorySize" + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "duration", + "required": false + }, + { + "type": "reason", + "required": false + }, + { + "type": "requestId", + "required": false + }, + { + "type": "requestServiceType", + "required": false + }, + { + "type": "result", + "required": false + } + ] + }, + { + "name": "amazonq_codeGenerationThumbsDown", + "description": "User clicked on the thumbs down button to say that they are unsatisfied", + "unit": "Count", + "metadata": [ + { + "type": "amazonqConversationId" + }, + { + "type": "credentialStartUrl", + "required": false + } + ] + }, + { + "name": "amazonq_codeGenerationThumbsUp", + "description": "User clicked on the thumbs up button to say that they are unsatisfied", + "unit": "Count", + "metadata": [ + { + "type": "amazonqConversationId" + }, + { + "type": "credentialStartUrl", + "required": false + } + ] + }, + { + "name": "amazonq_createUpload", + "description": "Captures createUploadUrl invocation process", + "metadata": [ + { + "type": "amazonqConversationId" + }, + { + "type": "amazonqRepositorySize", + "required": false + }, + { + "type": "amazonqUploadIntent", + "required": false + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "duration", + "required": false + }, + { + "type": "reason", + "required": false + }, + { + "type": "requestId", + "required": false + }, + { + "type": "requestServiceType", + "required": false + }, + { + "type": "result", + "required": false + } + ] + }, + { + "name": "amazonq_endChat", + "description": "Captures end of the conversation with amazonq /dev", + "metadata": [ + { + "type": "amazonqConversationId" + }, + { + "type": "amazonqEndOfTheConversationLatency", + "required": false + }, + { + "type": "credentialStartUrl", + "required": false + } + ] + }, + { + "name": "amazonq_interactWithMessage", + "description": "When a user interacts with a message in the conversation", + "metadata": [ + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "cwsprChatAcceptedCharactersLength", + "required": false + }, + { + "type": "cwsprChatAcceptedNumberOfLines", + "required": false + }, + { + "type": "cwsprChatCodeBlockIndex", + "required": false + }, + { + "type": "cwsprChatConversationId", + "required": true + }, + { + "type": "cwsprChatHasReference", + "required": false + }, + { + "type": "cwsprChatInteractionTarget", + "required": false + }, + { + "type": "cwsprChatInteractionType", + "required": true + }, + { + "type": "cwsprChatMessageId", + "required": true + } + ] + }, + { + "name": "amazonq_isAcceptedCodeChanges", + "description": "User applied code changes generated for the task.", + "metadata": [ + { + "type": "amazonqConversationId" + }, + { + "type": "amazonqNumberOfFilesAccepted" + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "enabled" + } + ] + }, + { + "name": "amazonq_isApproachAccepted", + "description": "User has accepted the approach generated", + "metadata": [ + { + "type": "amazonqConversationId" + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "enabled" + } + ] + }, + { + "name": "amazonq_isProvideFeedbackForCodeGen", + "description": "User asked to regenerate code generation with a comment", + "metadata": [ + { + "type": "amazonqConversationId" + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "enabled" + } + ] + }, + { + "name": "amazonq_isReviewedChanges", + "description": "User reviewed changes", + "passive": true, + "metadata": [ + { + "type": "amazonqConversationId" + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "enabled" + } + ] + }, + { + "name": "amazonq_modifySourceFolder", + "description": "User modified source folder", + "metadata": [ + { + "type": "amazonqConversationId" + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "reason", + "required": false + }, + { + "type": "result", + "required": false + } + ] + }, + { + "name": "amazonq_startConversationInvoke", + "description": "Captures startConversation invocation process", + "metadata": [ + { + "type": "amazonqConversationId", + "required": false + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "duration", + "required": false + }, + { + "type": "reason", + "required": false + }, + { + "type": "requestId", + "required": false + }, + { + "type": "requestServiceType", + "required": false + }, + { + "type": "result", + "required": false + } + ] + }, + { + "name": "amazonq_viewChatPanel", + "description": "Captures if Q chat panel is successfully viewed or not", + "metadata": [ + { + "type": "reason", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "apigateway_copyUrl", + "description": "Copying an API Gateway remote URL", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "apigateway_invokeLocal", + "description": "Invoking one simulated API Gateway call using the SAM cli", + "metadata": [ + { + "type": "debug" + }, + { + "type": "httpMethod", + "required": false + }, + { + "type": "lambdaArchitecture", + "required": false + }, + { + "type": "result" + }, + { + "type": "runtime", + "required": false + } + ] + }, + { + "name": "apigateway_invokeRemote", + "description": "Calling a remote API Gateway", + "metadata": [ + { + "type": "httpMethod", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "apigateway_startLocalServer", + "description": "Called when starting a local API Gateway server simulator with SAM. Only called when starting it for long running testing, not for single invokes", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "appBuilder_installTool", + "description": "Click Install button in Getting Started Walkthrough", + "metadata": [ + { + "type": "source", + "required": false + }, + { + "type": "toolId", + "required": false + } + ] + }, + { + "name": "appBuilder_openLocalInvokeWebView", + "description": "Click open Local invoke WebView button in Application Builder", + "metadata": [ + { + "type": "source", + "required": false + } + ] + }, + { + "name": "appBuilder_openRemoteInvokeWebView", + "description": "Click open Remote invoke WebView button in Application Builder", + "metadata": [ + { + "type": "source", + "required": false + } + ] + }, + { + "name": "appBuilder_openTemplate", + "description": "Click open template button in Application Builder", + "metadata": [ + { + "type": "source", + "required": false + } + ] + }, + { + "name": "appBuilder_selectWalkthroughTemplate", + "description": "Select a template and create project in Getting Started Walkthrough", + "metadata": [ + { + "type": "action", + "required": false + }, + { + "type": "source", + "required": false + } + ] + }, + { + "name": "appBuilder_startWalkthrough", + "description": "Open Getting Started Walkthrough", + "metadata": [ + { + "type": "source", + "required": false + } + ] + }, + { + "name": "appcomposer_addConnection", + "description": "Called when two resources are connected", + "metadata": [ + { + "type": "destFacetType" + }, + { + "type": "destResourceType" + }, + { + "type": "sourceFacetType" + }, + { + "type": "sourceResourceType" + } + ] + }, + { + "name": "appcomposer_addResource", + "description": "Called when a resource is added to the canvas", + "metadata": [ + { + "type": "resourceType" + } + ] + }, + { + "name": "appcomposer_closeWfs", + "description": "Called when Step Functions Workflow Studio is closed", + "metadata": [ + { + "type": "didSave" + } + ] + }, + { + "name": "appcomposer_customerReady", + "description": "Called after a customer loads into Composeer", + "metadata": [ + { + "type": "initializeTime" + }, + { + "type": "loadFileTime" + }, + { + "type": "saveFileTime" + } + ] + }, + { + "name": "appcomposer_deployClicked", + "description": "Called after clicking the Sync button" + }, + { + "name": "appcomposer_deployCompleted", + "description": "Called after a Composer-triggered SAM Sync completes" + }, + { + "name": "appcomposer_fps", + "description": "Called regularly to record app performance", + "metadata": [ + { + "type": "fps" + } + ] + }, + { + "name": "appcomposer_generateAccepted", + "description": "Called after accepting a generative AI suggestion", + "metadata": [ + { + "type": "numAttempts" + }, + { + "type": "resourceType" + } + ] + }, + { + "name": "appcomposer_generateClicked", + "description": "Called after generating a standard resource template partial", + "metadata": [ + { + "type": "resourceType" + } + ] + }, + { + "name": "appcomposer_generateRejected", + "description": "Called after rejecting a generative AI suggestion", + "metadata": [ + { + "type": "numAttempts" + }, + { + "type": "resourceType" + } + ] + }, + { + "name": "appcomposer_initializeProject", + "description": "Called when a project successfully loads", + "metadata": [ + { + "type": "resourceCounts" + }, + { + "type": "totalResourceCount" + } + ] + }, + { + "name": "appcomposer_invalidGeneration", + "description": "Called after a generate failed", + "metadata": [ + { + "type": "generateFailure" + }, + { + "type": "resourceType" + } + ] + }, + { + "name": "appcomposer_openTemplate", + "description": "Called after opening a template", + "metadata": [ + { + "type": "hasChatAuth" + }, + { + "type": "source", + "required": false + } + ] + }, + { + "name": "appcomposer_openWfs", + "description": "Called when Step Functions Workflow Studio is opened" + }, + { + "name": "appcomposer_postProcess", + "description": "Called after a generate is processed", + "metadata": [ + { + "type": "pathsScrubbed" + }, + { + "type": "resourceType" + } + ] + }, + { + "name": "appcomposer_regenerateClicked", + "description": "Called after regenerating a standard resource template partial", + "metadata": [ + { + "type": "resourceType" + } + ] + }, + { + "name": "apprunner_copyServiceUrl", + "description": "Copy the service URL" + }, + { + "name": "apprunner_createService", + "description": "Create an App Runner service", + "metadata": [ + { + "type": "appRunnerServiceSource" + }, + { + "type": "reason", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "apprunner_deleteService", + "description": "Delete an App Runner service", + "metadata": [ + { + "type": "appRunnerServiceStatus", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "apprunner_openServiceUrl", + "description": "Open the service URL in a browser" + }, + { + "name": "apprunner_pauseService", + "description": "Pause a running App Runner service", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "apprunner_resumeService", + "description": "Resume a paused App Runner service", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "apprunner_startDeployment", + "description": "Start a new deployment for an App Runner service", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "apprunner_viewApplicationLogs", + "description": "View the App Runner application logs (the logs for your running service)" + }, + { + "name": "apprunner_viewServiceLogs", + "description": "View the App Runner service logs (the logs produced by App Runner)" + }, + { + "name": "auth_addConnection", + "description": "New connection was added in the 'Add New Connection' workflow.", + "metadata": [ + { + "type": "attempts", + "required": false + }, + { + "type": "authEnabledFeatures", + "required": false + }, + { + "type": "authScopes", + "required": false + }, + { + "type": "credentialSourceId" + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "featureId" + }, + { + "type": "invalidInputFields", + "required": false + }, + { + "type": "isAggregated" + }, + { + "type": "isReAuth" + }, + { + "type": "reason", + "required": false + }, + { + "type": "result" + }, + { + "type": "source" + }, + { + "type": "ssoRegistrationClientId", + "required": false + }, + { + "type": "ssoRegistrationExpiresAt", + "required": false + } + ] + }, + { + "name": "auth_addedConnections", + "description": "The diff/change in Auth connections", + "metadata": [ + { + "type": "attempts" + }, + { + "type": "authConnectionsCount" + }, + { + "type": "enabledAuthConnections" + }, + { + "type": "newAuthConnectionsCount" + }, + { + "type": "newEnabledAuthConnections" + }, + { + "type": "reason", + "required": false + }, + { + "type": "result" + }, + { + "type": "source" + } + ] + }, + { + "name": "auth_signInPageClosed", + "description": "When the Amazon Q sign in page is closed.", + "metadata": [], + "passive": true + }, + { + "name": "auth_signInPageOpened", + "description": "When the Amazon Q sign in page is opened and focused.", + "metadata": [], + "passive": true + }, + { + "name": "auth_switchRoles", + "description": "Called when user clicks yes or no to switch role upon adding new connection", + "metadata": [ + { + "type": "authConnectionsCount" + }, + { + "type": "userChoice" + } + ] + }, + { + "name": "auth_userState", + "description": "The state of the user's authentication upon startup.", + "metadata": [ + { + "type": "authEnabledConnections", + "required": true + }, + { + "type": "authScopes", + "required": false + }, + { + "type": "authStatus", + "required": true + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "source", + "required": true + }, + { + "type": "ssoRegistrationClientId", + "required": false + }, + { + "type": "ssoRegistrationExpiresAt", + "required": false + } + ], + "passive": true + }, + { + "name": "aws_copyArn", + "description": "Copy the ARN of an AWS resource", + "metadata": [ + { + "type": "serviceType" + } + ] + }, + { + "name": "aws_createCredentials", + "description": "Create a new credentials file" + }, + { + "name": "aws_deleteResource", + "description": "Delete an AWS resource", + "metadata": [ + { + "type": "result" + }, + { + "type": "serviceType" + } + ] + }, + { + "name": "aws_expandExplorerNode", + "description": "Expand a service root node in the AWS explorer window", + "metadata": [ + { + "type": "serviceType" + } + ] + }, + { + "name": "aws_experimentActivation", + "description": "An experiment was activated or deactivated in the Toolkit", + "metadata": [ + { + "type": "experimentId" + }, + { + "type": "experimentState" + } + ] + }, + { + "name": "aws_featureConfig", + "description": "AB Testing Feature response and Cohort Assignments", + "metadata": [ + { + "type": "featureValue" + }, + { + "type": "featureVariation" + }, + { + "type": "id" + } + ] + }, + { + "name": "aws_help", + "description": "Open docs for the extension", + "metadata": [ + { + "type": "name", + "required": false + } + ] + }, + { + "name": "aws_helpQuickstart", + "description": "Open the quickstart guide", + "metadata": [ + { + "type": "result" + } + ], + "passive": true + }, + { + "name": "aws_injectCredentials", + "description": "Inject selected AWS credentials into a third-party run (e.g. RunConfiguration)", + "metadata": [ + { + "type": "result" + }, + { + "type": "runtimeString", + "required": false + } + ] + }, + { + "name": "aws_loadCredentials", + "description": "Load credentials from a credential source", + "unit": "Count", + "metadata": [ + { + "type": "credentialSourceId" + } + ], + "passive": true + }, + { + "name": "aws_loginWithBrowser", + "description": "Extension navigated the user to a web browser to perform/complete the login process.", + "metadata": [ + { + "type": "credentialSourceId", + "required": false + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "credentialType", + "required": false + }, + { + "type": "isReAuth", + "required": false + }, + { + "type": "reAuthReason", + "required": false + }, + { + "type": "result" + }, + { + "type": "source" + }, + { + "type": "ssoRegistrationClientId", + "required": false + }, + { + "type": "ssoRegistrationExpiresAt", + "required": false + } + ] + }, + { + "name": "aws_modifyCredentials", + "description": "Modify credentials (e.g. Add, Edit, Delete)", + "metadata": [ + { + "type": "credentialModification" + }, + { + "type": "result" + }, + { + "type": "serviceType", + "required": false + }, + { + "type": "source" + } + ] + }, + { + "name": "aws_modifySetting", + "description": "An setting was changed by users in the Toolkit. This metric can optionally provide the new state of the setting via settingState.", + "metadata": [ + { + "type": "settingId" + }, + { + "type": "settingState", + "required": false + } + ] + }, + { + "name": "aws_openCredentials", + "description": "Open the credentials file", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "aws_openUrl", + "description": "Opens a url", + "metadata": [ + { + "type": "result" + }, + { + "type": "source", + "required": false + }, + { + "type": "url", + "required": false + } + ] + }, + { + "name": "aws_refreshCredentials", + "description": "Emitted when credentials are automatically refreshed by the AWS SDK or Toolkit", + "passive": true, + "metadata": [ + { + "type": "credentialSourceId", + "required": false + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "credentialType", + "required": false + }, + { + "type": "reason", + "required": false + }, + { + "type": "reasonDesc", + "required": false + }, + { + "type": "requestId", + "required": false + }, + { + "type": "result" + }, + { + "type": "sessionDuration", + "required": false + }, + { + "type": "ssoRegistrationClientId", + "required": false + }, + { + "type": "ssoRegistrationExpiresAt", + "required": false + } + ] + }, + { + "name": "aws_refreshExplorer", + "description": "Refresh the AWS explorer window" + }, + { + "name": "aws_reportPluginIssue", + "description": "Report an issue with the plugin" + }, + { + "name": "aws_saveCredentials", + "description": "Save credentials" + }, + { + "name": "aws_setCredentials", + "description": "Select a credentials profile", + "metadata": [ + { + "type": "credentialSourceId", + "required": false + }, + { + "type": "credentialType", + "required": false + } + ] + }, + { + "name": "aws_setPartition", + "description": "A partition change occurred", + "metadata": [ + { + "type": "partitionId" + } + ] + }, + { + "name": "aws_setRegion", + "description": "A region change occurred", + "metadata": [] + }, + { + "name": "aws_showExtensionSource", + "description": "Open the repo for the extension" + }, + { + "name": "aws_toolInstallation", + "description": "An external tool was installed automatically", + "metadata": [ + { + "type": "result" + }, + { + "type": "toolId" + } + ], + "passive": true + }, + { + "name": "aws_validateCredentials", + "description": "Validate credentials when selecting new credentials", + "metadata": [ + { + "type": "credentialSourceId", + "required": false + }, + { + "type": "credentialType", + "required": false + }, + { + "type": "result" + } + ], + "passive": true + }, + { + "name": "aws_webviewInstallation", + "description": "Captures process of webview installation", + "metadata": [ + { + "type": "elementId" + }, + { + "type": "isRetry" + }, + { + "type": "reason", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "beanstalk_deleteApplication", + "description": "Called when user deletes a Beanstalk application", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "beanstalk_deleteEnvironment", + "description": "Called when user deletes a Beanstalk environment", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "beanstalk_deploy", + "description": "Called when deploying an application to Elastic Beanstalk", + "metadata": [ + { + "type": "duration", + "required": false + }, + { + "type": "enhancedHealthEnabled", + "required": false + }, + { + "type": "framework", + "required": false + }, + { + "type": "initialDeploy" + }, + { + "type": "name", + "required": false + }, + { + "type": "result" + }, + { + "type": "serviceType", + "required": false + }, + { + "type": "source", + "required": false + }, + { + "type": "xrayEnabled", + "required": false + } + ] + }, + { + "name": "beanstalk_editEnvironment", + "description": "Edit configuration of a Beanstalk environment", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "beanstalk_openApplication", + "description": "Open a window to view the status of the Beanstalk Application", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "beanstalk_openEnvironment", + "description": "Open a window to view the status of the Beanstalk Environment", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "beanstalk_publishWizard", + "description": "Called when user completes the Elastic Beanstalk publish wizard", + "metadata": [ + { + "type": "duration", + "required": false + }, + { + "type": "result" + }, + { + "type": "serviceType", + "required": false + }, + { + "type": "source", + "required": false + } + ] + }, + { + "name": "beanstalk_rebuildEnvironment", + "description": "Rebuild a Beanstalk environment", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "beanstalk_restartApplication", + "description": "Restart application server for a Beanstalk environment", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudformation_createProject", + "description": "Called when creating a CloudFormation project", + "metadata": [ + { + "type": "result" + }, + { + "type": "templateName" + } + ] + }, + { + "name": "cloudformation_delete", + "description": "Called when deleting a cloudformation stack", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudformation_deploy", + "description": "Called when deploying a CloudFormation template", + "metadata": [ + { + "type": "duration", + "required": false + }, + { + "type": "initialDeploy" + }, + { + "type": "result" + }, + { + "type": "serviceType", + "required": false + }, + { + "type": "source", + "required": false + } + ] + }, + { + "name": "cloudformation_open", + "description": "Open a CloudFormation stack in the stack viewer", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudformation_publishWizard", + "description": "Called when user completes the CloudFormation template publish wizard", + "metadata": [ + { + "type": "duration", + "required": false + }, + { + "type": "result" + }, + { + "type": "serviceType", + "required": false + }, + { + "type": "source", + "required": false + } + ] + }, + { + "name": "cloudfront_createDistribution", + "description": "Create a CloudFront Distribution", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudfront_createStreamingDistribution", + "description": "Create a CloudFront Streaming Distribution", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudfront_deleteDistribution", + "description": "Called when user deletes a CloudFront Distribution", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudfront_deleteStreamingDistribution", + "description": "Called when user deletes a CloudFront Streaming Distribution", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudfront_openDistribution", + "description": "Open a window to view the status of the CloudFront Distribution", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudfront_openInvalidationRequest", + "description": "Open a window to view the Cloudfront Invalidation requests", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudfront_openStreamingDistribution", + "description": "Open a window to view the status of the CloudFront Streaming Distribution", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudwatchinsights_executeQuery", + "description": "Start an insights query", + "metadata": [ + { + "type": "insightsQueryStringType" + }, + { + "type": "insightsQueryTimeType" + }, + { + "type": "result" + } + ] + }, + { + "name": "cloudwatchinsights_openDetailedLogRecord", + "description": "Get all details for the selected log record", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudwatchinsights_openEditor", + "description": "Open the insights query editor", + "metadata": [ + { + "type": "insightsDialogOpenSource" + } + ] + }, + { + "name": "cloudwatchinsights_retrieveQuery", + "description": "Retrieve list of available saved queries from AWS", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudwatchinsights_saveQuery", + "description": "Save query parameters to AWS", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudwatchlogs_copyArn", + "description": "Copy the ARN of a CloudWatch Logs entity", + "metadata": [ + { + "type": "cloudWatchResourceType" + }, + { + "type": "result" + } + ] + }, + { + "name": "cloudwatchlogs_delete", + "description": "Delete a CloudWatch Logs entity.", + "metadata": [ + { + "type": "cloudWatchResourceType" + }, + { + "type": "result" + } + ] + }, + { + "name": "cloudwatchlogs_download", + "unit": "Bytes", + "description": "Download a CloudWatch Logs entity. Value indicates the final size of the formatted stream in bytes.", + "metadata": [ + { + "type": "cloudWatchResourceType" + }, + { + "type": "result" + } + ] + }, + { + "name": "cloudwatchlogs_downloadStreamToFile", + "unit": "Bytes", + "description": "Download a stream to a file on disk. Value indicates the final size of the formatted stream. (Deprecated - use cloudwatchlogs_download)", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudwatchlogs_filter", + "description": "Filters a CloudWatch Logs entity. (Essentially a subset of cloudwatchlogs_open)", + "metadata": [ + { + "type": "cloudWatchResourceType" + }, + { + "type": "hasTextFilter", + "required": false + }, + { + "type": "hasTimeFilter", + "required": false + }, + { + "type": "result" + }, + { + "type": "source", + "required": false + } + ] + }, + { + "name": "cloudwatchlogs_open", + "description": "Open a CloudWatch Logs entity. ServiceType and source indicate where the request came from (example: while viewing an ECS container)", + "metadata": [ + { + "type": "cloudWatchLogsPresentation", + "required": false + }, + { + "type": "cloudWatchResourceType" + }, + { + "type": "hasTextFilter", + "required": false + }, + { + "type": "hasTimeFilter", + "required": false + }, + { + "type": "result" + }, + { + "type": "serviceType", + "required": false + }, + { + "type": "source" + } + ] + }, + { + "name": "cloudwatchlogs_openGroup", + "description": "Open the CloudWatch Logs group window. ServiceType indicates that it was opened from a different service (like directly from an ECS container) (Deprecated - use cloudwatchlogs_open)", + "metadata": [ + { + "type": "result" + }, + { + "type": "serviceType", + "required": false + } + ] + }, + { + "name": "cloudwatchlogs_openStream", + "description": "Open a CloudWatch Logs stream in the window. ServiceType indicates that it was opened from a different service (like directly from an ECS container) (Deprecated - use cloudwatchlogs_open)", + "metadata": [ + { + "type": "result" + }, + { + "type": "serviceType", + "required": false + } + ] + }, + { + "name": "cloudwatchlogs_openStreamInEditor", + "description": "Download a stream to memory then open in an editor.", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudwatchlogs_refresh", + "description": "Refresh a CloudWatch Logs entity", + "metadata": [ + { + "type": "cloudWatchResourceType" + } + ] + }, + { + "name": "cloudwatchlogs_refreshGroup", + "description": "Refresh group is pressed (Deprecated, use cloudwatchlogs_refresh)" + }, + { + "name": "cloudwatchlogs_refreshStream", + "description": "Refresh stream is pressed (Deprecated, use cloudwatchlogs_refresh)" + }, + { + "name": "cloudwatchlogs_searchGroup", + "description": "Called when a group is searched", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudwatchlogs_searchStream", + "description": "Called when a stream is searched", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudwatchlogs_showEventsAround", + "description": "Show event around a time period in ms specified by Value", + "unit": "Milliseconds", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudwatchlogs_tailStream", + "description": "Tail stream off/on", + "metadata": [ + { + "type": "enabled" + } + ] + }, + { + "name": "cloudwatchlogs_viewCurrentMessagesInEditor", + "description": "Copy the currently open (possibly filtered) messages to an editor", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "cloudwatchlogs_wrapEvents", + "description": "Word wrap events off/on", + "metadata": [ + { + "type": "enabled" + } + ] + }, + { + "name": "codecatalyst_connect", + "description": "Connect to a Amazon CodeCatalyst dev environment", + "metadata": [ + { + "type": "result" + }, + { + "type": "userId" + } + ] + }, + { + "name": "codecatalyst_createDevEnvironment", + "description": "Create an Amazon CodeCatalyst Dev Environment", + "metadata": [ + { + "type": "codecatalyst_createDevEnvironmentRepoType", + "required": false + }, + { + "type": "result" + }, + { + "type": "userId" + } + ] + }, + { + "name": "codecatalyst_devEnvironmentWorkflowStatistic", + "description": "Workflow statistic for connecting to a dev environment", + "passive": true, + "metadata": [ + { + "type": "codecatalyst_devEnvironmentWorkflowError", + "required": false + }, + { + "type": "codecatalyst_devEnvironmentWorkflowStep" + }, + { + "type": "duration" + }, + { + "type": "result" + }, + { + "type": "userId" + } + ] + }, + { + "name": "codecatalyst_localClone", + "description": "Clone a Amazon CodeCatalyst code repository locally", + "metadata": [ + { + "type": "result" + }, + { + "type": "userId" + } + ] + }, + { + "name": "codecatalyst_updateDevEnvironmentSettings", + "description": "Update properties of a Amazon CodeCatalyst Dev Environment", + "metadata": [ + { + "type": "codecatalyst_updateDevEnvironmentLocationType" + }, + { + "type": "result" + }, + { + "type": "userId" + } + ] + }, + { + "name": "codecatalyst_updateDevfile", + "description": "Trigger a devfile update on a Amazon CodeCatalyst dev environment", + "metadata": [ + { + "type": "result" + }, + { + "type": "userId" + } + ] + }, + { + "name": "codecommit_cloneRepo", + "description": "A repo is cloned from CodeCommit", + "metadata": [ + { + "type": "reason", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "codecommit_createRepo", + "description": "A repo is created in CodeCommit", + "metadata": [ + { + "type": "reason", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "codecommit_setCredentials", + "description": "A connection is established to CodeCommit to perform actions on repos", + "metadata": [ + { + "type": "credentialType", + "required": false + }, + { + "type": "result" + } + ], + "passive": true + }, + { + "name": "codeTransform_applyChanges", + "description": "Apply suggested changes to buildable units.", + "metadata": [ + { + "type": "codeTransformNumberOfTransformedFilesAccepted", + "required": true + }, + { + "type": "codeTransformNumberOfTransformedUnitsAccepted", + "required": false + }, + { + "type": "codeTransformSessionId", + "required": true + } + ] + }, + { + "name": "codeTransform_dependenciesCopied", + "description": "Deprecated - use codeTransform_uploadProject (The repo copies over at least one dependency successfully)", + "metadata": [ + { + "type": "codeTransformSessionId", + "required": true + } + ] + }, + { + "name": "codeTransform_downloadArtifact", + "description": "User downloads code transform artifact", + "metadata": [ + { + "type": "codeTransformArtifactType", + "required": true + }, + { + "type": "codeTransformJobId", + "required": true + }, + { + "type": "codeTransformRuntimeError", + "required": false + }, + { + "type": "codeTransformRunTimeLatency", + "required": true + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "codeTransformTotalByteSize", + "required": true + }, + { + "type": "reason", + "required": false + }, + { + "type": "result", + "required": true + } + ] + }, + { + "name": "codeTransform_humanInTheLoop", + "description": "The user interactivity when a transformation pause state is reached.", + "metadata": [ + { + "type": "codeTransformJobId", + "required": false + }, + { + "type": "codeTransformMetadata", + "required": true + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "reason", + "required": false + }, + { + "type": "result", + "required": false + } + ] + }, + { + "name": "codeTransform_initiateTransform", + "description": "User initiates code transform from Q Chat Prompt.", + "metadata": [ + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "credentialSourceId", + "required": false + }, + { + "type": "reason", + "required": false + }, + { + "type": "result", + "required": true + } + ] + }, + { + "name": "codeTransform_isDoubleClickedToTriggerInvalidProject", + "description": "Deprecated - use codeTransform_validateProject (Transform initiated a job but there is a validation error)", + "metadata": [ + { + "type": "codeTransformPreValidationError", + "required": true + }, + { + "type": "codeTransformRuntimeError", + "required": false + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "reason", + "required": true + }, + { + "type": "result", + "required": true + } + ] + }, + { + "name": "codeTransform_jobArtifactDownloadAndDeserializeTime", + "description": "Deprecated - use codeTransform_downloadArtifact (job is ending download zip contents)", + "metadata": [ + { + "type": "codeTransformJobId", + "required": true + }, + { + "type": "codeTransformRuntimeError", + "required": false + }, + { + "type": "codeTransformRunTimeLatency", + "required": true + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "codeTransformTotalByteSize", + "required": true + } + ] + }, + { + "name": "codeTransform_jobCreateZipEndTime", + "description": "Deprecated - use codeTransform_uploadProject (A timestamp for when the job is ending upload zip contents)", + "metadata": [ + { + "type": "codeTransformRunTimeLatency", + "required": true + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "codeTransformTotalByteSize", + "required": true + } + ] + }, + { + "name": "codeTransform_jobIsCancelledByUser", + "description": "After a job is running the user has the ability to cancel the job.", + "metadata": [ + { + "type": "codeTransformCancelSrcComponents", + "required": true + }, + { + "type": "codeTransformRuntimeError", + "required": false + }, + { + "type": "codeTransformSessionId", + "required": true + } + ] + }, + { + "name": "codeTransform_jobIsClosedDuringIdeRun", + "description": "The user closes their IDE and stops viewing the transformation.", + "metadata": [ + { + "type": "codeTransformJobId", + "required": true + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "codeTransformStatus", + "required": true + } + ] + }, + { + "name": "codeTransform_jobIsResumedAfterIdeClose", + "description": "The user was previously running a transformation and came back to IDE to see it still running", + "metadata": [ + { + "type": "codeTransformJobId", + "required": true + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "codeTransformStatus", + "required": true + } + ] + }, + { + "name": "codeTransform_jobIsStartedFromChatPrompt", + "description": "The user initiates a transform job from the Amazon Q chat prompt.", + "metadata": [ + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "credentialSourceId", + "required": false + } + ] + }, + { + "name": "codeTransform_jobStart", + "description": "Transform job started for uploaded project.", + "metadata": [ + { + "type": "codeTransformJobId", + "required": false + }, + { + "type": "codeTransformNumberOfProjects", + "required": false + }, + { + "type": "codeTransformNumberOfTransformedFiles", + "required": false + }, + { + "type": "codeTransformRunTimeLatency", + "required": false + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "codeTransformTarget", + "required": false + }, + { + "type": "credentialSourceId", + "required": false + }, + { + "type": "reason", + "required": false + }, + { + "type": "result", + "required": false + }, + { + "type": "source", + "required": false + } + ] + }, + { + "name": "codeTransform_jobStartedCompleteFromPopupDialog", + "passive": true, + "description": "Deprecated - use codeTransform_submitSelection (code execution starts after model validation)", + "metadata": [ + { + "type": "codeTransformJavaSourceVersionsAllowed", + "required": true + }, + { + "type": "codeTransformJavaTargetVersionsAllowed", + "required": true + }, + { + "type": "codeTransformProjectId", + "required": true + }, + { + "type": "codeTransformSessionId", + "required": true + } + ] + }, + { + "name": "codeTransform_jobStatusChanged", + "passive": true, + "description": "During the transformation progress, log the status steps returning from the API.", + "metadata": [ + { + "type": "codeTransformJobId", + "required": true + }, + { + "type": "codeTransformPreviousStatus", + "required": true + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "codeTransformStatus", + "required": true + } + ] + }, + { + "name": "codeTransform_localBuildProject", + "description": "Transform initiates local build.", + "metadata": [ + { + "type": "codeTransformBuildCommand", + "required": true + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "reason", + "required": false + }, + { + "type": "result", + "required": true + } + ] + }, + { + "name": "codeTransform_logApiError", + "passive": true, + "description": "Deprecated - avoid logging every service call", + "metadata": [ + { + "type": "codeTransformJobId", + "required": false + }, + { + "type": "codeTransformRequestId", + "required": false + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "codeTransformTotalByteSize", + "required": false + }, + { + "type": "reason", + "required": true + } + ] + }, + { + "name": "codeTransform_logApiLatency", + "passive": true, + "description": "Deprecated - avoid logging every service call", + "metadata": [ + { + "type": "codeTransformApiNames", + "required": true + }, + { + "type": "codeTransformJobId", + "required": false + }, + { + "type": "codeTransformRequestId", + "required": false + }, + { + "type": "codeTransformRunTimeLatency", + "required": true + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "codeTransformTotalByteSize", + "required": false + }, + { + "type": "codeTransformUploadId", + "required": false + } + ] + }, + { + "name": "codeTransform_logGeneralError", + "passive": true, + "description": "A general error has occurred.", + "metadata": [ + { + "type": "codeTransformJobId", + "required": false + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "reason", + "required": true + } + ] + }, + { + "name": "codeTransform_mvnBuildFailed", + "description": "Deprecated - use codeTransform_localBuildProject (The maven command build failed)", + "metadata": [ + { + "type": "codeTransformMavenBuildCommand", + "required": true + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "reason", + "required": false + } + ] + }, + { + "name": "codeTransform_projectDetails", + "passive": true, + "description": "Deprecated - use codeTransform_validateProject (Transform initiates project validation before user interaction)", + "metadata": [ + { + "type": "codeTransformLocalJavaVersion", + "required": false + }, + { + "type": "codeTransformPreValidationError", + "required": false + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "reason", + "required": false + }, + { + "type": "result", + "required": true + } + ] + }, + { + "name": "codeTransform_submitSelection", + "description": "User provides input to project module and language selection.", + "metadata": [ + { + "type": "codeTransformJavaSourceVersionsAllowed", + "required": false + }, + { + "type": "codeTransformJavaTargetVersionsAllowed", + "required": false + }, + { + "type": "codeTransformProjectId", + "required": false + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "reason", + "required": false + }, + { + "type": "result", + "required": true + }, + { + "type": "userChoice", + "required": false + } + ] + }, + { + "name": "codeTransform_totalRunTime", + "passive": true, + "description": "We want to log the total run time in the users experience for the IDE. The total runtime should end when all API's have finished running and the users is prompted for next step actions.", + "metadata": [ + { + "type": "buildSystemVersion", + "required": false + }, + { + "type": "codeTransformJobId", + "required": false + }, + { + "type": "codeTransformLocalJavaVersion", + "required": false + }, + { + "type": "codeTransformLocalMavenVersion", + "required": false + }, + { + "type": "codeTransformPlanReceivedCount", + "required": false + }, + { + "type": "codeTransformResultStatusMessage", + "required": false + }, + { + "type": "codeTransformRunTimeLatency", + "required": true + }, + { + "type": "codeTransformSessionId", + "required": true + } + ] + }, + { + "name": "codeTransform_uploadProject", + "description": "Transform initiates project artifact upload.", + "metadata": [ + { + "type": "codeTransformDependenciesCopied", + "required": true + }, + { + "type": "codeTransformRunTimeLatency", + "required": true + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "codeTransformTotalByteSize", + "required": true + }, + { + "type": "reason", + "required": false + }, + { + "type": "result", + "required": true + } + ] + }, + { + "name": "codeTransform_validateProject", + "description": "Transform initiates project language, build tool, and build file validation.", + "metadata": [ + { + "type": "buildSystemVersion", + "required": false + }, + { + "type": "codeTransformBuildSystem", + "required": false + }, + { + "type": "codeTransformLocalJavaVersion", + "required": false + }, + { + "type": "codeTransformPreValidationError", + "required": false + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "reason", + "required": false + }, + { + "type": "result", + "required": true + } + ] + }, + { + "name": "codeTransform_vcsDiffViewerVisible", + "description": "Deprecated - use codeTransform_viewArtifact (timestamp when the diff view is being displayed to the user)", + "metadata": [ + { + "type": "codeTransformJobId", + "required": false + }, + { + "type": "codeTransformSessionId", + "required": true + } + ] + }, + { + "name": "codeTransform_vcsViewerCanceled", + "description": "Deprecated - use codeTransform_viewArtifact (An interactivity measured when users cancel a patch view)", + "metadata": [ + { + "type": "codeTransformJobId", + "required": false + }, + { + "type": "codeTransformPatchViewerCancelSrcComponents", + "required": true + }, + { + "type": "codeTransformRuntimeError", + "required": false + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "codeTransformStatus", + "required": true + } + ] + }, + { + "name": "codeTransform_vcsViewerClicked", + "description": "Deprecated - use codeTransform_viewArtifact (An interactivity measured when users click to view diff results)", + "metadata": [ + { + "type": "codeTransformJobId", + "required": false + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "codeTransformVCSViewerSrcComponents", + "required": true + } + ] + }, + { + "name": "codeTransform_vcsViewerSubmitted", + "description": "Deprecated - use codeTransform_viewArtifact (An interactivity measured when users submit their patch view results)", + "metadata": [ + { + "type": "codeTransformJobId", + "required": false + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "codeTransformStatus", + "required": true + } + ] + }, + { + "name": "codeTransform_viewArtifact", + "description": "User clicks to view downloaded artifact.", + "metadata": [ + { + "type": "codeTransformArtifactType", + "required": true + }, + { + "type": "codeTransformJobId", + "required": true + }, + { + "type": "codeTransformSessionId", + "required": true + }, + { + "type": "codeTransformStatus", + "required": true + }, + { + "type": "codeTransformVCSViewerSrcComponents", + "required": true + }, + { + "type": "reason", + "required": false + }, + { + "type": "result", + "required": true + }, + { + "type": "userChoice", + "required": false + } + ] + }, + { + "name": "codewhisperer_blockedInvocation", + "description": "Client side invocation blocked by another invocation in progress", + "metadata": [ + { + "type": "codewhispererAutomatedTriggerType", + "required": false + }, + { + "type": "codewhispererCursorOffset" + }, + { + "type": "codewhispererLanguage" + }, + { + "type": "codewhispererLineNumber" + }, + { + "type": "codewhispererTriggerType" + }, + { + "type": "credentialStartUrl", + "required": false + } + ] + }, + { + "name": "codewhisperer_clientComponentLatency", + "description": "The latency from each CodeWhisperer components in milliseconds", + "passive": true, + "metadata": [ + { + "type": "codewhispererAllCompletionsLatency" + }, + { + "type": "codewhispererCompletionType" + }, + { + "type": "codewhispererCredentialFetchingLatency" + }, + { + "type": "codewhispererCustomizationArn", + "required": false + }, + { + "type": "codewhispererEndToEndLatency" + }, + { + "type": "codewhispererFirstCompletionLatency" + }, + { + "type": "codewhispererLanguage" + }, + { + "type": "codewhispererPostprocessingLatency" + }, + { + "type": "codewhispererPreprocessingLatency" + }, + { + "type": "codewhispererRequestId" + }, + { + "type": "codewhispererSessionId" + }, + { + "type": "codewhispererTriggerType" + }, + { + "type": "codewhispererUserGroup" + }, + { + "type": "credentialStartUrl", + "required": false + } + ] + }, + { + "name": "codewhisperer_codePercentage", + "description": "Percentage of user tokens against suggestions until 5 mins of time", + "metadata": [ + { + "type": "codewhispererAcceptedTokens" + }, + { + "type": "codewhispererCustomizationArn", + "required": false + }, + { + "type": "codewhispererLanguage" + }, + { + "type": "codewhispererPercentage" + }, + { + "type": "codewhispererSuggestedTokens", + "required": false + }, + { + "type": "codewhispererTotalTokens" + }, + { + "type": "codewhispererUserGroup" + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "reason", + "required": false + }, + { + "type": "successCount" + } + ], + "passive": true + }, + { + "name": "codewhisperer_codeScanIssueApplyFix", + "description": "Called when a code scan issue suggested fix is applied", + "metadata": [ + { + "type": "component" + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "detectorId" + }, + { + "type": "findingId" + }, + { + "type": "reason", + "required": false + }, + { + "type": "result" + }, + { + "type": "ruleId", + "required": false + } + ] + }, + { + "name": "codewhisperer_codeScanIssueHover", + "description": "Called when a code scan issue is hovered over", + "metadata": [ + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "detectorId" + }, + { + "type": "findingId" + }, + { + "type": "includesFix" + }, + { + "type": "ruleId", + "required": false + } + ] + }, + { + "name": "codewhisperer_codeScanIssueViewDetails", + "description": "Called when a code scan issue webview is opened", + "metadata": [ + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "detectorId" + }, + { + "type": "findingId" + }, + { + "type": "ruleId", + "required": false + } + ] + }, + { + "name": "codewhisperer_enabled", + "description": "Whether or not CodeWhisperer is enabled", + "passive": true, + "metadata": [ + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "enabled", + "required": true + }, + { + "type": "source", + "required": true + } + ] + }, + { + "name": "codewhisperer_onboardingClick", + "description": "This metric provides the particular language and task type selected by the user in the onboarding page by clicking on the Try Example button.", + "metadata": [ + { + "type": "codewhispererGettingStartedTask" + }, + { + "type": "codewhispererLanguage" + } + ] + }, + { + "name": "codewhisperer_perceivedLatency", + "description": "The duration from user last modification to the first recommendation shown in milliseconds", + "metadata": [ + { + "type": "codewhispererCompletionType" + }, + { + "type": "codewhispererCustomizationArn", + "required": false + }, + { + "type": "codewhispererLanguage" + }, + { + "type": "codewhispererRequestId" + }, + { + "type": "codewhispererSessionId", + "required": false + }, + { + "type": "codewhispererTriggerType" + }, + { + "type": "codewhispererUserGroup" + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "duration" + } + ] + }, + { + "name": "codewhisperer_securityScan", + "description": "Client side invocation of the CodeWhisperer Security Scan", + "metadata": [ + { + "type": "artifactsUploadDuration" + }, + { + "type": "codeScanServiceInvocationsDuration" + }, + { + "type": "codewhispererCodeScanBuildPayloadBytes", + "required": false + }, + { + "type": "codewhispererCodeScanBuildZipFileBytes", + "required": false + }, + { + "type": "codewhispererCodeScanIssuesWithFixes", + "required": false + }, + { + "type": "codewhispererCodeScanJobId", + "required": false + }, + { + "type": "codewhispererCodeScanLines" + }, + { + "type": "codewhispererCodeScanProjectBytes", + "required": false + }, + { + "type": "codewhispererCodeScanScope", + "required": false + }, + { + "type": "codewhispererCodeScanSrcPayloadBytes" + }, + { + "type": "codewhispererCodeScanSrcZipFileBytes" + }, + { + "type": "codewhispererCodeScanTotalIssues" + }, + { + "type": "codewhispererLanguage" + }, + { + "type": "contextTruncationDuration" + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "duration" + }, + { + "type": "reason", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "codewhisperer_serviceInvocation", + "description": "Client side invocation of the CodeWhisperer service for suggestion", + "metadata": [ + { + "type": "codewhispererAutomatedTriggerType", + "required": false + }, + { + "type": "codewhispererCompletionType", + "required": false + }, + { + "type": "codewhispererCursorOffset" + }, + { + "type": "codewhispererCustomizationArn", + "required": false + }, + { + "type": "codewhispererGettingStartedTask", + "required": false + }, + { + "type": "codewhispererImportRecommendationEnabled", + "required": false + }, + { + "type": "codewhispererLanguage" + }, + { + "type": "codewhispererLastSuggestionIndex", + "required": false + }, + { + "type": "codewhispererLineNumber" + }, + { + "type": "codewhispererRequestId", + "required": false + }, + { + "type": "codewhispererRuntime", + "required": false + }, + { + "type": "codewhispererRuntimeSource", + "required": false + }, + { + "type": "codewhispererSessionId", + "required": false + }, + { + "type": "codewhispererSupplementalContextIsUtg", + "required": false + }, + { + "type": "codewhispererSupplementalContextLatency", + "required": false + }, + { + "type": "codewhispererSupplementalContextLength", + "required": false + }, + { + "type": "codewhispererSupplementalContextTimeout", + "required": false + }, + { + "type": "codewhispererTriggerType" + }, + { + "type": "codewhispererUserGroup" + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "duration" + }, + { + "type": "reason", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "codewhisperer_userDecision", + "description": "User acceptance or rejection of each suggestion returned by the CodeWhisperer service request", + "metadata": [ + { + "type": "codewhispererCompletionType" + }, + { + "type": "codewhispererGettingStartedTask", + "required": false + }, + { + "type": "codewhispererLanguage" + }, + { + "type": "codewhispererPaginationProgress", + "required": false + }, + { + "type": "codewhispererRequestId" + }, + { + "type": "codewhispererRuntime", + "required": false + }, + { + "type": "codewhispererRuntimeSource", + "required": false + }, + { + "type": "codewhispererSessionId", + "required": false + }, + { + "type": "codewhispererSuggestionImportCount", + "required": false + }, + { + "type": "codewhispererSuggestionIndex" + }, + { + "type": "codewhispererSuggestionReferenceCount" + }, + { + "type": "codewhispererSuggestionReferences", + "required": false + }, + { + "type": "codewhispererSuggestionState" + }, + { + "type": "codewhispererSupplementalContextIsUtg", + "required": false + }, + { + "type": "codewhispererSupplementalContextLength", + "required": false + }, + { + "type": "codewhispererSupplementalContextTimeout", + "required": false + }, + { + "type": "codewhispererTriggerType" + }, + { + "type": "codewhispererUserGroup" + }, + { + "type": "credentialStartUrl", + "required": false + } + ] + }, + { + "name": "codewhisperer_userModification", + "description": "Percentage of user modifications for the selected suggestion until a fixed period of time", + "metadata": [ + { + "type": "codewhispererCharactersAccepted" + }, + { + "type": "codewhispererCharactersModified" + }, + { + "type": "codewhispererCompletionType" + }, + { + "type": "codewhispererLanguage" + }, + { + "type": "codewhispererModificationPercentage" + }, + { + "type": "codewhispererRequestId" + }, + { + "type": "codewhispererRuntime", + "required": false + }, + { + "type": "codewhispererRuntimeSource", + "required": false + }, + { + "type": "codewhispererSessionId", + "required": false + }, + { + "type": "codewhispererSuggestionIndex" + }, + { + "type": "codewhispererTriggerType" + }, + { + "type": "codewhispererUserGroup" + }, + { + "type": "credentialStartUrl", + "required": false + } + ] + }, + { + "name": "codewhisperer_userTriggerDecision", + "description": "User decision aggregated at trigger level", + "metadata": [ + { + "type": "codewhispererAutomatedTriggerType", + "required": false + }, + { + "type": "codewhispererCharactersAccepted", + "required": false + }, + { + "type": "codewhispererCharactersRecommended", + "required": false + }, + { + "type": "codewhispererClassifierResult", + "required": false + }, + { + "type": "codewhispererClassifierThreshold", + "required": false + }, + { + "type": "codewhispererCompletionType" + }, + { + "type": "codewhispererCursorOffset" + }, + { + "type": "codewhispererCustomizationArn", + "required": false + }, + { + "type": "codewhispererFeatureEvaluations", + "required": false + }, + { + "type": "codewhispererFirstRequestId" + }, + { + "type": "codewhispererGettingStartedTask", + "required": false + }, + { + "type": "codewhispererIsPartialAcceptance", + "required": false + }, + { + "type": "codewhispererLanguage" + }, + { + "type": "codewhispererLineNumber" + }, + { + "type": "codewhispererPartialAcceptanceCount", + "required": false + }, + { + "type": "codewhispererPreviousSuggestionState", + "required": false + }, + { + "type": "codewhispererSessionId", + "required": false + }, + { + "type": "codewhispererSuggestionCount" + }, + { + "type": "codewhispererSuggestionImportCount" + }, + { + "type": "codewhispererSuggestionState" + }, + { + "type": "codewhispererSupplementalContextIsUtg", + "required": false + }, + { + "type": "codewhispererSupplementalContextLength", + "required": false + }, + { + "type": "codewhispererSupplementalContextStrategyId", + "required": false + }, + { + "type": "codewhispererSupplementalContextTimeout", + "required": false + }, + { + "type": "codewhispererTimeSinceLastDocumentChange", + "required": false + }, + { + "type": "codewhispererTimeSinceLastUserDecision", + "required": false + }, + { + "type": "codewhispererTimeToFirstRecommendation", + "required": false + }, + { + "type": "codewhispererTotalShownTime", + "required": false + }, + { + "type": "codewhispererTriggerCharacter", + "required": false + }, + { + "type": "codewhispererTriggerType" + }, + { + "type": "codewhispererTypeaheadLength" + }, + { + "type": "codewhispererUserGroup" + }, + { + "type": "credentialStartUrl", + "required": false + }, + { + "type": "reason", + "required": false + } + ] + }, + { + "name": "deeplink_open", + "description": "User requested that a resource be opened in the browser using the deeplink service", + "metadata": [ + { + "type": "result" + }, + { + "type": "serviceType", + "required": false + }, + { + "type": "source" + } + ], + "passive": true + }, + { + "name": "dynamicresource_copyIdentifier", + "description": "Copy the dynamic resource identifier", + "metadata": [ + { + "type": "resourceType" + } + ] + }, + { + "name": "dynamicresource_getResource", + "description": "Open the dynamic resource model in the IDE", + "metadata": [ + { + "type": "resourceType" + }, + { + "type": "result" + } + ] + }, + { + "name": "dynamicresource_listResource", + "description": "Expand a Resource Type node", + "metadata": [ + { + "type": "resourceType" + }, + { + "type": "result" + } + ] + }, + { + "name": "dynamicresource_mutateResource", + "description": "A dynamic resource mutation request completed", + "metadata": [ + { + "type": "duration" + }, + { + "type": "dynamicResourceOperation" + }, + { + "type": "resourceType" + }, + { + "type": "result" + } + ] + }, + { + "name": "dynamicresource_selectResources", + "description": "Change the list of available dynamic resources in the AWS Explorer" + }, + { + "name": "dynamodb_createTable", + "description": "Create a DynamoDB table", + "metadata": [ + { + "type": "reason", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "dynamodb_deleteRecord", + "description": "Deletes a record in DynamoDB record", + "metadata": [ + { + "type": "reason", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "dynamodb_deleteTable", + "description": "Delete a DynamoDB table", + "metadata": [ + { + "type": "reason", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "dynamodb_edit", + "description": "Modify a DynamoDB entity", + "metadata": [ + { + "type": "dynamoDbTarget" + }, + { + "type": "reason", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "dynamodb_fetchRecords", + "description": "Fetch records from a DynamoDB table in the table browser", + "metadata": [ + { + "type": "count", + "required": false + }, + { + "type": "dynamoDbFetchType" + }, + { + "type": "dynamoDbIndexType", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "dynamodb_fetchTables", + "description": "Fetches the tables in a DynamoDB entity", + "metadata": [ + { + "type": "count", + "required": false + }, + { + "type": "result" + }, + { + "type": "source", + "required": false + } + ] + }, + { + "name": "dynamodb_openTable", + "description": "Open a DynamoDB table in the table browser", + "metadata": [ + { + "type": "count", + "required": false + }, + { + "type": "result" + }, + { + "type": "source", + "required": false + } + ] + }, + { + "name": "dynamodb_view", + "description": "View a DynamoDB entity", + "metadata": [ + { + "type": "dynamoDbTarget" + }, + { + "type": "reason", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "ec2_changeState", + "description": "Change the state of an EC2 Instance", + "metadata": [ + { + "type": "ec2InstanceState" + }, + { + "type": "result" + } + ] + }, + { + "name": "ec2_clearPrivateKey", + "unit": "Count", + "description": "Remove the private key of an EC2 Key Pair from internal storage", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_connectToInstance", + "description": "Perform a connection to an EC2 Instance", + "metadata": [ + { + "type": "ec2ConnectionType" + }, + { + "type": "result" + } + ] + }, + { + "name": "ec2_copyAmiToRegion", + "description": "Copy AMI image to another region", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_createAmi", + "description": "Create an image from an EC2 Instance", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_createElasticIp", + "description": "Create (allocate) an Elastic IP address", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_createKeyPair", + "description": "Create an EC2 Key Pair", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_createSecurityGroup", + "description": "Create an EC2 security group", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_createSnapshot", + "description": "Create an EC2 volume snapshot", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_createVolume", + "description": "Create an EC2 volume", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_deleteAmi", + "unit": "Count", + "description": "Delete (de-register) an AMI image", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_deleteElasticIp", + "description": "Delete (release) an Elastic IP address", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_deleteKeyPair", + "unit": "Count", + "description": "Delete an EC2 Key Pair", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_deleteSecurityGroup", + "unit": "Count", + "description": "Delete an EC2 security group", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_deleteSnapshot", + "unit": "Count", + "description": "Delete an EC2 Volume Snapshot", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_deleteVolume", + "unit": "Count", + "description": "Delete an EC2 Volume", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_editAmiPermission", + "description": "Edit AMI image permissions", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_editInstanceElasticIp", + "description": "Associate or disassociate an Elastic IP with an EC2 Instance", + "metadata": [ + { + "type": "enabled", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "ec2_editInstanceShutdownBehavior", + "description": "Adjust the shutdown behavior of an EC2 Instance", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_editInstanceTerminationProtection", + "description": "Adjust the termination protection of an EC2 Instance", + "metadata": [ + { + "type": "enabled", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "ec2_editInstanceType", + "description": "Adjust the instance type of an EC2 Instance", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_editInstanceUserData", + "description": "Adjust an EC2 Instance's user data", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_editSecurityGroupPermission", + "description": "Alter an EC2 security group permission", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_editVolumeAttachment", + "description": "Attach (enabled = true) or detach a volume", + "metadata": [ + { + "type": "enabled" + }, + { + "type": "result" + } + ] + }, + { + "name": "ec2_exportPrivateKey", + "description": "Save the private key of an EC2 Key Pair out to disk", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_importPrivateKey", + "description": "Store the private key of an EC2 Key Pair in internal storage", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_launchInstance", + "description": "Launch an EC2 Instance", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_openAMIs", + "description": "Open a window to view EC2 AMIs", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_openElasticIPs", + "description": "Open a window to view EC2 Elastic IPs", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_openInstances", + "description": "Open a window to view EC2 Instances", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_openKeyPairs", + "description": "Open to view EC2 Key pairs", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_openSecurityGroups", + "description": "Open a window to view EC2 Security Groups", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_openVolumes", + "description": "Open a window to view EC2 Volumes", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_viewInstanceSystemLog", + "description": "View the system log of an EC2 Instance", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ec2_viewInstanceUserData", + "description": "View an EC2 Instance's user data", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ecr_copyRepositoryUri", + "description": "Called when the user copies the repository uri from a node" + }, + { + "name": "ecr_copyTagUri", + "description": "Called when the user copies the repository tag uri from a node. The tag uri is the repository uri + : + the tag name" + }, + { + "name": "ecr_createRepository", + "description": "Called when creating a new ECR repository", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ecr_deleteRepository", + "description": "Called when deleting an existing ECR repository", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ecr_deleteTags", + "unit": "Count", + "description": "Called when deleting a tag in an ECR repository. The operation is a batch operation by default, value represents the number of tags deleted.", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ecr_deployImage", + "description": "Called when deploying an image to ECR", + "metadata": [ + { + "type": "duration", + "required": false + }, + { + "type": "ecrDeploySource", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "ecs_deleteCluster", + "description": "Delete an ECS cluster", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ecs_deleteScheduledTask", + "unit": "Count", + "description": "Delete ECS Scheduled task(s)", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ecs_deleteService", + "description": "Called when user deletes an ECS service", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ecs_deployScheduledTask", + "description": "Called when deploying a scheduled task to an ECS cluster", + "metadata": [ + { + "type": "duration", + "required": false + }, + { + "type": "ecsLaunchType" + }, + { + "type": "result" + } + ] + }, + { + "name": "ecs_deployService", + "description": "Called when deploying a service to an ECS cluster", + "metadata": [ + { + "type": "duration", + "required": false + }, + { + "type": "ecsLaunchType" + }, + { + "type": "result" + } + ] + }, + { + "name": "ecs_deployTask", + "description": "Called when deploying a task to an ECS cluster", + "metadata": [ + { + "type": "duration", + "required": false + }, + { + "type": "ecsLaunchType" + }, + { + "type": "result" + } + ] + }, + { + "name": "ecs_disableExecuteCommand", + "description": "Called when ECS execute command is disabled", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ecs_editService", + "description": "Edit configuration of an ECS service", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ecs_enableExecuteCommand", + "description": "Called when ECS execute command is enabled", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ecs_openCluster", + "description": "Open to view status of an ECS Cluster", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ecs_openRepository", + "description": "Open to view status of an ECS Repository", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ecs_publishWizard", + "description": "Called when user completes the ECS publish wizard", + "metadata": [ + { + "type": "duration", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "ecs_runExecuteCommand", + "description": "Called when the ECS execute command is run", + "metadata": [ + { + "type": "ecsExecuteCommandType" + }, + { + "type": "result" + } + ] + }, + { + "name": "ecs_stopTask", + "unit": "Count", + "description": "Stop ECS task(s)", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "feedback_result", + "description": "Called while submitting in-IDE feedback", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "file_editAwsFile", + "description": "Use authoring features such as autocompletion, syntax checking, and highlighting, for AWS filetypes (CFN, SAM, etc.). Emit this _once_ per file-editing session for a given file. For generic code files see `ide_editCodeFile`.", + "metadata": [ + { + "type": "awsFiletype", + "required": true + }, + { + "type": "filenameExt", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "iam_create", + "description": "Create an IAM resource", + "metadata": [ + { + "type": "iamResourceType" + }, + { + "type": "result" + } + ] + }, + { + "name": "iam_createUserAccessKey", + "description": "Create Access Key for an IAM user", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "iam_delete", + "description": "Delete an IAM resource", + "metadata": [ + { + "type": "iamResourceType" + }, + { + "type": "result" + } + ] + }, + { + "name": "iam_deleteUserAccessKey", + "description": "Delete Access Key for an IAM user", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "iam_edit", + "description": "Edits policy/configuration associated with an IAM resource", + "metadata": [ + { + "type": "iamResourceType" + }, + { + "type": "result" + } + ] + }, + { + "name": "iam_open", + "description": "Open a window to view/edit an IAM resource", + "metadata": [ + { + "type": "iamResourceType" + }, + { + "type": "result" + } + ] + }, + { + "name": "iam_openGroup", + "description": "Open a window to view/edit IAM Group Policy", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "iam_openRole", + "description": "Open a window to view/edit IAM Role Policy", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "iam_openUser", + "description": "Open a window to view/edit IAM User Configuration", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ide_editCodeFile", + "description": "User opened a code file with the given file extension. Client should DEDUPLICATE this metric (ideally hourly/daily). AWS-specific files should (also) emit `file_editAwsFile`.", + "passive": true, + "metadata": [ + { + "type": "filenameExt", + "required": false + } + ] + }, + { + "name": "lambda_configure", + "description": "Called when opening the local configuration of a Lambda to edit", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "lambda_create", + "description": "Called when creating lambdas remotely", + "metadata": [ + { + "type": "runtime" + } + ] + }, + { + "name": "lambda_createProject", + "description": "Called when creating a lambda project", + "metadata": [ + { + "type": "language" + }, + { + "type": "result" + }, + { + "type": "templateName" + }, + { + "type": "variant", + "required": false + } + ] + }, + { + "name": "lambda_delete", + "description": "called when deleting lambdas remotely", + "unit": "None", + "metadata": [ + { + "type": "duration" + }, + { + "type": "result" + } + ] + }, + { + "name": "lambda_deploy", + "description": "Called when deploying a Lambda Function", + "metadata": [ + { + "type": "duration", + "required": false + }, + { + "type": "initialDeploy" + }, + { + "type": "lambdaArchitecture", + "required": false + }, + { + "type": "lambdaPackageType" + }, + { + "type": "language", + "required": false + }, + { + "type": "platform", + "required": false + }, + { + "type": "result" + }, + { + "type": "runtime", + "required": false + }, + { + "type": "serviceType", + "required": false + }, + { + "type": "source", + "required": false + }, + { + "type": "xrayEnabled", + "required": false + } + ] + }, + { + "name": "lambda_editFunction", + "description": "Called when creating lambdas remotely", + "metadata": [ + { + "type": "lambdaPackageType" + }, + { + "type": "result" + }, + { + "type": "update", + "required": false + } + ] + }, + { + "name": "lambda_goToHandler", + "description": "Jump to a lambda handler from elsewhere", + "metadata": [ + { + "type": "source", + "required": false + } + ] + }, + { + "name": "lambda_import", + "description": "Called when importing a remote Lambda function", + "metadata": [ + { + "type": "result" + }, + { + "type": "runtime", + "required": false + } + ] + }, + { + "name": "lambda_invokeLocal", + "description": "Called when invoking lambdas locally (with SAM in most toolkits)", + "metadata": [ + { + "type": "debug" + }, + { + "type": "lambdaArchitecture", + "required": false + }, + { + "type": "lambdaPackageType" + }, + { + "type": "result" + }, + { + "type": "runtime", + "required": false + }, + { + "type": "source", + "required": false + }, + { + "type": "version", + "required": false + } + ] + }, + { + "name": "lambda_invokeRemote", + "description": "Called when invoking lambdas remotely", + "metadata": [ + { + "type": "result" + }, + { + "type": "runtime", + "required": false + }, + { + "type": "source", + "required": false + } + ] + }, + { + "name": "lambda_publishWizard", + "description": "Called when user completes the Lambda publish wizard", + "metadata": [ + { + "type": "duration", + "required": false + }, + { + "type": "result" + }, + { + "type": "serviceType", + "required": false + }, + { + "type": "source", + "required": false + } + ] + }, + { + "name": "lambda_updateFunctionCode", + "description": "Called when updating a Lambda function's code outside the context of a SAM template", + "metadata": [ + { + "type": "result" + }, + { + "type": "runtime", + "required": false + } + ] + }, + { + "name": "rds_createConnectionConfiguration", + "description": "Called when creating a new database connection configuration to for a RDS database. In Datagrip we do not get this infromation if it is created directly, so this is only counts actions.", + "metadata": [ + { + "type": "databaseCredentials" + }, + { + "type": "databaseEngine", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "rds_createSecurityGroup", + "description": "Create a RDS security group", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "rds_createSubnetGroup", + "description": "Create a RDS subnet group", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "rds_deleteInstance", + "description": "Delete a RDS DB instance", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "rds_deleteSecurityGroup", + "unit": "Count", + "description": "Delete RDS security group(s)", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "rds_deleteSubnetGroup", + "unit": "Count", + "description": "Delete RDS subnet group(s)", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "rds_getCredentials", + "description": "Called when getting IAM/SecretsManager credentials for a RDS database. Value represents how long it takes in ms.", + "unit": "Milliseconds", + "metadata": [ + { + "type": "databaseCredentials" + }, + { + "type": "databaseEngine" + }, + { + "type": "result" + } + ] + }, + { + "name": "rds_launchInstance", + "description": "Launch a RDS DB instance", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "rds_openInstances", + "description": "Open a window to view RDS DB Instances", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "rds_openSecurityGroups", + "description": "Open a window to view RDS Security Groups", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "rds_openSubnets", + "description": "Open a window to view RDS Subnet Groups", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "redshift_createConnectionConfiguration", + "description": "Called when creating a new database connection configuration to for a Redshift database. In Datagrip we do not get this infromation if it is created directly, so this only counts actions.", + "metadata": [ + { + "type": "databaseCredentials" + }, + { + "type": "result" + } + ] + }, + { + "name": "redshift_getCredentials", + "description": "Called when getting IAM/SecretsManager credentials for a Redshift database. Value represents how long it takes in ms.", + "unit": "Milliseconds", + "metadata": [ + { + "type": "databaseCredentials" + }, + { + "type": "result" + } + ] + }, + { + "name": "s3_copyBucketName", + "description": "Copy the bucket name to the clipboard" + }, + { + "name": "s3_copyPath", + "description": "Copy the path of a S3 object to the clipboard" + }, + { + "name": "s3_copyUri", + "description": "Copy the S3 URI of a S3 object to the clipboard (e.g. s3:///abc.txt)", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "s3_copyUrl", + "description": "Copy the URL of a S3 object to the clipboard", + "metadata": [ + { + "type": "presigned" + }, + { + "type": "result" + } + ] + }, + { + "name": "s3_createBucket", + "description": "Create a S3 bucket", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "s3_createFolder", + "description": "Create an S3 folder", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "s3_deleteBucket", + "description": "Delete a S3 bucket", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "s3_deleteObject", + "description": "Delete S3 object(s)", + "metadata": [ + { + "type": "failedCount", + "required": false + }, + { + "type": "result" + }, + { + "type": "successCount", + "required": false + } + ] + }, + { + "name": "s3_downloadObject", + "description": "Download S3 object(s)", + "metadata": [ + { + "type": "component", + "required": false + }, + { + "type": "failedCount", + "required": false + }, + { + "type": "result" + }, + { + "type": "successCount", + "required": false + } + ] + }, + { + "name": "s3_downloadObjects", + "description": "Download multiple S3 objects", + "unit": "Count", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "s3_editObject", + "description": "Edit or view one or more S3 objects in the IDE", + "unit": "Count", + "metadata": [ + { + "type": "component", + "required": false + }, + { + "type": "result" + } + ] + }, + { + "name": "s3_openBucketProperties", + "description": "Open a window to view S3 bucket properties", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "s3_openEditor", + "description": "Open a view of a S3 bucket", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "s3_openMultipartUpload", + "description": "Open a window to view S3 Multipart upload", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "s3_renameObject", + "description": "Rename a single S3 object", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "s3_uploadObject", + "description": "Upload S3 object(s)", + "metadata": [ + { + "type": "component", + "required": false + }, + { + "type": "failedCount", + "required": false + }, + { + "type": "result" + }, + { + "type": "successCount", + "required": false + } + ] + }, + { + "name": "s3_uploadObjects", + "description": "Upload multiple S3 objects", + "unit": "Count", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "sam_build", + "description": "Called when building a SAM application", + "metadata": [ + { + "type": "lambdaPackageType", + "required": false + }, + { + "type": "source", + "required": false + }, + { + "type": "version", + "required": false + } + ] + }, + { + "name": "sam_deploy", + "description": "Called when deploying a SAM application", + "metadata": [ + { + "type": "result" + }, + { + "type": "source", + "required": false + }, + { + "type": "version", + "required": false + } + ] + }, + { + "name": "sam_info", + "description": "Called when checking if the SAM executable on the local machine is valid with a valid version", + "passive": true, + "metadata": [ + { + "type": "reason", + "required": false + }, + { + "type": "result" + }, + { + "type": "version", + "required": false + } + ] + }, + { + "name": "sam_init", + "description": "Called when initing a SAM application", + "metadata": [ + { + "type": "eventBridgeSchema", + "required": false + }, + { + "type": "lambdaArchitecture", + "required": false + }, + { + "type": "lambdaPackageType", + "required": false + }, + { + "type": "reason", + "required": false + }, + { + "type": "result" + }, + { + "type": "runtime", + "required": false + }, + { + "type": "templateName", + "required": false + }, + { + "type": "version", + "required": false + } + ] + }, + { + "name": "sam_sync", + "description": "Called when syncing a SAM application", + "metadata": [ + { + "type": "lambdaPackageType", + "required": false + }, + { + "type": "reason", + "required": false + }, + { + "type": "result" + }, + { + "type": "source", + "required": false + }, + { + "type": "syncedResources" + }, + { + "type": "version", + "required": false + } + ] + }, + { + "name": "schemas_download", + "description": "Called when downloading an EventBridge schema", + "metadata": [ + { + "type": "result" + }, + { + "type": "schemaLanguage", + "required": false + } + ] + }, + { + "name": "schemas_search", + "description": "Called when searching an EventBridge schema registry", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "schemas_view", + "description": "Called when selecting an EventBridge schema to view", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "session_end", + "description": "Called when stopping the IDE on a best effort basis", + "passive": true + }, + { + "name": "session_start", + "description": "Called when starting the plugin", + "passive": true + }, + { + "name": "sns_createSubscription", + "description": "Create a SNS Subscription", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "sns_createTopic", + "description": "Create a SNS Topic", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "sns_deleteSubscription", + "description": "Called when user deletes SNS subscription(s)", + "unit": "Count", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "sns_deleteTopic", + "description": "Called when user deletes a SNS Topic", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "sns_openSubscriptions", + "description": "Open a window to view SNS Subscriptions", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "sns_openTopic", + "description": "Open a window to view details of SNS Topic", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "sns_publishMessage", + "description": "Publish message to a SNS topic", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "sqs_configureLambdaTrigger", + "description": "Configure the queue as a trigger for a Lambda", + "metadata": [ + { + "type": "result" + }, + { + "type": "sqsQueueType" + } + ] + }, + { + "name": "sqs_createQueue", + "description": "Create a new SQS queue", + "metadata": [ + { + "type": "result" + }, + { + "type": "sqsQueueType", + "required": false + } + ] + }, + { + "name": "sqs_deleteMessages", + "description": "Delete one or more messages from an SQS queue. Value indicates the number of messages that we tried to delete.", + "unit": "Count", + "metadata": [ + { + "type": "result" + }, + { + "type": "sqsQueueType" + } + ] + }, + { + "name": "sqs_deleteQueue", + "description": "Called when user deletes a SQS queue", + "metadata": [ + { + "type": "result" + }, + { + "type": "sqsQueueType", + "required": false + } + ] + }, + { + "name": "sqs_editQueueParameters", + "description": "Edit the Queue parameters", + "metadata": [ + { + "type": "result" + }, + { + "type": "sqsQueueType" + } + ] + }, + { + "name": "sqs_openQueue", + "description": "Open an SQS queue. Initially opens to either the send message pane or poll messages pane.", + "metadata": [ + { + "type": "sqsQueueType" + } + ] + }, + { + "name": "sqs_purgeQueue", + "description": "Purge all messages from the queue", + "metadata": [ + { + "type": "result" + }, + { + "type": "sqsQueueType" + } + ] + }, + { + "name": "sqs_sendMessage", + "description": "Send a message to an SQS queue", + "metadata": [ + { + "type": "result" + }, + { + "type": "sqsQueueType" + } + ] + }, + { + "name": "sqs_subscribeSns", + "description": "Subscribe the queue to messages from an sns topic", + "metadata": [ + { + "type": "result" + }, + { + "type": "sqsQueueType" + } + ] + }, + { + "name": "threatComposer_closed", + "description": "Called after closing a threat composer file", + "metadata": [ + { + "type": "id", + "required": true + } + ] + }, + { + "name": "threatComposer_created", + "description": "Called after a new threat composer file is created using command pallet or New File option", + "metadata": [ + { + "type": "id", + "required": true + } + ] + }, + { + "name": "threatComposer_error", + "description": "Called after an error is thrown from the threat composer view", + "metadata": [ + { + "type": "id", + "required": true + } + ] + }, + { + "name": "threatComposer_fileSaved", + "description": "Called after a threat composer file has been saved", + "metadata": [ + { + "type": "id", + "required": true + }, + { + "type": "saveType", + "required": true + } + ] + }, + { + "name": "threatComposer_opened", + "description": "Called after opening a threat composer file", + "metadata": [ + { + "type": "id", + "required": true + } + ] + }, + { + "name": "toolkit_closeModule", + "description": "The user closed 'something' (specified by 'module'). Examples: a view, feature, resource, ...", + "metadata": [ + { + "type": "module", + "required": true + } + ], + "passive": true + }, + { + "name": "toolkit_featureState", + "description": "Represents the current enabled state of a feature. Used to track user journey through a feature. Emitted after feature-specific operations of interest in the Toolkit.", + "metadata": [ + { + "type": "authStatus", + "required": false + }, + { + "type": "credentialSourceId", + "required": false + }, + { + "type": "enabled", + "required": true + }, + { + "type": "featureId", + "required": true + }, + { + "type": "source", + "required": true + } + ], + "passive": true + }, + { + "name": "toolkit_getExternalResource", + "description": "The toolkit tried to retrieve blob data from a url", + "metadata": [ + { + "type": "reason", + "required": false + }, + { + "type": "result", + "required": true + }, + { + "type": "url", + "required": true + } + ], + "passive": true + }, + { + "name": "toolkit_init", + "description": "The Toolkit has completed initialization", + "metadata": [ + { + "type": "duration", + "required": false + }, + { + "type": "result", + "required": false + } + ], + "passive": true + }, + { + "name": "toolkit_initModule", + "description": "The Toolkit has completed initialization for the specified module.", + "metadata": [ + { + "type": "attempts", + "required": false + }, + { + "type": "duration", + "required": false + }, + { + "type": "module", + "required": true + }, + { + "type": "result", + "required": true + }, + { + "type": "version", + "required": false + } + ], + "passive": true + }, + { + "name": "toolkit_invokeAction", + "description": "User invoked an action. `source` is the notification that produced the action", + "metadata": [ + { + "type": "action", + "required": true + }, + { + "type": "component", + "required": true + }, + { + "type": "id", + "required": true + }, + { + "type": "reason", + "required": false + }, + { + "type": "result", + "required": true + }, + { + "type": "source", + "required": true + } + ] + }, + { + "name": "toolkit_openModule", + "description": "The user opened 'something' (specified by 'module'). Examples: a view, feature, resource, ...", + "metadata": [ + { + "type": "module", + "required": true + }, + { + "type": "result", + "required": true + }, + { + "type": "source", + "required": true + } + ], + "passive": true + }, + { + "name": "toolkit_showAction", + "description": "The toolkit tried to show an action. Source represents the notification that produced the action", + "metadata": [ + { + "type": "component", + "required": true + }, + { + "type": "id", + "required": true + }, + { + "type": "reason", + "required": false + }, + { + "type": "result", + "required": true + }, + { + "type": "source", + "required": true + } + ], + "passive": true + }, + { + "name": "toolkit_showNotification", + "description": "The toolkit tried to show a notification message", + "metadata": [ + { + "type": "component", + "required": true + }, + { + "type": "id", + "required": true + }, + { + "type": "reason", + "required": false + }, + { + "type": "result", + "required": true + } + ], + "passive": true + }, + { + "name": "toolkit_viewLogs", + "description": "View logs for the toolkit" + }, + { + "name": "ui_click", + "description": "User clicked/activated a UI element. This does not necessarily have to be an explicit mouse click. Any user action that has the same behavior as a mouse click can use this event.", + "metadata": [ + { + "type": "elementId" + } + ] + }, + { + "name": "vpc_openACLs", + "description": "Open a window to view VPC Network ACLs", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "vpc_openGateways", + "description": "Open a window to view VPC Internet Gateway", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "vpc_openRouteTables", + "description": "Open a window to view VPC RouteTable", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "vpc_openSubnets", + "description": "Open a window to view VPC Subnets", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "vpc_openVPCs", + "description": "Open a window to view VPC details", + "metadata": [ + { + "type": "result" + } + ] + } + ] +} \ No newline at end of file diff --git a/plugin/codegen-resources/definitions/vscodeDefinitions.json b/plugin/codegen-resources/definitions/vscodeDefinitions.json new file mode 100644 index 00000000..ba9ca106 --- /dev/null +++ b/plugin/codegen-resources/definitions/vscodeDefinitions.json @@ -0,0 +1,239 @@ +{ + "types": [ + { + "name": "documentFormat", + "type": "string", + "allowedValues": ["JSON, YAML"], + "description": "SSM Create document format selection" + }, + { + "name": "ssmOperation", + "type": "string", + "allowedValues": ["Create", "Update"], + "description": "SSM Publish Document operation type" + }, + { + "name": "starterTemplate", + "type": "string", + "description": "Starter template chosen during create document" + }, + { + "name": "command", + "type": "string", + "description": "The id of a VS Code command" + }, + { + "name": "debounceCount", + "type": "int", + "description": "Number of times the telemetry event was debounced before emission" + } + ], + "metrics": [ + { + "name": "vscode_executeCommand", + "description": "Emitted whenever a registered Toolkit command is executed", + "passive": true, + "metadata": [ + { "type": "command" }, + { "type": "source" }, + { "type": "debounceCount" }, + { "type": "duration" }, + { "type": "result" }, + { + "type": "reason", + "required": false + } + ] + }, + { + "name": "aws_refreshCredentials", + "description": "Emitted when credentials are automatically refreshed by the AWS SDK", + "passive": true, + "metadata": [ + { + "type": "result" + }, + { + "type": "credentialType", + "required": false + }, + { + "type": "credentialSourceId", + "required": false + } + ] + }, + { + "name": "ssm_createDocument", + "description": "An SSM Document is created locally", + "unit": "None", + "metadata": [ + { + "type": "result" + }, + { + "type": "documentFormat", + "required": false + }, + { + "type": "starterTemplate", + "required": false + } + ] + }, + { + "name": "ssm_deleteDocument", + "description": "An SSM Document is deleted", + "unit": "None", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ssm_executeDocument", + "description": "An SSM Document is deleted", + "unit": "None", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ssm_openDocument", + "description": "An SSM Document is opened locally", + "unit": "None", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "ssm_publishDocument", + "description": "SSM Document related metrics for create and update", + "unit": "None", + "metadata": [ + { + "type": "result" + }, + { + "type": "ssmOperation" + } + ] + }, + { + "name": "ssm_updateDocumentVersion", + "description": "SSM Document related metrics for updating document default version", + "unit": "None", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "stepfunctions_createStateMachineFromTemplate", + "description": "" + }, + { + "name": "stepfunctions_downloadStateMachineDefinition", + "description": "", + "unit": "None", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "stepfunctions_executeStateMachine", + "description": "", + "unit": "None", + "metadata": [ + { + "type": "result" + } + ] + }, + { + "name": "stepfunctions_executeStateMachineView", + "description": "" + }, + { + "name": "stepfunctions_previewstatemachine", + "description": "" + }, + { + "name": "vscode_activeRegions", + "description": "Record the number of active regions at startup and when regions are added/removed", + "unit": "Count", + "passive": true + }, + { + "name": "vscode_viewLogs", + "description": "View the VSCode IDE logs" + }, + { + "name": "aws_showExplorerErrorDetails", + "description": "Called when getting more details about errors thrown by the explorer", + "metadata": [{ "type": "result" }] + }, + { + "name": "aws_showRegion", + "description": "Records a call to add a region to the explorer" + }, + { + "name": "aws_hideRegion", + "description": "Records a call to remove a region from the explorer" + }, + { + "name": "sam_detect", + "description": "Called when detecting the location of the SAM CLI", + "metadata": [{ "type": "result" }], + "passive": true + }, + { + "name": "cdk_explorerDisabled", + "description": "Called when expanding the CDK explorer is disabled" + }, + { + "name": "cdk_explorerEnabled", + "description": "Called when the CDK explorer is enabled" + }, + { + "name": "cdk_appExpanded", + "description": "Called when the CDK explorer is expanded" + }, + { + "name": "cdk_provideFeedback", + "description": "Called when providing feedback for CDK" + }, + { + "name": "cdk_help", + "description": "Called when clicking on help for CDK" + }, + { + "name": "cdk_refreshExplorer", + "description": "Called when refreshing the CDK explorer" + }, + { + "name": "sam_attachDebugger", + "description": "Called after trying to attach a debugger to a local sam invoke", + "metadata": [ + { "type": "result" }, + { "type": "lambdaPackageType" }, + { "type": "runtime" }, + { "type": "attempts" }, + { "type": "duration" }, + { "type": "lambdaArchitecture", "required": false } + ] + }, + { + "name": "sam_openConfigUi", + "description": "Called after opening the SAM Config UI" + } + ] +} diff --git a/plugin/codegen-resources/telemetrySchema.json b/plugin/codegen-resources/telemetrySchema.json new file mode 100644 index 00000000..227df134 --- /dev/null +++ b/plugin/codegen-resources/telemetrySchema.json @@ -0,0 +1,79 @@ +{ + "$id": "AWSToolkitTelemetry", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AWS Toolkit Telemetry", + "type": "object", + "properties": { + "types": { + "type": "array", + "description": "Metadata used by other calls", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the metadata type", + "pattern": "^(?!value|project|createTime).*" + }, + "type": { + "enum": ["int", "double", "string", "boolean"] + }, + "description": { + "type": "string" + }, + "allowedValues": { + "oneOf": [ + { "type": "array", "items": { "type": "number" } }, + { "type": "array", "items": { "type": "string" } } + ] + } + }, + "required": ["name", "description"] + } + }, + "metrics": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the metadata type", + "pattern": "^.*_.*$" + }, + "description": { + "type": "string" + }, + "unit": { + "enum": ["Milliseconds", "Bytes", "Percent", "Count", "None"] + }, + "metadata": { + "type": "array", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": ["type"] + } + }, + "passive": { + "type": "boolean", + "description": "Set as true if the metric is emitted without any explicit user action." + }, + "trackPerformance": { + "type": "boolean", + "description": "Set as true if the metric can track run-time performance information. Default=false" + } + }, + "required": ["name", "description"] + } + } + }, + "required": ["metrics"] +} diff --git a/plugin/pom.xml b/plugin/pom.xml index 9a688ca6..f49787c6 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -18,6 +18,7 @@ 2.25.33 v20.9.0 10.1.0 + 2.17.1 @@ -42,13 +43,6 @@ pom import - - com.fasterxml.jackson - jackson-bom - 2.17.1 - import - pom - @@ -61,11 +55,8 @@ com.fasterxml.jackson.core jackson-databind + ${jackson.version} - - com.fasterxml.jackson.core - jackson-core - org.apache.httpcomponents httpclient @@ -334,6 +325,19 @@ false + + software.aws.toolkits.eclipse + telemetry-generator + 1.0.0-SNAPSHOT + + + generate-sources + + generate-telemetry + + + + diff --git a/plugin/src/software/aws/toolkits/eclipse/amazonq/telemetry/MetricEventMetadata.java b/plugin/src/software/aws/toolkits/eclipse/amazonq/telemetry/MetricEventMetadata.java new file mode 100644 index 00000000..1b4b3304 --- /dev/null +++ b/plugin/src/software/aws/toolkits/eclipse/amazonq/telemetry/MetricEventMetadata.java @@ -0,0 +1,22 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.eclipse.amazonq.telemetry; + +import software.amazon.awssdk.services.toolkittelemetry.model.AWSProduct; + +public record MetricEventMetadata( + String awsAccount, + String awsRegion, + AWSProduct awsProduct, + String awsVersion +) { + public MetricEventMetadata() { + this( + null, + null, + AWSProduct.AMAZON_Q_FOR_ECLIPSE, + null + ); + } +} diff --git a/pom.xml b/pom.xml index 77718d4f..28a41a3c 100644 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,7 @@ plugin feature updatesite + telemetry @@ -36,6 +37,10 @@ + + com.fasterxml.jackson.core + jackson-databind + org.junit junit-bom diff --git a/telemetry/pom.xml b/telemetry/pom.xml new file mode 100644 index 00000000..96e95033 --- /dev/null +++ b/telemetry/pom.xml @@ -0,0 +1,79 @@ + + + 4.0.0 + + software.aws.toolkits.eclipse + amazon-q-eclipse-group + 1.0.0-SNAPSHOT + ../ + + + telemetry-generator + maven-plugin + + + 17 + + + + + com.squareup + javapoet + 1.13.0 + + + com.squareup + javapoet + 1.13.0 + + + com.github.erosb + everit-json-schema + 1.14.4 + + + org.apache.maven + maven-plugin-api + 3.8.2 + + + com.fasterxml.jackson.core + jackson-databind + 2.17.1 + + + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.6.4 + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + + org.apache.maven.plugins + maven-plugin-plugin + 3.14.0 + + telemetry-generator + + + + default-descriptor + + descriptor + + + + + + + \ No newline at end of file diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/ResourceLoader.java b/telemetry/src/software/aws/toolkits/telemetry/generator/ResourceLoader.java new file mode 100644 index 00000000..f36caaf4 --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/ResourceLoader.java @@ -0,0 +1,47 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; + +public final class ResourceLoader { + private static final String SCHEMA_PATH = "telemetrySchema.json"; + private static final String COMMON_DEFINITIONS = "definitions/commonDefinitions.json"; + + private final File basePath; + private final List definitionsFiles; + private final String schemaFile; + + public ResourceLoader(final File basePath) { + this.basePath = basePath; + this.definitionsFiles = new ArrayList<>(); + this.definitionsFiles.add(loadResource(COMMON_DEFINITIONS)); + this.schemaFile = loadResource(SCHEMA_PATH); + } + + private String loadResource(final String path) { + try (InputStream inputStream = new FileInputStream(new File(basePath, path)); + Scanner scanner = new Scanner(inputStream, StandardCharsets.UTF_8)) { + return scanner.useDelimiter("\\A").next(); + } catch (IOException e) { + System.err.println("Error while loading resources: " + e); + throw new RuntimeException(e); + } + } + + public List getDefinitionsFiles() { + return definitionsFiles; + } + + public String getSchemaFile() { + return schemaFile; + } +} \ No newline at end of file diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/TelemetryGenerator.java b/telemetry/src/software/aws/toolkits/telemetry/generator/TelemetryGenerator.java new file mode 100644 index 00000000..1cd2a078 --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/TelemetryGenerator.java @@ -0,0 +1,131 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator; + +import com.squareup.javapoet.AnnotationSpec; +import com.squareup.javapoet.ClassName; +import com.squareup.javapoet.MethodSpec; +import com.squareup.javapoet.TypeSpec; +import software.aws.toolkits.telemetry.generator.model.MetricSchema; +import software.aws.toolkits.telemetry.generator.model.TelemetryMetricType; +import software.aws.toolkits.telemetry.generator.model.TelemetrySchema; +import software.aws.toolkits.telemetry.generator.util.FileWriter; +import software.aws.toolkits.telemetry.generator.util.MetricDatumBuilder; +import software.aws.toolkits.telemetry.generator.util.ParsingUtils; + +import javax.lang.model.element.Modifier; +import java.io.File; +import java.io.IOException; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +public final class TelemetryGenerator { + + private static final String PACKAGE_NAME = "software.aws.toolkits.telemetry"; + + private TelemetryGenerator() { + // Prevent instantiation + } + + public static void generateTelemetry(final File inputDirectory, final File outputDirectory) throws IOException { + TelemetrySchema telemetry = TelemetryParser.parseFiles(inputDirectory); + outputDirectory.mkdirs(); + + TypeSpec.Builder telemetryDefinitions = TypeSpec.classBuilder("TelemetryDefinitions") + .addModifiers(Modifier.PUBLIC) + .addAnnotation(AnnotationSpec.builder(SuppressWarnings.class) + .addMember("value", "{$S, $S}", "unused", "MemberVisibilityCanBePrivate") + .build()); + + generateTelemetryDefinitions(telemetry.types(), telemetryDefinitions, outputDirectory); + generateTelemetryMetrics(telemetry.metrics(), outputDirectory); + + } + + private static void generateTelemetryDefinitions(final List types, final TypeSpec.Builder telemetryDefinitions, final File outputDirectory) { + for (TelemetryMetricType type : types) { + if (type.allowedValues() != null && !type.allowedValues().isEmpty()) { + generateTelemetryDefinition(type, telemetryDefinitions); + } + } + FileWriter.writeClassToFile(telemetryDefinitions.build(), outputDirectory, PACKAGE_NAME); + } + + private static void generateTelemetryDefinition(final TelemetryMetricType type, final TypeSpec.Builder telemetryDefinitions) { + String enumTypeName = ParsingUtils.toTypeFormat(type.name()); + TypeSpec.Builder enumBuilder = TypeSpec.enumBuilder(enumTypeName) + .addModifiers(Modifier.PUBLIC) + .addField(String.class, "value", Modifier.PRIVATE, Modifier.FINAL) + .addMethod(MethodSpec.constructorBuilder() + .addParameter(String.class, "value") + .addStatement("this.value = value") + .build()) + .addMethod(MethodSpec.methodBuilder("toString") + .addAnnotation(Override.class) + .addModifiers(Modifier.PUBLIC) + .returns(String.class) + .addStatement("return value") + .build()) + .addJavadoc(type.description()); + + for (Object enumValue : type.allowedValues()) { + String enumName = ParsingUtils.toEnumConstantFormat(enumValue.toString()); + enumBuilder.addEnumConstant(enumName, TypeSpec.anonymousClassBuilder("$S", enumValue.toString()).build()); + } + + enumBuilder.addEnumConstant("UNKNOWN", TypeSpec.anonymousClassBuilder("$S", "unknown").build()); + + enumBuilder.addMethod(MethodSpec.methodBuilder("from") + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns(ClassName.get("", enumTypeName)) + .addParameter(String.class, "type") + .addStatement("for ($L value : values()) { if (value.value.equals(type)) return value; }", enumTypeName) + .addStatement("return UNKNOWN") + .build()) + .build(); + + telemetryDefinitions.addType(enumBuilder.build()); + } + + private static void generateTelemetryMetrics(final List metrics, final File outputDirectory) { + metrics.stream() + .collect(Collectors.groupingBy(MetricSchema::getNamespace)) + .forEach((namespace, namespaceMetrics) -> generateNamespace(namespace, namespaceMetrics, outputDirectory)); + } + + private static void generateNamespace(final String namespace, final List metrics, final File outputDirectory) { + String namespaceClassName = ParsingUtils.toTypeFormat(namespace) + "Telemetry"; + TypeSpec.Builder namespaceBuilder = TypeSpec.classBuilder(namespaceClassName) + .addModifiers(Modifier.PUBLIC); + + metrics.stream() + .sorted(Comparator.comparing(MetricSchema::name)) + .forEach(metric -> generateMetricDatumBuilder(metric, namespaceBuilder)); + + FileWriter.writeClassToFile(namespaceBuilder.build(), outputDirectory, PACKAGE_NAME); + } + + private static void generateMetricDatumBuilder(final MetricSchema metric, final TypeSpec.Builder namespaceBuilder) { + String builderClassName = ParsingUtils.toTypeFormat(metric.name().split("_")[1]) + "EventBuilder"; + TypeSpec.Builder builderClassBuilder = MetricDatumBuilder.generateBuilder(metric, builderClassName); + namespaceBuilder.addType(builderClassBuilder.build()); + + MethodSpec.Builder factoryMethodBuilder = MethodSpec.methodBuilder(builderClassName.substring(0, builderClassName.length() - "Builder".length())) + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns(ClassName.get(namespaceBuilder.build().name, builderClassName)); + + factoryMethodBuilder.addCode("return new $T();\n", ClassName.get(namespaceBuilder.build().name, builderClassName)); + namespaceBuilder.addMethod(factoryMethodBuilder.build()); + } + + public static void main(String[] args) { + try { + TelemetryGenerator.generateTelemetry(new File("/Users/breedloj/workspace/amazon-q-eclipse/plugin/codegen-resources"), new File("/Users/breedloj/Desktop/telem")); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/TelemetryGeneratorMojo.java b/telemetry/src/software/aws/toolkits/telemetry/generator/TelemetryGeneratorMojo.java new file mode 100644 index 00000000..583586c8 --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/TelemetryGeneratorMojo.java @@ -0,0 +1,33 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + +import java.io.File; +import java.io.IOException; + +@Mojo(name = "generate-telemetry", defaultPhase = LifecyclePhase.GENERATE_SOURCES) +public class TelemetryGeneratorMojo extends AbstractMojo { + + @Parameter(defaultValue = "${project.basedir}/codegen-resources", property = "definitionsDirectory", required = true) + private File definitionsDirectory; + + @Parameter(defaultValue = "${project.build.directory}/generated-sources", property = "outputDirectory", required = true) + private File outputDirectory; + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + try { + TelemetryGenerator.generateTelemetry(definitionsDirectory, outputDirectory); + } catch (IOException e) { + throw new MojoExecutionException("Failed to generate telemetry classes", e); + } + } +} \ No newline at end of file diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/TelemetryParser.java b/telemetry/src/software/aws/toolkits/telemetry/generator/TelemetryParser.java new file mode 100644 index 00000000..b826001f --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/TelemetryParser.java @@ -0,0 +1,94 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import software.aws.toolkits.telemetry.generator.model.MetadataSchema; +import software.aws.toolkits.telemetry.generator.model.MetricSchema; +import software.aws.toolkits.telemetry.generator.model.TelemetryDefinition; +import software.aws.toolkits.telemetry.generator.model.TelemetryMetricType; +import software.aws.toolkits.telemetry.generator.model.TelemetrySchema; + +import org.everit.json.schema.Schema; +import org.everit.json.schema.loader.SchemaLoader; +import org.json.JSONObject; +import org.json.JSONTokener; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public final class TelemetryParser { + private static final ObjectMapper MAPPER = new ObjectMapper(); + + // prevent instantiation + private TelemetryParser() { } + + public static TelemetrySchema parseFiles(final File definitionsDirectory) { + ResourceLoader resourceLoader = new ResourceLoader(definitionsDirectory); + + List files = new ArrayList<>(); + files.addAll(resourceLoader.getDefinitionsFiles()); + + JSONObject rawSchema = new JSONObject(new JSONTokener(resourceLoader.getSchemaFile())); + Schema schema = SchemaLoader.load(rawSchema); + files.forEach(f -> validate(f, schema)); + + TelemetryDefinition telemetryDefinition = files.stream() + .map(TelemetryParser::parse) + .collect(Collectors.collectingAndThen( + Collectors.toList(), + defs -> new TelemetryDefinition( + defs.stream().flatMap(d -> d.types().stream()).distinct().collect(Collectors.toList()), + defs.stream().flatMap(d -> d.metrics().stream()).distinct().collect(Collectors.toList()) + ) + )); + + Map metadataTypes = telemetryDefinition.types().stream() + .collect(Collectors.toMap(TelemetryMetricType::name, t -> t)); + + List resolvedMetricTypes = telemetryDefinition.metrics().stream() + .map(m -> new MetricSchema( + m.name(), + m.description(), + m.unit(), + m.metadata().stream() + .map(md -> new MetadataSchema( + metadataTypes.get(md.type()), + md.required() + )) + .collect(Collectors.toList()), + m.passive() + )) + .collect(Collectors.toList()); + + return new TelemetrySchema( + telemetryDefinition.types(), + resolvedMetricTypes + ); + } + + private static void validate(final String fileContents, final Schema schema) { + try { + schema.validate(new JSONObject(fileContents)); + } catch (Exception e) { + System.err.println("Schema validation failed: " + e); + throw e; + } + } + + private static TelemetryDefinition parse(final String input) { + try { + return MAPPER.readValue(input, TelemetryDefinition.class); + } catch (IOException e) { + System.err.println("Error while parsing: " + e); + throw new RuntimeException(e); + } + } + +} diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetadataDefinition.java b/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetadataDefinition.java new file mode 100644 index 00000000..1da37a6b --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetadataDefinition.java @@ -0,0 +1,18 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public record MetadataDefinition(String type, Boolean required) { + @JsonCreator + public MetadataDefinition( + @JsonProperty("type") final String type, + @JsonProperty("required") final Boolean required + ) { + this.type = type; + this.required = required; + } +} diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetadataSchema.java b/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetadataSchema.java new file mode 100644 index 00000000..676486af --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetadataSchema.java @@ -0,0 +1,6 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator.model; + +public record MetadataSchema(TelemetryMetricType type, Boolean required) { } diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetricDefinition.java b/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetricDefinition.java new file mode 100644 index 00000000..030109ed --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetricDefinition.java @@ -0,0 +1,28 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator.model; + +import java.util.Collections; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public record MetricDefinition(String name, String description, MetricUnit unit, List metadata, + boolean passive) { + @JsonCreator + public MetricDefinition( + @JsonProperty("name") final String name, + @JsonProperty("description") final String description, + @JsonProperty("unit") final MetricUnit unit, + @JsonProperty("metadata") final List metadata, + @JsonProperty("passive") final boolean passive + ) { + this.name = name; + this.description = description; + this.unit = unit; + this.metadata = metadata != null ? metadata : Collections.emptyList(); + this.passive = passive; + } +} diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetricMetadataTypes.java b/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetricMetadataTypes.java new file mode 100644 index 00000000..dddfaf85 --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetricMetadataTypes.java @@ -0,0 +1,35 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator.model; + +import java.time.Instant; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.squareup.javapoet.TypeName; + +public final class MetricMetadataTypes { + @JsonValue + private final String type; + + private MetricMetadataTypes(final String type) { + this.type = type; + } + + public static final MetricMetadataTypes STRING = new MetricMetadataTypes("string"); + public static final MetricMetadataTypes INT = new MetricMetadataTypes("int"); + public static final MetricMetadataTypes DOUBLE = new MetricMetadataTypes("double"); + public static final MetricMetadataTypes BOOLEAN = new MetricMetadataTypes("boolean"); + public static final MetricMetadataTypes INSTANT = new MetricMetadataTypes("instant"); + + public TypeName javaType() { + return switch (this.type) { + case "string" -> TypeName.get(String.class); + case "int" -> TypeName.get(int.class); + case "double" -> TypeName.get(Double.class); + case "boolean" -> TypeName.get(boolean.class); + case "instant" -> TypeName.get(Instant.class); + default -> throw new IllegalArgumentException("Unsupported MetricMetadataTypes: " + this.type); + }; + } +} diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetricSchema.java b/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetricSchema.java new file mode 100644 index 00000000..a601b75e --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetricSchema.java @@ -0,0 +1,13 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator.model; + +import java.util.List; + +public record MetricSchema(String name, String description, MetricUnit unit, List metadata, + boolean passive) { + public String getNamespace() { + return name.split("_")[0].toLowerCase(); + } +} diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetricUnit.java b/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetricUnit.java new file mode 100644 index 00000000..ffdc963f --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/model/MetricUnit.java @@ -0,0 +1,36 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator.model; + +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MetricUnit { + @JsonValue + private final String type; + + private MetricUnit(final String type) { + this.type = type; + } + + public String getType() { + return this.type; + } + + public static final MetricUnit NONE = new MetricUnit("None"); + public static final MetricUnit MILLISECONDS = new MetricUnit("Milliseconds"); + public static final MetricUnit BYTES = new MetricUnit("Bytes"); + public static final MetricUnit PERCENT = new MetricUnit("Percent"); + public static final MetricUnit COUNT = new MetricUnit("Count"); + + public static MetricUnit fromString(final String type) { + return switch (type) { + case "None" -> NONE; + case "Milliseconds" -> MILLISECONDS; + case "Bytes" -> BYTES; + case "Percent" -> PERCENT; + case "Count" -> COUNT; + default -> throw new IllegalArgumentException("Invalid MetricUnit type: " + type); + }; + } +} diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/model/TelemetryDefinition.java b/telemetry/src/software/aws/toolkits/telemetry/generator/model/TelemetryDefinition.java new file mode 100644 index 00000000..ef0e1bb1 --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/model/TelemetryDefinition.java @@ -0,0 +1,20 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator.model; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public record TelemetryDefinition(List types, List metrics) { + @JsonCreator + public TelemetryDefinition( + @JsonProperty("types") final List types, + @JsonProperty("metrics") final List metrics + ) { + this.types = types; + this.metrics = metrics; + } +} diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/model/TelemetryMetricType.java b/telemetry/src/software/aws/toolkits/telemetry/generator/model/TelemetryMetricType.java new file mode 100644 index 00000000..849f2b71 --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/model/TelemetryMetricType.java @@ -0,0 +1,25 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator.model; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public record TelemetryMetricType(String name, String description, MetricMetadataTypes type, + List allowedValues) { + @JsonCreator + public TelemetryMetricType( + @JsonProperty("name") final String name, + @JsonProperty("description") final String description, + @JsonProperty("type") final MetricMetadataTypes type, + @JsonProperty("allowedValues") final List allowedValues + ) { + this.name = name; + this.description = description; + this.type = type; + this.allowedValues = allowedValues; + } +} diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/model/TelemetrySchema.java b/telemetry/src/software/aws/toolkits/telemetry/generator/model/TelemetrySchema.java new file mode 100644 index 00000000..95470bce --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/model/TelemetrySchema.java @@ -0,0 +1,9 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator.model; + +import java.util.List; + +public record TelemetrySchema(List types, List metrics) { } + diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/util/FileWriter.java b/telemetry/src/software/aws/toolkits/telemetry/generator/util/FileWriter.java new file mode 100644 index 00000000..1ac429eb --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/util/FileWriter.java @@ -0,0 +1,30 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator.util; + +import com.squareup.javapoet.JavaFile; +import com.squareup.javapoet.TypeSpec; + +import java.io.File; +import java.io.IOException; + +public final class FileWriter { + private FileWriter() { + // Prevent instantiation + } + + public static void writeClassToFile(final TypeSpec classSpec, final File outputFolder, final String packageName) { + try { + JavaFile.builder(packageName, classSpec) + .indent(" ") + .addFileComment("Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n") + .addFileComment("SPDX-License-Identifier: Apache-2.0\n") + .addFileComment("THIS FILE IS GENERATED! DO NOT EDIT BY HAND!") + .build() + .writeTo(outputFolder); + } catch (IOException e) { + throw new RuntimeException("Error writing class " + classSpec.name, e); + } + } +} \ No newline at end of file diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/util/MetricDatumBuilder.java b/telemetry/src/software/aws/toolkits/telemetry/generator/util/MetricDatumBuilder.java new file mode 100644 index 00000000..af15c50c --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/util/MetricDatumBuilder.java @@ -0,0 +1,96 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator.util; + +import com.squareup.javapoet.ClassName; +import com.squareup.javapoet.CodeBlock; +import com.squareup.javapoet.MethodSpec; +import com.squareup.javapoet.TypeName; +import com.squareup.javapoet.TypeSpec; + +import software.aws.toolkits.telemetry.generator.model.MetadataSchema; +import software.aws.toolkits.telemetry.generator.model.MetricMetadataTypes; +import software.aws.toolkits.telemetry.generator.model.MetricSchema; +import software.aws.toolkits.telemetry.generator.model.TelemetryMetricType; + +import java.util.ArrayList; +import java.util.List; +import javax.lang.model.element.Modifier; + +public final class MetricDatumBuilder { + private static final ClassName TELEMETRY_DEFINITIONS = ClassName.get("software.aws.toolkits.telemetry", "TelemetryDefinitions"); + private static final ClassName METRIC_DATUM = ClassName.get("software.amazon.awssdk.services.toolkittelemetry.model", "MetricDatum"); + private static final ClassName METADATA_ENTRY = ClassName.get("software.amazon.awssdk.services.toolkittelemetry.model", "MetadataEntry"); + private static final ClassName UNIT = ClassName.get("software.amazon.awssdk.services.toolkittelemetry.model", "Unit"); + + private MetricDatumBuilder() { + // Prevent instantiation + } + + public static TypeSpec.Builder generateBuilder(final MetricSchema metric, final String builderClassName) { + TypeSpec.Builder builderClassBuilder = TypeSpec.classBuilder(builderClassName) + .addModifiers(Modifier.PUBLIC, Modifier.STATIC); + + List metricMetadata = metric.metadata(); + metricMetadata.add(new MetadataSchema(new TelemetryMetricType("passive", "Indicates that the metric was not caused by an explicit user action.\n", + MetricMetadataTypes.BOOLEAN, null), true)); + metricMetadata.add(new MetadataSchema(new TelemetryMetricType("createTime", "The time that the event took place.", + MetricMetadataTypes.INSTANT, null), true)); + metricMetadata.add(new MetadataSchema(new TelemetryMetricType("value", "Value based on unit and call type.", MetricMetadataTypes.DOUBLE, null), true)); + + for (MetadataSchema metadata : metricMetadata) { + TypeName parameterType = getParameterType(metadata); + String parameterName = ParsingUtils.toArgumentFormat(metadata.type().name()); + builderClassBuilder.addField(parameterType, parameterName, Modifier.PRIVATE); + + MethodSpec.Builder builderMethodBuilder = MethodSpec.methodBuilder(parameterName) + .addModifiers(Modifier.PUBLIC) + .addJavadoc(metadata.type().description()) + .returns(ClassName.get("", builderClassName)) + .addParameter(parameterType, parameterName) + .addStatement("this.$1N = $1N", parameterName) + .addStatement("return this"); + + builderClassBuilder.addMethod(builderMethodBuilder.build()); + } + + MethodSpec.Builder constructorBuilder = MethodSpec.constructorBuilder() + .addModifiers(Modifier.PRIVATE); + builderClassBuilder.addMethod(constructorBuilder.build()); + + MethodSpec.Builder buildMethodBuilder = MethodSpec.methodBuilder("build") + .addModifiers(Modifier.PUBLIC) + .returns(METRIC_DATUM) + .addCode(generateBuildFunctionBody(metric)); + + builderClassBuilder.addMethod(buildMethodBuilder.build()); + + return builderClassBuilder; + } + + private static CodeBlock generateBuildFunctionBody(final MetricSchema metric) { + CodeBlock.Builder codeBlockBuilder = CodeBlock.builder(); + codeBlockBuilder.add("$T metadata = new $T<$T>();\n", ClassName.get(List.class), ClassName.get(ArrayList.class), METADATA_ENTRY); + for (MetadataSchema metadata : metric.metadata()) { + String metadataName = ParsingUtils.toArgumentFormat(metadata.type().name()); + codeBlockBuilder.add("metadata.add(MetadataEntry.builder().key($S).value(String.valueOf($L)).build());\n", metadataName, metadataName); + } + + codeBlockBuilder.add("\nreturn $T.builder()\n", METRIC_DATUM); + codeBlockBuilder.add(" .metricName($S)\n", metric.name()); + codeBlockBuilder.add(" .epochTimestamp((createTime != null ? createTime : Instant.now()).toEpochMilli())\n"); + codeBlockBuilder.add(" .unit($T.$L)\n", UNIT, metric.unit() != null ? metric.unit().getType().toUpperCase() : "NONE"); + codeBlockBuilder.add(" .value(value != null ? value : 1.0)\n"); + codeBlockBuilder.add(" .passive(passive)\n"); + codeBlockBuilder.add(" .metadata(metadata)\n"); + codeBlockBuilder.add(" .build();\n"); + return codeBlockBuilder.build(); + } + + private static TypeName getParameterType(final MetadataSchema metadata) { + return metadata.type().allowedValues() != null + ? ClassName.get(TELEMETRY_DEFINITIONS.canonicalName(), ParsingUtils.toTypeFormat(metadata.type().name())) + : metadata.type().type().javaType(); + } +} diff --git a/telemetry/src/software/aws/toolkits/telemetry/generator/util/ParsingUtils.java b/telemetry/src/software/aws/toolkits/telemetry/generator/util/ParsingUtils.java new file mode 100644 index 00000000..d4b8fdb6 --- /dev/null +++ b/telemetry/src/software/aws/toolkits/telemetry/generator/util/ParsingUtils.java @@ -0,0 +1,105 @@ +// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.telemetry.generator.util; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; + +/** + * Utility class for string manipulations. + */ +public final class ParsingUtils { + + // prevent instantiation + private ParsingUtils() { } + + /** + * Filters invalid characters (periods and spaces) from the input string. + * + * @param str the input string + * @return the filtered string + */ + public static String filterInvalidCharacters(final String str) { + return str.replace(".", "_").replace(" ", "_"); + } + + /** + * Converts the input string to an enum constant format (e.g., "dotnetcore2.1" -> "DOTNETCORE_2_1"). + * + * @param str the input string + * @return the enum constant format string + */ + public static String toEnumConstantFormat(final String str) { + StringBuilder sb = new StringBuilder(); + String[] words = splitWords(filterInvalidCharacters(str)); + for (int i = 0; i < words.length; i++) { + if (i > 0 && (isCapitalized(words[i]) || words[i].contains("-"))) { + sb.append("_"); + } + sb.append(words[i].toUpperCase().replace("-", "_")); + } + return StringUtils.replace(sb.toString(), "__", "_"); + } + + /** + * Converts the input string to a type format (e.g., "dotnetcore2.1" -> "DotnetCore21"). + * + * @param str the input string + * @return the type format string + */ + public static String toTypeFormat(final String str) { + StringBuilder sb = new StringBuilder(); + String[] words = splitWords(filterInvalidCharacters(str)); + for (String word : words) { + sb.append(capitalize(word)); + } + return sb.toString(); + } + + /** + * Converts the input string to an argument format (e.g., "DOTNETCORE_2_1" -> "dotnetcore2.1"). + * + * @param str the input string + * @return the argument format string + */ + public static String toArgumentFormat(final String str) { + StringBuilder sb = new StringBuilder(); + String[] words = splitWords(filterInvalidCharacters(str)); + for (int i = 0; i < words.length; i++) { + sb.append(i == 0 ? decapitalize(words[i]) : capitalize(words[i])); + } + return sb.toString(); + } + + private static String[] splitWords(final String str) { + String[] words = StringUtils.splitByCharacterTypeCamelCase(str); + List result = new ArrayList<>(); + for (String word : words) { + if (!word.isEmpty()) { + result.add(word); + } + } + return result.toArray(new String[0]); + } + + private static boolean isCapitalized(final String word) { + return !word.isEmpty() && Character.isUpperCase(word.charAt(0)); + } + + private static String capitalize(final String word) { + if (word.isEmpty()) { + return word; + } + return Character.toUpperCase(word.charAt(0)) + word.substring(1); + } + + private static String decapitalize(final String str) { + if (str.isEmpty()) { + return str; + } + return Character.toLowerCase(str.charAt(0)) + str.substring(1); + } +}