text:
// Copyright (C) 2009 The Android Open Source Project
//
// 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.

package com.google.gerrit.sshd.commands;

import com.google.gerrit.common.Version;
import com.google.gerrit.reviewdb.ReviewDb;
import com.google.gson.JsonObject;
import com.google.gwtorm.client.OrmException;
import com.google.gwtorm.client.SchemaFactory;
import com.google.gwtorm.jdbc.JdbcSchema;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

/** Simple interactive SQL query tool. */
public class QueryShell {
  public interface Factory {
    QueryShell create(@Assisted InputStream in, @Assisted OutputStream out);
  }

  public static enum OutputFormat {
    PRETTY, JSON;
  }

  private final BufferedReader in;
  private final PrintWriter out;
  private final SchemaFactory<ReviewDb> dbFactory;
  private OutputFormat outputFormat = OutputFormat.PRETTY;

  private ReviewDb db;
  private Connection connection;
  private Statement statement;

  @Inject
  QueryShell(final SchemaFactory<ReviewDb> dbFactory,

  @Assisted final InputStream in, @Assisted final OutputStream out)
      throws UnsupportedEncodingException {
    this.dbFactory = dbFactory;
    this.in = new BufferedReader(new InputStreamReader(in, "UTF-8"));
    this.out = new PrintWriter(new OutputStreamWriter(out, "UTF-8"));
  }

  public void setOutputFormat(OutputFormat fmt) {
    outputFormat = fmt;
  }

  public void run() {
    try {
      db = dbFactory.open();
      try {
        connection = ((JdbcSchema) db).getConnection();
        connection.setAutoCommit(true);

        statement = connection.createStatement();
        try {
          showBanner();
          readEvalPrintLoop();
        } finally {
          statement.close();
          statement = null;
        }
      } finally {
        db.close();
        db = null;
      }
    } catch (OrmException err) {
      out.println("fatal: Cannot open connection: " + err.getMessage());

    } catch (SQLException err) {
      out.println("fatal: Cannot open connection: " + err.getMessage());
    } finally {
      out.flush();
    }
  }

  public void execute(String query) {
    try {
      db = dbFactory.open();
      try {
        connection = ((JdbcSchema) db).getConnection();
        connection.setAutoCommit(true);

        statement = connection.createStatement();
        try {
          executeStatement(query);
        } finally {
          statement.close();
          statement = null;
        }
      } finally {
        db.close();
        db = null;
      }
    } catch (OrmException err) {
      out.println("fatal: Cannot open connection: " + err.getMessage());

    } catch (SQLException err) {
      out.println("fatal: Cannot open connection: " + err.getMessage());
    } finally {
      out.flush();
    }
  }

  private void readEvalPrintLoop() {
    final StringBuilder buffer = new StringBuilder();
    boolean executed = false;
    for (;;) {
      if (outputFormat == OutputFormat.PRETTY) {
        print(buffer.length() == 0 || executed ? "gerrit> " : "     -> ");
      }
      String line = readLine();
      if (line == null) {
        return;
      }

      if (line.startsWith("\\")) {
        // Shell command, check the various cases we recognize
        //
        line = line.substring(1);
        if (line.equals("h") || line.equals("?")) {
          showHelp();

        } else if (line.equals("q")) {
          if (outputFormat == OutputFormat.PRETTY) {
            println("Bye");
          }
          return;

        } else if (line.equals("r")) {
          buffer.setLength(0);
          executed = false;

        } else if (line.equals("p")) {
          println(buffer.toString());

        } else if (line.equals("g")) {
          if (buffer.length() > 0) {
            executeStatement(buffer.toString());
            executed = true;
          }

        } else if (line.equals("d")) {
          listTables();

        } else if (line.startsWith("d ")) {
          showTable(line.substring(2).trim());

        } else {
          final String msg = "'\\" + line + "' not supported";
          switch (outputFormat) {
            case JSON: {
              final JsonObject err = new JsonObject();
              err.addProperty("type", "error");
              err.addProperty("message", msg);
              println(err.toString());
              break;
            }
            case PRETTY:
            default:
              println("ERROR: " + msg);
              println("");
              showHelp();
              break;
          }
        }
        continue;
      }

      if (executed) {
        buffer.setLength(0);
        executed = false;
      }
      if (buffer.length() > 0) {
        buffer.append('\n');
      }
      buffer.append(line);

      if (buffer.length() > 0 && buffer.charAt(buffer.length() - 1) == ';') {
        executeStatement(buffer.toString());
        executed = true;
      }
    }
  }

