text:
#pragma once
#include <aws/synthetics/Synthetics_EXPORTS.h>
#include <aws/synthetics/SyntheticsErrors.h>
#include <aws/core/client/AWSError.h>
#include <aws/core/client/ClientConfiguration.h>
#include <aws/core/client/AWSClient.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/synthetics/model/CreateCanaryResult.h>
#include <aws/synthetics/model/DeleteCanaryResult.h>
#include <aws/synthetics/model/DescribeCanariesResult.h>
#include <aws/synthetics/model/DescribeCanariesLastRunResult.h>
#include <aws/synthetics/model/DescribeRuntimeVersionsResult.h>
#include <aws/synthetics/model/GetCanaryResult.h>
#include <aws/synthetics/model/GetCanaryRunsResult.h>
#include <aws/synthetics/model/ListTagsForResourceResult.h>
#include <aws/synthetics/model/StartCanaryResult.h>
#include <aws/synthetics/model/StopCanaryResult.h>
#include <aws/synthetics/model/TagResourceResult.h>
#include <aws/synthetics/model/UntagResourceResult.h>
#include <aws/synthetics/model/UpdateCanaryResult.h>
#include <aws/core/client/AsyncCallerContext.h>
#include <aws/core/http/HttpTypes.h>
#include <future>
#include <functional>

namespace Aws
{

namespace Http
{
  class HttpClient;
  class HttpClientFactory;
} // namespace Http

namespace Utils
{
  template< typename R, typename E> class Outcome;
namespace Threading
{
  class Executor;
} // namespace Threading
} // namespace Utils

namespace Auth
{
  class AWSCredentials;
  class AWSCredentialsProvider;
} // namespace Auth

namespace Client
{
  class RetryStrategy;
} // namespace Client

namespace Synthetics
{

namespace Model
{
        class CreateCanaryRequest;
        class DeleteCanaryRequest;
        class DescribeCanariesRequest;
        class DescribeCanariesLastRunRequest;
        class DescribeRuntimeVersionsRequest;
        class GetCanaryRequest;
        class GetCanaryRunsRequest;
        class ListTagsForResourceRequest;
        class StartCanaryRequest;
        class StopCanaryRequest;
        class TagResourceRequest;
        class UntagResourceRequest;
        class UpdateCanaryRequest;

        typedef Aws::Utils::Outcome<CreateCanaryResult, SyntheticsError> CreateCanaryOutcome;
        typedef Aws::Utils::Outcome<DeleteCanaryResult, SyntheticsError> DeleteCanaryOutcome;
        typedef Aws::Utils::Outcome<DescribeCanariesResult, SyntheticsError> DescribeCanariesOutcome;
        typedef Aws::Utils::Outcome<DescribeCanariesLastRunResult, SyntheticsError> DescribeCanariesLastRunOutcome;
        typedef Aws::Utils::Outcome<DescribeRuntimeVersionsResult, SyntheticsError> DescribeRuntimeVersionsOutcome;
        typedef Aws::Utils::Outcome<GetCanaryResult, SyntheticsError> GetCanaryOutcome;
        typedef Aws::Utils::Outcome<GetCanaryRunsResult, SyntheticsError> GetCanaryRunsOutcome;
        typedef Aws::Utils::Outcome<ListTagsForResourceResult, SyntheticsError> ListTagsForResourceOutcome;
        typedef Aws::Utils::Outcome<StartCanaryResult, SyntheticsError> StartCanaryOutcome;
        typedef Aws::Utils::Outcome<StopCanaryResult, SyntheticsError> StopCanaryOutcome;
        typedef Aws::Utils::Outcome<TagResourceResult, SyntheticsError> TagResourceOutcome;
        typedef Aws::Utils::Outcome<UntagResourceResult, SyntheticsError> UntagResourceOutcome;
        typedef Aws::Utils::Outcome<UpdateCanaryResult, SyntheticsError> UpdateCanaryOutcome;

        typedef std::future<CreateCanaryOutcome> CreateCanaryOutcomeCallable;
        typedef std::future<DeleteCanaryOutcome> DeleteCanaryOutcomeCallable;
        typedef std::future<DescribeCanariesOutcome> DescribeCanariesOutcomeCallable;
        typedef std::future<DescribeCanariesLastRunOutcome> DescribeCanariesLastRunOutcomeCallable;
        typedef std::future<DescribeRuntimeVersionsOutcome> DescribeRuntimeVersionsOutcomeCallable;
        typedef std::future<GetCanaryOutcome> GetCanaryOutcomeCallable;
        typedef std::future<GetCanaryRunsOutcome> GetCanaryRunsOutcomeCallable;
        typedef std::future<ListTagsForResourceOutcome> ListTagsForResourceOutcomeCallable;
        typedef std::future<StartCanaryOutcome> StartCanaryOutcomeCallable;
        typedef std::future<StopCanaryOutcome> StopCanaryOutcomeCallable;
        typedef std::future<TagResourceOutcome> TagResourceOutcomeCallable;
        typedef std::future<UntagResourceOutcome> UntagResourceOutcomeCallable;
        typedef std::future<UpdateCanaryOutcome> UpdateCanaryOutcomeCallable;
} // namespace Model

  class SyntheticsClient;

    typedef std::function<void(const SyntheticsClient*, const Model::CreateCanaryRequest&, const Model::CreateCanaryOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > CreateCanaryResponseReceivedHandler;
    typedef std::function<void(const SyntheticsClient*, const Model::DeleteCanaryRequest&, const Model::DeleteCanaryOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > DeleteCanaryResponseReceivedHandler;
    typedef std::function<void(const SyntheticsClient*, const Model::DescribeCanariesRequest&, const Model::DescribeCanariesOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > DescribeCanariesResponseReceivedHandler;
    typedef std::function<void(const SyntheticsClient*, const Model::DescribeCanariesLastRunRequest&, const Model::DescribeCanariesLastRunOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > DescribeCanariesLastRunResponseReceivedHandler;
    typedef std::function<void(const SyntheticsClient*, const Model::DescribeRuntimeVersionsRequest&, const Model::DescribeRuntimeVersionsOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > DescribeRuntimeVersionsResponseReceivedHandler;
    typedef std::function<void(const SyntheticsClient*, const Model::GetCanaryRequest&, const Model::GetCanaryOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > GetCanaryResponseReceivedHandler;
    typedef std::function<void(const SyntheticsClient*, const Model::GetCanaryRunsRequest&, const Model::GetCanaryRunsOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > GetCanaryRunsResponseReceivedHandler;
    typedef std::function<void(const SyntheticsClient*, const Model::ListTagsForResourceRequest&, const Model::ListTagsForResourceOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > ListTagsForResourceResponseReceivedHandler;
    typedef std::function<void(const SyntheticsClient*, const Model::StartCanaryRequest&, const Model::StartCanaryOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > StartCanaryResponseReceivedHandler;
    typedef std::function<void(const SyntheticsClient*, const Model::StopCanaryRequest&, const Model::StopCanaryOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > StopCanaryResponseReceivedHandler;
    typedef std::function<void(const SyntheticsClient*, const Model::TagResourceRequest&, const Model::TagResourceOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > TagResourceResponseReceivedHandler;
    typedef std::function<void(const SyntheticsClient*, const Model::UntagResourceRequest&, const Model::UntagResourceOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > UntagResourceResponseReceivedHandler;
    typedef std::function<void(const SyntheticsClient*, const Model::UpdateCanaryRequest&, const Model::UpdateCanaryOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > UpdateCanaryResponseReceivedHandler;

  /**
   * <fullname>Amazon CloudWatch Synthetics</fullname>
You can use Amazon
   * CloudWatch Synthetics to continually monitor your services. You can create and
   * manage canaries, which are modular, lightweight scripts that monitor your
   * endpoints and APIs from the outside-in. You can set up your canaries to run 24
   * hours a day, once per minute. The canaries help you check the availability and
   * latency of your web services and troubleshoot anomalies by investigating load
   * time data, screenshots of the UI, logs, and metrics. The canaries seamlessly
   * integrate with CloudWatch ServiceLens to help you trace the causes of impacted
   * nodes in your applications. For more information, see Using
   * ServiceLens to Monitor the Health of Your Applications in the Amazon
   * CloudWatch User Guide.

Before you create and manage canaries, be
   * aware of the security considerations. For more information, see Security
   * Considerations for Synthetics Canaries.

   */
  class AWS_SYNTHETICS_API SyntheticsClient : public Aws::Client::AWSJsonClient
  {
    public:
      typedef Aws::Client::AWSJsonClient BASECLASS;

       /**
        * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config
        * is not specified, it will be initialized to default values.
        */
        SyntheticsClient(const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration());

       /**
        * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config
        * is not specified, it will be initialized to default values.
        */
        SyntheticsClient(const Aws::Auth::AWSCredentials& credentials, const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration());

       /**
        * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied,
        * the default http client factory will be used
        */
        SyntheticsClient(const std::shared_ptr<Aws::Auth::AWSCredentialsProvider>& credentialsProvider,
            const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration());

        virtual ~SyntheticsClient();

        /**
         *
Creates a canary. Canaries are scripts that monitor your endpoints and APIs
         * from the outside-in. Canaries help you check the availability and latency of
         * your web services and troubleshoot anomalies by investigating load time data,
         * screenshots of the UI, logs, and metrics. You can set up a canary to run
         * continuously or just once.

Do not use CreateCanary to
         * modify an existing canary. Use UpdateCanary
         * instead.

To create canaries, you must have the
         * CloudWatchSyntheticsFullAccess policy. If you are creating a new
         * IAM role for the canary, you also need the the iam:CreateRole,
         * iam:CreatePolicy and iam:AttachRolePolicy permissions.
         * For more information, see Necessary
         * Roles and Permissions.

Do not include secrets or proprietary
         * information in your canary names. The canary name makes up part of the Amazon
         * Resource Name (ARN) for the canary, and the ARN is included in outbound calls
         * over the internet. For more information, see Security
         * Considerations for Synthetics Canaries.

See Also:
   AWS
         * API Reference

         */
        virtual Model::CreateCanaryOutcome CreateCanary(const Model::CreateCanaryRequest& request) const;

        /**
         *
Creates a canary. Canaries are scripts that monitor your endpoints and APIs
         * from the outside-in. Canaries help you check the availability and latency of
         * your web services and troubleshoot anomalies by investigating load time data,
         * screenshots of the UI, logs, and metrics. You can set up a canary to run
         * continuously or just once.

Do not use CreateCanary to
         * modify an existing canary. Use UpdateCanary
         * instead.

To create canaries, you must have the
         * CloudWatchSyntheticsFullAccess policy. If you are creating a new
         * IAM role for the canary, you also need the the iam:CreateRole,
         * iam:CreatePolicy and iam:AttachRolePolicy permissions.
         * For more information, see Necessary
         * Roles and Permissions.

Do not include secrets or proprietary
         * information in your canary names. The canary name makes up part of the Amazon
         * Resource Name (ARN) for the canary, and the ARN is included in outbound calls
         * over the internet. For more information, see Security
         * Considerations for Synthetics Canaries.

See Also:
   AWS
         * API Reference

         *
         * returns a future to the operation so that it can be executed in parallel to other requests.
         */
        virtual Model::CreateCanaryOutcomeCallable CreateCanaryCallable(const Model::CreateCanaryRequest& request) const;

        /**
         *
Creates a canary. Canaries are scripts that monitor your endpoints and APIs
         * from the outside-in. Canaries help you check the availability and latency of
         * your web services and troubleshoot anomalies by investigating load time data,
         * screenshots of the UI, logs, and metrics. You can set up a canary to run
         * continuously or just once.

Do not use CreateCanary to
         * modify an existing canary. Use UpdateCanary
         * instead.

To create canaries, you must have the
         * CloudWatchSyntheticsFullAccess policy. If you are creating a new
         * IAM role for the canary, you also need the the iam:CreateRole,
         * iam:CreatePolicy and iam:AttachRolePolicy permissions.
         * For more information, see Necessary
         * Roles and Permissions.

Do not include secrets or proprietary
         * information in your canary names. The canary name makes up part of the Amazon
         * Resource Name (ARN) for the canary, and the ARN is included in outbound calls
         * over the internet. For more information, see Security
         * Considerations for Synthetics Canaries.

See Also:
   AWS
         * API Reference

         *
         * Queues the request into a thread executor and triggers associated callback when operation has finished.
         */
        virtual void CreateCanaryAsync(const Model::CreateCanaryRequest& request, const CreateCanaryResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;

        /**
         *
Permanently deletes the specified canary.

When you delete a canary,
         * resources used and created by the canary are not automatically deleted. After
         * you delete a canary that you do not intend to use again, you should also delete
         * the following:

The Lambda functions and layers used by this
         * canary. These have the prefix cwsyn-MyCanaryName .

         *

The CloudWatch alarms created for this canary. These alarms have a name
         * of Synthetics-SharpDrop-Alarm-MyCanaryName .

         *
Amazon S3 objects and buckets, such as the canary's artifact location.

         *

IAM roles created for the canary. If they were created in the
         * console, these roles have the name
         * role/service-role/CloudWatchSyntheticsRole-MyCanaryName .

         *

CloudWatch Logs log groups created for the canary. These logs
         * groups have the name /aws/lambda/cwsyn-MyCanaryName .

         *

Before you delete a canary, you might want to use
         * GetCanary to display the information about this canary. Make note
         * of the information returned by this operation so that you can delete these
         * resources after you delete the canary.

See Also:
   AWS
         * API Reference

         */
        virtual Model::DeleteCanaryOutcome DeleteCanary(const Model::DeleteCanaryRequest& request) const;

        /**
         *
Permanently deletes the specified canary.

When you delete a canary,
         * resources used and created by the canary are not automatically deleted. After
         * you delete a canary that you do not intend to use again, you should also delete
         * the following:

The Lambda functions and layers used by this
         * canary. These have the prefix cwsyn-MyCanaryName .

         *

The CloudWatch alarms created for this canary. These alarms have a name
         * of Synthetics-SharpDrop-Alarm-MyCanaryName .

         *
Amazon S3 objects and buckets, such as the canary's artifact location.

         *

IAM roles created for the canary. If they were created in the
         * console, these roles have the name
         * role/service-role/CloudWatchSyntheticsRole-MyCanaryName .

         *

CloudWatch Logs log groups created for the canary. These logs
         * groups have the name /aws/lambda/cwsyn-MyCanaryName .

         *

Before you delete a canary, you might want to use
         * GetCanary to display the information about this canary. Make note
         * of the information returned by this operation so that you can delete these
         * resources after you delete the canary.

See Also:
   AWS
         * API Reference

         *
         * returns a future to the operation so that it can be executed in parallel to other requests.
         */
        virtual Model::DeleteCanaryOutcomeCallable DeleteCanaryCallable(const Model::DeleteCanaryRequest& request) const;

        /**
         *
Permanently deletes the specified canary.

When you delete a canary,
         * resources used and created by the canary are not automatically deleted. After
         * you delete a canary that you do not intend to use again, you should also delete
         * the following:

The Lambda functions and layers used by this
         * canary. These have the prefix cwsyn-MyCanaryName .

         *

The CloudWatch alarms created for this canary. These alarms have a name
         * of Synthetics-SharpDrop-Alarm-MyCanaryName .

         *
Amazon S3 objects and buckets, such as the canary's artifact location.

         *

IAM roles created for the canary. If they were created in the
         * console, these roles have the name
         * role/service-role/CloudWatchSyntheticsRole-MyCanaryName .

         *

CloudWatch Logs log groups created for the canary. These logs
         * groups have the name /aws/lambda/cwsyn-MyCanaryName .

         *

Before you delete a canary, you might want to use
         * GetCanary to display the information about this canary. Make note
         * of the information returned by this operation so that you can delete these
         * resources after you delete the canary.

See Also:
   AWS
         * API Reference

         *
         * Queues the request into a thread executor and triggers associated callback when operation has finished.
         */
        virtual void DeleteCanaryAsync(const Model::DeleteCanaryRequest& request, const DeleteCanaryResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;

        /**
         *
This operation returns a list of the canaries in your account, along with
         * full details about each canary.

This operation does not have
         * resource-level authorization, so if a user is able to use
         * DescribeCanaries, the user can see all of the canaries in the
         * account. A deny policy can only be used to restrict access to all canaries. It
         * cannot be used on specific resources.

See Also:
   AWS
         * API Reference

         */
        virtual Model::DescribeCanariesOutcome DescribeCanaries(const Model::DescribeCanariesRequest& request) const;

        /**
         *
This operation returns a list of the canaries in your account, along with
         * full details about each canary.

This operation does not have
         * resource-level authorization, so if a user is able to use
         * DescribeCanaries, the user can see all of the canaries in the
         * account. A deny policy can only be used to restrict access to all canaries. It
         * cannot be used on specific resources.

See Also:
   AWS
         * API Reference

         *
         * returns a future to the operation so that it can be executed in parallel to other requests.
         */
        virtual Model::DescribeCanariesOutcomeCallable DescribeCanariesCallable(const Model::DescribeCanariesRequest& request) const;

        /**
         *
This operation returns a list of the canaries in your account, along with
         * full details about each canary.

This operation does not have
         * resource-level authorization, so if a user is able to use
         * DescribeCanaries, the user can see all of the canaries in the
         * account. A deny policy can only be used to restrict access to all canaries. It
         * cannot be used on specific resources.

See Also:
   AWS
         * API Reference

         *
         * Queues the request into a thread executor and triggers associated callback when operation has finished.
         */
        virtual void DescribeCanariesAsync(const Model::DescribeCanariesRequest& request, const DescribeCanariesResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;

        /**
         *
Use this operation to see information from the most recent run of each canary
         * that you have created.

See Also:
   AWS
         * API Reference

         */
        virtual Model::DescribeCanariesLastRunOutcome DescribeCanariesLastRun(const Model::DescribeCanariesLastRunRequest& request) const;

        /**
         *
Use this operation to see information from the most recent run of each canary
         * that you have created.

See Also:
   AWS
         * API Reference

         *
         * returns a future to the operation so that it can be executed in parallel to other requests.
         */
        virtual Model::DescribeCanariesLastRunOutcomeCallable DescribeCanariesLastRunCallable(const Model::DescribeCanariesLastRunRequest& request) const;

        /**
         *
Use this operation to see information from the most recent run of each canary
         * that you have created.

See Also:
   AWS
         * API Reference

         *
         * Queues the request into a thread executor and triggers associated callback when operation has finished.
         */
        virtual void DescribeCanariesLastRunAsync(const Model::DescribeCanariesLastRunRequest& request, const DescribeCanariesLastRunResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;

        /**
         *
Returns a list of Synthetics canary runtime versions. For more information,
         * see
         * Canary Runtime Versions.

See Also:
   AWS
         * API Reference

         */
        virtual Model::DescribeRuntimeVersionsOutcome DescribeRuntimeVersions(const Model::DescribeRuntimeVersionsRequest& request) const;

        /**
         *
Returns a list of Synthetics canary runtime versions. For more information,
         * see
         * Canary Runtime Versions.

See Also:
   AWS
         * API Reference

         *
         * returns a future to the operation so that it can be executed in parallel to other requests.
         */
        virtual Model::DescribeRuntimeVersionsOutcomeCallable DescribeRuntimeVersionsCallable(const Model::DescribeRuntimeVersionsRequest& request) const;

        /**
         *
Returns a list of Synthetics canary runtime versions. For more information,
         * see
         * Canary Runtime Versions.

See Also:
   AWS
         * API Reference

         *
         * Queues the request into a thread executor and triggers associated callback when operation has finished.
         */
        virtual void DescribeRuntimeVersionsAsync(const Model::DescribeRuntimeVersionsRequest& request, const DescribeRuntimeVersionsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;

        /**
         *
Retrieves complete information about one canary. You must specify the name of
         * the canary that you want. To get a list of canaries and their names, use DescribeCanaries.

See
         * Also:
   AWS
         * API Reference

         */
        virtual Model::GetCanaryOutcome GetCanary(const Model::GetCanaryRequest& request) const;

        /**
         *
Retrieves complete information about one canary. You must specify the name of
         * the canary that you want. To get a list of canaries and their names, use DescribeCanaries.

See
         * Also:
   AWS
         * API Reference

         *
         * returns a future to the operation so that it can be executed in parallel to other requests.
         */
        virtual Model::GetCanaryOutcomeCallable GetCanaryCallable(const Model::GetCanaryRequest& request) const;

        /**
         *
Retrieves complete information about one canary. You must specify the name of
         * the canary that you want. To get a list of canaries and their names, use DescribeCanaries.

See
         * Also:
   AWS
         * API Reference

         *
         * Queues the request into a thread executor and triggers associated callback when operation has finished.
         */
        virtual void GetCanaryAsync(const Model::GetCanaryRequest& request, const GetCanaryResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;

        /**
         *
Retrieves a list of runs for a specified canary.

See Also:

         * AWS
         * API Reference

         */
        virtual Model::GetCanaryRunsOutcome GetCanaryRuns(const Model::GetCanaryRunsRequest& request) const;

        /**
         *
Retrieves a list of runs for a specified canary.

See Also:

         * AWS
         * API Reference

         *
         * returns a future to the operation so that it can be executed in parallel to other requests.
         */
        virtual Model::GetCanaryRunsOutcomeCallable GetCanaryRunsCallable(const Model::GetCanaryRunsRequest& request) const;

        /**
         *
Retrieves a list of runs for a specified canary.

See Also:

         * AWS
         * API Reference

         *
         * Queues the request into a thread executor and triggers associated callback when operation has finished.
         */
        virtual void GetCanaryRunsAsync(const Model::GetCanaryRunsRequest& request, const GetCanaryRunsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;

        /**
         *
Displays the tags associated with a canary.

See Also:
   AWS
         * API Reference

         */
        virtual Model::ListTagsForResourceOutcome ListTagsForResource(const Model::ListTagsForResourceRequest& request) const;

        /**
         *
Displays the tags associated with a canary.

See Also:
   AWS
         * API Reference

         *
         * returns a future to the operation so that it can be executed in parallel to other requests.
         */
        virtual Model::ListTagsForResourceOutcomeCallable ListTagsForResourceCallable(const Model::ListTagsForResourceRequest& request) const;

        /**
         *
Displays the tags associated with a canary.

See Also:
   AWS
         * API Reference

         *
         * Queues the request into a thread executor and triggers associated callback when operation has finished.
         */
        virtual void ListTagsForResourceAsync(const Model::ListTagsForResourceRequest& request, const ListTagsForResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;

        /**
         *
Use this operation to run a canary that has already been created. The
         * frequency of the canary runs is determined by the value of the canary's
         * Schedule. To see a canary's schedule, use GetCanary.

See
         * Also:
   AWS
         * API Reference

         */
        virtual Model::StartCanaryOutcome StartCanary(const Model::StartCanaryRequest& request) const;

        /**
         *
Use this operation to run a canary that has already been created. The
         * frequency of the canary runs is determined by the value of the canary's
         * Schedule. To see a canary's schedule, use GetCanary.

See
         * Also:
   AWS
         * API Reference

         *
         * returns a future to the operation so that it can be executed in parallel to other requests.
         */
        virtual Model::StartCanaryOutcomeCallable StartCanaryCallable(const Model::StartCanaryRequest& request) const;

        /**
         *
Use this operation to run a canary that has already been created. The
         * frequency of the canary runs is determined by the value of the canary's
         * Schedule. To see a canary's schedule, use GetCanary.

See
         * Also:
   AWS
         * API Reference

         *
         * Queues the request into a thread executor and triggers associated callback when operation has finished.
         */
        virtual void StartCanaryAsync(const Model::StartCanaryRequest& request, const StartCanaryResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;

        /**
         *
Stops the canary to prevent all future runs. If the canary is currently
         * running, Synthetics stops waiting for the current run of the specified canary to
         * complete. The run that is in progress completes on its own, publishes metrics,
         * and uploads artifacts, but it is not recorded in Synthetics as a completed
         * run.

You can use StartCanary to start it running again with
         * the canary's current schedule at any point in the future.

See
         * Also:
   AWS
         * API Reference

         */
        virtual Model::StopCanaryOutcome StopCanary(const Model::StopCanaryRequest& request) const;

        /**
         *
Stops the canary to prevent all future runs. If the canary is currently
         * running, Synthetics stops waiting for the current run of the specified canary to
         * complete. The run that is in progress completes on its own, publishes metrics,
         * and uploads artifacts, but it is not recorded in Synthetics as a completed
         * run.

You can use StartCanary to start it running again with
         * the canary's current schedule at any point in the future.

See
         * Also:
   AWS
         * API Reference

         *
         * returns a future to the operation so that it can be executed in parallel to other requests.
         */
        virtual Model::StopCanaryOutcomeCallable StopCanaryCallable(const Model::StopCanaryRequest& request) const;

        /**
         *
Stops the canary to prevent all future runs. If the canary is currently
         * running, Synthetics stops waiting for the current run of the specified canary to
         * complete. The run that is in progress completes on its own, publishes metrics,
         * and uploads artifacts, but it is not recorded in Synthetics as a completed
         * run.

You can use StartCanary to start it running again with
         * the canary's current schedule at any point in the future.

See
         * Also:
   AWS
         * API Reference

         *
         * Queues the request into a thread executor and triggers associated callback when operation has finished.
         */
        virtual void StopCanaryAsync(const Model::StopCanaryRequest& request, const StopCanaryResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;

        /**
         *
Assigns one or more tags (key-value pairs) to the specified canary.

         *
Tags can help you organize and categorize your resources. You can also use
         * them to scope user permissions, by granting a user permission to access or
         * change only resources with certain tag values.

Tags don't have any
         * semantic meaning to AWS and are interpreted strictly as strings of
         * characters.

You can use the TagResource action with a canary
         * that already has tags. If you specify a new tag key for the alarm, this tag is
         * appended to the list of tags associated with the alarm. If you specify a tag key
         * that is already associated with the alarm, the new tag value that you specify
         * replaces the previous value for that tag.

You can associate as many as 50
         * tags with a canary.

See Also:
   AWS
         * API Reference

         */
        virtual Model::TagResourceOutcome TagResource(const Model::TagResourceRequest& request) const;

        /**
         *
Assigns one or more tags (key-value pairs) to the specified canary.

         *
Tags can help you organize and categorize your resources. You can also use
         * them to scope user permissions, by granting a user permission to access or
         * change only resources with certain tag values.

Tags don't have any
         * semantic meaning to AWS and are interpreted strictly as strings of
         * characters.

You can use the TagResource action with a canary
         * that already has tags. If you specify a new tag key for the alarm, this tag is
         * appended to the list of tags associated with the alarm. If you specify a tag key
         * that is already associated with the alarm, the new tag value that you specify
         * replaces the previous value for that tag.

You can associate as many as 50
         * tags with a canary.

See Also:
   AWS
         * API Reference

         *
         * returns a future to the operation so that it can be executed in parallel to other requests.
         */
        virtual Model::TagResourceOutcomeCallable TagResourceCallable(const Model::TagResourceRequest& request) const;

        /**
         *
Assigns one or more tags (key-value pairs) to the specified canary.

         *
Tags can help you organize and categorize your resources. You can also use
         * them to scope user permissions, by granting a user permission to access or
         * change only resources with certain tag values.

Tags don't have any
         * semantic meaning to AWS and are interpreted strictly as strings of
         * characters.

You can use the TagResource action with a canary
         * that already has tags. If you specify a new tag key for the alarm, this tag is
         * appended to the list of tags associated with the alarm. If you specify a tag key
         * that is already associated with the alarm, the new tag value that you specify
         * replaces the previous value for that tag.

You can associate as many as 50
         * tags with a canary.

See Also:
   AWS
         * API Reference

         *
         * Queues the request into a thread executor and triggers associated callback when operation has finished.
         */
        virtual void TagResourceAsync(const Model::TagResourceRequest& request, const TagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;

        /**
         *
Removes one or more tags from the specified canary.

See Also:

         * AWS
         * API Reference

         */
        virtual Model::UntagResourceOutcome UntagResource(const Model::UntagResourceRequest& request) const;

        /**
         *
Removes one or more tags from the specified canary.

See Also:

         * AWS
         * API Reference

         *
         * returns a future to the operation so that it can be executed in parallel to other requests.
         */
        virtual Model::UntagResourceOutcomeCallable UntagResourceCallable(const Model::UntagResourceRequest& request) const;

        /**
         *
Removes one or more tags from the specified canary.

See Also:

         * AWS
         * API Reference

         *
         * Queues the request into a thread executor and triggers associated callback when operation has finished.
         */
        virtual void UntagResourceAsync(const Model::UntagResourceRequest& request, const UntagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;

        /**
         *
Use this operation to change the settings of a canary that has already been
         * created.

You can't use this operation to update the tags of an existing
         * canary. To change the tags of an existing canary, use TagResource.

See
         * Also:
   AWS
         * API Reference

         */
        virtual Model::UpdateCanaryOutcome UpdateCanary(const Model::UpdateCanaryRequest& request) const;

        /**
         *
Use this operation to change the settings of a canary that has already been
         * created.

You can't use this operation to update the tags of an existing
         * canary. To change the tags of an existing canary, use TagResource.

See
         * Also:
   AWS
         * API Reference

         *
         * returns a future to the operation so that it can be executed in parallel to other requests.
         */
        virtual Model::UpdateCanaryOutcomeCallable UpdateCanaryCallable(const Model::UpdateCanaryRequest& request) const;

        /**
         *
Use this operation to change the settings of a canary that has already been
         * created.

You can't use this operation to update the tags of an existing
         * canary. To change the tags of an existing canary, use TagResource.

See
         * Also:
   AWS
         * API Reference

         *
         * Queues the request into a thread executor and triggers associated callback when operation has finished.
         */
        virtual void UpdateCanaryAsync(const Model::UpdateCanaryRequest& request, const UpdateCanaryResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;

      void OverrideEndpoint(const Aws::String& endpoint);
    private:
      void init(const Aws::Client::ClientConfiguration& clientConfiguration);
        void CreateCanaryAsyncHelper(const Model::CreateCanaryRequest& request, const CreateCanaryResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
        void DeleteCanaryAsyncHelper(const Model::DeleteCanaryRequest& request, const DeleteCanaryResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
        void DescribeCanariesAsyncHelper(const Model::DescribeCanariesRequest& request, const DescribeCanariesResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
        void DescribeCanariesLastRunAsyncHelper(const Model::DescribeCanariesLastRunRequest& request, const DescribeCanariesLastRunResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
        void DescribeRuntimeVersionsAsyncHelper(const Model::DescribeRuntimeVersionsRequest& request, const DescribeRuntimeVersionsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
        void GetCanaryAsyncHelper(const Model::GetCanaryRequest& request, const GetCanaryResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
        void GetCanaryRunsAsyncHelper(const Model::GetCanaryRunsRequest& request, const GetCanaryRunsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
        void ListTagsForResourceAsyncHelper(const Model::ListTagsForResourceRequest& request, const ListTagsForResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
        void StartCanaryAsyncHelper(const Model::StartCanaryRequest& request, const StartCanaryResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
        void StopCanaryAsyncHelper(const Model::StopCanaryRequest& request, const StopCanaryResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
        void TagResourceAsyncHelper(const Model::TagResourceRequest& request, const TagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
        void UntagResourceAsyncHelper(const Model::UntagResourceRequest& request, const UntagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
        void UpdateCanaryAsyncHelper(const Model::UpdateCanaryRequest& request, const UpdateCanaryResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;

      Aws::String m_uri;
      Aws::String m_configScheme;
      std::shared_ptr<Aws::Utils::Threading::Executor> m_executor;
  };

} // namespace Synthetics
} // namespace Aws


text:
var Backbone = require('backbone');

module.exports = Backbone.Model.extend({

    defaults: {
        title: '',
        completed: false,
        created: 0
    },

    initialize: function () {
        if (this.isNew()) {
            this.set('created', Date.now());
        }
    },

    toggle: function () {
        return this.set('completed', !this.isCompleted());
    },

    isCompleted: function () {
        return this.get('completed');
    }

});

redpajama_set_name: RedPajamaGithub


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
N. Amer. Fl. (New York) 7(7): 498 (1922)

#### Original name
Puccinia semi-insculpta Arthur

### Remarks
null


text:
namespace MinVR {

VRGroupNode::VRGroupNode(const std::string &name) : VRDisplayNode(name)
{
}

VRGroupNode::~VRGroupNode()
{
}

VRDisplayNode*
VRGroupNode::create(VRMainInterface *vrMain, VRDataIndex *config, const std::string &nameSpace) {
	std::string nodeNameSpace = nameSpace;

	VRDisplayNode *node = new VRGroupNode(nameSpace);

	return node;
}

} // end namespace


text:
@implementation AppleMoviePosterDownloader

- (NSDictionary*) createMapWorker {
  NSString* url = [NSString stringWithFormat:@"http://%@.appspot.com/LookupPosterListings%@?provider=apple",
                   [Application apiHost], [Application apiVersion]];
  XmlElement* index = [NetworkUtilities xmlWithContentsOfAddress:url pause:NO];
  return [LargeMoviePosterCache processPosterListings:index];
}

@end


text:
package com.noahhuppert.counter.models.sqlite.exceptions;

/**
 * An exception thrown when an unknown error occurs in a database operation.
 */
public class DBOperationFailedException extends Exception {
    public DBOperationFailedException(Operation operation) {
        super("Failed to complete database operation \"" + operation + "\", unknown error");
    }

    public enum Operation {
        INSERT,
        QUERY,
        UPDATE,
        DELETE;
    }
}


text:
"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = _default;
function _default(pluginConfig, plugins) {
    if (pluginConfig === undefined) {
        return plugins;
    }
    const pluginNames = Array.isArray(pluginConfig) ? pluginConfig : [
        ...new Set(plugins.filter((pluginName)=>{
            return pluginConfig !== false && pluginConfig[pluginName] !== false;
        }).concat(Object.keys(pluginConfig).filter((pluginName)=>{
            return pluginConfig[pluginName] !== false;
        }))),
    ];
    return pluginNames;
}


text:
User

    <form name="vm.userForm" ng-submit="vm.update(vm.userForm.$valid)" novalidate>
      <fieldset>

          First Name
          <input type="text" id="firstName" name="firstName" class="form-control" ng-model="vm.user.firstName" placeholder="First Name" required />

First name is required.

          Last Name
          <input type="text" id="lastName" name="lastName" class="form-control" ng-model="vm.user.lastName" placeholder="Last Name" required />

Last name is required.

          Roles

            <input class="form-control" type="text" name="roles" ng-model="vm.user.roles" id="roles" ng-list required />

At least one role is required.

          <input type="submit" value="Update" class="btn btn-default">

      </fieldset>
    </form>


text:
#ifndef ALX_STATE_HPP
#define ALX_STATE_HPP

#include <allegro5/allegro.h>
#include "alx/Value.hpp"

namespace alx {

/**
    Value-based wrapper class around ALLEGRO_STATE.
 */
class State : public Value<ALLEGRO_STATE> {
public:
    /**
        The default constructor.
     */
    State() {
    }

    /**
        constructor from state.
        @param state state.
     */
    State(const ALLEGRO_STATE &state) : Value(state) {
    }

    /**
        Restores the state.
     */
    void restore() const {
        al_restore_state(&get());
    }

    /**
        Retrieves the state.
     */
    void retrieve(int flags) {
        al_store_state(&get(), flags);
    }
};

} //namespace alx

#endif //ALX_STATE_HPP


text:
#region License
// The MIT License (MIT)
// Copyright (c) 2015 João Simões
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endregion
namespace SimplePersistence.UoW.NH
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Linq.Expressions;
    using JetBrains.Annotations;
    using NHibernate;
    using NHibernate.Linq;

    /// <summary>
    /// Implementation of an <see cref="IAsyncRepository{TEntity,TId}"/> for the NHibernate,
    /// exposing only sync operations
    /// </summary>
    /// <typeparam name="TEntity">The entity type</typeparam>
    /// <typeparam name="TKey">The key type</typeparam>
    public abstract class NHibernateSyncRepository<TEntity, TKey> : ISyncRepository<TEntity, TKey>
        where TEntity : class
        where TKey : IEquatable<TKey>
    {
        private readonly Func<TEntity, TKey, bool> _filterById;
        private readonly ISession _session;

        /// <summary>
        /// The database session
        /// </summary>
        protected ISession Session
        {
            get { return _session; }
        }

        /// <summary>
        /// Creates a new repository
        /// </summary>
        /// <param name="session">The database session</param>
        /// <param name="filterById">The filter by the entity if expression</param>
        /// <exception cref="ArgumentNullException"></exception>
        protected NHibernateSyncRepository([NotNull] ISession session, [NotNull] Func<TEntity, TKey, bool> filterById)
        {
            if (session == null) throw new ArgumentNullException("session");
            if (filterById == null) throw new ArgumentNullException("filterById");

            _session = session;
            _filterById = filterById;
        }

        #region Query

        /// <summary>
        /// Gets an <see cref="IQueryable{TEntity}"/> for this repository entities
        /// </summary>
        /// <returns>The <see cref="IQueryable{TEntity}"/> object</returns>
        public virtual IQueryable<TEntity> Query()
        {
            return Session.Query<TEntity>();
        }

        /// <summary>
        /// Gets an <see cref="IQueryable{TEntity}"/> for this repository entities
        /// </summary>
        /// <param name="id">The entity unique identifier</param>
        /// <returns>The <see cref="IQueryable{TEntity}"/> object</returns>
        public IQueryable<TEntity> QueryById(TKey id)
        {
            return Query().Where(e => _filterById(e, id));
        }

        /// <summary>
        /// Gets an <see cref="IQueryable{TEntity}"/> for this repository entities
        /// that will also fetch, on execution, all the entity navigation properties
        /// </summary>
        /// <param name="propertiesToFetch">The navigation properties to also fetch on query execution</param>
        /// <returns>The <see cref="IQueryable{TEntity}"/> object</returns>
        public virtual IQueryable<TEntity> QueryFetching(params Expression<Func<TEntity, object>>[] propertiesToFetch)
        {
            return propertiesToFetch.Aggregate(Query(), (current, expression) => current.Fetch(expression));
        }

        #endregion

        #region GetById

        /// <summary>
        /// Gets an entity by its unique identifier from this repository
        /// </summary>
        /// <param name="id">The entity unique identifier</param>
        /// <returns>The entity or null if not found</returns>
        public virtual TEntity GetById(TKey id)
        {
            return Session.Get<TEntity>(id);
        }

        #endregion

        #region Add

        /// <summary>
        /// Adds the entity to the repository
        /// </summary>
        /// <param name="entity">The entity to add</param>
        /// <returns>The entity</returns>
        public virtual TEntity Add(TEntity entity)
        {
            if (entity == null) throw new ArgumentNullException("entity");
            Session.Save(entity);
            return entity;
        }

        /// <summary>
        /// Adds a range of entities to the repository
        /// </summary>
        /// <param name="entities">The entities to add</param>
        /// <returns>The range of entities added</returns>
        public virtual IEnumerable<TEntity> Add(IEnumerable<TEntity> entities)
        {
            if (entities == null) throw new ArgumentNullException("entities");
            return entities.Select(Add).ToArray();
        }

        #endregion

        #region Update

        /// <summary>
        /// Updates the entity in the repository
        /// </summary>
        /// <param name="entity">The entity to update</param>
        /// <returns>The entity</returns>
        public virtual TEntity Update(TEntity entity)
        {
            if (entity == null) throw new ArgumentNullException("entity");
            Session.Update(entity);
            return entity;
        }

        /// <summary>
        /// Updates a range of entities in the repository
        /// </summary>
        /// <param name="entities">The entities to update</param>
        /// <returns>The entities</returns>
        public virtual IEnumerable<TEntity> Update(IEnumerable<TEntity> entities)
        {
            if (entities == null) throw new ArgumentNullException("entities");
            return entities.Select(Update).ToArray();
        }

        #endregion

        #region Delete

        /// <summary>
        /// Deletes the entity in the repository
        /// </summary>
        /// <param name="entity">The entity to delete</param>
        /// <returns>The entity</returns>
        public virtual TEntity Delete(TEntity entity)
        {
            if (entity == null) throw new ArgumentNullException("entity");
            Session.Delete(entity);
            return entity;
        }

        /// <summary>
        /// Deletes a range of entity in the repository
        /// </summary>
        /// <param name="entities">The entities to delete</param>
        /// <returns>The entities</returns>
        public virtual IEnumerable<TEntity> Delete(IEnumerable<TEntity> entities)
        {
            if (entities == null) throw new ArgumentNullException("entities");
            return entities.Select(Delete).ToArray();
        }

        #endregion

        #region Total

        /// <summary>
        /// Gets the total entities in the repository
        /// </summary>
        /// <returns>The total</returns>
        public virtual long Total()
        {
            return Session.QueryOver<TEntity>().RowCountInt64();
        }

        #endregion

        #region Exists

        /// <summary>
        /// Checks if an entity with the given key exists
        /// </summary>
        /// <param name="id">The entity unique identifier</param>
        /// <returns>True if entity exists</returns>
        public bool Exists(TKey id)
        {
            return QueryById(id).Any();
        }

        #endregion
    }
}


text:
package org.wso2.carbon.identity.entitlement.cache;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.identity.entitlement.PDPConstants;
import org.wso2.carbon.identity.entitlement.common.EntitlementConstants;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * PolicyCache is to manage cluster level distributed cache for the status of the policy file. This is not distribute
 * complete policy file within cluster itself.
 */
public class PolicyCache extends EntitlementBaseCache<IdentityCacheKey, PolicyStatus>{

    private static Log log = LogFactory.getLog(PolicyCache.class);
    private static final Object lock = new Object();
    private int myHashCode;
    private static Map<Integer,Integer> cacheInvalidationState = new HashMap<Integer, Integer>();
    private static Map<Integer,Map<String,PolicyStatus>> localPolicyCacheMap = new HashMap<Integer,Map<String,PolicyStatus>>();

    /**
     *
     * @param timeout
     */
    public PolicyCache(int timeout) {
    	super(PDPConstants.ENTITLEMENT_POLICY_INVALIDATION_CACHE,timeout);
        PolicyCacheUpdateListener policyCacheUpdateListener = new PolicyCacheUpdateListener();
        PolicyCacheCreatedListener policyCacheCreatedListener = new PolicyCacheCreatedListener();
        setCacheEntryUpdatedListener(policyCacheUpdateListener);
        setCacheEntryCreatedListener(policyCacheCreatedListener);
        initCacheBuilder();

        if(log.isDebugEnabled()){
            int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
            log.debug("PolicyCache initializing for tenant " + tenantId);
        }
    }

    /**
     * This method triggered by cache entry listener.
     *
     * @param identityCacheKey
     * @param policyStatus
     */
    public static void updateLocalPolicyCacheMap(IdentityCacheKey identityCacheKey, PolicyStatus policyStatus){
        if(identityCacheKey.getKey()!=null) {
            if(!identityCacheKey.getKey().equals("")) {
                if(log.isDebugEnabled()){
                    log.debug("Updating local cache map for the tenant : " + identityCacheKey.getTenantId() + " and Policy : " + identityCacheKey.getKey());
                }
                synchronized (localPolicyCacheMap) {
                    if (localPolicyCacheMap.get(identityCacheKey.getTenantId()) != null) {
                        if(localPolicyCacheMap.get(identityCacheKey.getTenantId()).get(identityCacheKey.getKey())!=null){
                            PolicyStatus status = localPolicyCacheMap.get(identityCacheKey.getTenantId()).get(identityCacheKey.getKey());
                            status.setPolicyAction(getPriorityAction(status.getPolicyAction(),policyStatus.getPolicyAction()));
                            if(log.isDebugEnabled()){
                                log.debug("Updated existing policy in local cache map :  Policy : " + identityCacheKey.getKey() + " and new action : " + getPriorityAction(status.getPolicyAction(),policyStatus.getPolicyAction()));
                            }
                        }else{
                            localPolicyCacheMap.get(identityCacheKey.getTenantId()).put(policyStatus.getPolicyId(),policyStatus);
                            if(log.isDebugEnabled()){
                                log.debug("Adding policy in to the local cache policy map : policy :  " + identityCacheKey.getKey()  );
                            }
                        }
                    } else {
                        Map<String,PolicyStatus> map = new HashMap<String,PolicyStatus>();

                        map.put(policyStatus.getPolicyId(),policyStatus);
                        localPolicyCacheMap.put(identityCacheKey.getTenantId(), map);
                        if(log.isDebugEnabled()){
                            log.debug("Adding policy in to the local cache policy map : policy :  " + identityCacheKey.getKey() + " add new entry for this tenant : " + identityCacheKey.getTenantId() );
                        }

                    }
                }
            }else{
                cacheInvalidationState.put(identityCacheKey.getTenantId(),1);
                if(log.isDebugEnabled()){
                    log.debug("Trigger event to clear all cache in tenant :  " + identityCacheKey.getTenantId());
                }
            }
        }
    }

    /**
     * Do invalidate all policy cache
     */
    public void invalidateCache(){

        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        if(log.isDebugEnabled()){
            log.debug("Trigger invalidateCache to tenant :  " + tenantId + " and all policy ");
        }

        IdentityCacheKey cacheKey = new IdentityCacheKey(tenantId,"");
        addToCache(cacheKey,new PolicyStatus());

    }

    /**
     * Check the state of expire in local cache.
     *
     * @return
     */
    public boolean isInvalidate(){

        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        int state = 0 ;

        synchronized (cacheInvalidationState) {
            if(cacheInvalidationState.get(tenantId)!=null) {
                state = cacheInvalidationState.get(tenantId);
            }

            cacheInvalidationState.put(tenantId,0);
        }
        if(log.isDebugEnabled()){
            log.debug("Check the invalidation state of all cache : " + state);
        }

        if(state==1){
            return true ;
        }else{
            return false ;
        }

    }

    /**
     *
     * Invalidate any policy with action. It will send the cluster message to clean this policy in all the nodes.
     *
     * @param policyId
     * @param action
     */
    public void invalidateCache(String policyId, String action) {

        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();

        if(log.isDebugEnabled()){
            log.debug("Trigger invalidateCache to tenant :  " + tenantId + " and policy " + policyId + " for  action " +
                    ": " + action);
        }

        IdentityCacheKey cacheKey = new IdentityCacheKey(tenantId,policyId);
        PolicyStatus policyStatus = (PolicyStatus)getValueFromCache(cacheKey);

        if(policyStatus==null) {
            policyStatus = new PolicyStatus(policyId,0,action);
        }else{
            policyStatus.setStatusCount(policyStatus.getStatusCount() + 1);
            policyStatus.setPolicyAction(action);
        }
        updateToCache(cacheKey, policyStatus);

        synchronized (localPolicyCacheMap) {
            if(localPolicyCacheMap.get(cacheKey.getTenantId())!=null){
                if(localPolicyCacheMap.get(cacheKey.getTenantId()).get(cacheKey.getKey())!=null){
                    PolicyStatus status = localPolicyCacheMap.get(cacheKey.getTenantId()).get(cacheKey.getKey());
                    status.setPolicyAction(getPriorityAction(status.getPolicyAction(),action));
                }
            }else{
                Map<String,PolicyStatus> map = new HashMap<String,PolicyStatus>();

                map.put(policyId,policyStatus);
                localPolicyCacheMap.put(cacheKey.getTenantId(),map);
            }
        }
    }

    /**
     * Read the invalidated policies in the local cache. Local cache always synch up with the cluster cache.
     *
     * @return
     */
    public Collection<PolicyStatus> getInvalidatedPolicies(){

        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();

        if(log.isDebugEnabled()){
            log.debug("Reading invalidated policy files for : "+ tenantId);
        }
        Collection<PolicyStatus> tmpSet = null ;

        if(localPolicyCacheMap.get(tenantId)!=null) {

            Map<String,PolicyStatus> tmpMap = localPolicyCacheMap.get(tenantId);
            tmpSet = tmpMap.values();
        }

        return tmpSet ;
    }

    /**
     * This method is for get the priority of the action.
     *
     * ex: There is already updated action saying change the order of that. But another action coming syaing delete
     * this. What would be the latest state of that policy cache ? It is decided by the following order. In this case
     * even though the older state is -re-order, we have to change it to the delete because delete is highher than
     * the re-order.
     *
     * @param currentAction
     * @param newAction
     * @return
     */
    private static String getPriorityAction(String currentAction, String newAction){

        if(EntitlementConstants.PolicyPublish.ACTION_DELETE.equals(currentAction) || EntitlementConstants.PolicyPublish.ACTION_DELETE.equals(newAction)){
            return EntitlementConstants.PolicyPublish.ACTION_DELETE;
        }else if(EntitlementConstants.PolicyPublish.ACTION_DISABLE.equals(currentAction) || EntitlementConstants.PolicyPublish.ACTION_DISABLE.equals(newAction)){
            return EntitlementConstants.PolicyPublish.ACTION_DELETE;
        }else if(EntitlementConstants.PolicyPublish.ACTION_ENABLE.equals(currentAction) || EntitlementConstants.PolicyPublish.ACTION_ENABLE.equals(newAction)){
            return EntitlementConstants.PolicyPublish.ACTION_CREATE;
        }else if(EntitlementConstants.PolicyPublish.ACTION_UPDATE.equals(currentAction) || EntitlementConstants.PolicyPublish.ACTION_UPDATE.equals(newAction)){
            return EntitlementConstants.PolicyPublish.ACTION_UPDATE;
        }else if(EntitlementConstants.PolicyPublish.ACTION_ORDER.equals(currentAction) || EntitlementConstants.PolicyPublish.ACTION_ORDER.equals(newAction)){
            return EntitlementConstants.PolicyPublish.ACTION_ORDER;
        }
        return newAction ;
    }

}


text:
<?php
/**
 * Created by PhpStorm.
 * User: sunny
 * Date: 2015/9/16
 * Time: 14:56
 */
namespace OC\Files\Mount;
use OCP\Files\Mount\IMountDatabase;

class MountDatabase implements IMountDatabase{

    /**
     * 获取mount表中所有mount信息
     * time:2015.9.16
     * by sunny
     * @return 所有mount信息
     */
    public function getAllMountPoints()
    {
        $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*mount` ');
        $result = $query->execute();
        $res=$result->fetchAll();
        return $res;
    }
    /**
     * 获取对应用户名的mount信息
     * time:2015.9.16
     * by sunny
     * @return 某个mount信息
     */
    public function getMountPointByUserAndStorage($uid,$storage)
    {
        $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*mount`  WHERE LOWER(`name`) = LOWER(?) AND `storage_name`=?');
        $result = $query->execute(array($uid,$storage));
        $res=$result->fetchRow();
        return $res;
    }
    /**
     * 获取对应用户名的mount信息
     * time:2015.9.16
     * by sunny
     * @return 某个mount信息
     */
    public function getMountPointByUser($uid)
    {
        $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*mount`  WHERE LOWER(`name`) = LOWER(?)');
        $result = $query->execute(array($uid));
        $res=$result->fetchRow();
        return $res;
    }
    /**
     * 插入mount数据库
     * time:2015.9.16
     * by sunny
     * @return true or false
     */
    public function insertMountPoint($mountpoint)
    {
        $name=key($mountpoint);

        $storage_name=key($mountpoint[$name]);

        $storage=$mountpoint[$name][$storage_name];

        $class=$storage['class'];

        $option=json_encode($storage['options']);

        $priority=$storage['priority'];

        $storage_id=$storage['storage_id'];

        $query = \OC_DB::prepare('INSERT INTO `*PREFIX*mount` ( `category`, `name`, `storage_name`, `class`, `options`, `priority`, `storage_id` ) VALUES( ?, ?, ?, ?, ?, ?, ? )');
        $result = $query->execute(array(0,$name, $storage_name,$class,$option,$priority,$storage_id));

        return $result ? true : false;
    }
    /**
     * 根据用户uid删除mount信息
     * time:2015.9.16
     * by sunny
     * @return 删除某个mount信息
     */
    public function deleteMountPoint($uid,$storage)
    {
        $query = \OC_DB::prepare('DELETE FROM `*PREFIX*mount` WHERE `name` = ? AND `storage_name` = ?');
        $result = $query->execute(array($uid,$storage));

        return $result ? true : false;
    }
}


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.08.27 at 09:11:46 AM CEST
//

package com.logitags.cibet.bindings;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

/**
 *
Java class for CustomControlBinding complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="CustomControlBinding">
 *   <complexContent>
 *     <extension base="{http://www.logitags.com}InExBinding">
 *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}token" />
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CustomControlBinding")
public class CustomControlBinding
    extends InExBinding
{

    @XmlAttribute(name = "name", required = true)
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    @XmlSchemaType(name = "token")
    protected String name;

    /**
     * Gets the value of the name property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setName(String value) {
        this.name = value;
    }

}


text:
Cross platform 256bit AES encryption / decryption.
========
This project contains the implementation of 256 bit AES encryption which works on all the platforms (C#, iOS, Android and Node.js). One of the key objective is to make AES work on all the platforms with simple implementation.

Platforms Supported:

1. iOS

2. Android

3. Windows (C#).

4. Node.js

Features:

1. Cross platform support. Encryption-Decryption works across C#, iOS, Android and Node.js.

2. Support for Random IV (initialization vector) for encryption and decryption. Randomization is crucial for encryption schemes to achieve semantic security, a property whereby repeated usage of the scheme under the same key does not allow an attacker to infer relationships between segments of the encrypted message.

3.  Support for SHA-256 for hashing the key. Never use plain text as encryption key. Always hash the plain text key and then use for encryption. AES permits the use of 256-bit keys. Breaking a symmetric 256-bit key by brute force requires 2^128 times more computational power than a 128-bit key. A device that could check a billion billion (10^18) AES keys per second would in theory require about 3×10^51 years to exhaust the 256-bit key space.

How to encrypt a string:

See code samples for more details. You'll have to perform following steps:

1. Generate Ramdom IV using the provided randomIV generator function.
2. Select a secret key and hash it using the provided SHA-256 hash function.
3. Encrypt your string using the hashed key and random IV.

How to decrypt a string:

See code samples for more details. You'll have to perform following steps:

1. Get the encrypted text and the randomIV used for encryption
2. Decrypt the strying using the provided decrypt function !


text:
<!DOCTYPE html>

	<title>A Web Dev Playground</title>
	<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" type="text/css" href="/css/normalize.css">
	<link rel="stylesheet" type="text/css" href="/css/style.css">

STEPH LOPEZ

Web Developer

HTML - CSS - EXPERT

DEAD CENTER

PURE CSS

THIS OPTIMIZED SUN IMAGE ROTATES INFINITELY

THIS CIRCLE ZOOMS ON HOVER

RESPONSIVE GRID

			I MADE THESE TILES RESPONSIVE ACROSS ALL SCREEN SIZES

INPUT FIELDS

			<form>

				<input type="text" placeholder="HTML/CSS BEST PRACTICES">

			</form>

				1

				PRETTY AWESOME TEAMMATE!

I  BEM SYNTAX!


text:
using UnityEngine;

public class MonoSingletonAtom : MonoBehaviour {

    /// <summary>
    /// Be aware this will not prevent a non singleton constructor
    ///   such as `T myT = new T();`
    /// To prevent that, add `protected T () {}` to your singleton class.
    ///
    /// As a note, this is made as MonoBehaviour because we need Coroutines.
    ///
    /// 加线程锁的单例
    /// </summary>
    public class MonoSingletonAtom<T> : MonoBehaviour where T : MonoBehaviour
    {
        private static T mInstance;

        private static object mLock = new object();

        public static T Instance
        {
            get
            {
                if (applicationIsQuitting)
                {
                    Debug.LogError("[Singleton] Instance '" + typeof(T) +
                    "' already destroyed on application quit." +
                    " Won't create again - returning null.");
                    return null;
                }

                lock (mLock)
                {
                    if (mInstance == null)
                    {
                        mInstance = (T)FindObjectOfType(typeof(T));

                        if (FindObjectsOfType(typeof(T)).Length > 1)
                        {
                            Debug.LogError("[Singleton] Something went really wrong " +
                                " - there should never be more than 1 singleton!" +
                                " Reopening the scene might fix it.");
                            return mInstance;
                        }

                        if (mInstance == null)
                        {
                            GameObject singleton = new GameObject();
                            mInstance = singleton.AddComponent<T>();
                            singleton.name = "(singleton) " + typeof(T).ToString();

                            DontDestroyOnLoad(singleton);

                            Debug.LogError("[Singleton] An instance of " + typeof(T) +
                                " is needed in the scene, so '" + singleton +
                                "' was created with DontDestroyOnLoad.");
                        }
                        else
                        {
                            Debug.LogError("[Singleton] Using instance already created: " +
                                mInstance.gameObject.name);
                        }
                    }

                    return mInstance;
                }
            }
        }

        private static bool applicationIsQuitting = false;
        /// <summary>
        /// When Unity quits, it destroys objects in a random order.
        /// In principle, a Singleton is only destroyed when application quits.
        /// If any script calls Instance after it have been destroyed,
        ///   it will create a buggy ghost object that will stay on the Editor scene
        ///   even after stopping playing the Application. Really bad!
        /// So, this was made to be sure we're not creating that buggy ghost object.
        /// </summary>
        public void OnDestroy()
        {
            applicationIsQuitting = true;
        }
    }
}