private Amazon.APIGateway.Model.UpdateIntegrationResponseResponse CallAWSServiceOperation(IAmazonAPIGateway client, Amazon.APIGateway.Model.UpdateIntegrationResponseRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon API Gateway", "UpdateIntegrationResponse");
     try
     {
         #if DESKTOP
         return(client.UpdateIntegrationResponse(request));
         #elif CORECLR
         return(client.UpdateIntegrationResponseAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            Client = CreateClient(_CurrentCredentials, _RegionEndpoint);
        }
Пример #3
0
 internal GetUsagePlansPaginator(IAmazonAPIGateway client, GetUsagePlansRequest request)
 {
     this._client  = client;
     this._request = request;
 }
Пример #4
0
        protected Func <Task <Settings> > CreateSettingsInitializer(
            CommandLineApplication cmd,
            bool requireAwsProfile = true
            )
        {
            CommandOption awsProfileOption = null;
            CommandOption awsRegionOption  = null;

            // add misc options
            var tierOption = cmd.Option("--tier|-T <NAME>", "(optional) Name of deployment tier (default: LAMBDASHARP_TIER environment variable)", CommandOptionType.SingleValue);

            if (requireAwsProfile)
            {
                awsProfileOption = cmd.Option("--aws-profile|-P <NAME>", "(optional) Use a specific AWS profile from the AWS credentials file", CommandOptionType.SingleValue);
                awsRegionOption  = cmd.Option("--aws-region <NAME>", "(optional) Use a specific AWS region (default: read from AWS profile)", CommandOptionType.SingleValue);
            }

            // add hidden testing options
            var awsAccountIdOption         = cmd.Option("--aws-account-id <VALUE>", "(test only) Override AWS account Id (default: read from AWS profile)", CommandOptionType.SingleValue);
            var awsUserArnOption           = cmd.Option("--aws-user-arn <ARN>", "(test only) Override AWS user ARN (default: read from AWS profile)", CommandOptionType.SingleValue);
            var toolVersionOption          = cmd.Option("--cli-version <VALUE>", "(test only) LambdaSharp CLI version for profile", CommandOptionType.SingleValue);
            var deploymentBucketNameOption = cmd.Option("--deployment-bucket-name <NAME>", "(test only) S3 Bucket name used to deploy modules (default: read from LambdaSharp CLI configuration)", CommandOptionType.SingleValue);
            var tierVersionOption          = cmd.Option("--tier-version <VERSION>", "(test only) LambdaSharp tier version (default: read from deployment tier)", CommandOptionType.SingleValue);
            var promptsAsErrorsOption      = cmd.Option("--prompts-as-errors", "(optional) Missing parameters cause an error instead of a prompts (use for CI/CD to avoid unattended prompts)", CommandOptionType.NoValue);

            awsAccountIdOption.ShowInHelpText         = false;
            awsUserArnOption.ShowInHelpText           = false;
            toolVersionOption.ShowInHelpText          = false;
            deploymentBucketNameOption.ShowInHelpText = false;
            tierVersionOption.ShowInHelpText          = false;
            return(async() => {
                // check if experimental caching feature is enabled
                Settings.AllowCaching = string.Equals((Environment.GetEnvironmentVariable("LAMBDASHARP_FEATURE_CACHING") ?? "false"), "true", StringComparison.OrdinalIgnoreCase);

                // initialize deployment tier
                string tier = tierOption.Value() ?? Environment.GetEnvironmentVariable("LAMBDASHARP_TIER") ?? "";

                // initialize AWS profile
                try {
                    AwsAccountInfo awsAccount = null;
                    IAmazonSimpleSystemsManagement ssmClient = null;
                    IAmazonCloudFormation cfnClient = null;
                    IAmazonKeyManagementService kmsClient = null;
                    IAmazonS3 s3Client = null;
                    IAmazonAPIGateway apiGatewayClient = null;
                    IAmazonIdentityManagementService iamClient = null;
                    IAmazonLambda lambdaClient = null;
                    if (requireAwsProfile)
                    {
                        awsAccount = await InitializeAwsProfile(
                            awsProfileOption.Value(),
                            awsAccountIdOption.Value(),
                            awsRegionOption.Value(),
                            awsUserArnOption.Value()
                            );

                        if (awsAccount == null)
                        {
                            return null;
                        }

                        // create AWS clients
                        ssmClient = new AmazonSimpleSystemsManagementClient(AWSConfigs.RegionEndpoint);
                        cfnClient = new AmazonCloudFormationClient(AWSConfigs.RegionEndpoint);
                        kmsClient = new AmazonKeyManagementServiceClient(AWSConfigs.RegionEndpoint);
                        s3Client = new AmazonS3Client(AWSConfigs.RegionEndpoint);
                        apiGatewayClient = new AmazonAPIGatewayClient(AWSConfigs.RegionEndpoint);
                        iamClient = new AmazonIdentityManagementServiceClient(AWSConfigs.RegionEndpoint);
                        lambdaClient = new AmazonLambdaClient(AWSConfigs.RegionEndpoint);
                    }
                    if (HasErrors)
                    {
                        return null;
                    }

                    // initialize LambdaSharp deployment values
                    var tierVersion = tierVersionOption.Value();
                    var deploymentBucketName = deploymentBucketNameOption.Value();

                    // initialize LambdaSharp testing values
                    VersionInfo toolVersion = null;
                    if (toolVersionOption.HasValue())
                    {
                        toolVersion = VersionInfo.Parse(toolVersionOption.Value());
                    }

                    // create a settings instance for each module filename
                    return new Settings(toolVersion ?? Version)
                    {
                        TierVersion = (tierVersion != null) ? VersionInfo.Parse(tierVersion) : null,
                        Tier = tier,
                        AwsRegion = awsAccount?.Region,
                        AwsAccountId = awsAccount?.AccountId,
                        AwsUserArn = awsAccount?.UserArn,
                        DeploymentBucketName = deploymentBucketName,
                        SsmClient = ssmClient,
                        CfnClient = cfnClient,
                        KmsClient = kmsClient,
                        S3Client = s3Client,
                        ApiGatewayClient = apiGatewayClient,
                        IamClient = iamClient,
                        LambdaClient = lambdaClient,
                        PromptsAsErrors = promptsAsErrorsOption.HasValue()
                    };
                } catch (AmazonClientException e) when(e.Message == "No RegionEndpoint or ServiceURL configured")
                {
                    LogError("AWS profile is missing a region specifier");
                    return null;
                }
            });
        }
 internal GetBasePathMappingsPaginator(IAmazonAPIGateway client, GetBasePathMappingsRequest request)
 {
     this._client  = client;
     this._request = request;
 }
Пример #6
0
 internal GetModelsPaginator(IAmazonAPIGateway client, GetModelsRequest request)
 {
     this._client  = client;
     this._request = request;
 }
 internal GetDeploymentsPaginator(IAmazonAPIGateway client, GetDeploymentsRequest request)
 {
     this._client  = client;
     this._request = request;
 }
Пример #8
0
 internal GetDomainNamesPaginator(IAmazonAPIGateway client, GetDomainNamesRequest request)
 {
     this._client  = client;
     this._request = request;
 }
Пример #9
0
 internal APIGatewayPaginatorFactory(IAmazonAPIGateway client)
 {
     this.client = client;
 }
 internal GetClientCertificatesPaginator(IAmazonAPIGateway client, GetClientCertificatesRequest request)
 {
     this._client  = client;
     this._request = request;
 }