  private void listTables() {
    final DatabaseMetaData meta;
    try {
      meta = connection.getMetaData();
    } catch (SQLException e) {
      error(e);
      return;
    }

    try {
      final String[] types = {"TABLE", "VIEW"};
      ResultSet rs = meta.getTables(null, null, null, types);
      try {
        if (outputFormat == OutputFormat.PRETTY) {
          println("                     List of relations");
        }
        showResultSet(rs, false, //
            Identity.create(rs, "TABLE_SCHEM"), //
            Identity.create(rs, "TABLE_NAME"), //
            Identity.create(rs, "TABLE_TYPE"));
      } finally {
        rs.close();
      }
    } catch (SQLException e) {
      error(e);
    }

    println("");
  }

  private void showTable(String tableName) {
    final DatabaseMetaData meta;
    try {
      meta = connection.getMetaData();

      if (meta.storesUpperCaseIdentifiers()) {
        tableName = tableName.toUpperCase();
      } else if (meta.storesLowerCaseIdentifiers()) {
        tableName = tableName.toLowerCase();
      }
    } catch (SQLException e) {
      error(e);
      return;
    }

    try {
      ResultSet rs = meta.getColumns(null, null, tableName, null);
      try {
        if (!rs.next()) {
          throw new SQLException("Table " + tableName + " not found");
        }

        if (outputFormat == OutputFormat.PRETTY) {
          println("                     Table " + tableName);
        }
        showResultSet(rs, true, //
            Identity.create(rs, "COLUMN_NAME"), //
            new Function("TYPE") {
              @Override
              String apply(final ResultSet rs) throws SQLException {
                String type = rs.getString("TYPE_NAME");
                switch (rs.getInt("DATA_TYPE")) {
                  case java.sql.Types.CHAR:
                  case java.sql.Types.VARCHAR:
                    type += "(" + rs.getInt("COLUMN_SIZE") + ")";
                    break;
                }

                String def = rs.getString("COLUMN_DEF");
                if (def != null && !def.isEmpty()) {
                  type += " DEFAULT " + def;
                }

                int nullable = rs.getInt("NULLABLE");
                if (nullable == DatabaseMetaData.columnNoNulls) {
                  type += " NOT NULL";
                }
                return type;
              }
            });
      } finally {
        rs.close();
      }
    } catch (SQLException e) {
      error(e);
      return;
    }

    try {
      ResultSet rs = meta.getIndexInfo(null, null, tableName, false, true);
      try {
        Map<String, IndexInfo> indexes = new TreeMap<String, IndexInfo>();
        while (rs.next()) {
          final String indexName = rs.getString("INDEX_NAME");
          IndexInfo def = indexes.get(indexName);
          if (def == null) {
            def = new IndexInfo();
            def.name = indexName;
            indexes.put(indexName, def);
          }

          if (!rs.getBoolean("NON_UNIQUE")) {
            def.unique = true;
          }

          final int pos = rs.getInt("ORDINAL_POSITION");
          final String col = rs.getString("COLUMN_NAME");
          String desc = rs.getString("ASC_OR_DESC");
          if ("D".equals(desc)) {
            desc = " DESC";
          } else {
            desc = "";
          }
          def.addColumn(pos, col + desc);

          String filter = rs.getString("FILTER_CONDITION");
          if (filter != null && !filter.isEmpty()) {
            def.filter.append(filter);
          }
        }

        if (outputFormat == OutputFormat.PRETTY) {
          println("");
          println("Indexes on " + tableName + ":");
          for (IndexInfo def : indexes.values()) {
            println("  " + def);
          }
        }
      } finally {
        rs.close();
      }
    } catch (SQLException e) {
      error(e);
      return;
    }

    println("");
  }

