Skip to content

Commit

Permalink
Add S3 copy launch configuration and update S3ClientFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed Feb 12, 2024
1 parent ed242f8 commit 72d9c46
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,4 @@ src/global.json

build/
package-lock.json
src/Stars.Data.Tests/Resources/BKA/L1C/data/4089411-0220-PAN-C-1-1-1139831-160712T150120-BR
38 changes: 38 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,44 @@
// },
"enableStepFiltering": false
},
{
"name": "Copy S3 from CDS",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/Stars.Console/bin/Debug/net6.0/Stars.dll",
"args": [
"copy",
"-v",
"-k",
"-r",
"4",
"-nohtml",
"-si",
"CDS",
"--output",
"/tmp/stars",
"https://catalogue.dataspace.copernicus.eu/stac/collections/SENTINEL-3/items/S3B_SL_1_RBT____20240207T082602_20240207T082902_20240207T092904_0179_089_221_0540_PS2_O_NR_004.SEN3"
],
"cwd": "${workspaceFolder}/src",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false,
"logging": {
"moduleLoad": false
},
"justMyCode": false,
"requireExactSource": false,
// "symbolOptions": {
// // "searchPaths": [
// // "/data/workspace/Others/aws-sdk-net/sdk/src"
// // ],
// "searchMicrosoftSymbolServer": true,
// "searchNuGetOrgSymbolServer": true
// },
"enableStepFiltering": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
],
"omnisharp.disableMSBuildDiagnosticWarning": true,
"dotnet-test-explorer.testProjectPath": "**/*Tests.@(csproj|vbproj|fsproj)",
"jira-plugin.workingProject": "DATAAUTHOR",
"jira-plugin.workingProject": "",
"dotnet.defaultSolution": "src/Terradue.Stars.sln"
}
1 change: 1 addition & 0 deletions src/Stars.Services/Resources/AmazonCustomS3Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ internal void ForceCustomRegion(string region)
internal void SetServiceURL(string serviceURL)
{
_serviceURL = serviceURL;
this.ServiceURL = _serviceURL;
}
}
}
7 changes: 2 additions & 5 deletions src/Stars.Services/Resources/S3ClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,8 @@ private static AmazonCustomS3Config CreateS3Configuration(AWSOptions options)
{
config.RegionEndpoint = options.Region;
}
else
{
config.SetServiceURL(defaultConfig.ServiceURL);
}
}
config.SetServiceURL(defaultConfig.ServiceURL);

return config;
}
Expand All @@ -380,7 +377,7 @@ public async Task<AWSCredentials> GetWebIdentityCredentialsAsync(string serviceU
var assumeRoleResult = await stsClient.AssumeRoleWithWebIdentityAsync(new AssumeRoleWithWebIdentityRequest
{
WebIdentityToken = jwt.RawData,
RoleArn = "arn:aws:iam::123456789012:role/RoleForTerradue",
// RoleArn = "arn:aws:iam::123456789012:role/RoleForTerradue",
RoleSessionName = "MySession",
DurationSeconds = 3600,
Policy = policy
Expand Down
2 changes: 2 additions & 0 deletions src/Stars.Services/Resources/S3Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public S3Options()
Policies = new S3OptionsPolicies();
}

public List<string> DomainsWithNoCertificateVerification { get; set; } = new List<string>();

public Dictionary<string, S3Configuration> Services { get; set; }

public S3OptionsPolicies Policies { get; set; }
Expand Down
2 changes: 0 additions & 2 deletions src/Stars.Tests/S3OptionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ public async Task NamedS3ClientAsync()
s3Client = s3ClientFactory.CreateS3Client(s3url);
Assert.NotNull(s3Client);
Assert.Equal("fr-par", s3Client.Config.AuthenticationRegion);
// the serviceUrl will be null as the new Custom config will use the DetermineServiceURL method
Assert.Equal(null, s3Client.Config.ServiceURL);
}

}
Expand Down

0 comments on commit 72d9c46

Please sign in to comment.