Skip to content

Commit 5d1b36f

Browse files
committed
Organization ID and Deployment configuration
1 parent 264ca66 commit 5d1b36f

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

plugins/axiom/personal_access_token.go

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,38 @@ func PersonalAccessToken() schema.CredentialType {
2828
},
2929
},
3030
},
31+
{
32+
Name: fieldname.Organization,
33+
MarkdownDescription: "The organization ID of the organization the access token is valid for. Only valid for Axiom Cloud.",
34+
Secret: false,
35+
Composition: &schema.ValueComposition{
36+
Charset: schema.Charset{
37+
Lowercase: true,
38+
Digits: true,
39+
Specific: []rune{'-'},
40+
},
41+
},
42+
},
43+
{
44+
Name: fieldname.Deployment,
45+
MarkdownDescription: "Deployment to use.",
46+
Secret: false,
47+
Optional: true,
48+
Composition: &schema.ValueComposition{
49+
Charset: schema.Charset{
50+
Lowercase: true,
51+
Digits: true,
52+
},
53+
},
54+
},
3155
},
3256
DefaultProvisioner: provision.EnvVars(defaultEnvVarMapping),
3357
Importer: importer.TryEnvVarPair(defaultEnvVarMapping),
3458
}
3559
}
3660

3761
var defaultEnvVarMapping = map[string]sdk.FieldName{
38-
"AXIOM_TOKEN": fieldname.Token,
62+
"AXIOM_TOKEN": fieldname.Token,
63+
"AXIOM_ORG_ID": fieldname.Organization,
64+
"AXIOM_DEPLOYMENT": fieldname.Deployment,
3965
}

plugins/axiom/personal_access_token_test.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ func TestPersonalAccessTokenProvisioner(t *testing.T) {
1212
plugintest.TestProvisioner(t, PersonalAccessToken().DefaultProvisioner, map[string]plugintest.ProvisionCase{
1313
"default": {
1414
ItemFields: map[sdk.FieldName]string{
15-
fieldname.Token: "xapt-wovexreez0qf7zvkn935na41cudk2example",
15+
fieldname.Token: "xapt-wovexreez0qf7zvkn935na41cudk2example",
16+
fieldname.Organization: "example",
17+
fieldname.Deployment: "cloud",
1618
},
1719
ExpectedOutput: sdk.ProvisionOutput{
1820
Environment: map[string]string{
19-
"AXIOM_TOKEN": "xapt-wovexreez0qf7zvkn935na41cudk2example",
21+
"AXIOM_TOKEN": "xapt-wovexreez0qf7zvkn935na41cudk2example",
22+
"AXIOM_ORG_ID": "example",
23+
"AXIOM_DEPLOYMENT": "cloud",
2024
},
2125
},
2226
},
@@ -27,12 +31,16 @@ func TestPersonalAccessTokenImporter(t *testing.T) {
2731
plugintest.TestImporter(t, PersonalAccessToken().Importer, map[string]plugintest.ImportCase{
2832
"environment": {
2933
Environment: map[string]string{
30-
"AXIOM_TOKEN": "xapt-wovexreez0qf7zvkn935na41cudk2example",
34+
"AXIOM_TOKEN": "xapt-wovexreez0qf7zvkn935na41cudk2example",
35+
"AXIOM_ORG_ID": "example",
36+
"AXIOM_DEPLOYMENT": "cloud",
3137
},
3238
ExpectedCandidates: []sdk.ImportCandidate{
3339
{
3440
Fields: map[sdk.FieldName]string{
35-
fieldname.Token: "xapt-wovexreez0qf7zvkn935na41cudk2example",
41+
fieldname.Token: "xapt-wovexreez0qf7zvkn935na41cudk2example",
42+
fieldname.Organization: "example",
43+
fieldname.Deployment: "cloud",
3644
},
3745
},
3846
},

sdk/schema/fieldname/names.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const (
2727
Credentials = sdk.FieldName("Credentials")
2828
Database = sdk.FieldName("Database")
2929
DefaultRegion = sdk.FieldName("Default Region")
30+
Deployment = sdk.FieldName("Deployment")
3031
Email = sdk.FieldName("Email")
3132
Endpoint = sdk.FieldName("Endpoint")
3233
Host = sdk.FieldName("Host")
@@ -78,6 +79,7 @@ func ListAll() []sdk.FieldName {
7879
Credentials,
7980
Database,
8081
DefaultRegion,
82+
Deployment,
8183
Endpoint,
8284
Host,
8385
HostAddress,

0 commit comments

Comments
 (0)