All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.resys.hdes.client.api.HdesStore Maven / Gradle / Ivy

There is a newer version: 3.130.78
Show newest version
package io.resys.hdes.client.api;

/*-
 * #%L
 * hdes-client-api
 * %%
 * Copyright (C) 2020 - 2021 Copyright 2020 ReSys OÜ
 * %%
 * 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.
 * #L%
 */

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;

import org.immutables.value.Value;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import io.resys.hdes.client.api.ast.AstBody.AstBodyType;
import io.resys.hdes.client.api.ast.AstCommand;
import io.smallrye.mutiny.Uni;

public interface HdesStore {
  Uni create(CreateStoreEntity newType);
  Uni update(UpdateStoreEntity updateType);
  Uni delete(DeleteAstType deleteType);
  Uni> batch(ImportStoreEntity batchType);
  
  QueryBuilder query();
  HistoryQuery history();
  String getRepoName();
  String getHeadName();
  StoreRepoBuilder repo();
  
  interface StoreRepoBuilder {
    StoreRepoBuilder repoName(String repoName);
    StoreRepoBuilder headName(String headName);
    Uni create();    
    HdesStore build();
    Uni createIfNot();
  }
  
  interface HistoryQuery {
    Uni get(String id);
  }
   
  interface QueryBuilder {
    Uni get();
    Uni get(String id);
  }
  

  @Value.Immutable
  public interface ImportStoreEntity {
    List getCreate();
    List getUpdate();
  }
  
  @JsonSerialize(as = ImmutableUpdateStoreEntityWithBodyType.class)
  @JsonDeserialize(as = ImmutableUpdateStoreEntityWithBodyType.class)
  @Value.Immutable
  interface UpdateStoreEntityWithBodyType extends Serializable {
    String getId();
    AstBodyType getBodyType();
    List getBody();
  }
  
  @JsonSerialize(as = ImmutableDeleteAstType.class)
  @JsonDeserialize(as = ImmutableDeleteAstType.class)
  @Value.Immutable
  interface DeleteAstType extends Serializable {
    String getId();
    AstBodyType getBodyType();
  }
  
  @JsonSerialize(as = ImmutableUpdateStoreEntity.class)
  @JsonDeserialize(as = ImmutableUpdateStoreEntity.class)
  @Value.Immutable
  interface UpdateStoreEntity extends Serializable {
    String getId();
    List getBody();
  }
  
  @JsonSerialize(as = ImmutableCreateStoreEntity.class)
  @JsonDeserialize(as = ImmutableCreateStoreEntity.class)
  @Value.Immutable
  interface CreateStoreEntity extends Serializable {
    AstBodyType getBodyType();
    List getBody();
  }
  
  @JsonSerialize(as = ImmutableStoreState.class)
  @JsonDeserialize(as = ImmutableStoreState.class)
  @Value.Immutable
  interface StoreState {
    Map getTags();
    Map getFlows();
    Map getServices();
    Map getDecisions();
  }
  
  @JsonSerialize(as = ImmutableStoreEntity.class)
  @JsonDeserialize(as = ImmutableStoreEntity.class)
  @Value.Immutable
  interface StoreEntity {
    String getId();
    AstBodyType getBodyType();
    String getHash();
    List getBody();
  }
  
  @JsonSerialize(as = ImmutableHistoryEntity.class)
  @JsonDeserialize(as = ImmutableHistoryEntity.class)
  @Value.Immutable
  interface HistoryEntity {
    String getId();
    AstBodyType getBodyType();
    List getBody();
  }
  
  @JsonSerialize(as = ImmutableDetachedEntity.class)
  @JsonDeserialize(as = ImmutableDetachedEntity.class)
  @Value.Immutable
  interface DetachedEntity {
    String getHash();
    LocalDateTime getCreated();
    List getBody();
  }
  
  @JsonSerialize(as = ImmutableStoreExceptionMsg.class)
  @Value.Immutable
  interface StoreExceptionMsg {
    String getId();
    String getValue();
    List getArgs();
  }
  

  @FunctionalInterface
  interface HdesCredsSupplier extends Supplier {}
  
  @Value.Immutable
  interface HdesCreds {
    String getUser();
    String getEmail();
  } 
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy