- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
ListWorkforcesCommand
Use this operation to list all private and vendor workforces in an Amazon Web Services Region. Note that you can only have one private workforce per Amazon Web Services Region.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { SageMakerClient, ListWorkforcesCommand } from "@aws-sdk/client-sagemaker"; // ES Modules import
// const { SageMakerClient, ListWorkforcesCommand } = require("@aws-sdk/client-sagemaker"); // CommonJS import
const client = new SageMakerClient(config);
const input = { // ListWorkforcesRequest
SortBy: "Name" || "CreateDate",
SortOrder: "Ascending" || "Descending",
NameContains: "STRING_VALUE",
NextToken: "STRING_VALUE",
MaxResults: Number("int"),
};
const command = new ListWorkforcesCommand(input);
const response = await client.send(command);
// { // ListWorkforcesResponse
// Workforces: [ // Workforces // required
// { // Workforce
// WorkforceName: "STRING_VALUE", // required
// WorkforceArn: "STRING_VALUE", // required
// LastUpdatedDate: new Date("TIMESTAMP"),
// SourceIpConfig: { // SourceIpConfig
// Cidrs: [ // Cidrs // required
// "STRING_VALUE",
// ],
// },
// SubDomain: "STRING_VALUE",
// CognitoConfig: { // CognitoConfig
// UserPool: "STRING_VALUE", // required
// ClientId: "STRING_VALUE", // required
// },
// OidcConfig: { // OidcConfigForResponse
// ClientId: "STRING_VALUE",
// Issuer: "STRING_VALUE",
// AuthorizationEndpoint: "STRING_VALUE",
// TokenEndpoint: "STRING_VALUE",
// UserInfoEndpoint: "STRING_VALUE",
// LogoutEndpoint: "STRING_VALUE",
// JwksUri: "STRING_VALUE",
// Scope: "STRING_VALUE",
// AuthenticationRequestExtraParams: { // AuthenticationRequestExtraParams
// "<keys>": "STRING_VALUE",
// },
// },
// CreateDate: new Date("TIMESTAMP"),
// WorkforceVpcConfig: { // WorkforceVpcConfigResponse
// VpcId: "STRING_VALUE", // required
// SecurityGroupIds: [ // WorkforceSecurityGroupIds // required
// "STRING_VALUE",
// ],
// Subnets: [ // WorkforceSubnets // required
// "STRING_VALUE",
// ],
// VpcEndpointId: "STRING_VALUE",
// },
// Status: "Initializing" || "Updating" || "Deleting" || "Failed" || "Active",
// FailureReason: "STRING_VALUE",
// },
// ],
// NextToken: "STRING_VALUE",
// };
ListWorkforcesCommand Input
See ListWorkforcesCommandInput for more details
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
MaxResults | number | undefined | The maximum number of workforces returned in the response. |
NameContains | string | undefined | A filter you can use to search for workforces using part of the workforce name. |
NextToken | string | undefined | A token to resume pagination. |
SortBy | ListWorkforcesSortByOptions | undefined | Sort workforces using the workforce name or creation date. |
SortOrder | SortOrder | undefined | Sort workforces in ascending or descending order. |
ListWorkforcesCommand Output
See ListWorkforcesCommandOutput for details
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
Workforces Required | Workforce[] | undefined | A list containing information about your workforce. |
NextToken | string | undefined | A token to resume pagination. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
SageMakerServiceException | Base exception class for all service exceptions from SageMaker service. |