// Copyright 2022 LTN Global Communications, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. syntax = "proto3"; package tv.make.api; import "usage/usage.proto"; import "google/api/annotations.proto"; import "google/protobuf/timestamp.proto"; import "longrunning/operations.proto"; option go_package = "git.ltnglobal.com/make.tv/genproto/api;api"; service UsageService { // Methods starting with Generate* return a tv.make.api.LongRunningOperation which looks like the following // { // Name: teams//usage/calculations/ // Done: false // Metadata: Initial tv.make.calculon.Calculation with only id set to // Result: not set // } // // Note: The initial response is not done, so Result won't be set. Using Name one can subsequently query the // operations API to retrieve the state of the calculation. If the response from the operations API is Done and // did not run into an error, then Result will be set to the respective result type for the calculation. For // example, GenerateOutputUsageReport will result in a tv.make.api.GenerateOutputUsageReportResponse. // Generate an output usage report. Returns totals over the specified period. rpc GenerateOutputUsageReport (GenerateOutputUsageReportRequest) returns (tv.make.api.LongRunningOperation) { option (google.api.http) = {post: "/v1/teams/{team_id}/usage:generateOutputUsageReport"}; } // Generate an egress report. Returns daily totals over the specified period. rpc GenerateEgressReport (GenerateEgressReportRequest) returns (tv.make.api.LongRunningOperation) { option (google.api.http) = {post: "/v1/teams/{team_id}/usage:generateEgressReport"}; } // Generate a peak storage report. rpc GeneratePeakStorageReport (GeneratePeakStorageReportRequest) returns (tv.make.api.LongRunningOperation) { option (google.api.http) = {post: "/v1/teams/{team_id}/usage:generatePeakStorageReport"}; } // Generate a live recording report. rpc GenerateLiveRecordingReport (GenerateLiveRecordingReportRequest) returns (tv.make.api.LongRunningOperation) { option (google.api.http) = {post: "/v1/teams/{team_id}/usage:generateLiveRecordingReport"}; } // Generate an asset storage report. rpc GenerateStorageReport (GenerateStorageReportRequest) returns (tv.make.api.LongRunningOperation) { option (google.api.http) = {post: "/v1/teams/{team_id}/usage:generateStorageReport"}; } // Get a link to a download rpc CreateCsvDownloadUrl (CreateCsvDownloadUrlRequest) returns (CreateCsvDownloadUrlResponse) { option (google.api.http) = {post: "/v1/teams/{team_id}/usage:createCsvDownloadUrl"}; } } // The scope of the request. Wether to query for all subteams (ALL), or only the specified team (SINGLE). enum TeamScope { // if the scope is unknown, it will default to ALL TEAM_SCOPE_UNSPECIFIED = 0; // only query the team and not it's sub teams SINGLE = 1; // query the team and all of it's sub teams ALL = 2; } // Request message for UsageService.GenerateOutputUsageReport. message GenerateOutputUsageReportRequest { // Team identifier for the parent-team (scope=ALL) in order to request data for all sub-teams, // or just for one team (scope=SINGLE). string team_id = 1; // Start time of the report google.protobuf.Timestamp start_time = 2; // End time of the report google.protobuf.Timestamp end_time = 3; // The scope of the request TeamScope scope = 4; } // Result message as result in the longrunnging operation for UsageService.GenerateOutputUsageReport. message GenerateOutputUsageReportResponse { // Passthrough output usage OutputUsage passthrough = 1; // Transcoded 720p30 output usage OutputUsage transcoded_720p30 = 2; // Transcoded 720p60 output usage OutputUsage transcoded_720p60 = 3; // Transcoded 1080p30 output usage OutputUsage transcoded_1080p30 = 4; // Transcoded 1080p60 output usage OutputUsage transcoded_1080p60 = 5; // Multiview inputs usage OutputUsage multiview_input = 6; // Multiview output usage OutputUsage multiview_output = 7; } // Request message for UsageService.GenerateEgressReport. message GenerateEgressReportRequest { // Team identifier for the parent-team (scope=ALL) in order to request data for all sub-teams, // or just for one team (scope=SINGLE). string team_id = 1; // Start time of the report google.protobuf.Timestamp start_time = 2; // End time of the report google.protobuf.Timestamp end_time = 3; // The scope of the request TeamScope scope = 4; } // Result message as result in the longrunnging operation for UsageService.GenerateEgressReport. message GenerateEgressReportResponse { // List of how many bytes where used by outputs for each day repeated Egress egress = 1; // Sum of all used bytes int64 sum_egress_bytes = 2; } // Request message for UsageService.GeneratePeakStorageReport. message GeneratePeakStorageReportRequest { // Team identifier for the parent-team (scope=ALL) in order to request data for all sub-teams, // or just for one team (scope=SINGLE). string team_id = 1; // Start time of the report google.protobuf.Timestamp start_time = 2; // End time of the report google.protobuf.Timestamp end_time = 3; // The scope of the request TeamScope scope = 4; } // Result message as result in the longrunnging operation for UsageService.GeneratePeakStorageReport. message GeneratePeakStorageReportResponse { // List of the peak storage for each day repeated AssetPeakStorage asset_peak_storage = 1; // Maximum peak storage in the requested time range (start, end) int64 max_storage_bytes = 2; } // Request message for UsageService.GenerateLiveRecordingReport. message GenerateLiveRecordingReportRequest { // Team identifier for the parent-team (scope=ALL) in order to request data for all sub-teams, // or just for one team (scope=SINGLE). string team_id = 1; // Start time of the report google.protobuf.Timestamp start_time = 2; // End time of the report google.protobuf.Timestamp end_time = 3; // The scope of the request TeamScope scope = 4; } // Result message as result in the longrunnging operation for UsageService.GenerateLiveRecordingReport. message GenerateLiveRecordingReportResponse { // List of the live recordings for each day repeated LiveRecording live_recordings = 1; // Maximum recorded bytes in the requested time range (start, end) int64 max_recorded_bytes = 2; } // Request message for UsageService.GenerateStorageReport. message GenerateStorageReportRequest { // Team identifier for the parent-team (scope=ALL) in order to request data for all sub-teams, // or just for one team (scope=SINGLE). string team_id = 1; // Start time of the report google.protobuf.Timestamp start_time = 2; // End time of the report google.protobuf.Timestamp end_time = 3; // The scope of the request TeamScope scope = 4; } // Result message as result in the longrunning operation for UsageService.GenerateStorageReport. message GenerateStorageReportResponse { // List of used storage for each day repeated AssetStorage asset_storage = 1; // Maximum peak storage in the requested time range (start, end) int64 storage_bytes_max = 2; } // Request message for [GetCSVDownload][tv.make.api.UsageService.GetCSVDownload] message CreateCsvDownloadUrlRequest { enum Report { UNSPECIFIED_REPORT = 0; OUTPUT = 1; MULTIVIEW = 2; EGRESS = 3; ASSET = 4; } // Team identifier for the parent-team (scope=ALL) in order to request data for all sub-teams, // or just for one team (scope=SINGLE). string team_id = 1; // Start time of the report google.protobuf.Timestamp start_time = 2; // End time of the report google.protobuf.Timestamp end_time = 3; // Which report is requested Report report = 4; // The scope of the request TeamScope scope = 5; } // Response message for [GetCSVDownload][tv.make.api.UsageService.GetCSVDownload] message CreateCsvDownloadUrlResponse { // An URL where the report can be downloaded by a HTTP request once. string download_url = 1; // The time when the download_url won't be accessible anymore google.protobuf.Timestamp expire_time = 2; }