  private void executeStatement(final String sql) {
    final long start = System.currentTimeMillis();
    final boolean hasResultSet;
    try {
      hasResultSet = statement.execute(sql);
    } catch (SQLException e) {
      error(e);
      return;
    }

    try {
      if (hasResultSet) {
        final ResultSet rs = statement.getResultSet();
        try {
          final int rowCount = showResultSet(rs, false);
          final long ms = System.currentTimeMillis() - start;
          switch (outputFormat) {
            case JSON: {
              final JsonObject tail = new JsonObject();
              tail.addProperty("type", "query-stats");
              tail.addProperty("rowCount", rowCount);
              tail.addProperty("runTimeMilliseconds", ms);
              println(tail.toString());
              break;
            }

            case PRETTY:
            default:
              println("(" + rowCount + (rowCount == 1 ? " row" : " rows") //
                  + "; " + ms + " ms)");
              break;
          }
        } finally {
          rs.close();
        }

      } else {
        final int updateCount = statement.getUpdateCount();
        final long ms = System.currentTimeMillis() - start;
        switch (outputFormat) {
          case JSON: {
            final JsonObject tail = new JsonObject();
            tail.addProperty("type", "update-stats");
            tail.addProperty("rowCount", updateCount);
            tail.addProperty("runTimeMilliseconds", ms);
            println(tail.toString());
            break;
          }

          case PRETTY:
          default:
            println("UPDATE " + updateCount + "; " + ms + " ms");
            break;
        }
      }
    } catch (SQLException e) {
      error(e);
    }
  }

  private int showResultSet(final ResultSet rs, boolean alreadyOnRow,
      Function... show) throws SQLException {
    switch (outputFormat) {
      case JSON:
        return showResultSetJson(rs, alreadyOnRow, show);
      case PRETTY:
      default:
        return showResultSetPretty(rs, alreadyOnRow, show);
    }
  }

  private int showResultSetJson(final ResultSet rs, boolean alreadyOnRow,
      Function... show) throws SQLException {
    final ResultSetMetaData meta = rs.getMetaData();
    final Function[] columnMap;
    if (show != null && 0 < show.length) {
      columnMap = show;

    } else {
      final int colCnt = meta.getColumnCount();
      columnMap = new Function[colCnt];
      for (int colId = 0; colId < colCnt; colId++) {
        final int p = colId + 1;
        final String name = meta.getColumnLabel(p);
        columnMap[colId] = new Identity(p, name);
      }
    }

    int rowCnt = 0;
    final int colCnt = columnMap.length;
    while (alreadyOnRow || rs.next()) {
      final JsonObject row = new JsonObject();
      final JsonObject cols = new JsonObject();
      for (int c = 0; c < colCnt; c++) {
        String v = columnMap[c].apply(rs);
        if (v == null) {
          continue;
        }
        cols.addProperty(columnMap[c].name.toLowerCase(), v);
      }
      row.addProperty("type", "row");
      row.add("columns", cols);
      println(row.toString());
      alreadyOnRow = false;
      rowCnt++;
    }
    return rowCnt;
  }

