Esempio n. 1
0
def signalr_update_custom(instance,
                          sku=None,
                          unit_count=1,
                          tags=None,
                          service_mode=None,
                          allowed_origins=None,
                          default_action=None,
                          enable_message_logs=None):
    instance.features = []

    if sku is not None:
        instance.sku = ResourceSku(name=sku, capacity=unit_count)

    if tags is not None:
        instance.tags = tags

    if service_mode is not None:
        instance.features += [
            SignalRFeature(flag="ServiceMode", value=service_mode)
        ]

    if enable_message_logs is not None:
        instance.features += [
            SignalRFeature(flag="EnableMessagingLogs",
                           value=enable_message_logs)
        ]

    if allowed_origins is not None:
        instance.cors = SignalRCorsSettings(allowed_origins=allowed_origins)

    if default_action is not None:
        instance.network_ac_ls = SignalRNetworkACLs(
            default_action=default_action)

    return instance
Esempio n. 2
0
def signalr_create(client,
                   signalr_name,
                   resource_group_name,
                   sku,
                   unit_count=1,
                   location=None,
                   tags=None,
                   service_mode='Default',
                   enable_message_logs=False,
                   allowed_origins=None,
                   default_action="Allow"):
    sku = ResourceSku(name=sku, capacity=unit_count)
    service_mode_feature = SignalRFeature(flag="ServiceMode",
                                          value=service_mode)
    enable_message_logs_feature = SignalRFeature(flag="EnableMessagingLogs",
                                                 value=enable_message_logs)
    cors_setting = SignalRCorsSettings(allowed_origins=allowed_origins)

    parameter = SignalRResource(
        tags=tags,
        sku=sku,
        host_name_prefix=signalr_name,
        features=[service_mode_feature, enable_message_logs_feature],
        cors=cors_setting,
        location=location,
        network_ac_ls=SignalRNetworkACLs(default_action=default_action))

    return client.create_or_update(resource_group_name, signalr_name,
                                   parameter)
Esempio n. 3
0
def signalr_create(client,
                   signalr_name,
                   resource_group_name,
                   sku,
                   unit_count=1,
                   location=None,
                   tags=None,
                   service_mode='Default',
                   allowed_origins=None):
    sku = ResourceSku(name=sku, capacity=unit_count)
    service_mode_feature = SignalRFeature(value=service_mode)
    cors_setting = SignalRCorsSettings(allowed_origins=allowed_origins)

    properties = SignalRCreateOrUpdateProperties(
        host_name_prefix=signalr_name,
        features=[service_mode_feature],
        cors=cors_setting)

    parameter = SignalRCreateParameters(tags=tags,
                                        sku=sku,
                                        properties=properties,
                                        location=location)

    return client.create_or_update(resource_group_name, signalr_name,
                                   parameter)
Esempio n. 4
0
def signalr_update_custom(instance,
                          sku=None,
                          unit_count=1,
                          tags=None,
                          service_mode=None,
                          allowed_origins=None):
    if sku is not None:
        instance.sku = ResourceSku(name=sku, capacity=unit_count)

    if tags is not None:
        instance.tags = tags

    properties = SignalRCreateOrUpdateProperties()

    if service_mode is not None:
        properties.features = [SignalRFeature(value=service_mode)]

    if allowed_origins is not None:
        properties.cors = SignalRCorsSettings(allowed_origins=allowed_origins)

    instance.properties = properties

    return instance