An API client for Amazon Fraud Detector. To construct a client, you need to configure a :region
and :credentials
.
frauddetector = Aws::FraudDetector::Client.new(
region: region_name,
credentials: credentials,
)
See #initialize for a full list of supported configuration options.
RegionYou can configure a default region in the following locations:
ENV['AWS_REGION']
Aws.config[:region]
Go here for a list of supported regions.
CredentialsDefault credentials are loaded automatically from the following locations:
ENV['AWS_ACCESS_KEY_ID']
and ENV['AWS_SECRET_ACCESS_KEY']
Aws.config[:credentials]
~/.aws/credentials
(more information)You can also construct a credentials object from one of the following classes:
Alternatively, you configure credentials with :access_key_id
and :secret_access_key
:
creds = YAML.load(File.read('/path/to/secrets'))
Aws::FraudDetector::Client.new(
access_key_id: creds['access_key_id'],
secret_access_key: creds['secret_access_key']
)
Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.
Instance Method Details #create_model(options = {}) ⇒ StructCreates a model using the specified model type.
#create_variable(options = {}) ⇒ Struct #delete_detector(options = {}) ⇒ StructDeletes the detector. Before deleting a detector, you must first delete all detector versions and rule versions associated with the detector.
When you delete a detector, Amazon Fraud Detector permanently deletes the detector and the data is no longer stored in Amazon Fraud Detector.
#delete_detector_version(options = {}) ⇒ StructDeletes the detector version. You cannot delete detector versions that are in ACTIVE
status.
When you delete a detector version, Amazon Fraud Detector permanently deletes the detector and the data is no longer stored in Amazon Fraud Detector.
#delete_entity_type(options = {}) ⇒ StructDeletes an entity type.
You cannot delete an entity type that is included in an event type.
When you delete an entity type, Amazon Fraud Detector permanently deletes that entity type from the evaluation history, and the data is no longer stored in Amazon Fraud Detector.
#delete_event(options = {}) ⇒ StructDeletes the specified event.
When you delete an event, Amazon Fraud Detector permanently deletes that event from the evaluation history, and the event data is no longer stored in Amazon Fraud Detector.
#delete_event_type(options = {}) ⇒ StructDeletes an event type.
You cannot delete an event type that is used in a detector or a model.
When you delete an entity type, Amazon Fraud Detector permanently deletes that entity type from the evaluation history, and the data is no longer stored in Amazon Fraud Detector.
#delete_external_model(options = {}) ⇒ StructRemoves a SageMaker model from Amazon Fraud Detector.
You can remove an Amazon SageMaker model if it is not associated with a detector version. Removing a SageMaker model disconnects it from Amazon Fraud Detector, but the model remains available in SageMaker.
#delete_label(options = {}) ⇒ StructDeletes a label.
You cannot delete labels that are included in an event type in Amazon Fraud Detector.
You cannot delete a label assigned to an event ID. You must first delete the relevant event ID.
When you delete a label, Amazon Fraud Detector permanently deletes that label from the evaluation history, and the data is no longer stored in Amazon Fraud Detector.
#delete_model(options = {}) ⇒ StructDeletes a model.
You can delete models and model versions in Amazon Fraud Detector, provided that they are not associated with a detector version.
When you delete a model, Amazon Fraud Detector permanently deletes that model from the evaluation history, and the data is no longer stored in Amazon Fraud Detector.
#delete_model_version(options = {}) ⇒ StructDeletes a model version.
You can delete models and model versions in Amazon Fraud Detector, provided that they are not associated with a detector version.
When you delete a model version, Amazon Fraud Detector permanently deletes that model version from the evaluation history, and the data is no longer stored in Amazon Fraud Detector.
#delete_outcome(options = {}) ⇒ StructDeletes an outcome.
You cannot delete an outcome that is used in a rule version.
When you delete an outcome, Amazon Fraud Detector permanently deletes that outcome from the evaluation history, and the data is no longer stored in Amazon Fraud Detector.
#delete_rule(options = {}) ⇒ StructDeletes the rule. You cannot delete a rule if it is used by an ACTIVE
or INACTIVE
detector version.
When you delete a rule, Amazon Fraud Detector permanently deletes that rule from the evaluation history, and the data is no longer stored in Amazon Fraud Detector.
#delete_variable(options = {}) ⇒ StructDeletes a variable.
You can't delete variables that are included in an event type in Amazon Fraud Detector.
Amazon Fraud Detector automatically deletes model output variables and SageMaker model output variables when you delete the model. You can't delete these variables manually.
When you delete a variable, Amazon Fraud Detector permanently deletes that variable from the evaluation history, and the data is no longer stored in Amazon Fraud Detector.
#describe_model_versions(options = {}) ⇒ Types::DescribeModelVersionsResultGets all of the model versions for the specified model type or for the specified model type and model ID. You can also get details for a single, specified model version.
#get_detectors(options = {}) ⇒ Types::GetDetectorsResultGets all detectors or a single detector if a detectorId
is specified. This is a paginated API. If you provide a null maxResults
, this action retrieves a maximum of 10 records per page. If you provide a maxResults
, the value must be between 5 and 10. To get the next page results, provide the pagination token from the GetDetectorsResponse
as part of your request. A null pagination token fetches the records from the beginning.
Gets all entity types or a specific entity type if a name is specified. This is a paginated API. If you provide a null maxResults
, this action retrieves a maximum of 10 records per page. If you provide a maxResults
, the value must be between 5 and 10. To get the next page results, provide the pagination token from the GetEntityTypesResponse
as part of your request. A null pagination token fetches the records from the beginning.
Evaluates an event against a detector version. If a version ID is not provided, the detectorâs (ACTIVE
) version is used.
Gets all event types or a specific event type if name is provided. This is a paginated API. If you provide a null maxResults
, this action retrieves a maximum of 10 records per page. If you provide a maxResults
, the value must be between 5 and 10. To get the next page results, provide the pagination token from the GetEventTypesResponse
as part of your request. A null pagination token fetches the records from the beginning.
Gets the details for one or more Amazon SageMaker models that have been imported into the service. This is a paginated API. If you provide a null maxResults
, this actions retrieves a maximum of 10 records per page. If you provide a maxResults
, the value must be between 5 and 10. To get the next page results, provide the pagination token from the GetExternalModelsResult
as part of your request. A null pagination token fetches the records from the beginning.
Gets the encryption key if a Key Management Service (KMS) customer master key (CMK) has been specified to be used to encrypt content in Amazon Fraud Detector.
#get_labels(options = {}) ⇒ Types::GetLabelsResultGets all labels or a specific label if name is provided. This is a paginated API. If you provide a null maxResults
, this action retrieves a maximum of 50 records per page. If you provide a maxResults
, the value must be between 10 and 50. To get the next page results, provide the pagination token from the GetGetLabelsResponse
as part of your request. A null pagination token fetches the records from the beginning.
Gets one or more models. Gets all models for the AWS account if no model type and no model id provided. Gets all models for the AWS account and model type, if the model type is specified but model id is not provided. Gets a specific model if (model type, model id) tuple is specified.
This is a paginated API. If you provide a null maxResults
, this action retrieves a maximum of 10 records per page. If you provide a maxResults
, the value must be between 1 and 10. To get the next page results, provide the pagination token from the response as part of your request. A null pagination token fetches the records from the beginning.
Gets one or more outcomes. This is a paginated API. If you provide a null maxResults
, this actions retrieves a maximum of 100 records per page. If you provide a maxResults
, the value must be between 50 and 100. To get the next page results, provide the pagination token from the GetOutcomesResult
as part of your request. A null pagination token fetches the records from the beginning.
Get all rules for a detector (paginated) if ruleId
and ruleVersion
are not specified. Gets all rules for the detector and the ruleId
if present (paginated). Gets a specific rule if both the ruleId
and the ruleVersion
are specified.
This is a paginated API. Providing null maxResults results in retrieving maximum of 100 records per page. If you provide maxResults the value must be between 50 and 100. To get the next page result, a provide a pagination token from GetRulesResult as part of your request. Null pagination token fetches the records from the beginning.
#get_variables(options = {}) ⇒ Types::GetVariablesResultGets all of the variables or the specific variable. This is a paginated API. Providing null maxSizePerPage
results in retrieving maximum of 100 records per page. If you provide maxSizePerPage
the value must be between 50 and 100. To get the next page result, a provide a pagination token from GetVariablesResult
as part of your request. Null pagination token fetches the records from the beginning.
Lists all tags associated with the resource. This is a paginated API. To get the next page results, provide the pagination token from the response as part of your request. A null pagination token fetches the records from the beginning.
#put_detector(options = {}) ⇒ StructCreates or updates a detector.
#put_entity_type(options = {}) ⇒ StructCreates or updates an entity type. An entity represents who is performing the event. As part of a fraud prediction, you pass the entity ID to indicate the specific entity who performed the event. An entity type classifies the entity. Example classifications include customer, merchant, or account.
#put_event_type(options = {}) ⇒ StructCreates or updates an event type. An event is a business activity that is evaluated for fraud risk. With Amazon Fraud Detector, you generate fraud predictions for events. An event type defines the structure for an event sent to Amazon Fraud Detector. This includes the variables sent as part of the event, the entity performing the event (such as a customer), and the labels that classify the event. Example event types include online payment transactions, account registrations, and authentications.
#put_external_model(options = {}) ⇒ StructCreates or updates an Amazon SageMaker model endpoint. You can also use this action to update the configuration of the model endpoint, including the IAM role and/or the mapped variables.
#put_kms_encryption_key(options = {}) ⇒ StructSpecifies the Key Management Service (KMS) customer master key (CMK) to be used to encrypt content in Amazon Fraud Detector.
#put_label(options = {}) ⇒ StructCreates or updates label. A label classifies an event as fraudulent or legitimate. Labels are associated with event types and used to train supervised machine learning models in Amazon Fraud Detector.
#put_outcome(options = {}) ⇒ StructCreates or updates an outcome.
#tag_resource(options = {}) ⇒ StructAssigns tags to a resource.
#untag_resource(options = {}) ⇒ StructRemoves tags from a resource.
#update_detector_version(options = {}) ⇒ StructUpdates a detector version. The detector version attributes that you can update include models, external model endpoints, rules, rule execution mode, and description. You can only update a DRAFT
detector version.
Updates the detector version's description. You can update the metadata for any detector version (DRAFT, ACTIVE,
or INACTIVE
).
Updates the detector versionâs status. You can perform the following promotions or demotions using UpdateDetectorVersionStatus
: DRAFT
to ACTIVE
, ACTIVE
to INACTIVE
, and INACTIVE
to ACTIVE
.
Updates a model. You can update the description attribute using this action.
#update_model_version(options = {}) ⇒ Types::UpdateModelVersionResultUpdates a model version. Updating a model version retrains an existing model version using updated training data and produces a new minor version of the model. You can update the training data set location and data access role attributes using this action. This action creates and trains a new minor version of the model, for example version 1.01, 1.02, 1.03.
#update_model_version_status(options = {}) ⇒ StructUpdates the status of a model version.
You can perform the following status updates:
Change the TRAINING_COMPLETE
status to ACTIVE
.
Change ACTIVE
to INACTIVE
.
Updates a rule's metadata. The description attribute can be updated.
#update_rule_version(options = {}) ⇒ Types::UpdateRuleVersionResultUpdates a rule version resulting in a new rule version. Updates a rule version resulting in a new rule version (version 1, 2, 3 ...).
#update_variable(options = {}) ⇒ Struct #wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ BooleanWaiters polls an API operation until a resource enters a desired state.
Basic UsageWaiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)
ConfigurationYou can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:
# poll for ~25 seconds
client.wait_until(...) do |w|
w.max_attempts = 5
w.delay = 5
end
Callbacks
You can be notified before each polling attempt and before each delay. If you throw :success
or :failure
from these callbacks, it will terminate the waiter.
started_at = Time.now
client.wait_until(...) do |w|
# disable max attempts
w.max_attempts = nil
# poll for 1 hour, instead of a number of attempts
w.before_wait do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
end
Handling Errors
When a waiter is successful, it returns true
. When a waiter fails, it raises an error. All errors raised extend from Waiters::Errors::WaiterFailed.
begin
client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
#waiter_names ⇒ Array<Symbol>
Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:
Waiter Name Client Method Default Delay: Default Max Attempts:RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4