def Update(self, name, release_track, args=None): """Updates a stream. Args: name: str, the reference of the stream to update. release_track: Some arguments are added based on the command release track. args: argparse.Namespace, The arguments that this command was invoked with. Returns: Operation: the operation for updating the connection profile. """ validate_only = args.validate_only force = args.force current_stream = self._GetExistingStream(name) updated_stream, update_fields = self._GetUpdatedStream( current_stream, release_track, args) request_id = util.GenerateRequestId() update_req_type = self._messages.DatastreamProjectsLocationsStreamsPatchRequest update_req = update_req_type( stream=updated_stream, name=updated_stream.name, requestId=request_id, validateOnly=validate_only, force=force ) if args.update_mask: update_req.updateMask = ','.join(update_fields) return self._service.Patch(update_req)
def Create(self, parent_ref, stream_id, release_track, args=None): """Creates a stream. Args: parent_ref: a Resource reference to a parent datastream.projects.locations resource for this stream. stream_id: str, the name of the resource to create. release_track: Some arguments are added based on the command release track. args: argparse.Namespace, The arguments that this command was invoked with. Returns: Operation: the operation for creating the stream. """ stream = self._GetStream(stream_id, release_track, args) validate_only = args.validate_only force = args.force request_id = util.GenerateRequestId() create_req_type = self._messages.DatastreamProjectsLocationsStreamsCreateRequest create_req = create_req_type( stream=stream, streamId=stream.name, parent=parent_ref, requestId=request_id, validateOnly=validate_only, force=force) return self._service.Create(create_req)
def Create(self, parent_ref, private_connection_id, release_track, args=None): """Creates a private connection. Args: parent_ref: a Resource reference to a parent datastream.projects.locations resource for this private connection. private_connection_id: str, the name of the resource to create. release_track: Some arguments are added based on the command release track. args: argparse.Namespace, The arguments that this command was invoked with. Returns: Operation: the operation for creating the private connection. """ private_connection = self._GetPrivateConnection( private_connection_id, release_track, args) request_id = util.GenerateRequestId() create_req_type = self._messages.DatastreamProjectsLocationsPrivateConnectionsCreateRequest create_req = create_req_type( privateConnection=private_connection, privateConnectionId=private_connection.name, parent=parent_ref, requestId=request_id) return self._service.Create(create_req)
def Create(self, parent_ref, connection_profile_id, cp_type, args=None): """Creates a connection profile. Args: parent_ref: a Resource reference to a parent datastream.projects.locations resource for this connection profile. connection_profile_id: str, the name of the resource to create. cp_type: str, the type of the connection profile ('MYSQL', '' args: argparse.Namespace, The arguments that this command was invoked with. Returns: Operation: the operation for creating the connection profile. """ self._ValidateArgs(args) connection_profile = self._GetConnectionProfile(cp_type, connection_profile_id, args) request_id = util.GenerateRequestId() create_req_type = self._messages.DatastreamProjectsLocationsConnectionProfilesCreateRequest create_req = create_req_type( connectionProfile=connection_profile, connectionProfileId=connection_profile.name, parent=parent_ref, requestId=request_id) return self._service.Create(create_req)
def Create(self, parent_ref, connection_profile_id, cp_type, release_track, args=None): """Creates a connection profile. Args: parent_ref: a Resource reference to a parent datastream.projects.locations resource for this connection profile. connection_profile_id: str, the name of the resource to create. cp_type: str, the type of the connection profile ('MYSQL', '' release_track: Some arguments are added based on the command release track. args: argparse.Namespace, The arguments that this command was invoked with. Returns: Operation: the operation for creating the connection profile. """ self._ValidateArgs(args) connection_profile = self._GetConnectionProfile( cp_type, connection_profile_id, args, release_track) # TODO(b/207467120): only use flags from args. force = False if release_track == base.ReleaseTrack.BETA or args.force: force = True request_id = util.GenerateRequestId() create_req_type = self._messages.DatastreamProjectsLocationsConnectionProfilesCreateRequest create_req = create_req_type( connectionProfile=connection_profile, connectionProfileId=connection_profile.name, parent=parent_ref, requestId=request_id, force=force) return self._service.Create(create_req)
def Update(self, name, cp_type, release_track, args=None): """Updates a connection profile. Args: name: str, the reference of the connection profile to update. cp_type: str, the type of the connection profile ('MYSQL', 'ORACLE') release_track: Some arguments are added based on the command release track. args: argparse.Namespace, The arguments that this command was invoked with. Returns: Operation: the operation for updating the connection profile. """ self._ValidateArgs(args) current_cp = self._GetExistingConnectionProfile(name) updated_cp, update_fields = self._GetUpdatedConnectionProfile( current_cp, cp_type, release_track, args) # TODO(b/207467120): only use flags from args. force = False if release_track == base.ReleaseTrack.BETA or args.force: force = True request_id = util.GenerateRequestId() update_req_type = self._messages.DatastreamProjectsLocationsConnectionProfilesPatchRequest update_req = update_req_type(connectionProfile=updated_cp, name=updated_cp.name, updateMask=','.join(update_fields), requestId=request_id, force=force) return self._service.Patch(update_req)
def Create(self, parent_ref, route_id, args=None): """Creates a route. Args: parent_ref: a Resource reference to a parent datastream.projects. locations.privateConnections resource for this route. route_id: str, the name of the resource to create. args: argparse.Namespace, The arguments that this command was invoked with. Returns: Operation: the operation for creating the private connection. """ route = self._GetRoute(route_id, args) request_id = util.GenerateRequestId() create_req_type = self._messages.DatastreamProjectsLocationsPrivateConnectionsRoutesCreateRequest create_req = create_req_type(route=route, routeId=route.name, parent=parent_ref, requestId=request_id) return self._service.Create(create_req)