  private int showResultSetPretty(final ResultSet rs, boolean alreadyOnRow,
      Function... show) throws SQLException {
    final ResultSetMetaData meta = rs.getMetaData();

    final Function[] columnMap;
    if (show != null && 0 < show.length) {
      columnMap = show;

    } else {
      final int colCnt = meta.getColumnCount();
      columnMap = new Function[colCnt];
      for (int colId = 0; colId < colCnt; colId++) {
        final int p = colId + 1;
        final String name = meta.getColumnLabel(p);
        columnMap[colId] = new Identity(p, name);
      }
    }

    final int colCnt = columnMap.length;
    final int[] widths = new int[colCnt];
    for (int c = 0; c < colCnt; c++) {
      widths[c] = columnMap[c].name.length();
    }

    final List<String[]> rows = new ArrayList<String[]>();
    while (alreadyOnRow || rs.next()) {
      final String[] row = new String[columnMap.length];
      for (int c = 0; c < colCnt; c++) {
        row[c] = columnMap[c].apply(rs);
        if (row[c] == null) {
          row[c] = "NULL";
        }
        widths[c] = Math.max(widths[c], row[c].length());
      }
      rows.add(row);
      alreadyOnRow = false;
    }

    final StringBuilder b = new StringBuilder();
    for (int c = 0; c < colCnt; c++) {
      if (0 < c) {
        b.append(" | ");
      }

      String n = columnMap[c].name;
      if (widths[c] < n.length()) {
        n = n.substring(0, widths[c]);
      }
      b.append(n);

      if (c < colCnt - 1) {
        for (int pad = n.length(); pad < widths[c]; pad++) {
          b.append(' ');
        }
      }
    }
    println(" " + b.toString());

    b.setLength(0);
    for (int c = 0; c < colCnt; c++) {
      if (0 < c) {
        b.append("-+-");
      }
      for (int pad = 0; pad < widths[c]; pad++) {
        b.append('-');
      }
    }
    println(" " + b.toString());

    boolean dataTruncated = false;
    for (String[] row : rows) {
      b.setLength(0);
      b.append(' ');

      for (int c = 0; c < colCnt; c++) {
        final int max = widths[c];
        if (0 < c) {
          b.append(" | ");
        }

        String s = row[c];
        if (1 < colCnt && max < s.length()) {
          s = s.substring(0, max);
          dataTruncated = true;
        }
        b.append(s);

        if (c < colCnt - 1) {
          for (int pad = s.length(); pad < max; pad++) {
            b.append(' ');
          }
        }
      }
      println(b.toString());
    }

    if (dataTruncated) {
      warning("some column data was truncated");
    }
    return rows.size();
  }

  private void warning(final String msg) {
    switch (outputFormat) {
      case JSON: {
        final JsonObject obj = new JsonObject();
        obj.addProperty("type", "warning");
        obj.addProperty("message", msg);
        println(obj.toString());
        break;
      }

      case PRETTY:
      default:
        println("WARNING: " + msg);
        break;
    }
  }

  private void error(final SQLException err) {
    switch (outputFormat) {
      case JSON: {
        final JsonObject obj = new JsonObject();
        obj.addProperty("type", "error");
        obj.addProperty("message", err.getMessage());
        println(obj.toString());
        break;
      }

      case PRETTY:
      default:
        println("ERROR: " + err.getMessage());
        break;
    }
  }

  private void print(String s) {
    out.print(s);
    out.flush();
  }

  private void println(String s) {
    out.print(s);
    out.print('\n');
    out.flush();
  }

  private String readLine() {
    try {
      return in.readLine();
    } catch (IOException e) {
      return null;
    }
  }

  private void showBanner() {
    if (outputFormat == OutputFormat.PRETTY) {
      println("Welcome to Gerrit Code Review " + Version.getVersion());
      try {
        print("(");
        print(connection.getMetaData().getDatabaseProductName());
        print(" ");
        print(connection.getMetaData().getDatabaseProductVersion());
        println(")");
      } catch (SQLException err) {
        error(err);
      }
      println("");
      println("Type '\\h' for help.  Type '\\r' to clear the buffer.");
      println("");
    }
  }

  private void showHelp() {
    final StringBuilder help = new StringBuilder();
    help.append("General\n");
    help.append("  \\q        quit\n");

    help.append("\n");
    help.append("Query Buffer\n");
    help.append("  \\g        execute the query buffer\n");
    help.append("  \\p        display the current buffer\n");
    help.append("  \\r        clear the query buffer\n");

    help.append("\n");
    help.append("Informational\n");
    help.append("  \\d        list all tables\n");
    help.append("  \\d NAME   describe table\n");

    help.append("\n");
    print(help.toString());
  }

  private static abstract class Function {
    final String name;

    Function(final String name) {
      this.name = name;
    }

    abstract String apply(ResultSet rs) throws SQLException;
  }

  private static class Identity extends Function {
    static Identity create(final ResultSet rs, final String name)
        throws SQLException {
      return new Identity(rs.findColumn(name), name);
    }

    final int colId;

    Identity(final int colId, final String name) {
      super(name);
      this.colId = colId;
    }

    @Override
    String apply(final ResultSet rs) throws SQLException {
      return rs.getString(colId);
    }
  }

  private static class IndexInfo {
    String name;
    boolean unique;
    final Map<Integer, String> columns = new TreeMap<Integer, String>();
    final StringBuilder filter = new StringBuilder();

