Giter VIP home page Giter VIP logo

Comments (2)

aajtodd avatar aajtodd commented on June 17, 2024

The Glacier docs say this about account ID:

The AccountId value is the AWS account ID of the account that owns the vault. You can either specify an AWS account ID or optionally a single '-' (hyphen), in which case Amazon S3 Glacier uses the AWS account ID associated with the credentials used to sign the request. If you use an account ID, do not include any hyphens ('-') in the ID.

Examples from Go V2 SDK:

This basically involves:

  1. Detect all operations that have an accountid member (case insensitive match)
  2. Register a middleware to default the account ID parameter to - if null (conditionally registered based on if the operation has an account id)

e.g.

suspend fun someOperationThatShouldGetDefaulted(input: RequestType): ResponseType {
    val op = ...
    
    op.execution.initialize.intercept { req, next -> 
        if (req.subject.accountId != null) return next(req)
        return next(req.subject.copy(accountId = "-"))
    }
}

This could be implemented either inline as shown or encapsulated in a re-usable middleware (see Go V2 links for inspiration). Although if implemented inline we don't really need a middleware, it could mutate the input before calling return op.roundTrip(client, input) (it was shown inline to demonstrate the concept).

ALTERNATIVES

  • Alternatively we could handle this in a few other spots including during serialization or as the default for the generated structure but it's probably easier to implement the middleware since no hooks exist for customizing the other locations.

estimate 1 wk - implementing the middleware + tests and registration via KotlinIntegration. The integration interface does not yet support conditional or per/operation registration but could be easily added.

from aws-sdk-kotlin.

aajtodd avatar aajtodd commented on June 17, 2024

We should be able to implement this as a custom trait instead. Or possibly even just an integration that overrides the SymbolProvider.

e.g.

class GlacierAccountIdDefault : KotlinIntegration {
    fun decorateSymbolProvider(...): SymbolProvider = GlacierSymbolProvider
}

private class GlacierSymbolProvider : KotlinSymbolProvider {
    override fun structureShape(shape: StructureShape): Symbol {
        // check for `accountId` members, set the default in the property bag if present
    }
}

from aws-sdk-kotlin.

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.