/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include #include #include namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace AppSync { namespace Model { /** *

Describes an API key.

Customers invoke AppSync GraphQL API operations * with API keys as an identity mechanism. There are two key versions:

* da1: We introduced this version at launch in November 2017. These keys * always expire after 7 days. Amazon DynamoDB TTL manages key expiration. These * keys ceased to be valid after February 21, 2018, and they should no longer be * used.

  • ListApiKeys returns the expiration time in * milliseconds.

  • CreateApiKey returns the * expiration time in milliseconds.

  • UpdateApiKey is * not available for this key version.

  • DeleteApiKey * deletes the item from the table.

  • Expiration is stored in * DynamoDB as milliseconds. This results in a bug where keys are not automatically * deleted because DynamoDB expects the TTL to be stored in seconds. As a one-time * action, we deleted these keys from the table on February 21, 2018.

  • *

da2: We introduced this version in February 2018 when AppSync * added support to extend key expiration.

  • * ListApiKeys returns the expiration time and deletion time in * seconds.

  • CreateApiKey returns the expiration * time and deletion time in seconds and accepts a user-provided expiration time in * seconds.

  • UpdateApiKey returns the expiration * time and and deletion time in seconds and accepts a user-provided expiration * time in seconds. Expired API keys are kept for 60 days after the expiration * time. You can update the key expiration time as long as the key isn't * deleted.

  • DeleteApiKey deletes the item from the * table.

  • Expiration is stored in DynamoDB as seconds. After the * expiration time, using the key to authenticate will fail. However, you can * reinstate the key before deletion.

  • Deletion is stored in * DynamoDB as seconds. The key is deleted after deletion time.

  • *

See Also:

AWS API * Reference

*/ class ApiKey { public: AWS_APPSYNC_API ApiKey(); AWS_APPSYNC_API ApiKey(Aws::Utils::Json::JsonView jsonValue); AWS_APPSYNC_API ApiKey& operator=(Aws::Utils::Json::JsonView jsonValue); AWS_APPSYNC_API Aws::Utils::Json::JsonValue Jsonize() const; /** *

The API key ID.

*/ inline const Aws::String& GetId() const{ return m_id; } /** *

The API key ID.

*/ inline bool IdHasBeenSet() const { return m_idHasBeenSet; } /** *

The API key ID.

*/ inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } /** *

The API key ID.

*/ inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } /** *

The API key ID.

*/ inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } /** *

The API key ID.

*/ inline ApiKey& WithId(const Aws::String& value) { SetId(value); return *this;} /** *

The API key ID.

*/ inline ApiKey& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} /** *

The API key ID.

*/ inline ApiKey& WithId(const char* value) { SetId(value); return *this;} /** *

A description of the purpose of the API key.

*/ inline const Aws::String& GetDescription() const{ return m_description; } /** *

A description of the purpose of the API key.

*/ inline bool DescriptionHasBeenSet() const { return m_descriptionHasBeenSet; } /** *

A description of the purpose of the API key.

*/ inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; } /** *

A description of the purpose of the API key.

*/ inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); } /** *

A description of the purpose of the API key.

*/ inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); } /** *

A description of the purpose of the API key.

*/ inline ApiKey& WithDescription(const Aws::String& value) { SetDescription(value); return *this;} /** *

A description of the purpose of the API key.

*/ inline ApiKey& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;} /** *

A description of the purpose of the API key.

*/ inline ApiKey& WithDescription(const char* value) { SetDescription(value); return *this;} /** *

The time after which the API key expires. The date is represented as seconds * since the epoch, rounded down to the nearest hour.

*/ inline long long GetExpires() const{ return m_expires; } /** *

The time after which the API key expires. The date is represented as seconds * since the epoch, rounded down to the nearest hour.

*/ inline bool ExpiresHasBeenSet() const { return m_expiresHasBeenSet; } /** *

The time after which the API key expires. The date is represented as seconds * since the epoch, rounded down to the nearest hour.

*/ inline void SetExpires(long long value) { m_expiresHasBeenSet = true; m_expires = value; } /** *

The time after which the API key expires. The date is represented as seconds * since the epoch, rounded down to the nearest hour.

*/ inline ApiKey& WithExpires(long long value) { SetExpires(value); return *this;} /** *

The time after which the API key is deleted. The date is represented as * seconds since the epoch, rounded down to the nearest hour.

*/ inline long long GetDeletes() const{ return m_deletes; } /** *

The time after which the API key is deleted. The date is represented as * seconds since the epoch, rounded down to the nearest hour.

*/ inline bool DeletesHasBeenSet() const { return m_deletesHasBeenSet; } /** *

The time after which the API key is deleted. The date is represented as * seconds since the epoch, rounded down to the nearest hour.

*/ inline void SetDeletes(long long value) { m_deletesHasBeenSet = true; m_deletes = value; } /** *

The time after which the API key is deleted. The date is represented as * seconds since the epoch, rounded down to the nearest hour.

*/ inline ApiKey& WithDeletes(long long value) { SetDeletes(value); return *this;} private: Aws::String m_id; bool m_idHasBeenSet = false; Aws::String m_description; bool m_descriptionHasBeenSet = false; long long m_expires; bool m_expiresHasBeenSet = false; long long m_deletes; bool m_deletesHasBeenSet = false; }; } // namespace Model } // namespace AppSync } // namespace Aws