Giter Site home page Giter Site logo

Comments (7)

lasred avatar lasred commented on May 29, 2024

There are not any generic templates or code to rotate secrets in the .net language. You could follow the general guidelines and overview of the rotation lambda here - https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets-lambda-function-overview.html and follow the existing Python template to write the .NET version.

Is there fundamental something about the existing python lambda rotation lambdas that does not fit your usecase? I prefer for you to write a customized python rotation lambda based off the python template and not start from scratch in dotnet.

from aws-secrets-manager-rotation-lambdas.

Manoj-Chakladar avatar Manoj-Chakladar commented on May 29, 2024

Thank you @lasred i will try what you said and will get back.

from aws-secrets-manager-rotation-lambdas.

Manoj-Chakladar avatar Manoj-Chakladar commented on May 29, 2024

Hi Everyone,
I am using the below snippet code which consist DescribeSecret method but i am facing an error due to protection level. I am using DescribeSecret to get all the secret values excluding the encrypted one. I have defined the configuration but i am not putting it below in the code snippet. Kindly help me with this.
code:
var client = new AmazonSecretsManagerClient(smConfig);

        //Make sure the version is staged correctly
       
        
        var response = client.DescribeSecret(new DescribeSecretRequest
        {
            SecretId = secretName
        });

        string arn = response.ARN;
        string description = response.Description;
        string kmsKeyId = response.KmsKeyId;
        DateTime lastAccessedDate = response.LastAccessedDate;
        DateTime lastChangedDate = response.LastChangedDate;
        DateTime lastRotatedDate = response.LastRotatedDate;
        string name = response.Name;
        bool rotationEnabled = response.RotationEnabled;
        string rotationLambdaARN = response.RotationLambdaARN;
        RotationRulesType rotationRules = response.RotationRules;

Error I am facing is in this line var response = client.DescribeSecret(new DescribeSecretRequest.
Error:
'AmazonSecretsManagerClient.DescribeSecret(DescribeSecretRequest)' is inaccessible due to its protection level.

from aws-secrets-manager-rotation-lambdas.

lasred avatar lasred commented on May 29, 2024

I was able to reproduce this error.

Can you try calling DescribeSecretAsync instead? - https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/SecretsManager/MSecretsManagerDescribeSecretAsyncDescribeSecretRequestCancellationToken.html ?

DescribeSecret should work as well according to our documentation - https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/SecretsManager/TSecretsManagerClient.html

And in the dotnet aws sdk, both methods are defined as public - https://github.com/aws/aws-sdk-net/blob/189abfb1d51c5300e68c741c536f4144d5f2c4fd/sdk/src/Services/SecretsManager/Generated/_bcl45/AmazonSecretsManagerClient.cs. DescribeSecret is defined on line 975. DescribeSecretAsync on line 1373.

Let me investigate this further as well(why DescribeSecret is inaccessible). Let me know if DescribeSecretAsync unblocks you/works on your end.

from aws-secrets-manager-rotation-lambdas.

Manoj-Chakladar avatar Manoj-Chakladar commented on May 29, 2024

image
I am using DescribeSecretAsync but as you see in the image it does not have the below variables as response which i require.

from aws-secrets-manager-rotation-lambdas.

lasred avatar lasred commented on May 29, 2024

Is it just an issue with your IDE-Visual Studio I'am guessing? Can you build this project?

ARN should be a property of DescribeSecretResponse - See https://github.com/aws/aws-sdk-net/blob/9d60d369808c68967ea42e0119c0815f6654142e/sdk/src/Services/SecretsManager/Generated/Model/DescribeSecretResponse.cs

from aws-secrets-manager-rotation-lambdas.

lasred avatar lasred commented on May 29, 2024

For your initial question(building the rotation lambdas in dotnet), have a look at this as well - #19

from aws-secrets-manager-rotation-lambdas.

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.