    void addColumn(int pos, String column) {
      columns.put(Integer.valueOf(pos), column);
    }

    @Override
    public String toString() {
      final StringBuilder r = new StringBuilder();
      r.append(name);
      if (unique) {
        r.append(" UNIQUE");
      }
      r.append(" (");
      boolean first = true;
      for (String c : columns.values()) {
        if (!first) r.append(", ");
        r.append(c);
        first = false;
      }
      r.append(")");
      if (filter.length() > 0) {
        r.append(" WHERE ");
        r.append(filter);
      }
      return r.toString();
    }
  }
}


text:
package com.intellij.openapi.roots.ui.configuration;

import com.intellij.ide.util.projectWizard.importSources.JavaSourceRootDetectionUtil;
import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileVisitor;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.List;

public class JavaVfsSourceRootDetectionUtil {
  private JavaVfsSourceRootDetectionUtil() {}

  /**
   * Scan directory and detect java source roots within it. The source root is detected as the following:
   *

   *
It contains at least one Java file.

   *
Java file is located in the sub-folder that matches package statement in the file.

   *

   *
   * @param dir a directory to scan
   * @param progressIndicator
   * @return a list of found source roots within directory. If no source roots are found, a empty list is returned.
   */
  @NotNull
  public static List<VirtualFile> suggestRoots(@NotNull VirtualFile dir, @NotNull final ProgressIndicator progressIndicator) {
    if (!dir.isDirectory()) {
      return ContainerUtil.emptyList();
    }

    final FileTypeManager typeManager = FileTypeManager.getInstance();
    final ArrayList<VirtualFile> foundDirectories = new ArrayList<VirtualFile>();
    try {
      VfsUtilCore.visitChildrenRecursively(dir, new VirtualFileVisitor() {
        @NotNull
        @Override
        public Result visitFileEx(@NotNull VirtualFile file) {
          progressIndicator.checkCanceled();

          if (file.isDirectory()) {
            if (typeManager.isFileIgnored(file) || StringUtil.startsWithIgnoreCase(file.getName(), "testData")) {
              return SKIP_CHILDREN;
            }
          }
          else {
            FileType type = typeManager.getFileTypeByFileName(file.getName());
            if (StdFileTypes.JAVA == type) {
              VirtualFile root = suggestRootForJavaFile(file);
              if (root != null) {
                foundDirectories.add(root);
                return skipTo(root);
              }
            }
          }

          return CONTINUE;
        }
      });
    }
    catch (ProcessCanceledException ignore) { }

    return foundDirectories;
  }

  @Nullable
  private static VirtualFile suggestRootForJavaFile(VirtualFile javaFile) {
    if (javaFile.isDirectory()) return null;

    CharSequence chars = LoadTextUtil.loadText(javaFile);

    String packageName = JavaSourceRootDetectionUtil.getPackageName(chars);
    if (packageName != null){
      VirtualFile root = javaFile.getParent();
      int index = packageName.length();
      while(index > 0){
        int index1 = packageName.lastIndexOf('.', index - 1);
        String token = packageName.substring(index1 + 1, index);
        String dirName = root.getName();
        final boolean equalsToToken = SystemInfo.isFileSystemCaseSensitive ? dirName.equals(token) : dirName.equalsIgnoreCase(token);
        if (!equalsToToken) {
          return null;
        }
        root = root.getParent();
        if (root == null){
          return null;
        }
        index = index1;
      }
      return root;
    }

    return null;
  }
}

redpajama_set_name: RedPajamaGithub


text:
namespace Microsoft.Azure.Management.RecoveryServices.Backup.Models
{
    using System.Linq;

    /// <summary>
    /// IaaS VM workload-specific restore.
    /// </summary>
    public partial class IaasVMRestoreRequest : RestoreRequest
    {
        /// <summary>
        /// Initializes a new instance of the IaasVMRestoreRequest class.
        /// </summary>
        public IaasVMRestoreRequest() { }

