there is Mediaplan CustomDefinitionResource: CustomResourceDefinition apiVersion:…
- User
there is Mediaplan CustomDefinitionResource:
CustomResourceDefinition
apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: mediaplans.crd.idom.project spec: group: crds.idom.project scope: Namespaced names: plural: mediaplans singular: mediaplan kind: Mediaplan shortNames: - mediap versions:
- name: v1alpha1 served: true storage: true schema: openAPIV3Schema: type: object properties: apiVersion: type: string description: ‘A unique version for the Kubernetes API’ kind: type: string description: ‘Type of resource’ metadata: type: object properties: name: type: string description: ‘Name of the resource’ required: - name spec: type: object properties: # scheduling schedule: type: string description: ‘Scheduling format for the mediaplan’ # channel metadata channel: type: object properties: name: type: string description: ‘Name of the channel’ guid: type: string description: ‘GUID of the channel’ id: type: integer description: ‘ID of the channel’ link: type: string description: ‘Link for the channel’ messagingSettings: type: object properties: # oneof: topic or files # generation topics topics: type: array items: type: object properties: code: type: string description: ‘Code for the topic’ weight: type: integer description: ‘Generation weight for the topic’ default: 1 # or choose files from s3 files: type: array items: type: object properties: uri: type: string description: ‘URI for the file’ # agent settings agentSettings: type: object properties: # count totalCount: type: integer description: ‘Total number of agents for the mediaplan’ default: 10 # credential comparison credentials: type: array items: type: object properties: key: type: string description: ‘Key for the credential’ value: type: string description: ‘Value for the credential’ # mimicry comparison mimicry: type: array items: type: object properties: key: type: string description: ‘Key for the mimicry option’ value: type: string description: ‘Value for the mimicry option’ # common mediaplan settings commonSettings: type: object properties: # output pkg generation coefficient # define, how many packages will be generated for one incoming message generationCoefficient: type: number description: ‘Output package generation coefficient’ default: # total packages count totalMessageCount: type: integer description: ‘Total number of messages for the mediaplan’ # estimated time for different messaging options estimatedLeadTime: type: string description: ‘Estimated lead time for the mediaplan’ # disable mimicry options (for agents) disableMimicryOptions: type: boolean description: ‘Disables mimicry options for agents’ # use image for packages didImageUsedForGeneration: type: boolean description: ‘Indicates if an image was used for package generation’
build a python web application, based on fastapi, kubernetes, opentelemetry with jaeger support, pydantic models, which serve CRUD operations for Mediaplan CustomResourceDefinition
- Assistant
Here's a basic skeleton of a Python web application based on FastAPI, Kubernetes, Opentelemetry with Jaeger support, and Pydantic models that serves CRUD operations for Mediaplan CustomResourceDefinition:
from fastapi import FastAPI from opentelemetry import trace from opentelemetry.ext.jaeger import JaegerSpanExporter from opentelemetry.sdk.resources import Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchExportSpanProcessor from pydantic import BaseModel # Define a Pydantic model for Mediaplan class Mediaplan(BaseModel): name: str schedule: str channel: dict messagingSettings: dict agentSettings: dict commonSettings: dict # Set up Opentelemetry tracing and Jaeger exporter trace.set_tracer_provider( TracerProvider( resource=Resource.create({"service.name": "Mediaplan API"}) ) ) tracer = trace.get_tracer(__name__) jaeger_exporter = JaegerSpanExporter( service_name="Mediaplan API", agent_host_name="localhost", agent_port=6831, ) trace.get_tracer_provider().add_span_processor( BatchExportSpanProcessor(jaeger_exporter) ) # Set up FastAPI app app = FastAPI() # Define CRUD endpoints for Mediaplan resource @app.get("/mediaplans") async def read_mediaplans(): with tracer.start_as_current_span("read_mediaplans"): # retrieve list of Mediaplans from Kubernetes API pass @app.get("/mediaplans/{mediaplan_id}") async def read_mediaplan(mediaplan_id: str): with tracer.start_as_current_span("read_mediaplan"): # retrieve specific Mediaplan from Kubernetes API using ID pass @app.post("/mediaplans") async def create_mediaplan(mediaplan: Mediaplan): with tracer.start_as_current_span("create_mediaplan"): # create new Mediaplan in Kubernetes API using Pydantic model pass @app.put("/mediaplans/{mediaplan_id}") async def update_mediaplan(mediaplan_id: str, mediaplan: Mediaplan): with tracer.start_as_current_span("update_mediaplan"): # update specific Mediaplan in Kubernetes API using ID and Pydantic model pass @app.delete("/mediaplans/{mediaplan_id}") async def delete_mediaplan(mediaplan_id: str): with tracer.start_as_current_span("delete_mediaplan"): # delete specific Mediaplan from Kubernetes API using ID passNote that this is a basic skeleton and will need to be fleshed out with the actual logic for interacting with the Kubernetes API. The Opentelemetry tracing and Jaeger support can also be adjusted to fit your specific needs.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.