コード例 #1
0
 def serialize(self, obj, attrs, user):
     name = obj.label or obj.public_key[:14]
     d = {
         'id': obj.public_key,
         'name': name,
         # label is here for compatibility
         'label': name,
         'public': obj.public_key,
         'secret': obj.secret_key,
         'projectId': obj.project_id,
         'isActive': obj.is_active,
         'rateLimit': {
             'window': obj.rate_limit_window,
             'count': obj.rate_limit_count,
         } if (obj.rate_limit_window and obj.rate_limit_count) else None,
         'dsn': {
             'secret': obj.dsn_private,
             'public': obj.dsn_public,
             'csp': obj.csp_endpoint,
             'security': obj.security_endpoint,
             'cdn': obj.js_sdk_loader_cdn_url,
         },
         'browserSdkVersion': get_selected_browser_sdk_version(obj),
         'browserSdk': {
             'choices': get_browser_sdk_version_choices(),
         },
         'dateCreated': obj.date_added,
     }
     return d
コード例 #2
0
 def serialize(self, obj, attrs, user):
     name = obj.label or obj.public_key[:14]
     d = {
         "id": obj.public_key,
         "name": name,
         # label is here for compatibility
         "label": name,
         "public": obj.public_key,
         "secret": obj.secret_key,
         "projectId": obj.project_id,
         "isActive": obj.is_active,
         "rateLimit": {"window": obj.rate_limit_window, "count": obj.rate_limit_count}
         if (obj.rate_limit_window and obj.rate_limit_count)
         else None,
         "dsn": {
             "secret": obj.dsn_private,
             "public": obj.dsn_public,
             "csp": obj.csp_endpoint,
             "security": obj.security_endpoint,
             "minidump": obj.minidump_endpoint,
             "unreal": obj.unreal_endpoint,
             "cdn": obj.js_sdk_loader_cdn_url,
         },
         "browserSdkVersion": get_selected_browser_sdk_version(obj),
         "browserSdk": {"choices": get_browser_sdk_version_choices()},
         "dateCreated": obj.date_added,
     }
     return d
コード例 #3
0
class KeySerializer(serializers.Serializer):
    name = serializers.CharField(max_length=200, required=False)
    isActive = serializers.BooleanField(required=False)
    rateLimit = RateLimitSerializer(required=False)
    browserSdkVersion = serializers.ChoiceField(
        choices=get_browser_sdk_version_choices(), required=False
    )
コード例 #4
0
ファイル: project_key.py プロジェクト: Kayle009/sentry
 def serialize(self, obj, attrs, user):
     name = obj.label or obj.public_key[:14]
     d = {
         'id': obj.public_key,
         'name': name,
         # label is here for compatibility
         'label': name,
         'public': obj.public_key,
         'secret': obj.secret_key,
         'projectId': obj.project_id,
         'isActive': obj.is_active,
         'rateLimit': {
             'window': obj.rate_limit_window,
             'count': obj.rate_limit_count,
         } if (obj.rate_limit_window and obj.rate_limit_count) else None,
         'dsn': {
             'secret': obj.dsn_private,
             'public': obj.dsn_public,
             'csp': obj.csp_endpoint,
             'security': obj.security_endpoint,
             'minidump': obj.minidump_endpoint,
             'unreal': obj.unreal_endpoint,
             'cdn': obj.js_sdk_loader_cdn_url,
         },
         'browserSdkVersion': get_selected_browser_sdk_version(obj),
         'browserSdk': {
             'choices': get_browser_sdk_version_choices(),
         },
         'dateCreated': obj.date_added,
     }
     return d
コード例 #5
0
class ProjectKeySerializer(serializers.Serializer):
    name = serializers.CharField(max_length=64, required=False, allow_blank=True, allow_null=True)
    public = serializers.RegexField(r"^[a-f0-9]{32}$", required=False, allow_null=True)
    secret = serializers.RegexField(r"^[a-f0-9]{32}$", required=False, allow_null=True)
    rateLimit = RateLimitSerializer(required=False, allow_null=True)
    isActive = serializers.BooleanField(required=False)
    browserSdkVersion = serializers.ChoiceField(
        choices=get_browser_sdk_version_choices(), required=False
    )