Giter Club home page Giter Club logo

Comments (1)

brycahta avatar brycahta commented on June 19, 2024

Does userdata need to be registered, in this function?

No, per my comment on your PR: #171 (comment)

what does this function do exactly? Is it actually needed?

Yup it's needed. It associates a path with handler during startup depending on which subcommand is used to start AEMM. For example, if users use events subcommand, aemm events <args>, then IMDS paths (and handlers) involving spot should not be available-- that logic is handled in getHandlerPairs.

Addressing this specific block:

	handlerPairs := []handlerPair{
		{path: "/", handler: handlers.ListRoutesHandler},
		{path: "/latest", handler: handlers.ListRoutesHandler},
		{path: static.ServicePath, handler: handlers.ListRoutesHandler},
		{path: dynamic.ServicePath, handler: handlers.ListRoutesHandler},
	}

handlerPairs is saying each of these paths have a List Handler, which is a handler that lists available routes for a given path. userdata does NOT have a List Handler because userdata has no routes itself just the userdata value. Ex:

  • /latest needs to register a List Handler because hitting this path should list the following routes:

    • dynamic
    • meta-data
    • user-data
  • /latest/dynamic needs to register a List Handler because hitting this path should list the following routes:

    • fws/instance-monitoring
    • instance-identity/document
    • instance-identity/pkcs7
    • instance-identity/signature
  • /latest/user-data does not have a List Handler because hitting this path will return user-data value:

    • MTIzNCxqb2huLHJlYm9vdCx0cnVlCg==

from amazon-ec2-metadata-mock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.