text:
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: workspaces_web
using AWS.Compat
using AWS.UUIDs

"""
    associate_browser_settings(browser_settings_arn, portal_arn)
    associate_browser_settings(browser_settings_arn, portal_arn, params::Dict{String,<:Any})

Associates a browser settings resource with a web portal.

# Arguments
- `browser_settings_arn`: The ARN of the browser settings.
- `portal_arn`: The ARN of the web portal.

"""
function associate_browser_settings(
    browserSettingsArn, portalArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "PUT",
        "/portals/$(portalArn)/browserSettings",
        Dict{String,Any}("browserSettingsArn" => browserSettingsArn);
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function associate_browser_settings(
    browserSettingsArn,
    portalArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "PUT",
        "/portals/$(portalArn)/browserSettings",
        Dict{String,Any}(
            mergewith(
                _merge, Dict{String,Any}("browserSettingsArn" => browserSettingsArn), params
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    associate_network_settings(network_settings_arn, portal_arn)
    associate_network_settings(network_settings_arn, portal_arn, params::Dict{String,<:Any})

Associates a network settings resource with a web portal.

# Arguments
- `network_settings_arn`: The ARN of the network settings.
- `portal_arn`: The ARN of the web portal.

"""
function associate_network_settings(
    networkSettingsArn, portalArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "PUT",
        "/portals/$(portalArn)/networkSettings",
        Dict{String,Any}("networkSettingsArn" => networkSettingsArn);
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function associate_network_settings(
    networkSettingsArn,
    portalArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "PUT",
        "/portals/$(portalArn)/networkSettings",
        Dict{String,Any}(
            mergewith(
                _merge, Dict{String,Any}("networkSettingsArn" => networkSettingsArn), params
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    associate_trust_store(portal_arn, trust_store_arn)
    associate_trust_store(portal_arn, trust_store_arn, params::Dict{String,<:Any})

Associates a trust store with a web portal.

# Arguments
- `portal_arn`: The ARN of the web portal.
- `trust_store_arn`: The ARN of the trust store.

"""
function associate_trust_store(
    portalArn, trustStoreArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "PUT",
        "/portals/$(portalArn)/trustStores",
        Dict{String,Any}("trustStoreArn" => trustStoreArn);
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function associate_trust_store(
    portalArn,
    trustStoreArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "PUT",
        "/portals/$(portalArn)/trustStores",
        Dict{String,Any}(
            mergewith(_merge, Dict{String,Any}("trustStoreArn" => trustStoreArn), params)
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    associate_user_settings(portal_arn, user_settings_arn)
    associate_user_settings(portal_arn, user_settings_arn, params::Dict{String,<:Any})

Associates a user settings resource with a web portal.

# Arguments
- `portal_arn`: The ARN of the web portal.
- `user_settings_arn`: The ARN of the user settings.

"""
function associate_user_settings(
    portalArn, userSettingsArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "PUT",
        "/portals/$(portalArn)/userSettings",
        Dict{String,Any}("userSettingsArn" => userSettingsArn);
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function associate_user_settings(
    portalArn,
    userSettingsArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "PUT",
        "/portals/$(portalArn)/userSettings",
        Dict{String,Any}(
            mergewith(
                _merge, Dict{String,Any}("userSettingsArn" => userSettingsArn), params
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    create_browser_settings(browser_policy)
    create_browser_settings(browser_policy, params::Dict{String,<:Any})

Creates a browser settings resource that can be associated with a web portal. Once
associated with a web portal, browser settings control how the browser will behave once a
user starts a streaming session for the web portal.

# Arguments
- `browser_policy`: A JSON string containing Chrome Enterprise policies that will be
  applied to all streaming sessions.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"additionalEncryptionContext"`: Additional encryption context of the browser settings.
- `"clientToken"`: A unique, case-sensitive identifier that you provide to ensure the
  idempotency of the request. Idempotency ensures that an API request completes only once.
  With an idempotent request, if the original request completes successfully, subsequent
  retries with the same client token returns the result from the original successful request.
  If you do not specify a client token, one is automatically generated by the AWS SDK.
- `"customerManagedKey"`: The custom managed key of the browser settings.
- `"tags"`: The tags to add to the browser settings resource. A tag is a key-value pair.
"""
function create_browser_settings(
    browserPolicy; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "POST",
        "/browserSettings",
        Dict{String,Any}(
            "browserPolicy" => browserPolicy, "clientToken" => string(uuid4())
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function create_browser_settings(
    browserPolicy,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "POST",
        "/browserSettings",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "browserPolicy" => browserPolicy, "clientToken" => string(uuid4())
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    create_identity_provider(identity_provider_details, identity_provider_name, identity_provider_type, portal_arn)
    create_identity_provider(identity_provider_details, identity_provider_name, identity_provider_type, portal_arn, params::Dict{String,<:Any})

Creates an identity provider resource that is then associated with a web portal.

# Arguments
- `identity_provider_details`: The identity provider details. The following list describes
  the provider detail keys for each identity provider type.    For Google and Login with
  Amazon:    client_id     client_secret     authorize_scopes      For Facebook:    client_id
      client_secret     authorize_scopes     api_version      For Sign in with Apple:
  client_id     team_id     key_id     private_key     authorize_scopes      For OIDC
  providers:    client_id     client_secret     attributes_request_method     oidc_issuer
  authorize_scopes     authorize_url if not available from discovery URL specified by
  oidc_issuer key     token_url if not available from discovery URL specified by oidc_issuer
  key     attributes_url if not available from discovery URL specified by oidc_issuer key
  jwks_uri if not available from discovery URL specified by oidc_issuer key      For SAML
  providers:    MetadataFile OR MetadataURL     IDPSignout optional
- `identity_provider_name`: The identity provider name.
- `identity_provider_type`: The identity provider type.
- `portal_arn`: The ARN of the web portal.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: A unique, case-sensitive identifier that you provide to ensure the
  idempotency of the request. Idempotency ensures that an API request completes only once.
  With an idempotent request, if the original request completes successfully, subsequent
  retries with the same client token returns the result from the original successful request.
  If you do not specify a client token, one is automatically generated by the AWS SDK.
"""
function create_identity_provider(
    identityProviderDetails,
    identityProviderName,
    identityProviderType,
    portalArn;
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "POST",
        "/identityProviders",
        Dict{String,Any}(
            "identityProviderDetails" => identityProviderDetails,
            "identityProviderName" => identityProviderName,
            "identityProviderType" => identityProviderType,
            "portalArn" => portalArn,
            "clientToken" => string(uuid4()),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function create_identity_provider(
    identityProviderDetails,
    identityProviderName,
    identityProviderType,
    portalArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "POST",
        "/identityProviders",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "identityProviderDetails" => identityProviderDetails,
                    "identityProviderName" => identityProviderName,
                    "identityProviderType" => identityProviderType,
                    "portalArn" => portalArn,
                    "clientToken" => string(uuid4()),
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    create_network_settings(security_group_ids, subnet_ids, vpc_id)
    create_network_settings(security_group_ids, subnet_ids, vpc_id, params::Dict{String,<:Any})

Creates a network settings resource that can be associated with a web portal. Once
associated with a web portal, network settings define how streaming instances will connect
with your specified VPC.

# Arguments
- `security_group_ids`: One or more security groups used to control access from streaming
  instances to your VPC.
- `subnet_ids`: The subnets in which network interfaces are created to connect streaming
  instances to your VPC. At least two of these subnets must be in different availability
  zones.
- `vpc_id`: The VPC that streaming instances will connect to.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: A unique, case-sensitive identifier that you provide to ensure the
  idempotency of the request. Idempotency ensures that an API request completes only once.
  With an idempotent request, if the original request completes successfully, subsequent
  retries with the same client token returns the result from the original successful request.
   If you do not specify a client token, one is automatically generated by the AWS SDK.
- `"tags"`: The tags to add to the network settings resource. A tag is a key-value pair.
"""
function create_network_settings(
    securityGroupIds, subnetIds, vpcId; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "POST",
        "/networkSettings",
        Dict{String,Any}(
            "securityGroupIds" => securityGroupIds,
            "subnetIds" => subnetIds,
            "vpcId" => vpcId,
            "clientToken" => string(uuid4()),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function create_network_settings(
    securityGroupIds,
    subnetIds,
    vpcId,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "POST",
        "/networkSettings",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "securityGroupIds" => securityGroupIds,
                    "subnetIds" => subnetIds,
                    "vpcId" => vpcId,
                    "clientToken" => string(uuid4()),
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    create_portal()
    create_portal(params::Dict{String,<:Any})

Creates a web portal.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"additionalEncryptionContext"`: The additional encryption context of the portal.
- `"clientToken"`: A unique, case-sensitive identifier that you provide to ensure the
  idempotency of the request. Idempotency ensures that an API request completes only once.
  With an idempotent request, if the original request completes successfully, subsequent
  retries with the same client token returns the result from the original successful request.
   If you do not specify a client token, one is automatically generated by the AWS SDK.
- `"customerManagedKey"`: The customer managed key of the web portal.
- `"displayName"`: The name of the web portal. This is not visible to users who log into
  the web portal.
- `"tags"`: The tags to add to the web portal. A tag is a key-value pair.
"""
function create_portal(; aws_config::AbstractAWSConfig=global_aws_config())
    return workspaces_web(
        "POST",
        "/portals",
        Dict{String,Any}("clientToken" => string(uuid4()));
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function create_portal(
    params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "POST",
        "/portals",
        Dict{String,Any}(
            mergewith(_merge, Dict{String,Any}("clientToken" => string(uuid4())), params)
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    create_trust_store(certificate_list)
    create_trust_store(certificate_list, params::Dict{String,<:Any})

Creates a trust store that can be associated with a web portal. A trust store contains
certificate authority (CA) certificates. Once associated with a web portal, the browser in
a streaming session will recognize certificates that have been issued using any of the CAs
in the trust store. If your organization has internal websites that use certificates issued
by private CAs, you should add the private CA certificate to the trust store.

# Arguments
- `certificate_list`: A list of CA certificates to be added to the trust store.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: A unique, case-sensitive identifier that you provide to ensure the
  idempotency of the request. Idempotency ensures that an API request completes only once.
  With an idempotent request, if the original request completes successfully, subsequent
  retries with the same client token returns the result from the original successful request.
   If you do not specify a client token, one is automatically generated by the AWS SDK.
- `"tags"`: The tags to add to the trust store. A tag is a key-value pair.
"""
function create_trust_store(
    certificateList; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "POST",
        "/trustStores",
        Dict{String,Any}(
            "certificateList" => certificateList, "clientToken" => string(uuid4())
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function create_trust_store(
    certificateList,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "POST",
        "/trustStores",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "certificateList" => certificateList, "clientToken" => string(uuid4())
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    create_user_settings(copy_allowed, download_allowed, paste_allowed, print_allowed, upload_allowed)
    create_user_settings(copy_allowed, download_allowed, paste_allowed, print_allowed, upload_allowed, params::Dict{String,<:Any})

Creates a user settings resource that can be associated with a web portal. Once associated
with a web portal, user settings control how users can transfer data between a streaming
session and the their local devices.

# Arguments
- `copy_allowed`: Specifies whether the user can copy text from the streaming session to
  the local device.
- `download_allowed`: Specifies whether the user can download files from the streaming
  session to the local device.
- `paste_allowed`: Specifies whether the user can paste text from the local device to the
  streaming session.
- `print_allowed`: Specifies whether the user can print to the local device.
- `upload_allowed`: Specifies whether the user can upload files from the local device to
  the streaming session.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: A unique, case-sensitive identifier that you provide to ensure the
  idempotency of the request. Idempotency ensures that an API request completes only once.
  With an idempotent request, if the original request completes successfully, subsequent
  retries with the same client token returns the result from the original successful request.
   If you do not specify a client token, one is automatically generated by the AWS SDK.
- `"tags"`: The tags to add to the user settings resource. A tag is a key-value pair.
"""
function create_user_settings(
    copyAllowed,
    downloadAllowed,
    pasteAllowed,
    printAllowed,
    uploadAllowed;
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "POST",
        "/userSettings",
        Dict{String,Any}(
            "copyAllowed" => copyAllowed,
            "downloadAllowed" => downloadAllowed,
            "pasteAllowed" => pasteAllowed,
            "printAllowed" => printAllowed,
            "uploadAllowed" => uploadAllowed,
            "clientToken" => string(uuid4()),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function create_user_settings(
    copyAllowed,
    downloadAllowed,
    pasteAllowed,
    printAllowed,
    uploadAllowed,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "POST",
        "/userSettings",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "copyAllowed" => copyAllowed,
                    "downloadAllowed" => downloadAllowed,
                    "pasteAllowed" => pasteAllowed,
                    "printAllowed" => printAllowed,
                    "uploadAllowed" => uploadAllowed,
                    "clientToken" => string(uuid4()),
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    delete_browser_settings(browser_settings_arn)
    delete_browser_settings(browser_settings_arn, params::Dict{String,<:Any})

Deletes browser settings.

# Arguments
- `browser_settings_arn`: The ARN of the browser settings.

"""
function delete_browser_settings(
    browserSettingsArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "DELETE",
        "/browserSettings/$(browserSettingsArn)";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function delete_browser_settings(
    browserSettingsArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "DELETE",
        "/browserSettings/$(browserSettingsArn)",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    delete_identity_provider(identity_provider_arn)
    delete_identity_provider(identity_provider_arn, params::Dict{String,<:Any})

Deletes the identity provider.

# Arguments
- `identity_provider_arn`: The ARN of the identity provider.

"""
function delete_identity_provider(
    identityProviderArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "DELETE",
        "/identityProviders/$(identityProviderArn)";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function delete_identity_provider(
    identityProviderArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "DELETE",
        "/identityProviders/$(identityProviderArn)",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    delete_network_settings(network_settings_arn)
    delete_network_settings(network_settings_arn, params::Dict{String,<:Any})

Deletes network settings.

# Arguments
- `network_settings_arn`: The ARN of the network settings.

"""
function delete_network_settings(
    networkSettingsArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "DELETE",
        "/networkSettings/$(networkSettingsArn)";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function delete_network_settings(
    networkSettingsArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "DELETE",
        "/networkSettings/$(networkSettingsArn)",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    delete_portal(portal_arn)
    delete_portal(portal_arn, params::Dict{String,<:Any})

Deletes a web portal.

# Arguments
- `portal_arn`: The ARN of the web portal.

"""
function delete_portal(portalArn; aws_config::AbstractAWSConfig=global_aws_config())
    return workspaces_web(
        "DELETE",
        "/portals/$(portalArn)";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function delete_portal(
    portalArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "DELETE",
        "/portals/$(portalArn)",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    delete_trust_store(trust_store_arn)
    delete_trust_store(trust_store_arn, params::Dict{String,<:Any})

Deletes the trust store.

# Arguments
- `trust_store_arn`: The ARN of the trust store.

"""
function delete_trust_store(
    trustStoreArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "DELETE",
        "/trustStores/$(trustStoreArn)";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function delete_trust_store(
    trustStoreArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "DELETE",
        "/trustStores/$(trustStoreArn)",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    delete_user_settings(user_settings_arn)
    delete_user_settings(user_settings_arn, params::Dict{String,<:Any})

Deletes user settings.

# Arguments
- `user_settings_arn`: The ARN of the user settings.

"""
function delete_user_settings(
    userSettingsArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "DELETE",
        "/userSettings/$(userSettingsArn)";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function delete_user_settings(
    userSettingsArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "DELETE",
        "/userSettings/$(userSettingsArn)",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    disassociate_browser_settings(portal_arn)
    disassociate_browser_settings(portal_arn, params::Dict{String,<:Any})

Disassociates browser settings from a web portal.

# Arguments
- `portal_arn`: The ARN of the web portal.

"""
function disassociate_browser_settings(
    portalArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "DELETE",
        "/portals/$(portalArn)/browserSettings";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function disassociate_browser_settings(
    portalArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "DELETE",
        "/portals/$(portalArn)/browserSettings",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    disassociate_network_settings(portal_arn)
    disassociate_network_settings(portal_arn, params::Dict{String,<:Any})

Disassociates network settings from a web portal.

# Arguments
- `portal_arn`: The ARN of the web portal.

"""
function disassociate_network_settings(
    portalArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "DELETE",
        "/portals/$(portalArn)/networkSettings";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function disassociate_network_settings(
    portalArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "DELETE",
        "/portals/$(portalArn)/networkSettings",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    disassociate_trust_store(portal_arn)
    disassociate_trust_store(portal_arn, params::Dict{String,<:Any})

Disassociates a trust store from a web portal.

# Arguments
- `portal_arn`: The ARN of the web portal.

"""
function disassociate_trust_store(
    portalArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "DELETE",
        "/portals/$(portalArn)/trustStores";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function disassociate_trust_store(
    portalArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "DELETE",
        "/portals/$(portalArn)/trustStores",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    disassociate_user_settings(portal_arn)
    disassociate_user_settings(portal_arn, params::Dict{String,<:Any})

Disassociates user settings from a web portal.

# Arguments
- `portal_arn`: The ARN of the web portal.

"""
function disassociate_user_settings(
    portalArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "DELETE",
        "/portals/$(portalArn)/userSettings";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function disassociate_user_settings(
    portalArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "DELETE",
        "/portals/$(portalArn)/userSettings",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    get_browser_settings(browser_settings_arn)
    get_browser_settings(browser_settings_arn, params::Dict{String,<:Any})

Gets browser settings.

# Arguments
- `browser_settings_arn`: The ARN of the browser settings.

"""
function get_browser_settings(
    browserSettingsArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "GET",
        "/browserSettings/$(browserSettingsArn)";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function get_browser_settings(
    browserSettingsArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "GET",
        "/browserSettings/$(browserSettingsArn)",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    get_identity_provider(identity_provider_arn)
    get_identity_provider(identity_provider_arn, params::Dict{String,<:Any})

Gets the identity provider.

# Arguments
- `identity_provider_arn`: The ARN of the identity provider.

"""
function get_identity_provider(
    identityProviderArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "GET",
        "/identityProviders/$(identityProviderArn)";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function get_identity_provider(
    identityProviderArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "GET",
        "/identityProviders/$(identityProviderArn)",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    get_network_settings(network_settings_arn)
    get_network_settings(network_settings_arn, params::Dict{String,<:Any})

Gets the network settings.

# Arguments
- `network_settings_arn`: The ARN of the network settings.

"""
function get_network_settings(
    networkSettingsArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "GET",
        "/networkSettings/$(networkSettingsArn)";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function get_network_settings(
    networkSettingsArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "GET",
        "/networkSettings/$(networkSettingsArn)",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    get_portal(portal_arn)
    get_portal(portal_arn, params::Dict{String,<:Any})

Gets the web portal.

# Arguments
- `portal_arn`: The ARN of the web portal.

"""
function get_portal(portalArn; aws_config::AbstractAWSConfig=global_aws_config())
    return workspaces_web(
        "GET",
        "/portals/$(portalArn)";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function get_portal(
    portalArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "GET",
        "/portals/$(portalArn)",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    get_portal_service_provider_metadata(portal_arn)
    get_portal_service_provider_metadata(portal_arn, params::Dict{String,<:Any})

Gets the service provider metadata.

# Arguments
- `portal_arn`: The ARN of the web portal.

"""
function get_portal_service_provider_metadata(
    portalArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "GET",
        "/portalIdp/$(portalArn)";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function get_portal_service_provider_metadata(
    portalArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "GET",
        "/portalIdp/$(portalArn)",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    get_trust_store(trust_store_arn)
    get_trust_store(trust_store_arn, params::Dict{String,<:Any})

Gets the trust store.

# Arguments
- `trust_store_arn`: The ARN of the trust store.

"""
function get_trust_store(trustStoreArn; aws_config::AbstractAWSConfig=global_aws_config())
    return workspaces_web(
        "GET",
        "/trustStores/$(trustStoreArn)";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function get_trust_store(
    trustStoreArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "GET",
        "/trustStores/$(trustStoreArn)",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    get_trust_store_certificate(thumbprint, trust_store_arn)
    get_trust_store_certificate(thumbprint, trust_store_arn, params::Dict{String,<:Any})

Gets the trust store certificate.

# Arguments
- `thumbprint`: The thumbprint of the trust store certificate.
- `trust_store_arn`: The ARN of the trust store certificate.

"""
function get_trust_store_certificate(
    thumbprint, trustStoreArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "GET",
        "/trustStores/$(trustStoreArn)/certificate",
        Dict{String,Any}("thumbprint" => thumbprint);
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function get_trust_store_certificate(
    thumbprint,
    trustStoreArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "GET",
        "/trustStores/$(trustStoreArn)/certificate",
        Dict{String,Any}(
            mergewith(_merge, Dict{String,Any}("thumbprint" => thumbprint), params)
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    get_user_settings(user_settings_arn)
    get_user_settings(user_settings_arn, params::Dict{String,<:Any})

Gets user settings.

# Arguments
- `user_settings_arn`: The ARN of the user settings.

"""
function get_user_settings(
    userSettingsArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "GET",
        "/userSettings/$(userSettingsArn)";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function get_user_settings(
    userSettingsArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "GET",
        "/userSettings/$(userSettingsArn)",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    list_browser_settings()
    list_browser_settings(params::Dict{String,<:Any})

Retrieves a list of browser settings.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of results to be included in the next page.
- `"nextToken"`: The pagination token used to retrieve the next page of results for this
  operation.
"""
function list_browser_settings(; aws_config::AbstractAWSConfig=global_aws_config())
    return workspaces_web(
        "GET", "/browserSettings"; aws_config=aws_config, feature_set=SERVICE_FEATURE_SET
    )
end
function list_browser_settings(
    params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "GET",
        "/browserSettings",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    list_identity_providers(portal_arn)
    list_identity_providers(portal_arn, params::Dict{String,<:Any})

Retrieves a list of identity providers for a specific web portal.

# Arguments
- `portal_arn`: The ARN of the web portal.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of results to be included in the next page.
- `"nextToken"`: The pagination token used to retrieve the next page of results for this
  operation.
"""
function list_identity_providers(
    portalArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "GET",
        "/portals/$(portalArn)/identityProviders";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function list_identity_providers(
    portalArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "GET",
        "/portals/$(portalArn)/identityProviders",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    list_network_settings()
    list_network_settings(params::Dict{String,<:Any})

Retrieves a list of network settings.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of results to be included in the next page.
- `"nextToken"`: The pagination token used to retrieve the next page of results for this
  operation.
"""
function list_network_settings(; aws_config::AbstractAWSConfig=global_aws_config())
    return workspaces_web(
        "GET", "/networkSettings"; aws_config=aws_config, feature_set=SERVICE_FEATURE_SET
    )
end
function list_network_settings(
    params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "GET",
        "/networkSettings",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    list_portals()
    list_portals(params::Dict{String,<:Any})

Retrieves a list or web portals.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of results to be included in the next page.
- `"nextToken"`: The pagination token used to retrieve the next page of results for this
  operation.
"""
function list_portals(; aws_config::AbstractAWSConfig=global_aws_config())
    return workspaces_web(
        "GET", "/portals"; aws_config=aws_config, feature_set=SERVICE_FEATURE_SET
    )
end
function list_portals(
    params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "GET", "/portals", params; aws_config=aws_config, feature_set=SERVICE_FEATURE_SET
    )
end

"""
    list_tags_for_resource(resource_arn)
    list_tags_for_resource(resource_arn, params::Dict{String,<:Any})

Retrieves a list of tags for a resource.

# Arguments
- `resource_arn`: The ARN of the resource.

"""
function list_tags_for_resource(
    resourceArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "GET",
        "/tags/$(resourceArn)";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function list_tags_for_resource(
    resourceArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "GET",
        "/tags/$(resourceArn)",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    list_trust_store_certificates(trust_store_arn)
    list_trust_store_certificates(trust_store_arn, params::Dict{String,<:Any})

Retrieves a list of trust store certificates.

# Arguments
- `trust_store_arn`: The ARN of the trust store

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of results to be included in the next page.
- `"nextToken"`: The pagination token used to retrieve the next page of results for this
  operation.
"""
function list_trust_store_certificates(
    trustStoreArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "GET",
        "/trustStores/$(trustStoreArn)/certificates";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function list_trust_store_certificates(
    trustStoreArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "GET",
        "/trustStores/$(trustStoreArn)/certificates",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    list_trust_stores()
    list_trust_stores(params::Dict{String,<:Any})

Retrieves a list of trust stores.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of results to be included in the next page.
- `"nextToken"`: The pagination token used to retrieve the next page of results for this
  operation.
"""
function list_trust_stores(; aws_config::AbstractAWSConfig=global_aws_config())
    return workspaces_web(
        "GET", "/trustStores"; aws_config=aws_config, feature_set=SERVICE_FEATURE_SET
    )
end
function list_trust_stores(
    params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "GET",
        "/trustStores",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    list_user_settings()
    list_user_settings(params::Dict{String,<:Any})

Retrieves a list of user settings.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of results to be included in the next page.
- `"nextToken"`: The pagination token used to retrieve the next page of results for this
  operation.
"""
function list_user_settings(; aws_config::AbstractAWSConfig=global_aws_config())
    return workspaces_web(
        "GET", "/userSettings"; aws_config=aws_config, feature_set=SERVICE_FEATURE_SET
    )
end
function list_user_settings(
    params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "GET",
        "/userSettings",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    tag_resource(resource_arn, tags)
    tag_resource(resource_arn, tags, params::Dict{String,<:Any})

Adds or overwrites one or more tags for the specified resource.

# Arguments
- `resource_arn`: The ARN of the resource.
- `tags`: The tags of the resource.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: A unique, case-sensitive identifier that you provide to ensure the
  idempotency of the request. Idempotency ensures that an API request completes only once.
  With an idempotent request, if the original request completes successfully, subsequent
  retries with the same client token returns the result from the original successful request.
   If you do not specify a client token, one is automatically generated by the AWS SDK.
"""
function tag_resource(resourceArn, tags; aws_config::AbstractAWSConfig=global_aws_config())
    return workspaces_web(
        "POST",
        "/tags/$(resourceArn)",
        Dict{String,Any}("tags" => tags, "clientToken" => string(uuid4()));
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function tag_resource(
    resourceArn,
    tags,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "POST",
        "/tags/$(resourceArn)",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}("tags" => tags, "clientToken" => string(uuid4())),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    untag_resource(resource_arn, tag_keys)
    untag_resource(resource_arn, tag_keys, params::Dict{String,<:Any})

Removes one or more tags from the specified resource.

# Arguments
- `resource_arn`: The ARN of the resource.
- `tag_keys`: The list of tag keys to remove from the resource.

"""
function untag_resource(
    resourceArn, tagKeys; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "DELETE",
        "/tags/$(resourceArn)",
        Dict{String,Any}("tagKeys" => tagKeys);
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function untag_resource(
    resourceArn,
    tagKeys,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "DELETE",
        "/tags/$(resourceArn)",
        Dict{String,Any}(mergewith(_merge, Dict{String,Any}("tagKeys" => tagKeys), params));
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    update_browser_settings(browser_settings_arn)
    update_browser_settings(browser_settings_arn, params::Dict{String,<:Any})

Updates browser settings.

# Arguments
- `browser_settings_arn`: The ARN of the browser settings.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"browserPolicy"`: A JSON string containing Chrome Enterprise policies that will be
  applied to all streaming sessions.
- `"clientToken"`: A unique, case-sensitive identifier that you provide to ensure the
  idempotency of the request. Idempotency ensures that an API request completes only once.
  With an idempotent request, if the original request completes successfully, subsequent
  retries with the same client token return the result from the original successful request.
  If you do not specify a client token, one is automatically generated by the AWS SDK.
"""
function update_browser_settings(
    browserSettingsArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "PATCH",
        "/browserSettings/$(browserSettingsArn)",
        Dict{String,Any}("clientToken" => string(uuid4()));
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function update_browser_settings(
    browserSettingsArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "PATCH",
        "/browserSettings/$(browserSettingsArn)",
        Dict{String,Any}(
            mergewith(_merge, Dict{String,Any}("clientToken" => string(uuid4())), params)
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    update_identity_provider(identity_provider_arn)
    update_identity_provider(identity_provider_arn, params::Dict{String,<:Any})

Updates the identity provider.

# Arguments
- `identity_provider_arn`: The ARN of the identity provider.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: A unique, case-sensitive identifier that you provide to ensure the
  idempotency of the request. Idempotency ensures that an API request completes only once.
  With an idempotent request, if the original request completes successfully, subsequent
  retries with the same client token return the result from the original successful request.
  If you do not specify a client token, one is automatically generated by the AWS SDK.
- `"identityProviderDetails"`: The details of the identity provider.
- `"identityProviderName"`: The name of the identity provider.
- `"identityProviderType"`: The type of the identity provider.
"""
function update_identity_provider(
    identityProviderArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "PATCH",
        "/identityProviders/$(identityProviderArn)",
        Dict{String,Any}("clientToken" => string(uuid4()));
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function update_identity_provider(
    identityProviderArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "PATCH",
        "/identityProviders/$(identityProviderArn)",
        Dict{String,Any}(
            mergewith(_merge, Dict{String,Any}("clientToken" => string(uuid4())), params)
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    update_network_settings(network_settings_arn)
    update_network_settings(network_settings_arn, params::Dict{String,<:Any})

Updates network settings.

# Arguments
- `network_settings_arn`: The ARN of the network settings.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: A unique, case-sensitive identifier that you provide to ensure the
  idempotency of the request. Idempotency ensures that an API request completes only once.
  With an idempotent request, if the original request completes successfully, subsequent
  retries with the same client token return the result from the original successful request.
  If you do not specify a client token, one is automatically generated by the AWS SDK.
- `"securityGroupIds"`: One or more security groups used to control access from streaming
  instances to your VPC.
- `"subnetIds"`: The subnets in which network interfaces are created to connect streaming
  instances to your VPC. At least two of these subnets must be in different availability
  zones.
- `"vpcId"`: The VPC that streaming instances will connect to.
"""
function update_network_settings(
    networkSettingsArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "PATCH",
        "/networkSettings/$(networkSettingsArn)",
        Dict{String,Any}("clientToken" => string(uuid4()));
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function update_network_settings(
    networkSettingsArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "PATCH",
        "/networkSettings/$(networkSettingsArn)",
        Dict{String,Any}(
            mergewith(_merge, Dict{String,Any}("clientToken" => string(uuid4())), params)
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    update_portal(portal_arn)
    update_portal(portal_arn, params::Dict{String,<:Any})

Updates a web portal.

# Arguments
- `portal_arn`: The ARN of the web portal.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"displayName"`: The name of the web portal. This is not visible to users who log into
  the web portal.
"""
function update_portal(portalArn; aws_config::AbstractAWSConfig=global_aws_config())
    return workspaces_web(
        "PUT",
        "/portals/$(portalArn)";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function update_portal(
    portalArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "PUT",
        "/portals/$(portalArn)",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    update_trust_store(trust_store_arn)
    update_trust_store(trust_store_arn, params::Dict{String,<:Any})

Updates the trust store.

# Arguments
- `trust_store_arn`: The ARN of the trust store.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"certificatesToAdd"`: A list of CA certificates to add to the trust store.
- `"certificatesToDelete"`: A list of CA certificates to delete from a trust store.
- `"clientToken"`: A unique, case-sensitive identifier that you provide to ensure the
  idempotency of the request. Idempotency ensures that an API request completes only once.
  With an idempotent request, if the original request completes successfully, subsequent
  retries with the same client token return the result from the original successful request.
  If you do not specify a client token, one is automatically generated by the AWS SDK.
"""
function update_trust_store(
    trustStoreArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "PATCH",
        "/trustStores/$(trustStoreArn)",
        Dict{String,Any}("clientToken" => string(uuid4()));
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function update_trust_store(
    trustStoreArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "PATCH",
        "/trustStores/$(trustStoreArn)",
        Dict{String,Any}(
            mergewith(_merge, Dict{String,Any}("clientToken" => string(uuid4())), params)
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    update_user_settings(user_settings_arn)
    update_user_settings(user_settings_arn, params::Dict{String,<:Any})

Updates the user settings.

# Arguments
- `user_settings_arn`: The ARN of the user settings.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: A unique, case-sensitive identifier that you provide to ensure the
  idempotency of the request. Idempotency ensures that an API request completes only once.
  With an idempotent request, if the original request completes successfully, subsequent
  retries with the same client token return the result from the original successful request.
  If you do not specify a client token, one is automatically generated by the AWS SDK.
- `"copyAllowed"`: Specifies whether the user can copy text from the streaming session to
  the local device.
- `"downloadAllowed"`: Specifies whether the user can download files from the streaming
  session to the local device.
- `"pasteAllowed"`: Specifies whether the user can paste text from the local device to the
  streaming session.
- `"printAllowed"`: Specifies whether the user can print to the local device.
- `"uploadAllowed"`: Specifies whether the user can upload files from the local device to
  the streaming session.
"""
function update_user_settings(
    userSettingsArn; aws_config::AbstractAWSConfig=global_aws_config()
)
    return workspaces_web(
        "PATCH",
        "/userSettings/$(userSettingsArn)",
        Dict{String,Any}("clientToken" => string(uuid4()));
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function update_user_settings(
    userSettingsArn,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return workspaces_web(
        "PATCH",
        "/userSettings/$(userSettingsArn)",
        Dict{String,Any}(
            mergewith(_merge, Dict{String,Any}("clientToken" => string(uuid4())), params)
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end


text:
module adapters_postgresql_dates_test

using Test # @test
using Octo.Adapters.PostgreSQL # SELECT FROM WHERE NOW() CURRENT_DATE extract

using Dates: DateTime, Year, Month, Day

@test to_sql([SELECT * FROM :users WHERE :created_at <= NOW() - Day(30)]) ==
             "SELECT * FROM users WHERE created_at <= NOW() - INTERVAL '30 days'"
@test to_sql([SELECT * FROM :users WHERE :created_at <= NOW() + Day(30)]) ==
             "SELECT * FROM users WHERE created_at <= NOW() + INTERVAL '30 days'"

struct License
end
Schema.model(License, table_name="licenses")
l = from(License)
@test to_sql([SELECT (l.purchased + l.valid * Day(1)) FROM l]) ==
             "SELECT purchased + valid * INTERVAL '1 day' FROM licenses"

@test to_sql([SELECT CURRENT_DATE + Day(1)]) ==
             "SELECT CURRENT_DATE + INTERVAL '1 day'"

timestamp = DateTime(2001,02,16, 20,38,40)
@test to_sql([SELECT extract(Month, timestamp)]) ==
             "SELECT EXTRACT(MONTH FROM TIMESTAMP '2001-02-16 20:38:40')"

months = Year(2) + Month(3)
@test to_sql([SELECT extract(Month, months)]) ==
             "SELECT EXTRACT(MONTH FROM INTERVAL '2 years 3 months')"

end # module adapters_postgresql_dates_test

ext: jl


text:
# dummy module for testing assignment in parcel
module A
    module B
        module C
        struct CT
            x::Int
        end
        end
        module D
        end
    end
    f(a) = 1
    myjoin(arg::String, args::String...) = arg * " " * join(args, ' ')
end


text:
# Copyright 2017, Iain Dunning, Joey Huchette, Miles Lubin, and contributors    #src
# This Source Code Form is subject to the terms of the Mozilla Public License   #src
# v.2.0. If a copy of the MPL was not distributed with this file, You can       #src
# obtain one at https://mozilla.org/MPL/2.0/.                                   #src

# # K-means clustering via SDP

# From "Approximating K-means-type clustering via semidefinite programming" By
# Jiming Peng and Yu Wei.
#
# Given a set of points $a_1, \ldots, a_m$  in $R_n$, allocate them to k clusters.

using JuMP
import LinearAlgebra
import SCS
import Test  #src

function example_cluster(; verbose = true)
    ## Data points
    n = 2
    m = 6
    a = Any[
        [2.0, 2.0], [2.5, 2.1], [7.0, 7.0], [2.2, 2.3], [6.8, 7.0], [7.2, 7.5]
    ]
    k = 2
    ## Weight matrix
    W = zeros(m, m)
    for i in 1:m
        for j in i + 1:m
            W[i, j] = W[j, i] = exp(-LinearAlgebra.norm(a[i] - a[j]) / 1.0)
        end
    end
    model = Model(SCS.Optimizer)
    set_silent(model)
    ## Z >= 0, PSD
    @variable(model, Z[1:m, 1:m], PSD)
    @constraint(model, Z .>= 0)
    ## min Tr(W(I-Z))
    I = Matrix(1.0 * LinearAlgebra.I, m, m)
    @objective(model, Min, LinearAlgebra.tr(W * (I - Z)))
    ## Z e = e
    @constraint(model, Z * ones(m) .== ones(m))
    ## Tr(Z) = k
    @constraint(model, LinearAlgebra.tr(Z) == k)
    optimize!(model)
    Z_val = value.(Z)
    ## A simple rounding scheme
    which_cluster = zeros(Int, m)
    num_clusters = 0
    for i in 1:m
        Z_val[i, i] <= 1e-6 && continue
        if which_cluster[i] == 0
            num_clusters += 1
            which_cluster[i] = num_clusters
            for j in i + 1:m
                if LinearAlgebra.norm(Z_val[i, j] - Z_val[i, i]) <= 1e-6
                    which_cluster[j] = num_clusters
                end
            end
        end
    end
    Test.@test which_cluster == [1, 1, 2, 1, 2, 2]  #src
    if verbose
        ## Print results
        for cluster in 1:k
            println("Cluster $cluster")
            for i in 1:m
                if which_cluster[i] == cluster
                    println(a[i])
                end
            end
        end
    end
    return
end

example_cluster()

max_stars_repo_name: ethansaxenian/RosettaDecode

max_issues_repo_name: ethansaxenian/RosettaDecode

max_forks_repo_name: ethansaxenian/RosettaDecode


text:
# Use baremodule to shave off a few KB from the serialized `.ji` file
baremodule SoapyUHD_jll
using Base
using Base: UUID
import JLLWrappers

JLLWrappers.@generate_main_file_header("SoapyUHD")
JLLWrappers.@generate_main_file("SoapyUHD", UUID("5710b6fb-c5a3-5f8f-93a5-d73c28ee0e84"))
end  # module SoapyUHD_jll


text:
"""
    helpers.jl -- Feel free to modify anything you like in this file!

Provides the problem structure and some useful functions. In particular, students may be
interested in `count` - to help with writing their algorithm, and `main` - to test their
methods. Note that `starter_code/localtest.jl` provides an identical test to that found
in the autograder. `main`, on the other hand, returns other metrics that may be of
interest during development.
"""

# Statistics is the only allowed external package (Random is part of the standard library)
# If you would like to use any other (standard) packages, make sure to do so in `project2.jl`
# *NOT HERE*.
using Random
using Statistics

# A global counter that keeps track of how many times each function has been called.
# It may seem like a clever hack to edit this dictionary as part of your optimize
# method to get infinite function evaluations, but beware...
# you'll regret it when it goes through the autograder
const COUNTERS = Dict{String, Int}()

"""
    @counted

A function defined with this macro increments the global counter `COUNTERS`
each time it's called.

Example:
    @counted f(x) = 2x  #each time `f(x)` is called, we also have `COUNTERS["f"] += 1`
"""
macro counted(f)
    name = f.args[1].args[1]
    name_str = String(name)
    body = f.args[2]
    update_counter = quote
        if !haskey(COUNTERS, $name_str)
            COUNTERS[$name_str] = 0
        end
        COUNTERS[$name_str] += 1
    end
    insert!(body.args, 1, update_counter)
    return f
end

# simple.jl defines the 3 simple problems. It's included down here rather than at the
# top because it relies on @counted and COUNTERS to track the evaluation counts.
include("simple.jl")

const PROBS = Dict("simple1" => (f=simple1, g=simple1_gradient, c = simple1_constraints, x0=simple1_init, n=2000),
                   "simple2" => (f=simple2, g=simple2_gradient, c = simple2_constraints, x0=simple2_init, n=2000),
                   "simple3" => (f=simple3, g=simple3_gradient, c = simple3_constraints, x0=simple3_init, n=2000))

"""
    count(f::Function)
    count(f, g)
    count(f, g, c)

Check how many times the function f has been called, or calculate `f + 2g`, or `f + 2g + c`
"""
Base.count(f::Function) = get(COUNTERS, string(nameof(f)), 0)
Base.count(f::Function, g::Function) = count(f) + 2*count(g)
Base.count(f::Function, g::Function, c::Function) = count(f) + 2*count(g) + count(c)

"""
    get_score(f, g, c, x, n)

The score is computed as `f(x⋆)` using the potential optimum `x`.
If `count(f, g) + count(c) > n`, or the constraints are violated, the score is increased significantly,
with overevaluating being penalized much harsher than constraint violation.
Also returns the number of evaluations.
"""
function get_score(f, g, c, x, n)
    num_evals = count(f, g) + count(c)

    # helper function to compute the inf-norm penalty
    p_max(x) = max(maximum(c(x)), 0)

    score = f(x)
    score += (num_evals>n)*1e9 + (p_max(x)>0)*1e7

    return num_evals, score
end

"""
    main(probname, repeat, opt_func)

Evaluates a problem given by `probname` `repeat` times using `opt_func`
as the optimization (pass in your `optimize`). Returns the number of evaluations
for each trial and each trial's score.

## Arguments:
    - `probname`: Name of optimization problem (e.g. "simple1")
    - `repeat`: Number of Monte Carlo evaluations
    - `opt_func`: Optimization algorithm
## Returns:
    - (`scores`, `nevals`)
"""
function main(probname::String, repeat::Int, opt_func, seed = 42)
    prob = PROBS[probname]
    f, g, c, x0, n = prob.f, prob.g, prob.c, prob.x0, prob.n

    scores = zeros(repeat)
    nevals = zeros(Int, repeat)
    optima = Vector{typeof(x0())}(undef, repeat)

    # Repeat the optimization with a different initialization
    for i in 1:repeat
        empty!(COUNTERS) # fresh eval-count each time
        Random.seed!(seed + i)
        optima[i] = opt_func(f, g, c, x0(), n, probname)
        nevals[i], scores[i] = get_score(f, g, c, optima[i], n)
    end

    return scores, nevals, optima
end


text:
abstract type AbstractStepwiseRegression{T} end
######################### Forward Regression #############################
struct ForwardRegression{T, AT<:AbstractMatOrFac{T}, B<:AbstractVector{T},
                        V<:AbstractVector{T}, QT<:AbstractMatOrFac{T}, FT} <: AbstractMatchingPursuit{T}
    A::AT # matrix
    b::B # target
    r::V # residual
    QA::QT # temporary storage
    AiQR::FT # updatable QR factorization of Ai
    δ²::V # decrease in SQUARED residual norm
    rescaling::V # OLS rescaling
end
const FR = ForwardRegression
const OrthogonalLeastSquares = ForwardRegression # a.k.a.
const OLS = OrthogonalLeastSquares
const OOMP = OLS # a.k.a. Optimal OMP
const ORMP = OLS # a.k.a order-recursive matching pursuit
const StepwiseRegression = FR

FR(A::AbstractMatOrFac, b::AbstractVector, x::SparseVector) = FR(A, b, x.nzind)
function FR(A::AbstractMatOrFac, b::AbstractVector, nzind::AbstractVector{Int} = ones(Int, 0))
    size(A, 1) == length(b) || throw(DimensionMismatch("size(A, 1) = $(size(A, 1)) ≠ $(length(b)) = length(b)"))
    n, m = size(A)
    T = eltype(A)
    r, Ar = zeros(T, n), zeros(T, m)
    QA = zeros(T, (n, m))
    AiQR = UpdatableQR(A[:, nzind])
    rescaling = colnorms(A)
    δ² = fill(-Inf, m)
    FR(A, b, r, QA, AiQR, δ², rescaling)
end

function fr(A::AbstractMatOrFac, b::AbstractVector;
     max_residual::Real = 0., min_decrease::Real = 0., sparsity::Int = size(A, 2))
     fr(A, b, max_residual, min_decrease, sparsity)
end

# calculates a solution to a potentially underdetermined
# linear system Ax = b with the forward greedy algorithm
# max_ε is the residual norm tolerance
# min_δ is the largest marginal increase in residual norm before the algorithm terminates
# k is the desired sparsity of the solution
# whichever criterion is hit first
function fr(A::AbstractMatOrFac, b::AbstractVector, max_ε::Real, min_δ::Real,
            k::Int = size(A, 1), x = spzeros(size(A, 2)))
    P = FR(A, b)
    for i in 1:k
        forward_step!(P, x, max_ε, min_δ) || break
    end
    return x
end
const ols = fr
const oomp = fr
const ormp = fr
# returns true if foward step was successful, updates x in place
function forward_step!(P::FR, x::SparseVector, max_ε::Real, min_δ::Real)
    nnz(x) < size(P.A, 1) || return false
    residual!(P.r, P.A, x, P.b)
    normr = norm(P.r)
    normr > max_ε || return false
    δ² = forward_δ!(P, x)
    max_δ², i = findmax(δ²)
    if min_δ^2 < max_δ²
        a = @view P.A[:, i]
        addindex!(x, P.AiQR, a, i) # i is index into x.nzval, NOT into x
        ldiv!!(x.nzval, P.AiQR, P.b, P.r)
        return true
    else
        ldiv!!(x.nzval, P.AiQR, P.b, P.r)
        return false
    end
end

function forward_δ!(P::FR, x::AbstractVector)
    residual!(P, x)
    mul!(P.δ², P.A', P.r) # δ = Ar = q
    rescaling = ols_rescaling!(P, x)
    @. P.δ² = P.δ²^2 / rescaling
    @. P.δ²[x.nzind] = 0
    return P.δ²
end

function acquisition_index!(P::FR, x::AbstractVector)
    argmax(forward_δ!(P, x))
end

function update!(P::FR, x::AbstractVector)
    nnz(x) < size(P.A, 1) || return false
    i = acquisition_index!(P, x)
    a = @view P.A[:, i]
    addindex!(x, P.AiQR, a, i)
    ldiv!!(x.nzval, P.AiQR, P.b, P.r) # least-squares solve for active atoms, reuses P.r for intermediate result
    return x
end

###############################################################################
# calculates squared energetic norm of all passive atoms
# |x|^2 - x' * P_I * x where P_I is the projection onto active column set of A
# Q is assumed to be part of QR-factorization of active set
function ols_rescaling!(P::OLS, x::SparseVector)
    Q = P.AiQR.Q
    # @. P.QA = P.A
    # lmul!(Q, P.QA)
    mul!(P.QA, Q', P.A)
    sum!(abs2, P.rescaling', P.A) # unnecessary if P.A is normalized
    QA = @view P.QA[1:nnz(x), :]
    k, m = size(QA)
    for j in 1:m
        @simd for i in 1:k
            @inbounds P.rescaling[j] -= QA[i, j]^2
        end
    end
    return P.rescaling
end


text:
using OceanTurbulenceParameterEstimation.LossFunctions: ForwardMap
using OceanTurbulenceParameterEstimation.Models: FreeParameters
using OceanTurbulenceParameterEstimation.ParameterEstimation: InverseProblem

"""
    visualize!(output::ForwardMap;
                    fields = [:u, :v, :b, :e],
                    directory = pwd(),
                    filename = "realizations.png"
                    )
"""
function visualize!(output::ForwardMap;
                    fields = [:u, :v, :b, :e],
                    directory = pwd(),
                    filename = "realizations.png"
                    )
    isdir(directory) || makedir(directory)

    fig = Figure(resolution = (200*(length(fields)+1), 200*length(observations)), font = "CMU Serif")
    colors = [:black, :red, :blue]

    function empty_plot!(fig_position)
        ax = fig_position = Axis(fig_position)
        hidedecorations!(ax)
        hidespines!(ax, :t, :b, :l, :r)
    end

    for (i, data) in enumerate(observations)

        targets = data.targets
        snapshots = round.(Int, range(targets[1], targets[end], length=3))
        bcs = data.boundary_conditions

        empty_plot!(fig[i,1])
        text!(fig[i,1], "Qᵇ = $(tostring(bcs.Qᵇ)) m⁻¹s⁻³\nQᵘ = $(tostring(bcs.Qᵘ)) m⁻¹s⁻²\nf = $(tostring(data.constants[:f])) s⁻¹",
                    position = (0, 0),
                    align = (:center, :center),
                    textsize = 15,
                    justification = :left)

        for (j, field) in enumerate(fields)
            middle = j > 1 && j < length(fields)
            remove_spines = j == 1 ? (:t, :r) : j == length(fields) ? (:t, :l) : (:t, :l, :r)
            axis_position = j == length(fields) ? (ylabelposition=:right, yaxisposition=:right) : NamedTuple()

            j += 1 # reserve the first column for row labels

            info = field_guide[field]

            # field data for each time step
            truth = getproperty(data, field)
            prediction = getproperty(predictions_batch[i], field)

            z = field ∈ [:u, :v] ? data.grid.zF[1:data.grid.Nz] : data.grid.zC[1:data.grid.Nz]

            to_plot = field ∈ data.relevant_fields

            if to_plot

                ax = Axis(fig[i,j]; xlabelpadding=0, xtickalign=1, ytickalign=1,
                                            merge(axis_position, info.axis_args)...)

                hidespines!(ax, remove_spines...)

                middle && hideydecorations!(ax, grid=false)

                lins = []
                for (color_index, target) in enumerate(snapshots)
                    l = lines!([interior(truth[target]) .* info.scaling ...], z; color = (colors[color_index], 0.4))
                    push!(lins, l)
                    l = lines!([interior(prediction[target - snapshots[1] + 1]) .* info.scaling ...], z; color = (colors[color_index], 1.0), linestyle = :dash)
                    push!(lins, l)
                end

                times = @. round((data.t[snapshots] - data.t[snapshots[1]]) / 86400, sigdigits=2)

                legendlabel(time) = ["LES, t = $time days", "Model, t = $time days"]
                Legend(fig[1,2:3], lins, vcat([legendlabel(time) for time in times]...), nbanks=2)
                lins = []
            else

                empty_plot!(fig[i,j])
            end
        end
    end

    save(joinpath(directory, filename), fig, px_per_unit = 2.0)
    return nothing
end

visualize!(ip::InverseProblem, parameters; kwargs...) = visualize!(model_time_series(ip, parameters); kwargs...)

function visualize_and_save!(calibration, validation, parameters, directory; fields=[:u, :v, :b, :e])
        isdir(directory) || makedir(directory)

        path = joinpath(directory, "results.txt")
        o = open_output_file(path)
        write(o, "Training relative weights: $(calibration.relative_weights) \n")
        write(o, "Validation relative weights: $(validation.relative_weights) \n")
        write(o, "Training default parameters: $(validation.default_parameters) \n")
        write(o, "Validation default parameters: $(validation.default_parameters) \n")

        write(o, "------------ \n \n")
        default_parameters = calibration.default_parameters
        train_loss_default = calibration(default_parameters)
        valid_loss_default = validation(default_parameters)
        write(o, "Default parameters: $(default_parameters) \nLoss on training: $(train_loss_default) \nLoss on validation: $(valid_loss_default) \n------------ \n \n")

        train_loss = calibration(parameters)
        valid_loss = validation(parameters)
        write(o, "Parameters: $(parameters) \nLoss on training: $(train_loss) \nLoss on validation: $(valid_loss) \n------------ \n \n")

        write(o, "Training loss reduction: $(train_loss/train_loss_default) \n")
        write(o, "Validation loss reduction: $(valid_loss/valid_loss_default) \n")
        close(o)

        parameters = calibration.parameters.ParametersToOptimize(parameters)

        for inverse_problem in [calibration, validation]

            all_data = inverse_problem.observations
            simulation = inverse_problem.simulation
            set!(simulation.model, parameters)

            for data_length in Set(length.(getproperty.(all_data, :t)))

                observations = [d for d in all_data if length(d.t) == data_length]
                days = observations[1].t[end]/86400

                new_ip = InverseProblem()

                visualize!(simulation, observations, parameters;
                                                 fields = fields,
                                                 filename = joinpath(directory, "$(days)_day_simulations.png"))
            end
        end

    return nothing
end


text:
# Use baremodule to shave off a few KB from the serialized `.ji` file
baremodule LHAPDF_jll
using Base
using Base: UUID
import JLLWrappers

JLLWrappers.@generate_main_file_header("LHAPDF")
JLLWrappers.@generate_main_file("LHAPDF", UUID("35e999c2-fdc2-5bcf-ab83-8b034bf9a5d1"))
end  # module LHAPDF_jll


text:
# instantiate environment
using Pkg; Pkg.instantiate()

using GeoStats
using SpectralGaussianSimulation
using DensityRatioEstimation
using CategoricalArrays
using LossFunctions
using ProgressMeter
using DataFrames
using MLJ, CSV
using LinearAlgebra
using Random

# reproducible results
Random.seed!(2020)

# generate random images with given spatial mean, range and sill
function generator(nimgs=1; mean=0., range=1., sill=1., size=(100,100))
  γ = GaussianVariogram(range=range, sill=sill)
  p = SimulationProblem(RegularGrid{Float64}(size), (:Z1=>Float64,:Z2=>Float64), nimgs)
  s = SpecGaussSim(:Z1=>(mean=mean, variogram=γ), :Z2=>(mean=mean, variogram=γ))
  solve(p, s)
end

# generate a covariate shift configuration with given δ and τ
function covariateshift(δ, τ, r; ns=1, nt=1, size=(100,100))
  μ₁, σ₁ = 0.0, 1.0
  μ₂, σ₂ = (3*√2*σ₁)δ + μ₁, τ*σ₁
  simgs = generator(ns, mean=μ₁, sill=σ₁^2, range=r, size=size)
  timgs = generator(nt, mean=μ₂, sill=σ₂^2, range=r, size=size)
  simgs, timgs
end

# geostatistical learning problem with given covariate shift configuration
function problem(; δ=0.0, τ=1.0, r=10.0, size=(100,100))
  # covariate shift
  simgs, timgs = covariateshift(δ, τ, r, nt=101, size=size)

  # sine-norm labeling function
  label(z, p=1) = sin(4*norm(z, p)) < 0 ? 1 : 0
  function f(Γ)
    labels = [label(z) for z in view(Γ, [:Z1,:Z2])]
    ldict  = OrderedDict(:LABEL => categorical(labels))
    georef(ldict, domain(Γ))
  end

  # add labels to all samples
  Ωss = [join(Ω, f(Ω)) for Ω in simgs]
  Ωts = [join(Ω, f(Ω)) for Ω in timgs]

  # geostatistical learning problem
  t = ClassificationTask((:Z1,:Z2), :LABEL)
  p = LearningProblem(Ωss[1], Ωts[1], t)

  # return problem and other Ωt samples
  p, Ωts[2:end]
end

# estimators of generalization error
error_cv( m, p, k, ℒ) = error(PointwiseLearn(m), p, CrossValidation(k, loss=ℒ))
error_bcv(m, p, r, ℒ) = error(PointwiseLearn(m), p, BlockCrossValidation(r, loss=ℒ))
error_drv(m, p, k, ℒ) = error(PointwiseLearn(m), p, DensityRatioValidation(k, loss=ℒ, estimator=LSIF(σ=2.0,b=10)))

# true error (empirical approximation)
function error_empirical(m, p, Ωts, ℒ)
  # train on source data
  lm = learn(task(p), sourcedata(p), m)

  # test on various samples of target data
  ϵs = map(Ωts) do Ωt
    Ω̂t = perform(task(p), Ωt, lm)
    y  = vec(Ωt[:LABEL])
    ŷ  = vec(Ω̂t[:LABEL])
    LossFunctions.value(ℒ[:LABEL], y, ŷ, AggMode.Mean())
  end

  # return mean loss
  mean(ϵs)
end

function experiment(m, δ, τ, r, ℒ)
  # sample a problem
  p, Ωts = problem(δ=δ, τ=τ, r=r)

  # parameters for validation methods
  rᵦ = 20.
  s  = size(sourcedata(p))
  k  = round(Int, prod(s ./ rᵦ))

  # try different error estimates
  cv  = error_cv( m, p, k,  ℒ)[:LABEL]
  bcv = error_bcv(m, p, rᵦ, ℒ)[:LABEL]
  drv = error_drv(m, p, k,  ℒ)[:LABEL]

  # actual error (empirical estimate)
  actual = error_empirical(m, p, Ωts, ℒ)

  # model name (without "Classifier" suffix)
  model = chop(info(m).name, tail=10)

  (δ=δ, τ=τ, r=r, CV=cv, BCV=bcv, DRV=drv, ACTUAL=actual, MODEL=model)
end

# -------------
# MAIN SCRIPT
# -------------

# learning models
@load KNeighborsClassifier pkg="ScikitLearn"
@load DecisionTreeClassifier pkg="DecisionTree"

# misclassification loss
ℒ = Dict(:LABEL => MisclassLoss())

# parameter ranges
mrange = [KNeighborsClassifier(), DecisionTreeClassifier()]
δrange = 0.0:0.1:0.7
τrange = 0.3:0.1:0.9
rrange = [1e-4,1e+1,2e+1]

# experiment iterator and progress
iterator = Iterators.product(mrange, δrange, τrange, rrange)
progress = Progress(length(iterator), "Gaussian experiment:")

# return missing in case of failure
skip = e -> (println("Skipped: $e"); missing)

# perform experiments
results = progress_pmap(iterator, progress=progress,
                        on_error=skip) do (m, δ, τ, r)
  experiment(m, δ, τ, r, ℒ)
end

# save results
fname = joinpath(@__DIR__,"results","gaussian.csv")
CSV.write(fname, DataFrame(skipmissing(results)))

max_issues_repo_name: IBM/geostats-gen-error

max_forks_repo_name: IBM/geostats-gen-error


text:
@scalar_rule(SpecialFunctions.airyai(x), SpecialFunctions.airyaiprime(x))
@scalar_rule(SpecialFunctions.airyaiprime(x), x * SpecialFunctions.airyai(x))
@scalar_rule(SpecialFunctions.airybi(x), SpecialFunctions.airybiprime(x))
@scalar_rule(SpecialFunctions.airybiprime(x), x * SpecialFunctions.airybi(x))
@scalar_rule(SpecialFunctions.besselj0(x), -SpecialFunctions.besselj1(x))
@scalar_rule(
    SpecialFunctions.besselj1(x),
    (SpecialFunctions.besselj0(x) - SpecialFunctions.besselj(2, x)) / 2,
)
@scalar_rule(SpecialFunctions.bessely0(x), -SpecialFunctions.bessely1(x))
@scalar_rule(
    SpecialFunctions.bessely1(x),
    (SpecialFunctions.bessely0(x) - SpecialFunctions.bessely(2, x)) / 2,
)
@scalar_rule(SpecialFunctions.dawson(x), 1 - (2 * x * Ω))
@scalar_rule(SpecialFunctions.digamma(x), SpecialFunctions.trigamma(x))
@scalar_rule(SpecialFunctions.erf(x), (2 / sqrt(π)) * exp(-x * x))
@scalar_rule(SpecialFunctions.erfc(x), -(2 / sqrt(π)) * exp(-x * x))
@scalar_rule(SpecialFunctions.erfcinv(x), -(sqrt(π) / 2) * exp(Ω^2))
@scalar_rule(SpecialFunctions.erfcx(x), (2 * x * Ω) - (2 / sqrt(π)))
@scalar_rule(SpecialFunctions.erfi(x), (2 / sqrt(π)) * exp(x * x))
@scalar_rule(SpecialFunctions.erfinv(x), (sqrt(π) / 2) * exp(Ω^2))
@scalar_rule(SpecialFunctions.gamma(x), Ω * SpecialFunctions.digamma(x))
@scalar_rule(
    SpecialFunctions.invdigamma(x),
    inv(SpecialFunctions.trigamma(SpecialFunctions.invdigamma(x))),
)
@scalar_rule(SpecialFunctions.trigamma(x), SpecialFunctions.polygamma(2, x))

# binary
@scalar_rule(
    SpecialFunctions.besselj(ν, x),
    (NaN, (SpecialFunctions.besselj(ν - 1, x) - SpecialFunctions.besselj(ν + 1, x)) / 2),
)
@scalar_rule(
    SpecialFunctions.besseli(ν, x),
    (NaN, (SpecialFunctions.besseli(ν - 1, x) + SpecialFunctions.besseli(ν + 1, x)) / 2),
)
@scalar_rule(
    SpecialFunctions.bessely(ν, x),
    (NaN, (SpecialFunctions.bessely(ν - 1, x) - SpecialFunctions.bessely(ν + 1, x)) / 2),
)
@scalar_rule(
    SpecialFunctions.besselk(ν, x),
    (NaN, -(SpecialFunctions.besselk(ν - 1, x) + SpecialFunctions.besselk(ν + 1, x)) / 2),
)
@scalar_rule(
    SpecialFunctions.hankelh1(ν, x),
    (NaN, (SpecialFunctions.hankelh1(ν - 1, x) - SpecialFunctions.hankelh1(ν + 1, x)) / 2),
)
@scalar_rule(
    SpecialFunctions.hankelh2(ν, x),
    (NaN, (SpecialFunctions.hankelh2(ν - 1, x) - SpecialFunctions.hankelh2(ν + 1, x)) / 2),
)
@scalar_rule(
    SpecialFunctions.polygamma(m, x),
    (NaN, SpecialFunctions.polygamma(m + 1, x))
)
# todo: setup for common expr
@scalar_rule(
    SpecialFunctions.beta(a, b),
    (Ω*(SpecialFunctions.digamma(a) - SpecialFunctions.digamma(a + b)),
     Ω*(SpecialFunctions.digamma(b) - SpecialFunctions.digamma(a + b)),)
)
@scalar_rule(
    SpecialFunctions.lbeta(a, b),
    (SpecialFunctions.digamma(a) - SpecialFunctions.digamma(a + b),
     SpecialFunctions.digamma(b) - SpecialFunctions.digamma(a + b),)
)
# Changes between SpecialFunctions 0.7 and 0.8
if isdefined(SpecialFunctions, :lgamma)
    # actually is the absolute value of the logorithm of gamma
    @scalar_rule(SpecialFunctions.lgamma(x), SpecialFunctions.digamma(x))
end

if isdefined(SpecialFunctions, :logabsgamma)
    # actually is the absolute value of the logorithm of gamma paired with sign gamma
    @scalar_rule(SpecialFunctions.logabsgamma(x), SpecialFunctions.digamma(x), Zero())
end

if isdefined(SpecialFunctions, :loggamma)
    @scalar_rule(SpecialFunctions.loggamma(x), SpecialFunctions.digamma(x))
end


text:
export CDTextString, CDDate, CDRect, getUTCTime

"""
```
    CDTextString
```
PDF file format structure provides two primary string types. Hexadecimal string `CosXString`
and literal string `CosLiteralString`. However, these are mere binary representation of
string types without having any encoding associated for semantic representation.
Determination of encoding is carried out mostly by associated fonts and character maps in
the content stream. There are also strings used in descriptions and other attributes of a
PDF file where no font or mapping information is provided. This represents the string type
in such situations. Typically, strings in PDFs are of 3 types.

1. Text string
    a. PDDocEncoded string - Similar to ISO_8859-1
    b. UTF-16BE strings
2. ASCII string
3. Byte string - Pure binary data no interpretation

1 and 2 can be represented by the `CDTextString`. `convert` methods are provided to
translate the `CosString` to `CDTextString`

*Ref*: PDF Specification Section 7.9.2

*Note*: Internally `CDTextString` is a `String` object of julia.
"""
const CDTextString = String

using Dates
using Dates: CompoundPeriod
using Rectangle
using Printf

import Base: ==, isless, show

"""
```
    CDDate
```
Internally represented as string objects, these are timezone enabled date and time objects.

PDF files support the string format: (D:YYYYMMDDHHmmSSOHH'mm)

"""
struct CDDate
    d::DateTime
    tz::CompoundPeriod
    ahead::Bool
    CDDate(d::DateTime, tz::CompoundPeriod, ahead::Bool = true) = new(d, tz, ahead)
end

const CDDATE_REGEX =
    r"D:(?<dt>(\d\d){2,7})(?<tz>((?<ahead>[+-])(?<tzh>\d\d)('(?<tzm>\d\d))?|Z))?"

"""
```
    CDDate(s::CDTextString)
```
PDF files support the string format: (D:YYYYMMDDHHmmSSOHH'mm)

# Example

```
julia> date = CDDate("D:20190425173659+05'30")
D:20190425173659+05'30

julia> date.d
2019-04-25T17:36:59

julia> date.tz
5 hours, 30 minutes

julia> date.ahead
true
```
"""
function CDDate(str::CDTextString)
    m = match(CDDATE_REGEX, str)
    m === nothing && error(E_INVALID_DATE)
    ut, tzh, tzm = m[:ahead], m[:tzh], m[:tzm]

    tzhr = tzh === nothing ? Hour(0) : Hour(parse(Int, tzh))
    tzhm = tzm === nothing ? Minute(0) : Minute(parse(Int, tzm))
    tz = CompoundPeriod(tzhr, tzhm)
    ahead = !(ut == "-")
    return CDDate(DateTime(m[:dt], dateformat"yyyymmddHHMMSS"), tz, ahead)
end

function Base.show(io::IO, dt::CDDate)
    print(io, "D:")
    Dates.format(io, dt.d, dateformat"YYYYmmddHHMMSS")
    tzp = dt.tz.periods
    np = length(tzp)
    @assert np <= 2
    np == 0 && return print(io, "Z")
    print(io, dt.ahead ? "+" : "-")
    tzh, tzm = 0, 0
    if np == 2
        tzh, tzm = tzp[1].value, tzp[2].value
    else
        p1 = tzp[1]
        p1 isa Hour   && (tzh = p1.value)
        p1 isa Minute && (tzm = p1.value)
    end
    tzs = @sprintf "%02d'%02d" tzh tzm
    print(io, tzs)
end

"""
```
    getUTCTime(d::CDDate) -> CDDate
```
Removes the timezone information and returns the CDDate at UTC.

# Example

```
julia> getUTCTime(CDDate("D:20190425173659+05'30"))
D:20190425120659Z
```
"""
getUTCTime(d::CDDate) =
    CDDate(d.ahead ? (d.d - d.tz) : (d.d + d.tz), CompoundPeriod())

Base.isless(d1::CDDate, d2::CDDate) = isless(getUTCTime(d1).d, getUTCTime(d2).d)

Base.:(==)(d1::CDDate, d2::CDDate) = !isless(d1, d2) && !isless(d2, d1)

"""
```
    CDRect
```
`CosArray` representation of a rectangle in the lower left and upper right point format

*Note*: `CDRect` maps to a `Rect` object in the `Rectangle` package.

# Example

```
julia> CDRect(CosArray(CosObject[CosInt(0), CosInt(0), CosInt(840), CosFloat(640)]))
Rect:[0.0 0.0 840.0 640.0]
```
"""
const CDRect = Rect


text:
__precompile__(false)

module SystemManager

DRIVER_LIST = Dict{Symbol, Bool}()

driver_init(name,init=true) = DRIVER_LIST[Symbol(name)]=init

function driver_check(name;soft=false)
  result=false
  if !haskey(DRIVER_LIST, Symbol(name)) || !DRIVER_LIST[Symbol(name)]
    if !soft error("Driver "*string(name)*" is not initalized!") end
  else
    result=true
  end
  result
end

macro DRIVER(name) Meta.quot(driver_init(name,false)) end
macro DRIVER_INIT(name) Meta.quot(driver_init(name)) end
macro DRIVER_CHECK(name) Meta.quot(driver_check(name)) end
macro DRIVER_ENABLED(name) Meta.quot(driver_check(name;soft=true)) end

export @DRIVER, @DRIVER_INIT, @DRIVER_CHECK, @DRIVER_ENABLED

generateID(id::Union{Nothing,Symbol}=nothing) = id == nothing ? Symbol(rand(UInt)) : id
export generateID

end # SystemManager

max_stars_repo_name: Gilga/JuliaOpenGL

max_issues_repo_name: Gilga/JuliaOpenGL

max_forks_repo_name: Gilga/JuliaOpenGL