        /// <summary>
        /// Initializes a new instance of the IaasVMRestoreRequest class.
        /// </summary>
        /// <param name="recoveryPointId">ID of the backup copy to be
        /// recovered.</param>
        /// <param name="recoveryType">Type of this recovery. Possible values
        /// include: 'Invalid', 'OriginalLocation', 'AlternateLocation',
        /// 'RestoreDisks'</param>
        /// <param name="sourceResourceId">Fully qualified ARM ID of the VM
        /// which is being recovered.</param>
        /// <param name="targetVirtualMachineId">This is the complete ARM Id
        /// of the VM that will be created.
        /// For e.g.
        /// /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm}</param>
        /// <param name="targetResourceGroupId">This is the ARM Id of the
        /// resource group that you want to create for this Virtual machine
        /// and other artifacts.
        /// For e.g.
        /// /subscriptions/{subId}/resourcegroups/{rg}</param>
        /// <param name="storageAccountId">Fully qualified ARM ID of the
        /// storage account to which the VM has to be restored.</param>
        /// <param name="virtualNetworkId">This is the virtual network Id of
        /// the vnet that will be attached to the virtual machine.
        /// User will be validated for join action permissions in
        /// the linked access.</param>
        /// <param name="subnetId">Subnet ID, is the subnet ID associated with
        /// the to be restored VM. For Classic VMs it would be
        /// {VnetID}/Subnet/{SubnetName} and, for the Azure Resource Manager
        /// VMs it would be ARM resource ID used to represent the
        /// subnet.</param>
        /// <param name="targetDomainNameId">Fully qualified ARM ID of the
        /// domain name to be associated to the VM being restored. This
        /// applies only to Classic Virtual Machines.</param>
        /// <param name="region">Region in which the virtual machine is
        /// restored.</param>
        /// <param name="affinityGroup">Affinity group associated to VM to be
        /// restored. Used only for Classic Compute Virtual Machines.</param>
        /// <param name="createNewCloudService">Should a new cloud service be
        /// created while restoring the VM. If this is false, VM will be
        /// restored to the same cloud service as it was at the time of
        /// backup.</param>
        /// <param name="encryptionDetails">Details needed if the VM was
        /// encrypted at the time of backup.</param>
        public IaasVMRestoreRequest(string recoveryPointId = default(string), RecoveryType? recoveryType = default(RecoveryType?), string sourceResourceId = default(string), string targetVirtualMachineId = default(string), string targetResourceGroupId = default(string), string storageAccountId = default(string), string virtualNetworkId = default(string), string subnetId = default(string), string targetDomainNameId = default(string), string region = default(string), string affinityGroup = default(string), bool? createNewCloudService = default(bool?), EncryptionDetails encryptionDetails = default(EncryptionDetails))
        {
            RecoveryPointId = recoveryPointId;
            RecoveryType = recoveryType;
            SourceResourceId = sourceResourceId;
            TargetVirtualMachineId = targetVirtualMachineId;
            TargetResourceGroupId = targetResourceGroupId;
            StorageAccountId = storageAccountId;
            VirtualNetworkId = virtualNetworkId;
            SubnetId = subnetId;
            TargetDomainNameId = targetDomainNameId;
            Region = region;
            AffinityGroup = affinityGroup;
            CreateNewCloudService = createNewCloudService;
            EncryptionDetails = encryptionDetails;
        }

        /// <summary>
        /// Gets or sets ID of the backup copy to be recovered.
        /// </summary>
        [Newtonsoft.Json.JsonProperty(PropertyName = "recoveryPointId")]
        public string RecoveryPointId { get; set; }

        /// <summary>
        /// Gets or sets type of this recovery. Possible values include:
        /// 'Invalid', 'OriginalLocation', 'AlternateLocation', 'RestoreDisks'
        /// </summary>
        [Newtonsoft.Json.JsonProperty(PropertyName = "recoveryType")]
        public RecoveryType? RecoveryType { get; set; }

        /// <summary>
        /// Gets or sets fully qualified ARM ID of the VM which is being
        /// recovered.
        /// </summary>
        [Newtonsoft.Json.JsonProperty(PropertyName = "sourceResourceId")]
        public string SourceResourceId { get; set; }

        /// <summary>
        /// Gets or sets this is the complete ARM Id of the VM that will be
        /// created.
        /// For e.g.
        /// /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm}
        /// </summary>
        [Newtonsoft.Json.JsonProperty(PropertyName = "targetVirtualMachineId")]
        public string TargetVirtualMachineId { get; set; }

