Update tenant creation credentials JSON (#1559)

This commit is contained in:
jinapurapu
2022-02-16 13:52:38 -08:00
committed by GitHub
parent 24cf6a3ada
commit f8c397e231
13 changed files with 47 additions and 6 deletions

View File

@@ -39,6 +39,9 @@ type ServiceAccountCreds struct {
// secret key
SecretKey string `json:"secretKey,omitempty"`
// url
URL string `json:"url,omitempty"`
}
// Validate validates this service account creds

View File

@@ -39,6 +39,9 @@ type TenantResponseItem struct {
// secret key
SecretKey string `json:"secret_key,omitempty"`
// url
URL string `json:"url,omitempty"`
}
// Validate validates this tenant response item

View File

@@ -3478,6 +3478,9 @@ func init() {
},
"secret_key": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
@@ -7741,6 +7744,9 @@ func init() {
},
"secret_key": {
"type": "string"
},
"url": {
"type": "string"
}
}
},

View File

@@ -1453,11 +1453,18 @@ func getTenantCreatedResponse(session *models.Principal, params operator_api.Cre
response = &models.CreateTenantResponse{
ExternalIDP: tenantExternalIDPConfigured,
}
thisClient := &operatorClient{
client: opClient,
}
minTenant, err := getTenant(ctx, thisClient, ns, tenantName)
if tenantReq.Idp != nil && !tenantExternalIDPConfigured {
for _, credential := range tenantReq.Idp.Keys {
response.Console = append(response.Console, &models.TenantResponseItem{
AccessKey: *credential.AccessKey,
SecretKey: *credential.SecretKey,
URL: GetTenantServiceURL(minTenant),
})
}
}

View File

@@ -135,6 +135,7 @@ const Account = ({ classes, displayErrorMessage }: IServiceAccountsProps) => {
console: {
accessKey: `${res.accessKey}`,
secretKey: `${res.secretKey}`,
url: `${res.url}`,
},
};
setNewServiceAccount(nsa);

View File

@@ -90,7 +90,6 @@ const download = (filename: string, text: string) => {
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
};
@@ -104,7 +103,6 @@ const CredentialsPrompt = ({
if (!newServiceAccount) {
return null;
}
const consoleCreds = get(newServiceAccount, "console", null);
const idp = get(newServiceAccount, "idp", false);
@@ -196,16 +194,22 @@ const CredentialsPrompt = ({
consoleExtras = {
console: [
{
url : consoleCreds.url,
access_key: consoleCreds.accessKey,
secret_key: consoleCreds.secretKey,
api: "s3v4",
path: "auto",
},
],
};
} else {
const cCreds = consoleCreds.map((itemMap) => {
return {
url: itemMap.url,
access_key: itemMap.accessKey,
secret_key: itemMap.secretKey,
api: "s3v4",
path: "auto",
};
});

View File

@@ -19,9 +19,11 @@ export interface NewServiceAccount {
console?: ConsoleSA | ConsoleSA[];
accessKey?: string;
secretKey?: string;
url?: string;
}
export interface ConsoleSA {
accessKey: string;
secretKey: string;
url: string;
}

View File

@@ -652,6 +652,9 @@ const AddTenant = ({
return {
accessKey: consoleKey.access_key,
secretKey: consoleKey.secret_key,
api: "s3v4",
path: "auto",
url: consoleKey.url,
};
});
@@ -661,6 +664,7 @@ const AddTenant = ({
console: {
accessKey: res.console.access_key,
secretKey: res.console.secret_key,
url: res.console.url,
},
};
}

View File

@@ -108,10 +108,11 @@ const UserServiceAccountsPanel = ({
fetchRecords();
if (res !== null) {
const nsa: NewServiceAccount = {
const nsa: NewServiceAccount = {
console: {
accessKey: `${res.accessKey}`,
secretKey: `${res.secretKey}`,
url : `${res.url}`,
},
};
setNewServiceAccount(nsa);

View File

@@ -5741,6 +5741,9 @@ func init() {
},
"secretKey": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
@@ -11582,6 +11585,9 @@ func init() {
},
"secretKey": {
"type": "string"
},
"url": {
"type": "string"
}
}
},

View File

@@ -134,7 +134,7 @@ func createServiceAccount(ctx context.Context, userClient MinioAdmin, policy str
if err != nil {
return nil, err
}
return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey}, nil
return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey, URL: getMinIOServer()}, nil
}
// createServiceAccount adds a service account with the given credentials to the userClient and assigns a policy to him if defined.
@@ -196,7 +196,7 @@ func createAUserServiceAccount(ctx context.Context, userClient MinioAdmin, polic
if err != nil {
return nil, err
}
return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey}, nil
return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey, URL: getMinIOServer()}, nil
}
func createAUserServiceAccountCreds(ctx context.Context, userClient MinioAdmin, policy string, user string, accessKey string, secretKey string) (*models.ServiceAccountCreds, error) {

View File

@@ -3745,6 +3745,8 @@ definitions:
type: string
secretKey:
type: string
url:
type: string
remoteBucket:
type: object
required:

View File

@@ -1868,7 +1868,9 @@ definitions:
type: string
secret_key:
type: string
url:
type: string
tenantPod:
type: object
required: