text:
namespace PlayFabServerSdk
{
    void PlayFabServer_ServerSysComponent::Reflect(AZ::ReflectContext* context)
    {
        if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
        {
            serialize->Class<PlayFabServer_ServerSysComponent, AZ::Component>()
                ->Version(0)
                ->SerializerForEmptyClass();

            if (AZ::EditContext* ec = serialize->GetEditContext())
            {
                ec->Class<PlayFabServer_ServerSysComponent>("PlayFabServer_Server", "Provides access to the Server API within the PlayFab Server SDK")
                    ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
                    // ->Attribute(AZ::Edit::Attributes::Category, "") Set a category
                    ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System"))
                    ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
                    ;
            }
        }
    }

    void PlayFabServer_ServerSysComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
    {
        provided.push_back(AZ_CRC("PlayFabServer_ServerService"));
    }

    void PlayFabServer_ServerSysComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
    {
        incompatible.push_back(AZ_CRC("PlayFabServer_ServerService"));
    }

    void PlayFabServer_ServerSysComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
    {
        (void)required;
    }

    void PlayFabServer_ServerSysComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
    {
        (void)dependent;
    }

    void PlayFabServer_ServerSysComponent::Init()
    {
    }

    void PlayFabServer_ServerSysComponent::Activate()
    {
        PlayFabServer_ServerRequestBus::Handler::BusConnect();
    }

    void PlayFabServer_ServerSysComponent::Deactivate()
    {
        PlayFabServer_ServerRequestBus::Handler::BusDisconnect();
    }

    int PlayFabServer_ServerSysComponent::GetPendingCalls()
    {
        return PlayFabRequestManager::playFabHttp->GetPendingCalls();
    }

    // ------------ Generated API call wrappers
    void PlayFabServer_ServerSysComponent::AddCharacterVirtualCurrency(ServerModels::AddCharacterVirtualCurrencyRequest& request, ProcessApiCallback<ServerModels::ModifyCharacterVirtualCurrencyResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::AddCharacterVirtualCurrency(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::AddFriend(ServerModels::AddFriendRequest& request, ProcessApiCallback<ServerModels::EmptyResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::AddFriend(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::AddPlayerTag(ServerModels::AddPlayerTagRequest& request, ProcessApiCallback<ServerModels::AddPlayerTagResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::AddPlayerTag(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::AddSharedGroupMembers(ServerModels::AddSharedGroupMembersRequest& request, ProcessApiCallback<ServerModels::AddSharedGroupMembersResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::AddSharedGroupMembers(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::AddUserVirtualCurrency(ServerModels::AddUserVirtualCurrencyRequest& request, ProcessApiCallback<ServerModels::ModifyUserVirtualCurrencyResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::AddUserVirtualCurrency(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::AuthenticateSessionTicket(ServerModels::AuthenticateSessionTicketRequest& request, ProcessApiCallback<ServerModels::AuthenticateSessionTicketResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::AuthenticateSessionTicket(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::AwardSteamAchievement(ServerModels::AwardSteamAchievementRequest& request, ProcessApiCallback<ServerModels::AwardSteamAchievementResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::AwardSteamAchievement(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::BanUsers(ServerModels::BanUsersRequest& request, ProcessApiCallback<ServerModels::BanUsersResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::BanUsers(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::ConsumeItem(ServerModels::ConsumeItemRequest& request, ProcessApiCallback<ServerModels::ConsumeItemResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::ConsumeItem(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::CreateSharedGroup(ServerModels::CreateSharedGroupRequest& request, ProcessApiCallback<ServerModels::CreateSharedGroupResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::CreateSharedGroup(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::DeleteCharacterFromUser(ServerModels::DeleteCharacterFromUserRequest& request, ProcessApiCallback<ServerModels::DeleteCharacterFromUserResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::DeleteCharacterFromUser(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::DeleteSharedGroup(ServerModels::DeleteSharedGroupRequest& request, ProcessApiCallback<ServerModels::EmptyResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::DeleteSharedGroup(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::DeleteUsers(ServerModels::DeleteUsersRequest& request, ProcessApiCallback<ServerModels::DeleteUsersResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::DeleteUsers(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::DeregisterGame(ServerModels::DeregisterGameRequest& request, ProcessApiCallback<ServerModels::DeregisterGameResponse> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::DeregisterGame(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::EvaluateRandomResultTable(ServerModels::EvaluateRandomResultTableRequest& request, ProcessApiCallback<ServerModels::EvaluateRandomResultTableResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::EvaluateRandomResultTable(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::ExecuteCloudScript(ServerModels::ExecuteCloudScriptServerRequest& request, ProcessApiCallback<ServerModels::ExecuteCloudScriptResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::ExecuteCloudScript(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetAllSegments(ProcessApiCallback<ServerModels::GetAllSegmentsResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetAllSegments(callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetAllUsersCharacters(ServerModels::ListUsersCharactersRequest& request, ProcessApiCallback<ServerModels::ListUsersCharactersResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetAllUsersCharacters(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetCatalogItems(ServerModels::GetCatalogItemsRequest& request, ProcessApiCallback<ServerModels::GetCatalogItemsResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetCatalogItems(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetCharacterData(ServerModels::GetCharacterDataRequest& request, ProcessApiCallback<ServerModels::GetCharacterDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetCharacterData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetCharacterInternalData(ServerModels::GetCharacterDataRequest& request, ProcessApiCallback<ServerModels::GetCharacterDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetCharacterInternalData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetCharacterInventory(ServerModels::GetCharacterInventoryRequest& request, ProcessApiCallback<ServerModels::GetCharacterInventoryResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetCharacterInventory(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetCharacterLeaderboard(ServerModels::GetCharacterLeaderboardRequest& request, ProcessApiCallback<ServerModels::GetCharacterLeaderboardResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetCharacterLeaderboard(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetCharacterReadOnlyData(ServerModels::GetCharacterDataRequest& request, ProcessApiCallback<ServerModels::GetCharacterDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetCharacterReadOnlyData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetCharacterStatistics(ServerModels::GetCharacterStatisticsRequest& request, ProcessApiCallback<ServerModels::GetCharacterStatisticsResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetCharacterStatistics(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetContentDownloadUrl(ServerModels::GetContentDownloadUrlRequest& request, ProcessApiCallback<ServerModels::GetContentDownloadUrlResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetContentDownloadUrl(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetFriendLeaderboard(ServerModels::GetFriendLeaderboardRequest& request, ProcessApiCallback<ServerModels::GetLeaderboardResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetFriendLeaderboard(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetFriendsList(ServerModels::GetFriendsListRequest& request, ProcessApiCallback<ServerModels::GetFriendsListResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetFriendsList(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetLeaderboard(ServerModels::GetLeaderboardRequest& request, ProcessApiCallback<ServerModels::GetLeaderboardResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetLeaderboard(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetLeaderboardAroundCharacter(ServerModels::GetLeaderboardAroundCharacterRequest& request, ProcessApiCallback<ServerModels::GetLeaderboardAroundCharacterResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetLeaderboardAroundCharacter(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetLeaderboardAroundUser(ServerModels::GetLeaderboardAroundUserRequest& request, ProcessApiCallback<ServerModels::GetLeaderboardAroundUserResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetLeaderboardAroundUser(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetLeaderboardForUserCharacters(ServerModels::GetLeaderboardForUsersCharactersRequest& request, ProcessApiCallback<ServerModels::GetLeaderboardForUsersCharactersResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetLeaderboardForUserCharacters(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetPlayerCombinedInfo(ServerModels::GetPlayerCombinedInfoRequest& request, ProcessApiCallback<ServerModels::GetPlayerCombinedInfoResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetPlayerCombinedInfo(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetPlayerProfile(ServerModels::GetPlayerProfileRequest& request, ProcessApiCallback<ServerModels::GetPlayerProfileResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetPlayerProfile(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetPlayerSegments(ServerModels::GetPlayersSegmentsRequest& request, ProcessApiCallback<ServerModels::GetPlayerSegmentsResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetPlayerSegments(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetPlayersInSegment(ServerModels::GetPlayersInSegmentRequest& request, ProcessApiCallback<ServerModels::GetPlayersInSegmentResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetPlayersInSegment(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetPlayerStatistics(ServerModels::GetPlayerStatisticsRequest& request, ProcessApiCallback<ServerModels::GetPlayerStatisticsResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetPlayerStatistics(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetPlayerStatisticVersions(ServerModels::GetPlayerStatisticVersionsRequest& request, ProcessApiCallback<ServerModels::GetPlayerStatisticVersionsResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetPlayerStatisticVersions(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetPlayerTags(ServerModels::GetPlayerTagsRequest& request, ProcessApiCallback<ServerModels::GetPlayerTagsResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetPlayerTags(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetPlayFabIDsFromFacebookIDs(ServerModels::GetPlayFabIDsFromFacebookIDsRequest& request, ProcessApiCallback<ServerModels::GetPlayFabIDsFromFacebookIDsResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetPlayFabIDsFromFacebookIDs(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetPlayFabIDsFromNintendoSwitchDeviceIds(ServerModels::GetPlayFabIDsFromNintendoSwitchDeviceIdsRequest& request, ProcessApiCallback<ServerModels::GetPlayFabIDsFromNintendoSwitchDeviceIdsResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetPlayFabIDsFromNintendoSwitchDeviceIds(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetPlayFabIDsFromSteamIDs(ServerModels::GetPlayFabIDsFromSteamIDsRequest& request, ProcessApiCallback<ServerModels::GetPlayFabIDsFromSteamIDsResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetPlayFabIDsFromSteamIDs(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetPublisherData(ServerModels::GetPublisherDataRequest& request, ProcessApiCallback<ServerModels::GetPublisherDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetPublisherData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetRandomResultTables(ServerModels::GetRandomResultTablesRequest& request, ProcessApiCallback<ServerModels::GetRandomResultTablesResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetRandomResultTables(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetSharedGroupData(ServerModels::GetSharedGroupDataRequest& request, ProcessApiCallback<ServerModels::GetSharedGroupDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetSharedGroupData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetTime(ProcessApiCallback<ServerModels::GetTimeResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetTime(callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetTitleData(ServerModels::GetTitleDataRequest& request, ProcessApiCallback<ServerModels::GetTitleDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetTitleData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetTitleInternalData(ServerModels::GetTitleDataRequest& request, ProcessApiCallback<ServerModels::GetTitleDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetTitleInternalData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetTitleNews(ServerModels::GetTitleNewsRequest& request, ProcessApiCallback<ServerModels::GetTitleNewsResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetTitleNews(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetUserAccountInfo(ServerModels::GetUserAccountInfoRequest& request, ProcessApiCallback<ServerModels::GetUserAccountInfoResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetUserAccountInfo(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetUserBans(ServerModels::GetUserBansRequest& request, ProcessApiCallback<ServerModels::GetUserBansResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetUserBans(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetUserData(ServerModels::GetUserDataRequest& request, ProcessApiCallback<ServerModels::GetUserDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetUserData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetUserInternalData(ServerModels::GetUserDataRequest& request, ProcessApiCallback<ServerModels::GetUserDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetUserInternalData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetUserInventory(ServerModels::GetUserInventoryRequest& request, ProcessApiCallback<ServerModels::GetUserInventoryResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetUserInventory(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetUserPublisherData(ServerModels::GetUserDataRequest& request, ProcessApiCallback<ServerModels::GetUserDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetUserPublisherData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetUserPublisherInternalData(ServerModels::GetUserDataRequest& request, ProcessApiCallback<ServerModels::GetUserDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetUserPublisherInternalData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetUserPublisherReadOnlyData(ServerModels::GetUserDataRequest& request, ProcessApiCallback<ServerModels::GetUserDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetUserPublisherReadOnlyData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GetUserReadOnlyData(ServerModels::GetUserDataRequest& request, ProcessApiCallback<ServerModels::GetUserDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GetUserReadOnlyData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GrantCharacterToUser(ServerModels::GrantCharacterToUserRequest& request, ProcessApiCallback<ServerModels::GrantCharacterToUserResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GrantCharacterToUser(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GrantItemsToCharacter(ServerModels::GrantItemsToCharacterRequest& request, ProcessApiCallback<ServerModels::GrantItemsToCharacterResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GrantItemsToCharacter(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GrantItemsToUser(ServerModels::GrantItemsToUserRequest& request, ProcessApiCallback<ServerModels::GrantItemsToUserResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GrantItemsToUser(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::GrantItemsToUsers(ServerModels::GrantItemsToUsersRequest& request, ProcessApiCallback<ServerModels::GrantItemsToUsersResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::GrantItemsToUsers(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::ModifyItemUses(ServerModels::ModifyItemUsesRequest& request, ProcessApiCallback<ServerModels::ModifyItemUsesResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::ModifyItemUses(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::MoveItemToCharacterFromCharacter(ServerModels::MoveItemToCharacterFromCharacterRequest& request, ProcessApiCallback<ServerModels::MoveItemToCharacterFromCharacterResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::MoveItemToCharacterFromCharacter(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::MoveItemToCharacterFromUser(ServerModels::MoveItemToCharacterFromUserRequest& request, ProcessApiCallback<ServerModels::MoveItemToCharacterFromUserResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::MoveItemToCharacterFromUser(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::MoveItemToUserFromCharacter(ServerModels::MoveItemToUserFromCharacterRequest& request, ProcessApiCallback<ServerModels::MoveItemToUserFromCharacterResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::MoveItemToUserFromCharacter(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::NotifyMatchmakerPlayerLeft(ServerModels::NotifyMatchmakerPlayerLeftRequest& request, ProcessApiCallback<ServerModels::NotifyMatchmakerPlayerLeftResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::NotifyMatchmakerPlayerLeft(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::RedeemCoupon(ServerModels::RedeemCouponRequest& request, ProcessApiCallback<ServerModels::RedeemCouponResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::RedeemCoupon(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::RedeemMatchmakerTicket(ServerModels::RedeemMatchmakerTicketRequest& request, ProcessApiCallback<ServerModels::RedeemMatchmakerTicketResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::RedeemMatchmakerTicket(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::RefreshGameServerInstanceHeartbeat(ServerModels::RefreshGameServerInstanceHeartbeatRequest& request, ProcessApiCallback<ServerModels::RefreshGameServerInstanceHeartbeatResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::RefreshGameServerInstanceHeartbeat(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::RegisterGame(ServerModels::RegisterGameRequest& request, ProcessApiCallback<ServerModels::RegisterGameResponse> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::RegisterGame(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::RemoveFriend(ServerModels::RemoveFriendRequest& request, ProcessApiCallback<ServerModels::EmptyResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::RemoveFriend(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::RemovePlayerTag(ServerModels::RemovePlayerTagRequest& request, ProcessApiCallback<ServerModels::RemovePlayerTagResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::RemovePlayerTag(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::RemoveSharedGroupMembers(ServerModels::RemoveSharedGroupMembersRequest& request, ProcessApiCallback<ServerModels::RemoveSharedGroupMembersResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::RemoveSharedGroupMembers(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::ReportPlayer(ServerModels::ReportPlayerServerRequest& request, ProcessApiCallback<ServerModels::ReportPlayerServerResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::ReportPlayer(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::RevokeAllBansForUser(ServerModels::RevokeAllBansForUserRequest& request, ProcessApiCallback<ServerModels::RevokeAllBansForUserResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::RevokeAllBansForUser(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::RevokeBans(ServerModels::RevokeBansRequest& request, ProcessApiCallback<ServerModels::RevokeBansResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::RevokeBans(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::RevokeInventoryItem(ServerModels::RevokeInventoryItemRequest& request, ProcessApiCallback<ServerModels::RevokeInventoryResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::RevokeInventoryItem(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::RevokeInventoryItems(ServerModels::RevokeInventoryItemsRequest& request, ProcessApiCallback<ServerModels::RevokeInventoryItemsResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::RevokeInventoryItems(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::SendCustomAccountRecoveryEmail(ServerModels::SendCustomAccountRecoveryEmailRequest& request, ProcessApiCallback<ServerModels::SendCustomAccountRecoveryEmailResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::SendCustomAccountRecoveryEmail(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::SendEmailFromTemplate(ServerModels::SendEmailFromTemplateRequest& request, ProcessApiCallback<ServerModels::SendEmailFromTemplateResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::SendEmailFromTemplate(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::SendPushNotification(ServerModels::SendPushNotificationRequest& request, ProcessApiCallback<ServerModels::SendPushNotificationResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::SendPushNotification(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::SetFriendTags(ServerModels::SetFriendTagsRequest& request, ProcessApiCallback<ServerModels::EmptyResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::SetFriendTags(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::SetGameServerInstanceData(ServerModels::SetGameServerInstanceDataRequest& request, ProcessApiCallback<ServerModels::SetGameServerInstanceDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::SetGameServerInstanceData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::SetGameServerInstanceState(ServerModels::SetGameServerInstanceStateRequest& request, ProcessApiCallback<ServerModels::SetGameServerInstanceStateResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::SetGameServerInstanceState(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::SetGameServerInstanceTags(ServerModels::SetGameServerInstanceTagsRequest& request, ProcessApiCallback<ServerModels::SetGameServerInstanceTagsResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::SetGameServerInstanceTags(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::SetPlayerSecret(ServerModels::SetPlayerSecretRequest& request, ProcessApiCallback<ServerModels::SetPlayerSecretResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::SetPlayerSecret(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::SetPublisherData(ServerModels::SetPublisherDataRequest& request, ProcessApiCallback<ServerModels::SetPublisherDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::SetPublisherData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::SetTitleData(ServerModels::SetTitleDataRequest& request, ProcessApiCallback<ServerModels::SetTitleDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::SetTitleData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::SetTitleInternalData(ServerModels::SetTitleDataRequest& request, ProcessApiCallback<ServerModels::SetTitleDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::SetTitleInternalData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::SubtractCharacterVirtualCurrency(ServerModels::SubtractCharacterVirtualCurrencyRequest& request, ProcessApiCallback<ServerModels::ModifyCharacterVirtualCurrencyResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::SubtractCharacterVirtualCurrency(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::SubtractUserVirtualCurrency(ServerModels::SubtractUserVirtualCurrencyRequest& request, ProcessApiCallback<ServerModels::ModifyUserVirtualCurrencyResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::SubtractUserVirtualCurrency(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UnlockContainerInstance(ServerModels::UnlockContainerInstanceRequest& request, ProcessApiCallback<ServerModels::UnlockContainerItemResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UnlockContainerInstance(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UnlockContainerItem(ServerModels::UnlockContainerItemRequest& request, ProcessApiCallback<ServerModels::UnlockContainerItemResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UnlockContainerItem(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UpdateAvatarUrl(ServerModels::UpdateAvatarUrlRequest& request, ProcessApiCallback<ServerModels::EmptyResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UpdateAvatarUrl(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UpdateBans(ServerModels::UpdateBansRequest& request, ProcessApiCallback<ServerModels::UpdateBansResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UpdateBans(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UpdateCharacterData(ServerModels::UpdateCharacterDataRequest& request, ProcessApiCallback<ServerModels::UpdateCharacterDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UpdateCharacterData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UpdateCharacterInternalData(ServerModels::UpdateCharacterDataRequest& request, ProcessApiCallback<ServerModels::UpdateCharacterDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UpdateCharacterInternalData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UpdateCharacterReadOnlyData(ServerModels::UpdateCharacterDataRequest& request, ProcessApiCallback<ServerModels::UpdateCharacterDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UpdateCharacterReadOnlyData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UpdateCharacterStatistics(ServerModels::UpdateCharacterStatisticsRequest& request, ProcessApiCallback<ServerModels::UpdateCharacterStatisticsResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UpdateCharacterStatistics(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UpdatePlayerStatistics(ServerModels::UpdatePlayerStatisticsRequest& request, ProcessApiCallback<ServerModels::UpdatePlayerStatisticsResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UpdatePlayerStatistics(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UpdateSharedGroupData(ServerModels::UpdateSharedGroupDataRequest& request, ProcessApiCallback<ServerModels::UpdateSharedGroupDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UpdateSharedGroupData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UpdateUserData(ServerModels::UpdateUserDataRequest& request, ProcessApiCallback<ServerModels::UpdateUserDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UpdateUserData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UpdateUserInternalData(ServerModels::UpdateUserInternalDataRequest& request, ProcessApiCallback<ServerModels::UpdateUserDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UpdateUserInternalData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UpdateUserInventoryItemCustomData(ServerModels::UpdateUserInventoryItemDataRequest& request, ProcessApiCallback<ServerModels::EmptyResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UpdateUserInventoryItemCustomData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UpdateUserPublisherData(ServerModels::UpdateUserDataRequest& request, ProcessApiCallback<ServerModels::UpdateUserDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UpdateUserPublisherData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UpdateUserPublisherInternalData(ServerModels::UpdateUserInternalDataRequest& request, ProcessApiCallback<ServerModels::UpdateUserDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UpdateUserPublisherInternalData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UpdateUserPublisherReadOnlyData(ServerModels::UpdateUserDataRequest& request, ProcessApiCallback<ServerModels::UpdateUserDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UpdateUserPublisherReadOnlyData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::UpdateUserReadOnlyData(ServerModels::UpdateUserDataRequest& request, ProcessApiCallback<ServerModels::UpdateUserDataResult> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::UpdateUserReadOnlyData(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::WriteCharacterEvent(ServerModels::WriteServerCharacterEventRequest& request, ProcessApiCallback<ServerModels::WriteEventResponse> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::WriteCharacterEvent(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::WritePlayerEvent(ServerModels::WriteServerPlayerEventRequest& request, ProcessApiCallback<ServerModels::WriteEventResponse> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::WritePlayerEvent(request, callback, errorCallback, customData);
    }
    void PlayFabServer_ServerSysComponent::WriteTitleEvent(ServerModels::WriteTitleEventRequest& request, ProcessApiCallback<ServerModels::WriteEventResponse> callback, ErrorCallback errorCallback, void* customData)
    {
        PlayFabServerApi::WriteTitleEvent(request, callback, errorCallback, customData);
    }
}


text:
import os

from paradrop.core.config import devices

class AirsharkInterfaceManager(object):
    def __init__(self):
        self.interface = None
        self.observers = []

    def interface_available(self):
        return self.interface != None

    def add_observer(self, observer):
        if self.observers.count(observer) == 0:
            self.observers.append(observer)

    def remove_observer(self, observer):
        if self.observers.count(observer) == 1:
            self.observers.remove(observer)

    def set_interface(self, interface):
        self.reset_interface()

        os.system("ip link set %s down" % interface)
        os.system("iw dev %s set type managed" % interface)
        os.system("ip link set %s up" % interface)

        self.interface = interface
        for observer in self.observers:
            observer.on_interface_up(self.interface)

    def reset_interface(self):
        if (self.interface is not None):
            for observer in self.observers:
                observer.on_interface_down(self.interface)

            self.interface = None

airshark_interface_manager = AirsharkInterfaceManager()

def configure(update):
    """
    Configure an Airshark interface.
    """
    hostConfig = update.cache_get('hostConfig')
    networkDevices = update.cache_get('networkDevices')

    interfaces = hostConfig.get('wifi-interfaces', [])
    airshark_interfaces = []

    # Look for objects in wifi-interfaces with mode == 'airshark'.
    for interface in interfaces:
        if interface.get('mode', None) != 'airshark':
            continue

        device = devices.resolveWirelessDevRef(interface['device'],
                networkDevices)
        if device['primary_interface'] is not None:
            airshark_interfaces.append(device['primary_interface'])

    if len(airshark_interfaces) > 1:
        raise Exception("Only one wifi interface can be in airshark mode")
    elif len(airshark_interfaces) == 1:
        airshark_interface = airshark_interfaces[0]
        airshark_interface_manager.set_interface(airshark_interface)
    else:
        airshark_interface_manager.reset_interface()

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
    <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
        <group>
            <file>file:/C:/xampp/htdocs/blogger/post.php</file>
            <file>file:/C:/xampp/htdocs/blogger/layout/_header.php</file>
        </group>
    </open-files>
</project-private>


text:
package br.recomende.model.profiling.engine;

import java.io.IOException;
import java.util.Map;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import br.recomende.model.curriculum.Languages;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class TermScorerTest {

	@Autowired
	private TermScorer termScorer;

	@Test
	public void testScoring() throws IOException {
		this.termScorer.score(TermField.TITLE, Languages.EN, "This paper presents a collection of " +
				"problems for natural language analysis derived mainly from theoretical linguistics.", true);
		this.termScorer.score(TermField.KEYWORDS, Languages.EN, "theoretical linguistics analysis", true);
		this.termScorer.score(TermField.TITLE, Languages.EN, "Botanical materia medica and pharmacology;" +
				" drugs considered from a botanical, pharmaceutical, physiological, therapeutical and toxicological standpoint.", false);
		this.termScorer.score(TermField.KEYWORDS, Languages.EN, "physiological botanical pharmacology", false);
		Map<String, Double> scores = this.termScorer.getScores();

		Assert.assertNotNull(scores);
	}

}


text:
<?xml version="1.0"?>
<package>
  <name>husky_control</name>
  <version>0.2.7</version>
  <description>Clearpath Husky controller configurations</description>

  <author email="pbovbel@clearpathrobotics.com">Paul Bovbel</author>

  <maintainer email="pbovbel@clearpathrobotics.com">Paul Bovbel</maintainer>

  <license>BSD</license>

  <url type="website">http://ros.org/wiki/husky_control</url>
  <url type="bugtracker">https://github.com/husky/husky/issues</url>
  <url type="repository">https://github.com/husly/husky</url>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roslaunch</build_depend>
  <run_depend>interactive_marker_twist_server</run_depend>
  <run_depend>diff_drive_controller</run_depend>
  <run_depend>joint_state_controller</run_depend>
  <run_depend>joint_trajectory_controller</run_depend>
  <run_depend>joy</run_depend>
  <run_depend>robot_localization</run_depend>
  <run_depend>rostopic</run_depend>
  <run_depend>controller_manager</run_depend>
  <run_depend>teleop_twist_joy</run_depend>
  <run_depend>twist_mux</run_depend>

  <export>
  </export>
</package>


text:
public class TypeMethod
{
  static final public se.chalmers.paragon.Lock Flow = se.chalmers.paragon.Lock.newLock("Flow", 2);
  public static se.chalmers.paragon.Policy pol(java.lang.Object a)
  {
    return se.chalmers.paragon.Policy.newPolicy("", se.chalmers.paragon.Policy.newPClause(se.chalmers.paragon.Actor.newActorVariable(0), se.chalmers.paragon.Atom.newAtom(Flow, a, se.chalmers.paragon.Actor.newActorVariable(0))));
  }
  final java.lang.Object alice = new java.lang.Object();
  public void test()
  {
    int a = 4;
  }
}


text:
from __future__ import absolute_import, division, print_function
__metaclass__ = type

ANSIBLE_METADATA = {'metadata_version': '1.1',
                    'status': ['preview'],
                    'supported_by': 'community'}

DOCUMENTATION = '''
---
module: azure_rm_appgateway
version_added: "2.7"
short_description: Manage Application Gateway instance.
description:
    - Create, update and delete instance of Application Gateway.

options:
    resource_group:
        description:
            - The name of the resource group.
        required: True
    name:
        description:
            - The name of the application gateway.
        required: True
    location:
        description:
            - Resource location. If not set, location from the resource group will be used as default.
    sku:
        description:
            - SKU of the application gateway resource.
        suboptions:
            name:
                description:
                    - Name of an application gateway SKU.
                choices:
                    - 'standard_small'
                    - 'standard_medium'
                    - 'standard_large'
                    - 'waf_medium'
                    - 'waf_large'
            tier:
                description:
                    - Tier of an application gateway.
                choices:
                    - 'standard'
                    - 'waf'
            capacity:
                description:
                    - Capacity (instance count) of an application gateway.
    ssl_policy:
        description:
            - SSL policy of the application gateway resource.
        suboptions:
            disabled_ssl_protocols:
                description:
                    - List of SSL protocols to be disabled on application gateway.
                choices:
                    - 'tls_v1_0'
                    - 'tls_v1_1'
                    - 'tls_v1_2'
            policy_type:
                description:
                    - Type of SSL Policy.
                choices:
                    - 'predefined'
                    - 'custom'
            policy_name:
                description:
                    - Name of Ssl C(predefined) policy.
                choices:
                    - 'ssl_policy20150501'
                    - 'ssl_policy20170401'
                    - 'ssl_policy20170401_s'
            cipher_suites:
                description:
                    - List of SSL cipher suites to be enabled in the specified order to application gateway.
                choices:
                    - tls_ecdhe_rsa_with_aes_256_gcm_sha384
                    - tls_ecdhe_rsa_with_aes_128_gcm_sha256
                    - tls_ecdhe_rsa_with_aes_256_cbc_sha384
                    - tls_ecdhe_rsa_with_aes_128_cbc_sha256
                    - tls_ecdhe_rsa_with_aes_256_cbc_sha
                    - tls_ecdhe_rsa_with_aes_128_cbc_sha
                    - tls_dhe_rsa_with_aes_256_gcm_sha384
                    - tls_dhe_rsa_with_aes_128_gcm_sha256
                    - tls_dhe_rsa_with_aes_256_cbc_sha
                    - tls_dhe_rsa_with_aes_128_cbc_sha
                    - tls_rsa_with_aes_256_gcm_sha384
                    - tls_rsa_with_aes_128_gcm_sha256
                    - tls_rsa_with_aes_256_cbc_sha256
                    - tls_rsa_with_aes_128_cbc_sha256
                    - tls_rsa_with_aes_256_cbc_sha
                    - tls_rsa_with_aes_128_cbc_sha
                    - tls_ecdhe_ecdsa_with_aes_256_gcm_sha384
                    - tls_ecdhe_ecdsa_with_aes_128_gcm_sha256
                    - tls_ecdhe_ecdsa_with_aes_256_cbc_sha384
                    - tls_ecdhe_ecdsa_with_aes_128_cbc_sha256
                    - tls_ecdhe_ecdsa_with_aes_256_cbc_sha
                    - tls_ecdhe_ecdsa_with_aes_128_cbc_sha
                    - tls_dhe_dss_with_aes_256_cbc_sha256
                    - tls_dhe_dss_with_aes_128_cbc_sha256
                    - tls_dhe_dss_with_aes_256_cbc_sha
                    - tls_dhe_dss_with_aes_128_cbc_sha
                    - tls_rsa_with_3des_ede_cbc_sha
                    - tls_dhe_dss_with_3des_ede_cbc_sha
            min_protocol_version:
                description:
                    - Minimum version of Ssl protocol to be supported on application gateway.
                choices:
                    - 'tls_v1_0'
                    - 'tls_v1_1'
                    - 'tls_v1_2'
    gateway_ip_configurations:
        description:
            - List of subnets used by the application gateway.
        suboptions:
            subnet:
                description:
                    - Reference of the subnet resource. A subnet from where application gateway gets its private address.
            name:
                description:
                    - Name of the resource that is unique within a resource group. This name can be used to access the resource.
    authentication_certificates:
        description:
            - Authentication certificates of the application gateway resource.
        suboptions:
            data:
                description:
                    - Certificate public data - base64 encoded pfx
            name:
                description:
                    - Name of the resource that is unique within a resource group. This name can be used to access the resource.
    redirect_configurations:
        version_added: "2.8"
        description:
            - Redirect configurations of the application gateway resource
        suboptions:
            redirect_type:
                description:
                    - Redirection type
                choices:
                    - 'permanent'
                    - 'found'
                    - 'see_other'
                    - 'temporary'
            target_listener:
                description:
                    - Reference to a listener to redirect the request to
            include_path:
                description:
                    - Include path in the redirected url
            include_query_string:
                description:
                    - Include query string in the redirected url
            name:
                description:
                    - Name of the resource that is unique within a resource group
    ssl_certificates:
        description:
            - SSL certificates of the application gateway resource.
        suboptions:
            data:
                description:
                    - Base-64 encoded pfx certificate.
            password:
                description:
                    - Password for the pfx file specified in I(data).
            name:
                description:
                    - Name of the resource that is unique within a resource group. This name can be used to access the resource.
    frontend_ip_configurations:
        description:
            - Frontend IP addresses of the application gateway resource.
        suboptions:
            private_ip_address:
                description:
                    - PrivateIPAddress of the network interface IP Configuration.
            private_ip_allocation_method:
                description:
                    - PrivateIP allocation method.
                choices:
                    - 'static'
                    - 'dynamic'
            subnet:
                description:
                    - Reference of the subnet resource.
            public_ip_address:
                description:
                    - Reference of the PublicIP resource.
            name:
                description:
                    - Name of the resource that is unique within a resource group. This name can be used to access the resource.
    frontend_ports:
        description:
            - List of frontend ports of the application gateway resource.
        suboptions:
            port:
                description:
                    - Frontend port
            name:
                description:
                    - Name of the resource that is unique within a resource group. This name can be used to access the resource.
    backend_address_pools:
        description:
            - List of backend address pool of the application gateway resource.
        suboptions:
            backend_addresses:
                description:
                    - List of backend addresses
                suboptions:
                    fqdn:
                        description:
                            - Fully qualified domain name (FQDN).
                    ip_address:
                        description:
                            - IP address
            name:
                description:
                    - Resource that is unique within a resource group. This name can be used to access the resource.
    probes:
        version_added: "2.8"
        description:
            - Probes available to the application gateway resource.
        suboptions:
            name:
                description:
                    - Name
            protocol:
                description:
                    - Protocol
                choices:
                    - 'http'
                    - 'https'
            host:
                description:
                    - Host
            path:
                description:
                    - Path
            timeout:
                description:
                    - Timeout
            interval:
                description:
                    - Interval
            unhealthy_threshold:
                description:
                    - Unhealthy Threshold
    backend_http_settings_collection:
        description:
            - Backend http settings of the application gateway resource.
        suboptions:
            probe:
                description:
                    - Probe
            port:
                description:
                    - Port
            protocol:
                description:
                    - Protocol.
                choices:
                    - 'http'
                    - 'https'
            cookie_based_affinity:
                description:
                    - Cookie based affinity.
                choices:
                    - 'enabled'
                    - 'disabled'
            request_timeout:
                description:
                    - "Request timeout in seconds. Application Gateway will fail the request if response is not received within RequestTimeout. Acceptable va
                      lues are from 1 second to 86400 seconds."
            authentication_certificates:
                description:
                    - List of references to application gateway authentication certificates.
                suboptions:
                    id:
                        description:
                            - Resource ID.
            host_name:
                description:
                    - Host header to be sent to the backend servers.
            pick_host_name_from_backend_address:
                description:
                    - Whether to pick host header should be picked from the host name of the backend server. Default value is false.
            affinity_cookie_name:
                description:
                    - Cookie name to use for the affinity cookie.
            path:
                description:
                    - Path which should be used as a prefix for all C(http) requests. Null means no path will be prefixed. Default value is null.
            name:
                description:
                    - Name of the resource that is unique within a resource group. This name can be used to access the resource.
    http_listeners:
        description:
            - List of HTTP listeners of the application gateway resource.
        suboptions:
            frontend_ip_configuration:
                description:
                    - Frontend IP configuration resource of an application gateway.
            frontend_port:
                description:
                    - Frontend port resource of an application gateway.
            protocol:
                description:
                    - Protocol.
                choices:
                    - 'http'
                    - 'https'
            host_name:
                description:
                    - Host name of C(http) listener.
            ssl_certificate:
                description:
                    - SSL certificate resource of an application gateway.
            require_server_name_indication:
                description:
                    - Applicable only if I(protocol) is C(https). Enables SNI for multi-hosting.
            name:
                description:
                    - Name of the resource that is unique within a resource group. This name can be used to access the resource.
    request_routing_rules:
        description:
            - List of request routing rules of the application gateway resource.
        suboptions:
            rule_type:
                description:
                    - Rule I(type).
                choices:
                    - 'basic'
                    - 'path_based_routing'
            backend_address_pool:
                description:
                    - Backend address pool resource of the application gateway.
            backend_http_settings:
                description:
                    - Frontend port resource of the application gateway.
            http_listener:
                description:
                    - Http listener resource of the application gateway.
            name:
                description:
                    - Name of the resource that is unique within a resource group. This name can be used to access the resource.
            redirect_configuration:
                description:
                    - Redirect configuration resource of the application gateway
    state:
        description:
            - Assert the state of the Public IP. Use C(present) to create or update a and
              C(absent) to delete.
        default: present
        choices:
            - absent
            - present

extends_documentation_fragment:
    - azure
    - azure_tags

author:
    - "Zim Kalinowski (@zikalino)"

'''

EXAMPLES = '''
- name: Create instance of Application Gateway
  azure_rm_appgateway:
    resource_group: myResourceGroup
    name: myappgateway
    sku:
      name: standard_small
      tier: standard
      capacity: 2
    gateway_ip_configurations:
      - subnet:
          id: "{{ subnet_id }}"
        name: app_gateway_ip_config
    frontend_ip_configurations:
      - subnet:
          id: "{{ subnet_id }}"
        name: sample_gateway_frontend_ip_config
    frontend_ports:
      - port: 90
        name: ag_frontend_port
    backend_address_pools:
      - backend_addresses:
          - ip_address: 10.0.0.4
        name: test_backend_address_pool
    backend_http_settings_collection:
      - port: 80
        protocol: http
        cookie_based_affinity: enabled
        name: sample_appgateway_http_settings
    http_listeners:
      - frontend_ip_configuration: sample_gateway_frontend_ip_config
        frontend_port: ag_frontend_port
        name: sample_http_listener
    request_routing_rules:
      - rule_type: Basic
        backend_address_pool: test_backend_address_pool
        backend_http_settings: sample_appgateway_http_settings
        http_listener: sample_http_listener
        name: rule1
'''

RETURN = '''
id:
    description:
        - Resource ID.
    returned: always
    type: str
    sample: id
'''

import time
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
from copy import deepcopy
from ansible.module_utils.network.common.utils import dict_merge
from ansible.module_utils.common.dict_transformations import (
    camel_dict_to_snake_dict, snake_dict_to_camel_dict,
    _camel_to_snake, _snake_to_camel,
)

try:
    from msrestazure.azure_exceptions import CloudError
    from msrest.polling import LROPoller
    from azure.mgmt.network import NetworkManagementClient
    from msrest.serialization import Model
except ImportError:
    # This is handled in azure_rm_common
    pass

class Actions:
    NoAction, Create, Update, Delete = range(4)

ssl_policy_spec = dict(
    disabled_ssl_protocols=dict(type='list'),
    policy_type=dict(type='str', choices=['predefined', 'custom']),
    policy_name=dict(type='str', choices=['ssl_policy20150501', 'ssl_policy20170401', 'ssl_policy20170401_s']),
    cipher_suites=dict(type='list'),
    min_protocol_version=dict(type='str', choices=['tls_v1_0', 'tls_v1_1', 'tls_v1_2'])
)

probe_spec = dict(
    host=dict(type='str'),
    interval=dict(type='int'),
    name=dict(type='str'),
    path=dict(type='str'),
    protocol=dict(type='str', choices=['http', 'https']),
    timeout=dict(type='int'),
    unhealthy_threshold=dict(type='int')
)

redirect_configuration_spec = dict(
    include_path=dict(type='bool'),
    include_query_string=dict(type='bool'),
    name=dict(type='str'),
    redirect_type=dict(type='str', choices=['permanent', 'found', 'see_other', 'temporary']),
    target_listener=dict(type='str')
)

class AzureRMApplicationGateways(AzureRMModuleBase):
    """Configuration class for an Azure RM Application Gateway resource"""

    def __init__(self):
        self.module_arg_spec = dict(
            resource_group=dict(
                type='str',
                required=True
            ),
            name=dict(
                type='str',
                required=True
            ),
            location=dict(
                type='str'
            ),
            sku=dict(
                type='dict'
            ),
            ssl_policy=dict(
                type='dict',
                options=ssl_policy_spec
            ),
            gateway_ip_configurations=dict(
                type='list'
            ),
            authentication_certificates=dict(
                type='list'
            ),
            ssl_certificates=dict(
                type='list'
            ),
            redirect_configurations=dict(
                type='list',
                elements='dict',
                options=redirect_configuration_spec
            ),
            frontend_ip_configurations=dict(
                type='list'
            ),
            frontend_ports=dict(
                type='list'
            ),
            backend_address_pools=dict(
                type='list'
            ),
            backend_http_settings_collection=dict(
                type='list'
            ),
            probes=dict(
                type='list',
                elements='dict',
                options=probe_spec
            ),
            http_listeners=dict(
                type='list'
            ),
            request_routing_rules=dict(
                type='list'
            ),
            state=dict(
                type='str',
                default='present',
                choices=['present', 'absent']
            )
        )

        self.resource_group = None
        self.name = None
        self.parameters = dict()

        self.results = dict(changed=False)
        self.mgmt_client = None
        self.state = None
        self.to_do = Actions.NoAction

        super(AzureRMApplicationGateways, self).__init__(derived_arg_spec=self.module_arg_spec,
                                                         supports_check_mode=True,
                                                         supports_tags=True)

    def exec_module(self, **kwargs):
        """Main module execution method"""

        for key in list(self.module_arg_spec.keys()) + ['tags']:
            if hasattr(self, key):
                setattr(self, key, kwargs[key])
            elif kwargs[key] is not None:
                if key == "id":
                    self.parameters["id"] = kwargs[key]
                elif key == "location":
                    self.parameters["location"] = kwargs[key]
                elif key == "sku":
                    ev = kwargs[key]
                    if 'name' in ev:
                        if ev['name'] == 'standard_small':
                            ev['name'] = 'Standard_Small'
                        elif ev['name'] == 'standard_medium':
                            ev['name'] = 'Standard_Medium'
                        elif ev['name'] == 'standard_large':
                            ev['name'] = 'Standard_Large'
                        elif ev['name'] == 'waf_medium':
                            ev['name'] = 'WAF_Medium'
                        elif ev['name'] == 'waf_large':
                            ev['name'] = 'WAF_Large'
                    if 'tier' in ev:
                        if ev['tier'] == 'standard':
                            ev['tier'] = 'Standard'
                        elif ev['tier'] == 'waf':
                            ev['tier'] = 'WAF'
                    self.parameters["sku"] = ev
                elif key == "ssl_policy":
                    ev = kwargs[key]
                    if 'policy_type' in ev:
                        ev['policy_type'] = _snake_to_camel(ev['policy_type'], True)
                    if 'policy_name' in ev:
                        if ev['policy_name'] == 'ssl_policy20150501':
                            ev['policy_name'] = 'AppGwSslPolicy20150501'
                        elif ev['policy_name'] == 'ssl_policy20170401':
                            ev['policy_name'] = 'AppGwSslPolicy20170401'
                        elif ev['policy_name'] == 'ssl_policy20170401_s':
                            ev['policy_name'] = 'AppGwSslPolicy20170401S'
                    if 'min_protocol_version' in ev:
                        if ev['min_protocol_version'] == 'tls_v1_0':
                            ev['min_protocol_version'] = 'TLSv1_0'
                        elif ev['min_protocol_version'] == 'tls_v1_1':
                            ev['min_protocol_version'] = 'TLSv1_1'
                        elif ev['min_protocol_version'] == 'tls_v1_2':
                            ev['min_protocol_version'] = 'TLSv1_2'
                    if 'disabled_ssl_protocols' in ev:
                        protocols = ev['disabled_ssl_protocols']
                        if protocols is not None:
                            for i in range(len(protocols)):
                                if protocols[i] == 'tls_v1_0':
                                    protocols[i] = 'TLSv1_0'
                                elif protocols[i] == 'tls_v1_1':
                                    protocols[i] = 'TLSv1_1'
                                elif protocols[i] == 'tls_v1_2':
                                    protocols[i] = 'TLSv1_2'
                    if 'cipher_suites' in ev:
                        suites = ev['cipher_suites']
                        if suites is not None:
                            for i in range(len(suites)):
                                suites[i] = suites[i].upper()
                elif key == "gateway_ip_configurations":
                    self.parameters["gateway_ip_configurations"] = kwargs[key]
                elif key == "authentication_certificates":
                    self.parameters["authentication_certificates"] = kwargs[key]
                elif key == "ssl_certificates":
                    self.parameters["ssl_certificates"] = kwargs[key]
                elif key == "redirect_configurations":
                    ev = kwargs[key]
                    for i in range(len(ev)):
                        item = ev[i]
                        if 'redirect_type' in item:
                            item['redirect_type'] = _snake_to_camel(item['redirect_type'], True)
                        if 'target_listener' in item:
                            id = http_listener_id(self.subscription_id,
                                                  kwargs['resource_group'],
                                                  kwargs['name'],
                                                  item['target_listener'])
                            item['target_listener'] = {'id': id}
                    self.parameters["redirect_configurations"] = ev
                elif key == "frontend_ip_configurations":
                    ev = kwargs[key]
                    for i in range(len(ev)):
                        item = ev[i]
                        if 'private_ip_allocation_method' in item:
                            item['private_ip_allocation_method'] = _snake_to_camel(item['private_ip_allocation_method'], True)
                        if 'public_ip_address' in item:
                            id = public_ip_id(self.subscription_id,
                                              kwargs['resource_group'],
                                              item['public_ip_address'])
                            item['public_ip_address'] = {'id': id}
                    self.parameters["frontend_ip_configurations"] = ev
                elif key == "frontend_ports":
                    self.parameters["frontend_ports"] = kwargs[key]
                elif key == "backend_address_pools":
                    self.parameters["backend_address_pools"] = kwargs[key]
                elif key == "probes":
                    ev = kwargs[key]
                    for i in range(len(ev)):
                        item = ev[i]
                        if 'protocol' in item:
                            item['protocol'] = _snake_to_camel(item['protocol'], True)
                    self.parameters["probes"] = ev
                elif key == "backend_http_settings_collection":
                    ev = kwargs[key]
                    for i in range(len(ev)):
                        item = ev[i]
                        if 'protocol' in item:
                            item['protocol'] = _snake_to_camel(item['protocol'], True)
                        if 'cookie_based_affinity' in item:
                            item['cookie_based_affinity'] = _snake_to_camel(item['cookie_based_affinity'], True)
                        if 'probe' in item:
                            id = probe_id(self.subscription_id,
                                          kwargs['resource_group'],
                                          kwargs['name'],
                                          item['probe'])
                            item['probe'] = {'id': id}
                    self.parameters["backend_http_settings_collection"] = ev
                elif key == "http_listeners":
                    ev = kwargs[key]
                    for i in range(len(ev)):
                        item = ev[i]
                        if 'frontend_ip_configuration' in item:
                            id = frontend_ip_configuration_id(self.subscription_id,
                                                              kwargs['resource_group'],
                                                              kwargs['name'],
                                                              item['frontend_ip_configuration'])
                            item['frontend_ip_configuration'] = {'id': id}

                        if 'frontend_port' in item:
                            id = frontend_port_id(self.subscription_id,
                                                  kwargs['resource_group'],
                                                  kwargs['name'],
                                                  item['frontend_port'])
                            item['frontend_port'] = {'id': id}
                        if 'ssl_certificate' in item:
                            id = ssl_certificate_id(self.subscription_id,
                                                    kwargs['resource_group'],
                                                    kwargs['name'],
                                                    item['ssl_certificate'])
                            item['ssl_certificate'] = {'id': id}
                        if 'protocol' in item:
                            item['protocol'] = _snake_to_camel(item['protocol'], True)
                        ev[i] = item
                    self.parameters["http_listeners"] = ev
                elif key == "request_routing_rules":
                    ev = kwargs[key]
                    for i in range(len(ev)):
                        item = ev[i]
                        if 'backend_address_pool' in item:
                            id = backend_address_pool_id(self.subscription_id,
                                                         kwargs['resource_group'],
                                                         kwargs['name'],
                                                         item['backend_address_pool'])
                            item['backend_address_pool'] = {'id': id}
                        if 'backend_http_settings' in item:
                            id = backend_http_settings_id(self.subscription_id,
                                                          kwargs['resource_group'],
                                                          kwargs['name'],
                                                          item['backend_http_settings'])
                            item['backend_http_settings'] = {'id': id}
                        if 'http_listener' in item:
                            id = http_listener_id(self.subscription_id,
                                                  kwargs['resource_group'],
                                                  kwargs['name'],
                                                  item['http_listener'])
                            item['http_listener'] = {'id': id}
                        if 'protocol' in item:
                            item['protocol'] = _snake_to_camel(item['protocol'], True)
                        if 'rule_type' in ev:
                            item['rule_type'] = _snake_to_camel(item['rule_type'], True)
                        if 'redirect_configuration' in item:
                            id = redirect_configuration_id(self.subscription_id,
                                                           kwargs['resource_group'],
                                                           kwargs['name'],
                                                           item['redirect_configuration'])
                            item['redirect_configuration'] = {'id': id}
                        ev[i] = item
                    self.parameters["request_routing_rules"] = ev
                elif key == "etag":
                    self.parameters["etag"] = kwargs[key]

        old_response = None
        response = None

        self.mgmt_client = self.get_mgmt_svc_client(NetworkManagementClient,
                                                    base_url=self._cloud_environment.endpoints.resource_manager)

        resource_group = self.get_resource_group(self.resource_group)

        if "location" not in self.parameters:
            self.parameters["location"] = resource_group.location

        old_response = self.get_applicationgateway()

        if not old_response:
            self.log("Application Gateway instance doesn't exist")
            if self.state == 'absent':
                self.log("Old instance didn't exist")
            else:
                self.to_do = Actions.Create
        else:
            self.log("Application Gateway instance already exists")
            if self.state == 'absent':
                self.to_do = Actions.Delete
            elif self.state == 'present':
                self.log("Need to check if Application Gateway instance has to be deleted or may be updated")
                self.to_do = Actions.Update

        if (self.to_do == Actions.Update):
            if (self.parameters['location'] != old_response['location'] or
                    self.parameters['sku']['name'] != old_response['sku']['name'] or
                    self.parameters['sku']['tier'] != old_response['sku']['tier'] or
                    self.parameters['sku']['capacity'] != old_response['sku']['capacity'] or
                    not compare_arrays(old_response, self.parameters, 'authentication_certificates') or
                    not compare_arrays(old_response, self.parameters, 'gateway_ip_configurations') or
                    not compare_arrays(old_response, self.parameters, 'redirect_configurations') or
                    not compare_arrays(old_response, self.parameters, 'frontend_ip_configurations') or
                    not compare_arrays(old_response, self.parameters, 'frontend_ports') or
                    not compare_arrays(old_response, self.parameters, 'backend_address_pools') or
                    not compare_arrays(old_response, self.parameters, 'probes') or
                    not compare_arrays(old_response, self.parameters, 'backend_http_settings_collection') or
                    not compare_arrays(old_response, self.parameters, 'request_routing_rules') or
                    not compare_arrays(old_response, self.parameters, 'http_listeners')):

                self.to_do = Actions.Update
            else:
                self.to_do = Actions.NoAction

        if (self.to_do == Actions.Create) or (self.to_do == Actions.Update):
            self.log("Need to Create / Update the Application Gateway instance")

            if self.check_mode:
                self.results['changed'] = True
                self.results["parameters"] = self.parameters
                return self.results

            response = self.create_update_applicationgateway()

            if not old_response:
                self.results['changed'] = True
            else:
                self.results['changed'] = old_response.__ne__(response)
            self.log("Creation / Update done")
        elif self.to_do == Actions.Delete:
            self.log("Application Gateway instance deleted")
            self.results['changed'] = True

            if self.check_mode:
                return self.results

            self.delete_applicationgateway()
            # make sure instance is actually deleted, for some Azure resources, instance is hanging around
            # for some time after deletion -- this should be really fixed in Azure
            while self.get_applicationgateway():
                time.sleep(20)
        else:
            self.log("Application Gateway instance unchanged")
            self.results['changed'] = False
            response = old_response

        if response:
            self.results["id"] = response["id"]

        return self.results

    def create_update_applicationgateway(self):
        '''
        Creates or updates Application Gateway with the specified configuration.

        :return: deserialized Application Gateway instance state dictionary
        '''
        self.log("Creating / Updating the Application Gateway instance {0}".format(self.name))

        try:
            response = self.mgmt_client.application_gateways.create_or_update(resource_group_name=self.resource_group,
                                                                              application_gateway_name=self.name,
                                                                              parameters=self.parameters)
            if isinstance(response, LROPoller):
                response = self.get_poller_result(response)

        except CloudError as exc:
            self.log('Error attempting to create the Application Gateway instance.')
            self.fail("Error creating the Application Gateway instance: {0}".format(str(exc)))
        return response.as_dict()

    def delete_applicationgateway(self):
        '''
        Deletes specified Application Gateway instance in the specified subscription and resource group.

        :return: True
        '''
        self.log("Deleting the Application Gateway instance {0}".format(self.name))
        try:
            response = self.mgmt_client.application_gateways.delete(resource_group_name=self.resource_group,
                                                                    application_gateway_name=self.name)
        except CloudError as e:
            self.log('Error attempting to delete the Application Gateway instance.')
            self.fail("Error deleting the Application Gateway instance: {0}".format(str(e)))

        return True

    def get_applicationgateway(self):
        '''
        Gets the properties of the specified Application Gateway.

        :return: deserialized Application Gateway instance state dictionary
        '''
        self.log("Checking if the Application Gateway instance {0} is present".format(self.name))
        found = False
        try:
            response = self.mgmt_client.application_gateways.get(resource_group_name=self.resource_group,
                                                                 application_gateway_name=self.name)
            found = True
            self.log("Response : {0}".format(response))
            self.log("Application Gateway instance : {0} found".format(response.name))
        except CloudError as e:
            self.log('Did not find the Application Gateway instance.')
        if found is True:
            return response.as_dict()

        return False

def public_ip_id(subscription_id, resource_group_name, name):
    """Generate the id for a frontend ip configuration"""
    return '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/publicIPAddresses/{2}'.format(
        subscription_id,
        resource_group_name,
        name
    )

def frontend_ip_configuration_id(subscription_id, resource_group_name, appgateway_name, name):
    """Generate the id for a frontend ip configuration"""
    return '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/applicationGateways/{2}/frontendIPConfigurations/{3}'.format(
        subscription_id,
        resource_group_name,
        appgateway_name,
        name
    )

def frontend_port_id(subscription_id, resource_group_name, appgateway_name, name):
    """Generate the id for a frontend port"""
    return '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/applicationGateways/{2}/frontendPorts/{3}'.format(
        subscription_id,
        resource_group_name,
        appgateway_name,
        name
    )

def redirect_configuration_id(subscription_id, resource_group_name, appgateway_name, name):
    """Generate the id for a redirect configuration"""
    return '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/applicationGateways/{2}/redirectConfigurations/{3}'.format(
        subscription_id,
        resource_group_name,
        appgateway_name,
        name
    )

def ssl_certificate_id(subscription_id, resource_group_name, ssl_certificate_name, name):
    """Generate the id for a frontend port"""
    return '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/applicationGateways/{2}/sslCertificates/{3}'.format(
        subscription_id,
        resource_group_name,
        ssl_certificate_name,
        name
    )

def backend_address_pool_id(subscription_id, resource_group_name, appgateway_name, name):
    """Generate the id for an address pool"""
    return '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/applicationGateways/{2}/backendAddressPools/{3}'.format(
        subscription_id,
        resource_group_name,
        appgateway_name,
        name
    )

def probe_id(subscription_id, resource_group_name, appgateway_name, name):
    """Generate the id for a probe"""
    return '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/applicationGateways/{2}/probes/{3}'.format(
        subscription_id,
        resource_group_name,
        appgateway_name,
        name
    )

def backend_http_settings_id(subscription_id, resource_group_name, appgateway_name, name):
    """Generate the id for a http settings"""
    return '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/applicationGateways/{2}/backendHttpSettingsCollection/{3}'.format(
        subscription_id,
        resource_group_name,
        appgateway_name,
        name
    )

def http_listener_id(subscription_id, resource_group_name, appgateway_name, name):
    """Generate the id for a http listener"""
    return '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/applicationGateways/{2}/httpListeners/{3}'.format(
        subscription_id,
        resource_group_name,
        appgateway_name,
        name
    )

def compare_arrays(old_params, new_params, param_name):
    old = old_params.get(param_name) or []
    new = new_params.get(param_name) or []

    oldd = {}
    for item in old:
        name = item['name']
        oldd[name] = item
    newd = {}
    for item in new:
        name = item['name']
        newd[name] = item

    newd = dict_merge(oldd, newd)
    return newd == oldd

def main():
    """Main execution"""
    AzureRMApplicationGateways()

if __name__ == '__main__':
    main()


text:
A Lita handler for a question answering (QA) system. Allows you to use CRUD operations.
More functionality is coming soon...

## Installation

Add lita-answers to your Lita instance's Gemfile:

``` ruby
gem "lita-answers"
```

## Usage

You could perform simple CRUD operations:
*CREATE* `remember 'question?' with 'answer.'`
*READ* `all questions`
*READ* `answer 'question?'`
*UPDATE* `change 'question?' to 'new answer.'`
*DELETE* `forget 'question?'`

## License

[MIT](http://opensource.org/licenses/MIT)


text:
/**
 * @author Yong.Teng
 */
package com.buession.redis.core.command;


text:
class GameObject
{
protected:
	GameObject() {}
	virtual ~GameObject(){}

public:
	virtual void draw() = 0;
	virtual void update() = 0;
	virtual void clean() = 0;

	//new load function
	virtual void load(const LoaderParams* pParams) = 0;
};

#endif //defined (__GameObject__)


text:
using System;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text;
using CodePlex.TfsLibrary;
using SvnBridge.Handlers;
using SvnBridge.Handlers.Renderers;
using SvnBridge.Infrastructure;
using SvnBridge.Infrastructure.Statistics;
using SvnBridge.Interfaces;
using SvnBridge.SourceControl;
using System.Web;
using SvnBridge.RequestHandlers.SAWSHandlers;

namespace SvnBridge.Net
{
    public class HttpContextDispatcher
    {
        protected readonly IPathParser parser;
        protected readonly ActionTrackingViaPerfCounter actionTracking;

        public HttpContextDispatcher(IPathParser parser, ActionTrackingViaPerfCounter actionTracking)
        {
            this.parser = parser;
            this.actionTracking = actionTracking;
        }

        public virtual RequestHandlerBase GetHandler(string httpMethod)
        {
            switch (httpMethod.ToLowerInvariant())
            {

#if __USE_Dynamsoft__
                case "lock":
                    return new SAWSLockHandler();
                case "unlock":
                    return new SAWSUnlockHandler();
#endif
                case "checkout":
#if __USE_Dynamsoft__
                    return new SAWSCheckOutHandler();
#else
                    return new CheckOutHandler();
#endif
                case "copy":
#if __USE_Dynamsoft__
                    return new SAWSCopyHandler();
#else
                    return new CopyHandler();
#endif
                case "delete":
#if __USE_Dynamsoft__
                    return new SAWSDeleteHandler();
#else
                    return new DeleteHandler();
#endif
                case "merge":
#if __USE_Dynamsoft__
                    return new SAWSMergeHandler();
#else
                    return new MergeHandler();
#endif
                case "mkactivity":
#if __USE_Dynamsoft__
                    return new SAWSMkActivityHandler();
#else
                    return new MkActivityHandler();
#endif
                case "mkcol":
#if __USE_Dynamsoft__
                    return new SAWSMkColHandler();
#else
                    return new MkColHandler();
#endif
                case "options":
#if __USE_Dynamsoft__
                    return new SAWSOptionsHandler();
#else
                    return new OptionsHandler();
#endif
                case "propfind":
#if __USE_Dynamsoft__
                    return new SAWSPropFindHandler();
#else
                    return new PropFindHandler();
#endif
                case "proppatch":
#if __USE_Dynamsoft__
                    return new SAWSPropPatchHandler();
#else
                    return new PropPatchHandler();
#endif
                case "put":
#if __USE_Dynamsoft__
                    return new SAWSPutHandler();
#else
                    return new PutHandler();
#endif
                case "report":
#if __USE_Dynamsoft__
                    return new SAWSReportHandler();
#else
                    return new ReportHandler();
#endif
                case "get":
#if __USE_Dynamsoft__
                    return new SAWSGetHandler();
#else
                    return new GetHandler();
#endif
                default:
                    return null;
            }
        }

        public void Dispatch(IHttpContext connection)
        {
            RequestHandlerBase handler = null;
            try
            {
                IHttpRequest request = connection.Request;
                if ("/!stats/request".Equals(request.LocalPath, StringComparison.InvariantCultureIgnoreCase))
                {
                    new StatsRenderer(Container.Resolve<ActionTrackingViaPerfCounter>()).Render(connection);
                    return;
                }

                NetworkCredential credential = GetCredential(connection);
                string tfsUrl = parser.GetServerUrl(request, credential);
                if (string.IsNullOrEmpty(tfsUrl))
                {
                    SendFileNotFoundResponse(connection);
                    return;
                }

                if (credential != null && (tfsUrl.ToLowerInvariant().EndsWith("codeplex.com") || tfsUrl.ToLowerInvariant().Contains("tfs.codeplex.com")))
                {
                    string username = credential.UserName;
                    string domain = credential.Domain;
                    if (!username.ToLowerInvariant().EndsWith("_cp"))
                    {
                        username += "_cp";
                    }
                    if (domain == "")
                    {
                        domain = "snd";
                    }
                    credential = new NetworkCredential(username, credential.Password, domain);
                }
                RequestCache.Items["serverUrl"] = tfsUrl;
                RequestCache.Items["projectName"] = parser.GetProjectName(request);
                RequestCache.Items["credentials"] = credential;

                handler = GetHandler(connection.Request.HttpMethod);
                if (handler == null)
                {
                    actionTracking.Error();
                    SendUnsupportedMethodResponse(connection);
                    return;
                }

                try
                {
                    actionTracking.Request(handler);
                    handler.Handle(connection, parser, credential);
                }
                catch (TargetInvocationException e)
                {
                    ExceptionHelper.PreserveStackTrace(e.InnerException);
                    throw e.InnerException;
                }
            }
            catch (WebException ex)
            {
                actionTracking.Error();

                HttpWebResponse response = ex.Response as HttpWebResponse;

                if (response != null && response.StatusCode == HttpStatusCode.Unauthorized)
                {
                    SendUnauthorizedResponse(connection);
                }
                else
                {
                    throw;
                }
            }
            catch (NetworkAccessDeniedException)
            {
                SendUnauthorizedResponse(connection);
            }
            catch (IOException)
            {
                // Error caused by client cancelling operation under IIS 6
                if (Configuration.LogCancelErrors)
                    throw;
            }
            catch (HttpException ex)
            {
                // Check if error caused by client cancelling operation under IIS 7
                if (!ex.Message.StartsWith("An error occurred while communicating with the remote host.") &&
                    !ex.Message.StartsWith("The remote host closed the connection."))
                    throw;

                if (Configuration.LogCancelErrors)
                    throw;
            }
            finally
            {
                if (handler != null)
                    handler.Cancel();
            }
        }

        private static NetworkCredential GetCredential(IHttpContext context)
        {
            string authorizationHeader = context.Request.Headers["Authorization"];
            if (!string.IsNullOrEmpty(authorizationHeader))
            {
                if (authorizationHeader.StartsWith("Digest"))
                {
                    return (NetworkCredential)CredentialCache.DefaultCredentials;
                }
                else if (authorizationHeader.StartsWith("Basic"))
                {
                    string encodedCredential = authorizationHeader.Substring(authorizationHeader.IndexOf(' ') + 1);
                    string credential = UTF8Encoding.UTF8.GetString(Convert.FromBase64String(encodedCredential));
                    string[] credentialParts = credential.Split(':');

                    string username = credentialParts[0];
                    string password = credentialParts[1];

                    if (username.IndexOf('\\') >= 0)
                    {
                        string domain = username.Substring(0, username.IndexOf('\\'));
                        username = username.Substring(username.IndexOf('\\') + 1);
                        return new NetworkCredential(username, password, domain);
                    }
                    return new NetworkCredential(username, password);
                }
                else
                {
                    throw new Exception("Unrecognized authorization header: " + authorizationHeader.StartsWith("Basic"));
                }
            }
            return CredentialsHelper.NullCredentials;
        }

        private static void SendUnauthorizedResponse(IHttpContext connection)
        {
            IHttpRequest request = connection.Request;
            IHttpResponse response = connection.Response;

            response.ClearHeaders();

            response.StatusCode = (int)HttpStatusCode.Unauthorized;
            response.ContentType = "text/html; charset=iso-8859-1";

            response.AppendHeader("WWW-Authenticate", "Basic realm=\"Subversion Repository\"");

            string content = "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n" +
                             "\n" +
                             "<title>401 Authorization Required</title>\n" +
                             "\n" +
                             "
Authorization Required
\n" +
                             "
This server could not verify that you\n" +
                             "are authorized to access the document\n" +
                             "requested.  Either you supplied the wrong\n" +
                             "credentials (e.g., bad password), or your\n" +
                             "browser doesn't understand how to supply\n" +
                             "the credentials required.
\n" +
                             "
\n" +
                             "<address>Apache" + request.Url.Host + " Port " +
                             request.Url.Port +
                             "</address>\n" +
                             "\n";

            byte[] buffer = Encoding.UTF8.GetBytes(content);

            response.OutputStream.Write(buffer, 0, buffer.Length);
        }

        private static void SendUnsupportedMethodResponse(IHttpContext connection)
        {
            IHttpResponse response = connection.Response;
            response.StatusCode = (int)HttpStatusCode.MethodNotAllowed;
            response.ContentType = "text/html";

            response.AppendHeader("Allow", "PROPFIND, REPORT, OPTIONS, MKACTIVITY, CHECKOUT, PROPPATCH, PUT, MERGE, DELETE, MKCOL");

            string content = @"

                        <title>405 Method Not Allowed</title>

The requested method is not supported.

                ";

            byte[] buffer = Encoding.UTF8.GetBytes(content);
            response.OutputStream.Write(buffer, 0, buffer.Length);
        }

        protected void SendFileNotFoundResponse(IHttpContext connection)
        {
            IHttpResponse response = connection.Response;
            response.StatusCode = (int)HttpStatusCode.NotFound;
            response.ContentType = "text/html; charset=iso-8859-1";

            string content =
                "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n" +
                "\n" +
                "<title>404 Not Found</title>\n" +
                "\n" +
                "
Not Found
\n" +
                "
\n" +
                "\n";

            byte[] buffer = Encoding.UTF8.GetBytes(content);
            response.OutputStream.Write(buffer, 0, buffer.Length);
        }
    }
}