        /// <summary>
        /// Gets or sets this is the ARM Id of the resource group that you
        /// want to create for this Virtual machine and other artifacts.
        /// For e.g. /subscriptions/{subId}/resourcegroups/{rg}
        /// </summary>
        [Newtonsoft.Json.JsonProperty(PropertyName = "targetResourceGroupId")]
        public string TargetResourceGroupId { get; set; }

        /// <summary>
        /// Gets or sets fully qualified ARM ID of the storage account to
        /// which the VM has to be restored.
        /// </summary>
        [Newtonsoft.Json.JsonProperty(PropertyName = "storageAccountId")]
        public string StorageAccountId { get; set; }

        /// <summary>
        /// Gets or sets this is the virtual network Id of the vnet that will
        /// be attached to the virtual machine.
        /// User will be validated for join action permissions in
        /// the linked access.
        /// </summary>
        [Newtonsoft.Json.JsonProperty(PropertyName = "virtualNetworkId")]
        public string VirtualNetworkId { get; set; }

        /// <summary>
        /// Gets or sets subnet ID, is the subnet ID associated with the to be
        /// restored VM. For Classic VMs it would be
        /// {VnetID}/Subnet/{SubnetName} and, for the Azure Resource Manager
        /// VMs it would be ARM resource ID used to represent the subnet.
        /// </summary>
        [Newtonsoft.Json.JsonProperty(PropertyName = "subnetId")]
        public string SubnetId { get; set; }

        /// <summary>
        /// Gets or sets fully qualified ARM ID of the domain name to be
        /// associated to the VM being restored. This applies only to Classic
        /// Virtual Machines.
        /// </summary>
        [Newtonsoft.Json.JsonProperty(PropertyName = "targetDomainNameId")]
        public string TargetDomainNameId { get; set; }

        /// <summary>
        /// Gets or sets region in which the virtual machine is restored.
        /// </summary>
        [Newtonsoft.Json.JsonProperty(PropertyName = "region")]
        public string Region { get; set; }

        /// <summary>
        /// Gets or sets affinity group associated to VM to be restored. Used
        /// only for Classic Compute Virtual Machines.
        /// </summary>
        [Newtonsoft.Json.JsonProperty(PropertyName = "affinityGroup")]
        public string AffinityGroup { get; set; }

        /// <summary>
        /// Gets or sets should a new cloud service be created while restoring
        /// the VM. If this is false, VM will be restored to the same cloud
        /// service as it was at the time of backup.
        /// </summary>
        [Newtonsoft.Json.JsonProperty(PropertyName = "createNewCloudService")]
        public bool? CreateNewCloudService { get; set; }

        /// <summary>
        /// Gets or sets details needed if the VM was encrypted at the time of
        /// backup.
        /// </summary>
        [Newtonsoft.Json.JsonProperty(PropertyName = "encryptionDetails")]
        public EncryptionDetails EncryptionDetails { get; set; }

    }
}


text:
Learn more about these concepts

    {% include "blog/" + ".html" %}
    ...or view all topics.


text:
package dockerclient

import (
	"os"
)

func makeNotExistError(s string) error {
	return os.ErrNotExist
}


text:
var ComponentPage = require('../component/Page.js');

require('angular').module( 'vgraph' ).directive( 'vgraphPage',
	[
	function(){
		return {
			restrict: 'A',
			scope : {
				settings : '=vgraphPage'
			},
			controller : ComponentPage,
			require : ['vgraphPage'],
			link: function ( $scope, $el, $attrs, requirements ){
				var page = requirements[0];

				$scope.$watch('settings', function( settings ){
					page.configure( settings );
				});
			}
		};
	}]
);


text:
function getParamsMap() {
    var map = {}
    if (document.URL.indexOf('?') > -1) {
        var paramsStr = document.URL.substring(document.URL.indexOf('?') + 1);
        var paramsArr = paramsStr.split('&');
        for (var index in paramsArr) {
            var param = paramsArr[index].split('=');
            var key = param[0];
            var value = param[1];
            var urlParamValue = map[key];
            if (urlParamValue == null) {
                urlParamValue = value;
                map[key] = urlParamValue;
            }
        }
    }
    return map;
}