Skip to content

Commit

Permalink
feat(client-sagemaker-featurestore-runtime): In this release, you can…
Browse files Browse the repository at this point in the history
… now chose between soft delete and hard delete when calling the DeleteRecord API, so you have more flexibility when it comes to managing online store data.
  • Loading branch information
awstools committed Mar 31, 2023
1 parent a9dc788 commit 6037599
Show file tree
Hide file tree
Showing 10 changed files with 676 additions and 245 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,32 @@ export class SageMakerFeatureStoreRuntime extends SageMakerFeatureStoreRuntimeCl

/**
* @public
* <p>Deletes a <code>Record</code> from a <code>FeatureGroup</code>. When the <code>DeleteRecord</code> API is called a new record will be added to the <code>OfflineStore</code> and the <code>Record</code> will be removed from the <code>OnlineStore</code>. This
* record will have a value of <code>True</code> in the <code>is_deleted</code> column.</p>
* <p>Deletes a <code>Record</code> from a <code>FeatureGroup</code> in the
* <code>OnlineStore</code>. Feature Store supports both <code>SOFT_DELETE</code> and
* <code>HARD_DELETE</code>. For <code>SOFT_DELETE</code> (default), feature columns are
* set to <code>null</code> and the record is no longer retrievable by <code>GetRecord</code>
* or <code>BatchGetRecord</code>. For<code> HARD_DELETE</code>, the complete
* <code>Record</code> is removed from the <code>OnlineStore</code>. In both cases, Feature
* Store appends the deleted record marker to the <code>OfflineStore</code> with feature
* values set to <code>null</code>, <code>is_deleted</code> value set to <code>True</code>,
* and <code>EventTime</code> set to the delete input <code>EventTime</code>.</p>
* <p>Note that the <code>EventTime</code> specified in <code>DeleteRecord</code> should be
* set later than the <code>EventTime</code> of the existing record in the
* <code>OnlineStore</code> for that <code>RecordIdentifer</code>. If it is not, the
* deletion does not occur:</p>
* <ul>
* <li>
* <p>For <code>SOFT_DELETE</code>, the existing (undeleted) record remains in the
* <code>OnlineStore</code>, though the delete record marker is still written to the
* <code>OfflineStore</code>.</p>
* </li>
* <li>
* <p>
* <code>HARD_DELETE</code> returns <code>EventTime</code>: <code>400
* ValidationException</code> to indicate that the delete operation failed. No delete
* record marker is written to the <code>OfflineStore</code>.</p>
* </li>
* </ul>
*/
public deleteRecord(
args: DeleteRecordCommandInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export interface BatchGetRecordCommandOutput extends BatchGetRecordResponse, __M
* <p>You do not have permission to perform an action.</p>
*
* @throws {@link InternalFailure} (server fault)
* <p>An internal failure occurred. Try your request again. If the problem
* persists, contact Amazon Web Services customer support.</p>
* <p>An internal failure occurred. Try your request again. If the problem persists, contact
* Amazon Web Services customer support.</p>
*
* @throws {@link ServiceUnavailable} (server fault)
* <p>The service is currently unavailable.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,32 @@ export interface DeleteRecordCommandOutput extends __MetadataBearer {}

/**
* @public
* <p>Deletes a <code>Record</code> from a <code>FeatureGroup</code>. When the <code>DeleteRecord</code> API is called a new record will be added to the <code>OfflineStore</code> and the <code>Record</code> will be removed from the <code>OnlineStore</code>. This
* record will have a value of <code>True</code> in the <code>is_deleted</code> column.</p>
* <p>Deletes a <code>Record</code> from a <code>FeatureGroup</code> in the
* <code>OnlineStore</code>. Feature Store supports both <code>SOFT_DELETE</code> and
* <code>HARD_DELETE</code>. For <code>SOFT_DELETE</code> (default), feature columns are
* set to <code>null</code> and the record is no longer retrievable by <code>GetRecord</code>
* or <code>BatchGetRecord</code>. For<code> HARD_DELETE</code>, the complete
* <code>Record</code> is removed from the <code>OnlineStore</code>. In both cases, Feature
* Store appends the deleted record marker to the <code>OfflineStore</code> with feature
* values set to <code>null</code>, <code>is_deleted</code> value set to <code>True</code>,
* and <code>EventTime</code> set to the delete input <code>EventTime</code>.</p>
* <p>Note that the <code>EventTime</code> specified in <code>DeleteRecord</code> should be
* set later than the <code>EventTime</code> of the existing record in the
* <code>OnlineStore</code> for that <code>RecordIdentifer</code>. If it is not, the
* deletion does not occur:</p>
* <ul>
* <li>
* <p>For <code>SOFT_DELETE</code>, the existing (undeleted) record remains in the
* <code>OnlineStore</code>, though the delete record marker is still written to the
* <code>OfflineStore</code>.</p>
* </li>
* <li>
* <p>
* <code>HARD_DELETE</code> returns <code>EventTime</code>: <code>400
* ValidationException</code> to indicate that the delete operation failed. No delete
* record marker is written to the <code>OfflineStore</code>.</p>
* </li>
* </ul>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand All @@ -54,6 +78,7 @@ export interface DeleteRecordCommandOutput extends __MetadataBearer {}
* TargetStores: [ // TargetStores
* "OnlineStore" || "OfflineStore",
* ],
* DeletionMode: "SoftDelete" || "HardDelete",
* };
* const command = new DeleteRecordCommand(input);
* const response = await client.send(command);
Expand All @@ -69,8 +94,8 @@ export interface DeleteRecordCommandOutput extends __MetadataBearer {}
* <p>You do not have permission to perform an action.</p>
*
* @throws {@link InternalFailure} (server fault)
* <p>An internal failure occurred. Try your request again. If the problem
* persists, contact Amazon Web Services customer support.</p>
* <p>An internal failure occurred. Try your request again. If the problem persists, contact
* Amazon Web Services customer support.</p>
*
* @throws {@link ServiceUnavailable} (server fault)
* <p>The service is currently unavailable.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export interface GetRecordCommandOutput extends GetRecordResponse, __MetadataBea
* <p>You do not have permission to perform an action.</p>
*
* @throws {@link InternalFailure} (server fault)
* <p>An internal failure occurred. Try your request again. If the problem
* persists, contact Amazon Web Services customer support.</p>
* <p>An internal failure occurred. Try your request again. If the problem persists, contact
* Amazon Web Services customer support.</p>
*
* @throws {@link ResourceNotFound} (client fault)
* <p>A resource that is required to perform an action was not found.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export interface PutRecordCommandOutput extends __MetadataBearer {}
* <p>You do not have permission to perform an action.</p>
*
* @throws {@link InternalFailure} (server fault)
* <p>An internal failure occurred. Try your request again. If the problem
* persists, contact Amazon Web Services customer support.</p>
* <p>An internal failure occurred. Try your request again. If the problem persists, contact
* Amazon Web Services customer support.</p>
*
* @throws {@link ServiceUnavailable} (server fault)
* <p>The service is currently unavailable.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const resolveClientEndpointParameters = <T>(
};

export interface EndpointParameters extends __EndpointParameters {
Region: string;
Region?: string;
UseDualStack?: boolean;
UseFIPS?: boolean;
Endpoint?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ import { RuleSetObject } from "@aws-sdk/util-endpoints";
or see "smithy.rules#endpointRuleSet"
in codegen/sdk-codegen/aws-models/sagemaker-featurestore-runtime.json */

const r="fn",
const q="required",
r="fn",
s="argv",
t="ref";
const a=true,
b=false,
c="String",
d="PartitionResult",
e="tree",
f="error",
g="endpoint",
h={"required":true,"default":false,"type":"Boolean"},
i={[t]:"Endpoint"},
j={[r]:"booleanEquals",[s]:[{[t]:"UseFIPS"},true]},
k={[r]:"booleanEquals",[s]:[{[t]:"UseDualStack"},true]},
l={},
m={[r]:"booleanEquals",[s]:[true,{[r]:"getAttr",[s]:[{[t]:d},"supportsFIPS"]}]},
n={[r]:"booleanEquals",[s]:[true,{[r]:"getAttr",[s]:[{[t]:d},"supportsDualStack"]}]},
o=[i],
p=[j],
q=[k];
const _data={version:"1.0",parameters:{Region:{required:a,type:c},UseDualStack:h,UseFIPS:h,Endpoint:{required:b,type:c}},rules:[{conditions:[{[r]:"aws.partition",[s]:[{[t]:"Region"}],assign:d}],type:e,rules:[{conditions:[{[r]:"isSet",[s]:o},{[r]:"parseURL",[s]:o,assign:"url"}],type:e,rules:[{conditions:p,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:f},{type:e,rules:[{conditions:q,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:f},{endpoint:{url:i,properties:l,headers:l},type:g}]}]},{conditions:[j,k],type:e,rules:[{conditions:[m,n],type:e,rules:[{endpoint:{url:"https://featurestore-runtime.sagemaker-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:l,headers:l},type:g}]},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:f}]},{conditions:p,type:e,rules:[{conditions:[m],type:e,rules:[{endpoint:{url:"https://featurestore-runtime.sagemaker-fips.{Region}.{PartitionResult#dnsSuffix}",properties:l,headers:l},type:g}]},{error:"FIPS is enabled but this partition does not support FIPS",type:f}]},{conditions:q,type:e,rules:[{conditions:[n],type:e,rules:[{endpoint:{url:"https://featurestore-runtime.sagemaker.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:l,headers:l},type:g}]},{error:"DualStack is enabled but this partition does not support DualStack",type:f}]},{endpoint:{url:"https://featurestore-runtime.sagemaker.{Region}.{PartitionResult#dnsSuffix}",properties:l,headers:l},type:g}]}]};
const a="isSet",
b="tree",
c="error",
d="endpoint",
e="PartitionResult",
f={[q]:false,"type":"String"},
g={[q]:true,"default":false,"type":"Boolean"},
h={[t]:"Endpoint"},
i={[r]:"booleanEquals",[s]:[{[t]:"UseFIPS"},true]},
j={[r]:"booleanEquals",[s]:[{[t]:"UseDualStack"},true]},
k={},
l={[r]:"booleanEquals",[s]:[true,{[r]:"getAttr",[s]:[{[t]:e},"supportsFIPS"]}]},
m={[r]:"booleanEquals",[s]:[true,{[r]:"getAttr",[s]:[{[t]:e},"supportsDualStack"]}]},
n=[i],
o=[j],
p=[{[t]:"Region"}];
const _data={version:"1.0",parameters:{Region:f,UseDualStack:g,UseFIPS:g,Endpoint:f},rules:[{conditions:[{[r]:a,[s]:[h]}],type:b,rules:[{conditions:n,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:c},{type:b,rules:[{conditions:o,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:c},{endpoint:{url:h,properties:k,headers:k},type:d}]}]},{type:b,rules:[{conditions:[{[r]:a,[s]:p}],type:b,rules:[{conditions:[{[r]:"aws.partition",[s]:p,assign:e}],type:b,rules:[{conditions:[i,j],type:b,rules:[{conditions:[l,m],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://featurestore-runtime.sagemaker-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:c}]},{conditions:n,type:b,rules:[{conditions:[l],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://featurestore-runtime.sagemaker-fips.{Region}.{PartitionResult#dnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"FIPS is enabled but this partition does not support FIPS",type:c}]},{conditions:o,type:b,rules:[{conditions:[m],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://featurestore-runtime.sagemaker.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"DualStack is enabled but this partition does not support DualStack",type:c}]},{type:b,rules:[{endpoint:{url:"https://featurestore-runtime.sagemaker.{Region}.{PartitionResult#dnsSuffix}",properties:k,headers:k},type:d}]}]}]},{error:"Invalid Configuration: Missing Region",type:c}]}]};
export const ruleSet: RuleSetObject = _data;
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export class AccessForbidden extends __BaseException {

/**
* @public
* <p>The identifier that identifies the batch of Records you are retrieving in a batch.</p>
* <p>The identifier that identifies the batch of Records you are retrieving in a
* batch.</p>
*/
export interface BatchGetRecordIdentifier {
/**
Expand All @@ -52,8 +53,9 @@ export interface BatchGetRecordIdentifier {
*/
export interface BatchGetRecordRequest {
/**
* <p>A list of <code>FeatureGroup</code> names, with their corresponding <code>RecordIdentifier</code> value, and Feature name
* that have been requested to be retrieved in batch.</p>
* <p>A list of <code>FeatureGroup</code> names, with their corresponding
* <code>RecordIdentifier</code> value, and Feature name that have been requested to be
* retrieved in batch.</p>
*/
Identifiers: BatchGetRecordIdentifier[] | undefined;
}
Expand All @@ -69,19 +71,21 @@ export interface BatchGetRecordError {
FeatureGroupName: string | undefined;

/**
* <p>The value for the <code>RecordIdentifier</code> in string format of a Record from a <code>FeatureGroup</code> that is causing
* an error when attempting to be retrieved.</p>
* <p>The value for the <code>RecordIdentifier</code> in string format of a Record from a
* <code>FeatureGroup</code> that is causing an error when attempting to be
* retrieved.</p>
*/
RecordIdentifierValueAsString: string | undefined;

/**
* <p>The error code of an error that has occured when attempting to retrieve a batch of
* <p>The error code of an error that has occurred when attempting to retrieve a batch of
* Records. For more information on errors, see <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_feature_store_GetRecord.html#API_feature_store_GetRecord_Errors">Errors</a>.</p>
*/
ErrorCode: string | undefined;

/**
* <p>The error message of an error that has occured when attempting to retrieve a record in the batch.</p>
* <p>The error message of an error that has occurred when attempting to retrieve a record in
* the batch.</p>
*/
ErrorMessage: string | undefined;
}
Expand Down Expand Up @@ -114,7 +118,7 @@ export interface BatchGetRecordResultDetail {
FeatureGroupName: string | undefined;

/**
* <p>The value of the record identifer in string format.</p>
* <p>The value of the record identifier in string format.</p>
*/
RecordIdentifierValueAsString: string | undefined;

Expand All @@ -139,16 +143,16 @@ export interface BatchGetRecordResponse {
Errors: BatchGetRecordError[] | undefined;

/**
* <p>A unprocessed list of <code>FeatureGroup</code> names, with their corresponding <code>RecordIdentifier</code> value,
* and Feature name.</p>
* <p>A unprocessed list of <code>FeatureGroup</code> names, with their corresponding
* <code>RecordIdentifier</code> value, and Feature name.</p>
*/
UnprocessedIdentifiers: BatchGetRecordIdentifier[] | undefined;
}

/**
* @public
* <p>An internal failure occurred. Try your request again. If the problem
* persists, contact Amazon Web Services customer support.</p>
* <p>An internal failure occurred. Try your request again. If the problem persists, contact
* Amazon Web Services customer support.</p>
*/
export class InternalFailure extends __BaseException {
readonly name: "InternalFailure" = "InternalFailure";
Expand Down Expand Up @@ -212,6 +216,20 @@ export class ValidationError extends __BaseException {
}
}

/**
* @public
* @enum
*/
export const DeletionMode = {
HARD_DELETE: "HardDelete",
SOFT_DELETE: "SoftDelete",
} as const;

/**
* @public
*/
export type DeletionMode = (typeof DeletionMode)[keyof typeof DeletionMode];

/**
* @public
* @enum
Expand Down Expand Up @@ -248,9 +266,17 @@ export interface DeleteRecordRequest {
EventTime: string | undefined;

/**
* <p>A list of stores from which you're deleting the record. By default, Feature Store deletes the record from all of the stores that you're using for the <code>FeatureGroup</code>.</p>
* <p>A list of stores from which you're deleting the record. By default, Feature Store
* deletes the record from all of the stores that you're using for the
* <code>FeatureGroup</code>.</p>
*/
TargetStores?: (TargetStore | string)[];

/**
* <p>The name of the deletion mode for deleting the record. By default, the deletion mode is
* set to <code>SoftDelete</code>.</p>
*/
DeletionMode?: DeletionMode | string;
}

/**
Expand Down Expand Up @@ -334,7 +360,8 @@ export interface PutRecordRequest {
Record: FeatureValue[] | undefined;

/**
* <p>A list of stores to which you're adding the record. By default, Feature Store adds the record to all of the stores that you're using for the <code>FeatureGroup</code>.</p>
* <p>A list of stores to which you're adding the record. By default, Feature Store adds the
* record to all of the stores that you're using for the <code>FeatureGroup</code>.</p>
*/
TargetStores?: (TargetStore | string)[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const serializeAws_restJson1DeleteRecordCommand = async (
() => input.TargetStores !== void 0,
() => (input.TargetStores! || []).map((_entry) => _entry as any),
],
DeletionMode: [, input.DeletionMode!],
});
let body: any;
return new __HttpRequest({
Expand Down
Loading

0 comments on commit 6037599

Please sign in to comment.