Skip to content

Commit

Permalink
devonfw#13: implement aws toolcommandlet
Browse files Browse the repository at this point in the history
  • Loading branch information
MattesMrzik committed Oct 27, 2023
1 parent fd02c60 commit 4d07265
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.property.KeywordProperty;
import com.devonfw.tools.ide.property.Property;
import com.devonfw.tools.ide.tool.aws.Aws;
import com.devonfw.tools.ide.tool.az.Azure;
import com.devonfw.tools.ide.tool.eclipse.Eclipse;
import com.devonfw.tools.ide.tool.gh.Gh;
Expand Down Expand Up @@ -72,6 +73,7 @@ private CommandletManagerImpl(IdeContext context) {
add(new KotlincNative(context));
add(new Vscode(context));
add(new Azure(context));
add(new Aws(context));
}

private void add(Commandlet commandlet) {
Expand Down
43 changes: 43 additions & 0 deletions cli/src/main/java/com/devonfw/tools/ide/tool/aws/Aws.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.devonfw.tools.ide.tool.aws;

import java.nio.file.Path;
import java.util.Set;

import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.environment.EnvironmentVariables;
import com.devonfw.tools.ide.environment.EnvironmentVariablesType;
import com.devonfw.tools.ide.tool.ToolCommandlet;

/**
* {@link ToolCommandlet} for AWS CLI (aws).
*/

public class Aws extends ToolCommandlet {

/**
* The constructor.
*
* @param context the {@link IdeContext}.
*/
public Aws(IdeContext context) {

super(context, "aws", Set.of(TAG_CLOUD));
}

@Override
public void postInstall() {

super.postInstall();

EnvironmentVariables variables = this.context.getVariables();
EnvironmentVariables typeVariables = variables.getByType(EnvironmentVariablesType.CONF);

Path awsConfigDir = this.context.getConfPath().resolve("aws");
this.context.getFileAccess().mkdirs(awsConfigDir);
Path awsConfigFile = awsConfigDir.resolve("config");
Path awsCredentialsFile = awsConfigDir.resolve("credentials");
typeVariables.set("AWS_CONFIG_FILE", awsConfigFile.toString(), true);
typeVariables.set("AWS_SHARED_CREDENTIALS_FILE", awsCredentialsFile.toString(), true);
typeVariables.save();
}
}
1 change: 1 addition & 0 deletions cli/src/main/resources/nls/Ide.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ usage=Usage:
values=Values:
commandlets=Available commandlets:
options=Options:
cmd-aws=Tool commandlet for AWS CLI.
cmd-az=Tool commandlet for Azure CLI.
cmd-env=Print the environment variables to set and export.
cmd-get-version=Get the version of the selected tool.
Expand Down
1 change: 1 addition & 0 deletions cli/src/main/resources/nls/Ide_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ usage=Verwendung:
values=Werte:
commandlets=Verfügbare Kommandos:
options=Optionen:
cmd-aws=Werkzeug Kommando fuer AWS Kommandoschnittstelle.
cmd-az=Werkzeug Kommando fuer Azure Kommandoschnittstelle.
cmd-env=Gibt die zu setztenden und exportierenden Umgebungsvariablen aus.
cmd-get-version=Zeigt die Version des selektierten Werkzeugs an.
Expand Down

0 comments on commit 4d07265

Please sign in to comment.